Commit a340846d authored by Grégory Wisniewski's avatar Grégory Wisniewski

Split partition table class in two. One for the admin node, another for other

node types. Add getCellListForID() in which is computed the cell related to an
OID or TID. Add _getPartitionTable() accessor in client application that check
if the master connection is established or not, and reconnect to obtain the last
partition table. Move the connecting_to_master_node lock in the accessors
instead of connectToPrimaryMaster(). This latter method is also set as private.
Note that the connection to primary master is not established at client startup
but when trying to access to the partition table or the primary connection. 
Split tests for the partition table and update others tests altered with changes
above. Fix a database name for mysqldb module, remove some unused import.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@627 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3776e9d9
This diff is collapsed.
......@@ -166,11 +166,8 @@ class PrimaryBootstrapHandler(PrimaryHandler):
# got an uuid from the primary master
app.uuid = your_uuid
# Create partition table if necessary
if app.pt is None:
# Always create partition table
app.pt = PartitionTable(num_partitions, num_replicas)
app.num_partitions = num_partitions
app.num_replicas = num_replicas
# Ask a primary master.
conn.lock()
......
This diff is collapsed.
......@@ -23,25 +23,8 @@ from mock import Mock, ReturnValues
from neo.tests.base import NeoTestBase
from neo import protocol
from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID
from neo.protocol import ERROR, REQUEST_NODE_IDENTIFICATION, ACCEPT_NODE_IDENTIFICATION, \
PING, PONG, ASK_PRIMARY_MASTER, ANSWER_PRIMARY_MASTER, ANNOUNCE_PRIMARY_MASTER, \
REELECT_PRIMARY_MASTER, NOTIFY_NODE_INFORMATION, START_OPERATION, \
STOP_OPERATION, ASK_LAST_IDS, ANSWER_LAST_IDS, ASK_PARTITION_TABLE, \
ANSWER_PARTITION_TABLE, SEND_PARTITION_TABLE, NOTIFY_PARTITION_CHANGES, \
ASK_UNFINISHED_TRANSACTIONS, ANSWER_UNFINISHED_TRANSACTIONS, \
ASK_OBJECT_PRESENT, ANSWER_OBJECT_PRESENT, \
DELETE_TRANSACTION, COMMIT_TRANSACTION, ASK_NEW_TID, ANSWER_NEW_TID, \
FINISH_TRANSACTION, NOTIFY_TRANSACTION_FINISHED, LOCK_INFORMATION, \
NOTIFY_INFORMATION_LOCKED, INVALIDATE_OBJECTS, UNLOCK_INFORMATION, \
ASK_NEW_OIDS, ANSWER_NEW_OIDS, ASK_STORE_OBJECT, ANSWER_STORE_OBJECT, \
ABORT_TRANSACTION, ASK_STORE_TRANSACTION, ANSWER_STORE_TRANSACTION, \
ASK_OBJECT, ANSWER_OBJECT, ASK_TIDS, ANSWER_TIDS, ASK_TRANSACTION_INFORMATION, \
ANSWER_TRANSACTION_INFORMATION, ASK_OBJECT_HISTORY, ANSWER_OBJECT_HISTORY, \
ASK_OIDS, ANSWER_OIDS, INVALID_PTID, \
NOT_READY_CODE, OID_NOT_FOUND_CODE, SERIAL_NOT_FOUND_CODE, TID_NOT_FOUND_CODE, \
PROTOCOL_ERROR_CODE, TIMEOUT_ERROR_CODE, BROKEN_NODE_DISALLOWED_CODE, \
INTERNAL_ERROR_CODE, \
STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, MASTER_NODE_TYPE, \
from neo.protocol import ERROR, \
INVALID_PTID, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, MASTER_NODE_TYPE, \
RUNNING_STATE, BROKEN_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
UP_TO_DATE_STATE, OUT_OF_DATE_STATE, FEEDING_STATE, DISCARDED_STATE
from neo.exception import ElectionFailure
......
......@@ -18,7 +18,6 @@
import logging
from neo.locking import RLock
import sys
import traceback
from neo import protocol
from neo.protocol import Packet, PacketMalformedError
......
......@@ -37,7 +37,7 @@ from neo.master.recovery import RecoveryEventHandler
from neo.master.verification import VerificationEventHandler
from neo.master.service import ServiceEventHandler
from neo.master.secondary import SecondaryEventHandler
from neo.pt import PartitionTable
from neo.master.pt import PartitionTable
from neo.util import dump
from neo.connector import getConnectorHandler
......
This diff is collapsed.
from neo.master.tests.testMasterApp import MasterAppTests
from neo.master.tests.testMasterPT import MasterPartitionTableTests
from neo.master.tests.testMasterElectionHandler import MasterElectionTests
from neo.master.tests.testMasterRecoveryHandler import MasterRecoveryTests
from neo.master.tests.testMasterService import MasterServiceTests
from neo.master.tests.testMasterVerificationHandler import MasterVerificationeTests
from neo.master.tests.testMasterVerificationHandler import MasterVerificationTests
__all__ = [
'MasterAppTests',
......@@ -10,5 +11,6 @@ __all__ = [
'MasterRecoveryTests',
'MasterServiceTests',
'MasterVerificationeTests',
'MasterPartitionTableTests',
]
This diff is collapsed.
......@@ -38,7 +38,7 @@ from neo.master.tests.connector import DoNothingConnector
from neo.connection import ClientConnection
class MasterVerificationeTests(NeoTestBase):
class MasterVerificationTests(NeoTestBase):
def setUp(self):
logging.basicConfig(level = logging.WARNING)
......
This diff is collapsed.
......@@ -25,7 +25,7 @@ from neo.tests.base import NeoTestBase
from neo.exception import DatabaseFailure
from neo.storage.mysqldb import MySQLDatabaseManager, p64, u64
NEO_SQL_DATABASE = 'test_mysqldb_1'
NEO_SQL_DATABASE = 'test_mysqldb1'
NEO_SQL_USER = 'test'
class StorageMySQSLdbTests(NeoTestBase):
......
This diff is collapsed.
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