Commit 2db4de86 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Make partition part of the SQL index.

Better performances are expected because of the removal of all MOD() operators
that would do a full scan to find the rows maching a given partition. Now a
query like '... where partition = x limit 10' should match only a subtree of
the table and not scan lots of rows if there is none matching this partition.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2306 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2b7a0882
This diff is collapsed.
...@@ -74,6 +74,7 @@ class StorageClientHandlerTests(NeoTestBase): ...@@ -74,6 +74,7 @@ class StorageClientHandlerTests(NeoTestBase):
def test_18_askTransactionInformation1(self): def test_18_askTransactionInformation1(self):
# transaction does not exists # transaction does not exists
conn = self._getConnection() conn = self._getConnection()
self.app.dm = Mock({'getNumPartitions': 1})
self.operation.askTransactionInformation(conn, INVALID_TID) self.operation.askTransactionInformation(conn, INVALID_TID)
self.checkErrorPacket(conn) self.checkErrorPacket(conn)
......
...@@ -57,6 +57,7 @@ class StorageStorageHandlerTests(NeoTestBase): ...@@ -57,6 +57,7 @@ class StorageStorageHandlerTests(NeoTestBase):
def test_18_askTransactionInformation1(self): def test_18_askTransactionInformation1(self):
# transaction does not exists # transaction does not exists
conn = self.getFakeConnection() conn = self.getFakeConnection()
self.app.dm = Mock({'getNumPartitions': 1})
self.operation.askTransactionInformation(conn, INVALID_TID) self.operation.askTransactionInformation(conn, INVALID_TID)
self.checkErrorPacket(conn) self.checkErrorPacket(conn)
......
...@@ -35,6 +35,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -35,6 +35,7 @@ class StorageMySQSLdbTests(NeoTestBase):
database = '%s@%s' % (NEO_SQL_USER, NEO_SQL_DATABASE) database = '%s@%s' % (NEO_SQL_USER, NEO_SQL_DATABASE)
self.db = MySQLDatabaseManager(database) self.db = MySQLDatabaseManager(database)
self.db.setup() self.db.setup()
self.db.setNumPartitions(1)
def tearDown(self): def tearDown(self):
self.db.close() self.db.close()
...@@ -159,6 +160,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -159,6 +160,7 @@ class StorageMySQSLdbTests(NeoTestBase):
self.checkConfigEntry(self.db.getUUID, self.db.setUUID, 'TEST_VALUE') self.checkConfigEntry(self.db.getUUID, self.db.setUUID, 'TEST_VALUE')
def test_NumPartitions(self): def test_NumPartitions(self):
self.db.setup(reset=True)
self.checkConfigEntry(self.db.getNumPartitions, self.checkConfigEntry(self.db.getNumPartitions,
self.db.setNumPartitions, 10) self.db.setNumPartitions, 10)
...@@ -613,6 +615,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -613,6 +615,7 @@ class StorageMySQSLdbTests(NeoTestBase):
def test__getObjectData(self): def test__getObjectData(self):
db = self.db db = self.db
db.setup(reset=True) db.setup(reset=True)
self.db.setNumPartitions(4)
tid0 = self.getNextTID() tid0 = self.getNextTID()
tid1 = self.getNextTID() tid1 = self.getNextTID()
tid2 = self.getNextTID() tid2 = self.getNextTID()
...@@ -699,6 +702,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -699,6 +702,7 @@ class StorageMySQSLdbTests(NeoTestBase):
def test__getDataTIDFromData(self): def test__getDataTIDFromData(self):
db = self.db db = self.db
db.setup(reset=True) db.setup(reset=True)
self.db.setNumPartitions(4)
tid1 = self.getNextTID() tid1 = self.getNextTID()
tid2 = self.getNextTID() tid2 = self.getNextTID()
oid1 = self.getOID(1) oid1 = self.getOID(1)
...@@ -723,6 +727,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -723,6 +727,7 @@ class StorageMySQSLdbTests(NeoTestBase):
def test__getDataTID(self): def test__getDataTID(self):
db = self.db db = self.db
db.setup(reset=True) db.setup(reset=True)
self.db.setNumPartitions(4)
tid1 = self.getNextTID() tid1 = self.getNextTID()
tid2 = self.getNextTID() tid2 = self.getNextTID()
oid1 = self.getOID(1) oid1 = self.getOID(1)
...@@ -745,6 +750,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -745,6 +750,7 @@ class StorageMySQSLdbTests(NeoTestBase):
def test_findUndoTID(self): def test_findUndoTID(self):
db = self.db db = self.db
db.setup(reset=True) db.setup(reset=True)
self.db.setNumPartitions(4)
tid1 = self.getNextTID() tid1 = self.getNextTID()
tid2 = self.getNextTID() tid2 = self.getNextTID()
tid3 = self.getNextTID() tid3 = self.getNextTID()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment