Commit 436e3a5c authored by Vincent Pelletier's avatar Vincent Pelletier

Stop defining and using default "NEO" logger.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2371 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 66486399
......@@ -17,8 +17,7 @@
import logging as logging_std
# default logger
logging = logging_std.getLogger('NEO')
# "logging" is available here only once setupLog has been called.
PREFIX = '%(asctime)s %(levelname)-9s %(name)-10s'
SUFFIX = ' [%(module)14s:%(lineno)3d] %(message)s'
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.node import NodeManager
from neo.event import EventManager
......@@ -68,7 +68,7 @@ class Application(object):
self.server = config.getBind()
self.master_addresses = config.getMasters()
logging.debug('IP address is %s, port is %d', *(self.server))
neo.logging.debug('IP address is %s, port is %d', *(self.server))
# The partition table is initialized after getting the number of
# partitions.
......@@ -105,7 +105,7 @@ class Application(object):
while True:
self.em.poll(1)
except PrimaryFailure:
logging.error('primary master is down')
neo.logging.error('primary master is down')
def connectToPrimary(self):
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.handler import EventHandler
from neo import protocol
......@@ -42,7 +42,7 @@ class AdminEventHandler(EventHandler):
"""This class deals with events for administrating cluster."""
def askPartitionList(self, conn, min_offset, max_offset, uuid):
logging.info("ask partition list from %s to %s for %s" %
neo.logging.info("ask partition list from %s to %s for %s" %
(min_offset, max_offset, dump(uuid)))
app = self.app
# check we have one pt otherwise ask it to PMN
......@@ -61,7 +61,7 @@ class AdminEventHandler(EventHandler):
def askNodeList(self, conn, node_type):
logging.info("ask node list for %s" %(node_type))
neo.logging.info("ask node list for %s" %(node_type))
def node_filter(n):
return n.getType() is node_type
node_list = self.app.nm.getList(node_filter)
......@@ -70,7 +70,7 @@ class AdminEventHandler(EventHandler):
conn.answer(p)
def setNodeState(self, conn, uuid, state, modify_partition_table):
logging.info("set node state for %s-%s" %(dump(uuid), state))
neo.logging.info("set node state for %s-%s" %(dump(uuid), state))
node = self.app.nm.getByUUID(uuid)
if node is None:
raise protocol.ProtocolError('invalid uuid')
......@@ -144,7 +144,7 @@ class MasterEventHandler(EventHandler):
def answerNodeInformation(self, conn):
# XXX: This will no more exists when the initialization module will be
# implemented for factorize code (as done for bootstrap)
logging.debug("answerNodeInformation")
neo.logging.debug("answerNodeInformation")
def notifyPartitionChanges(self, conn, ptid, cell_list):
self.app.pt.update(ptid, cell_list, self.app.nm)
......@@ -176,12 +176,12 @@ class MasterRequestEventHandler(EventHandler):
client_conn.answer(packet)
def answerClusterState(self, conn, state):
logging.info("answerClusterState for a conn")
neo.logging.info("answerClusterState for a conn")
self.app.cluster_state = state
self._answerNeoCTL(conn, Packets.AnswerClusterState(state))
def answerPartitionTable(self, conn, ptid, row_list):
logging.info("answerPartitionTable for a conn")
neo.logging.info("answerPartitionTable for a conn")
client_conn, kw = self.app.dispatcher.pop(conn.getPeerId())
# sent client the partition table
self.app.sendPartitionTable(client_conn)
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from time import sleep
from neo.handler import EventHandler
......@@ -106,7 +106,7 @@ class BootstrapManager(EventHandler):
conn.close()
return
logging.info('connected to a primary master node')
neo.logging.info('connected to a primary master node')
conn.ask(Packets.RequestIdentification(self.node_type,
self.uuid, self.server, self.name))
......@@ -120,7 +120,7 @@ class BootstrapManager(EventHandler):
if self.uuid != your_uuid:
# got an uuid from the primary master
self.uuid = your_uuid
logging.info('Got a new UUID : %s' % dump(self.uuid))
neo.logging.info('Got a new UUID : %s' % dump(self.uuid))
conn.setUUID(uuid)
def getPrimaryConnection(self, connector_handler):
......@@ -128,7 +128,7 @@ class BootstrapManager(EventHandler):
Primary lookup/connection process.
Returns when the connection is made.
"""
logging.info('connecting to a primary master node')
neo.logging.info('connecting to a primary master node')
em, nm = self.app.em, self.app.nm
index = 0
self.current = nm.getMasterList()[0]
......
......@@ -163,7 +163,7 @@ class Storage(BaseStorage.BaseStorage,
def pack(self, t, referencesf, gc=False):
if gc:
logging.warning('Garbage Collection is not available in NEO, '
neo.logging.warning('Garbage Collection is not available in NEO, '
'please use an external tool. Packing without GC.')
self.app.pack(t)
......
......@@ -29,7 +29,7 @@ from persistent.TimeStamp import TimeStamp
from neo import setupLog
setupLog('CLIENT', verbose=True)
from neo import logging
import neo
from neo.protocol import NodeTypes, Packets, INVALID_PARTITION, ZERO_TID
from neo.event import EventManager
from neo.util import makeChecksum as real_makeChecksum, dump
......@@ -317,7 +317,7 @@ class Application(object):
"""
Lookup for the current primary master node
"""
logging.debug('connecting to primary master...')
neo.logging.debug('connecting to primary master...')
ready = False
nm = self.nm
queue = self.local_var.queue
......@@ -349,7 +349,7 @@ class Application(object):
# Query for primary master node
if conn.getConnector() is None:
# This happens if a connection could not be established.
logging.error('Connection to master node %s failed',
neo.logging.error('Connection to master node %s failed',
self.trying_master_node)
continue
try:
......@@ -361,14 +361,15 @@ class Application(object):
# If we reached the primary master node, mark as connected
connected = self.primary_master_node is not None and \
self.primary_master_node is self.trying_master_node
logging.info('Connected to %s' % (self.primary_master_node, ))
neo.logging.info('Connected to %s' % (self.primary_master_node, ))
try:
ready = self.identifyToPrimaryNode(conn)
except ConnectionClosed:
logging.error('Connection to %s lost', self.trying_master_node)
neo.logging.error('Connection to %s lost',
self.trying_master_node)
self.primary_master_node = None
continue
logging.info("Connected and ready")
neo.logging.info("Connected and ready")
return conn
def identifyToPrimaryNode(self, conn):
......@@ -377,7 +378,7 @@ class Application(object):
Might raise ConnectionClosed so that the new primary can be
looked-up again.
"""
logging.info('Initializing from master')
neo.logging.info('Initializing from master')
queue = self.local_var.queue
# Identify to primary master and request initial data
while conn.getUUID() is None:
......@@ -490,7 +491,7 @@ class Application(object):
self.local_var.asked_object = 0
packet = Packets.AskObject(oid, serial, tid)
for cell in cell_list:
logging.debug('trying to load %s at %s before %s from %s',
neo.logging.debug('trying to load %s at %s before %s from %s',
dump(oid), dump(serial), dump(tid), dump(cell.getUUID()))
conn = self.cp.getConnForCell(cell)
if conn is None:
......@@ -506,13 +507,13 @@ class Application(object):
= self.local_var.asked_object
if noid != oid:
# Oops, try with next node
logging.error('got wrong oid %s instead of %s from node %s',
noid, dump(oid), cell.getAddress())
neo.logging.error('got wrong oid %s instead of %s from node ' \
'%s', noid, dump(oid), cell.getAddress())
self.local_var.asked_object = -1
continue
elif checksum != makeChecksum(data):
# Check checksum.
logging.error('wrong checksum from node %s for oid %s',
neo.logging.error('wrong checksum from node %s for oid %s',
cell.getAddress(), dump(oid))
self.local_var.asked_object = -1
continue
......@@ -553,7 +554,7 @@ class Application(object):
self._cache_lock_acquire()
try:
if oid in self.mq_cache:
logging.debug('load oid %s is cached', dump(oid))
neo.logging.debug('load oid %s is cached', dump(oid))
serial, data = self.mq_cache[oid]
return data, serial
finally:
......@@ -577,7 +578,7 @@ class Application(object):
def loadSerial(self, oid, serial):
"""Load an object for a given oid and serial."""
# Do not try in cache as it manages only up-to-date object
logging.debug('loading %s at %s', dump(oid), dump(serial))
neo.logging.debug('loading %s at %s', dump(oid), dump(serial))
return self._load(oid, serial=serial)[0]
......@@ -585,7 +586,7 @@ class Application(object):
def loadBefore(self, oid, tid):
"""Load an object for a given oid before tid committed."""
# Do not try in cache as it manages only up-to-date object
logging.debug('loading %s before %s', dump(oid), dump(tid))
neo.logging.debug('loading %s before %s', dump(oid), dump(tid))
return self._load(oid, tid=tid)
......@@ -611,7 +612,7 @@ class Application(object):
"""Store object."""
if transaction is not self.local_var.txn:
raise StorageTransactionError(self, transaction)
logging.debug('storing oid %s serial %s',
neo.logging.debug('storing oid %s serial %s',
dump(oid), dump(serial))
self._store(oid, serial, data)
return None
......@@ -699,8 +700,9 @@ class Application(object):
new_data = tryToResolveConflict(oid, conflict_serial, serial,
data)
if new_data is not None:
logging.info('Conflict resolution succeed for %r:%r with %r',
dump(oid), dump(serial), dump(conflict_serial))
neo.logging.info('Conflict resolution succeed for ' \
'%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial))
# Mark this conflict as resolved
resolved_serial_set.update(conflict_serial_dict.pop(oid))
# Try to store again
......@@ -708,10 +710,11 @@ class Application(object):
append(oid)
resolved = True
else:
logging.info('Conflict resolution failed for %r:%r with %r',
dump(oid), dump(serial), dump(conflict_serial))
neo.logging.info('Conflict resolution failed for ' \
'%r:%r with %r', dump(oid), dump(serial),
dump(conflict_serial))
else:
logging.info('Conflict reported for %r:%r with later ' \
neo.logging.info('Conflict reported for %r:%r with later ' \
'transaction %r , cannot resolve conflict.', dump(oid),
dump(serial), dump(conflict_serial))
if not resolved:
......@@ -779,7 +782,7 @@ class Application(object):
local_var.data_list)
add_involved_nodes = self.local_var.involved_nodes.add
for cell in self._getCellListForTID(tid, writable=True):
logging.debug("voting object %s %s", cell.getAddress(),
neo.logging.debug("voting object %s %s", cell.getAddress(),
cell.getState())
conn = self.cp.getConnForCell(cell)
if conn is None:
......@@ -824,7 +827,7 @@ class Application(object):
try:
conn.notify(p)
except:
logging.error('Exception in tpc_abort while notifying ' \
neo.logging.error('Exception in tpc_abort while notifying ' \
'storage node %r of abortion, ignoring.', conn, exc_info=1)
# Just wait for responses to arrive. If any leads to an exception,
......@@ -837,7 +840,7 @@ class Application(object):
try:
_waitAnyMessage()
except:
logging.error('Exception in tpc_abort while handling ' \
neo.logging.error('Exception in tpc_abort while handling ' \
'pending answers, ignoring.', exc_info=1)
self.local_var.clear()
......@@ -906,7 +909,7 @@ class Application(object):
continue
except NEOStorageNotFoundError:
# Tid not found, try with next node
logging.warning('Transaction %s was not found on node %s',
neo.logging.warning('Transaction %s was not found on node %s',
dump(undone_tid), self.nm.getByAddress(conn.getAddress()))
continue
......@@ -1022,7 +1025,7 @@ class Application(object):
update(tid_list)
ordered_tids = list(ordered_tids)
ordered_tids.sort(reverse=True)
logging.debug("UndoLog tids %s", [dump(x) for x in ordered_tids])
neo.logging.debug("UndoLog tids %s", [dump(x) for x in ordered_tids])
# For each transaction, get info
undo_info = []
append = undo_info.append
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.client.handlers import BaseHandler, AnswerBaseHandler
from neo.pt import MTPartitionTable as PartitionTable
......@@ -43,7 +43,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
if your_uuid is None:
raise ProtocolError('No UUID supplied')
app.uuid = your_uuid
logging.info('Got an UUID: %s', dump(app.uuid))
neo.logging.info('Got an UUID: %s', dump(app.uuid))
node = app.nm.getByAddress(conn.getAddress())
conn.setUUID(uuid)
......@@ -66,7 +66,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
if primary_node is None:
# I don't know such a node. Probably this information
# is old. So ignore it.
logging.warning('Unknown primary master UUID: %s. ' \
neo.logging.warning('Unknown primary master UUID: %s. ' \
'Ignoring.' % dump(primary_uuid))
else:
app.primary_master_node = primary_node
......@@ -94,7 +94,7 @@ class PrimaryNotificationsHandler(BaseHandler):
def connectionClosed(self, conn):
app = self.app
logging.critical("connection to primary master node closed")
neo.logging.critical("connection to primary master node closed")
conn.close()
app.master_conn = None
app.primary_master_node = None
......@@ -104,7 +104,7 @@ class PrimaryNotificationsHandler(BaseHandler):
app = self.app
if app.master_conn is not None:
assert conn is app.master_conn
logging.critical("connection timeout to primary master node " \
neo.logging.critical("connection timeout to primary master node " \
"expired")
BaseHandler.timeoutExpired(self, conn)
......@@ -112,11 +112,11 @@ class PrimaryNotificationsHandler(BaseHandler):
app = self.app
if app.master_conn is not None:
assert conn is app.master_conn
logging.critical("primary master node is broken")
neo.logging.critical("primary master node is broken")
BaseHandler.peerBroken(self, conn)
def stopOperation(self, conn):
logging.critical("master node ask to stop operation")
neo.logging.critical("master node ask to stop operation")
def invalidateObjects(self, conn, tid, oid_list):
app = self.app
......
......@@ -18,7 +18,7 @@
from ZODB.TimeStamp import TimeStamp
from ZODB.POSException import ConflictError
from neo import logging
import neo
from neo.client.handlers import BaseHandler, AnswerBaseHandler
from neo.protocol import NodeTypes, ProtocolError, LockState
from neo.util import dump
......@@ -74,7 +74,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
local_var = self.app.local_var
object_stored_counter_dict = local_var.object_stored_counter_dict[oid]
if conflicting:
logging.info('%r report a conflict for %r with %r', conn,
neo.logging.info('%r report a conflict for %r with %r', conn,
dump(oid), dump(serial))
conflict_serial_dict = local_var.conflict_serial_dict
if serial in object_stored_counter_dict:
......@@ -138,8 +138,8 @@ class StorageAnswersHandler(AnswerBaseHandler):
raise ConflictError, 'Lock wait timeout for oid %s on %r' % (
dump(oid), conn)
elif status == LockState.GRANTED:
logging.info('Store of oid %s was successful, but after timeout.',
dump(oid))
neo.logging.info('Store of oid %s was successful, but after ' \
'timeout.', dump(oid))
# XXX: Not sure what to do in this case yet, for now do nothing.
else:
# Nobody has the lock, although we asked storage to lock. This
......
......@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from threading import Thread, Event
from neo import logging
import neo
class ThreadedPoll(Thread):
"""Polling thread."""
......@@ -24,7 +24,7 @@ class ThreadedPoll(Thread):
# Garbage collector hint:
# Prevent logging module from being garbage-collected as it is needed for
# run method to cleanly exit.
logging = logging
neo = neo
def __init__(self, em, **kw):
Thread.__init__(self, **kw)
......@@ -39,8 +39,8 @@ class ThreadedPoll(Thread):
try:
self.em.poll()
except:
self.logging.error('poll raised, retrying', exc_info=1)
self.logging.debug('Threaded poll stopped')
self.neo.logging.error('poll raised, retrying', exc_info=1)
self.neo.logging.debug('Threaded poll stopped')
def stop(self):
self._stop.set()
......@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.locking import RLock
from neo.protocol import NodeTypes, Packets
from neo.connection import MTClientConnection, ConnectionClosed
......@@ -61,7 +61,8 @@ class ConnectionPool(object):
# Loop until a connection is obtained.
while True:
logging.debug('trying to connect to %s - %s', node, node.getState())
neo.logging.debug('trying to connect to %s - %s', node,
node.getState())
app.setNodeReady()
conn = MTClientConnection(app.em,
app.storage_event_handler, addr,
......@@ -71,7 +72,7 @@ class ConnectionPool(object):
try:
if conn.getConnector() is None:
# This happens, if a connection could not be established.
logging.error('Connection to %r failed', node)
neo.logging.error('Connection to %r failed', node)
self.notifyFailure(node)
return None
......@@ -85,15 +86,15 @@ class ConnectionPool(object):
app._waitMessage(conn, msg_id,
handler=app.storage_bootstrap_handler)
except ConnectionClosed:
logging.error('Connection to %r failed', node)
neo.logging.error('Connection to %r failed', node)
self.notifyFailure(node)
return None
if app.isNodeReady():
logging.info('Connected %r', node)
neo.logging.info('Connected %r', node)
return conn
else:
logging.info('%r not ready', node)
neo.logging.info('%r not ready', node)
self.notifyFailure(node)
return None
......@@ -108,8 +109,8 @@ class ConnectionPool(object):
not self.app.dispatcher.registered(conn):
del self.connection_dict[conn.getUUID()]
conn.close()
logging.debug('_dropConnections : connection to storage ' \
'node %s:%d closed', *(conn.getAddress()))
neo.logging.debug('_dropConnections : connection to ' \
'storage node %s:%d closed', *(conn.getAddress()))
if len(self.connection_dict) <= self.max_pool_size:
break
finally:
......
......@@ -17,7 +17,7 @@
from time import time
from neo import logging
import neo
from neo.locking import RLock
from neo.protocol import PacketMalformedError, Packets, ParserState
......@@ -62,9 +62,9 @@ def lockCheckWrapper(func):
def wrapper(self, *args, **kw):
if not self._lock._is_owned():
import traceback
logging.warning('%s called on %s instance without being locked.' \
' Stack:\n%s', func.func_code.co_name, self.__class__.__name__,
''.join(traceback.format_stack()))
neo.logging.warning('%s called on %s instance without being ' \
'locked. Stack:\n%s', func.func_code.co_name,
self.__class__.__name__, ''.join(traceback.format_stack()))
# Call anyway
return func(self, *args, **kw)
return wrapper
......@@ -173,7 +173,7 @@ class HandlerSwitcher(object):
if klass and isinstance(packet, klass) or packet.isError():
handler.packetReceived(connection, packet)
else:
logging.error('Unexpected answer %r in %r', packet, connection)
neo.logging.error('Unexpected answer %r in %r', packet, connection)
notification = Packets.Notify('Unexpected answer: %r' % packet)
connection.notify(notification)
connection.abort()
......@@ -181,7 +181,7 @@ class HandlerSwitcher(object):
# apply a pending handler if no more answers are pending
while len(self._pending) > 1 and not self._pending[0][0]:
del self._pending[0]
logging.debug('Apply handler %r on %r', self._pending[0][1],
neo.logging.debug('Apply handler %r on %r', self._pending[0][1],
connection)
if timeout == self._next_timeout:
self._updateNextTimeout()
......@@ -279,12 +279,12 @@ class BaseConnection(object):
if handlers.isPending():
msg_id = handlers.checkTimeout(self, t)
if msg_id is not None:
logging.info('timeout for %r with %r', msg_id, self)
neo.logging.info('timeout for %r with %r', msg_id, self)
self.close()
self.getHandler().timeoutExpired(self)
elif self._timeout.hardExpired(t):
# critical time reach or pong not received, abort
logging.info('timeout with %r', self)
neo.logging.info('timeout with %r', self)
self.notify(Packets.Notify('Timeout'))
self.abort()
self.getHandler().timeoutExpired(self)
......@@ -338,9 +338,9 @@ class BaseConnection(object):
def setHandler(self, handler):
if self._handlers.setHandler(handler):
logging.debug('Set handler %r on %r', handler, self)
neo.logging.debug('Set handler %r on %r', handler, self)
else:
logging.debug('Delay handler %r on %r', handler, self)
neo.logging.debug('Delay handler %r on %r', handler, self)
def getEventManager(self):
return self.em
......@@ -379,7 +379,7 @@ class ListeningConnection(BaseConnection):
"""A listen connection."""
def __init__(self, event_manager, handler, addr, connector, **kw):
logging.debug('listening to %s:%d', *addr)
neo.logging.debug('listening to %s:%d', *addr)
BaseConnection.__init__(self, event_manager, handler,
addr=addr, connector=connector)
self.connector.makeListeningConnection(addr)
......@@ -388,7 +388,7 @@ class ListeningConnection(BaseConnection):
def readable(self):
try:
new_s, addr = self.connector.getNewConnection()
logging.debug('accepted a connection from %s:%d', *addr)
neo.logging.debug('accepted a connection from %s:%d', *addr)
handler = self.getHandler()
new_conn = ServerConnection(self.getEventManager(), handler,
connector=new_s, addr=addr)
......@@ -451,7 +451,7 @@ class Connection(BaseConnection):
return next_id
def close(self):
logging.debug('closing a connector for %r', self)
neo.logging.debug('closing a connector for %r', self)
BaseConnection.close(self)
if self._on_close is not None:
self._on_close()
......@@ -462,7 +462,7 @@ class Connection(BaseConnection):
def abort(self):
"""Abort dealing with this connection."""
logging.debug('aborting a connector for %r', self)
neo.logging.debug('aborting a connector for %r', self)
self.aborted = True
def writable(self):
......@@ -548,16 +548,17 @@ class Connection(BaseConnection):
except ConnectorConnectionClosedException:
# connection resetted by peer, according to the man, this error
# should not occurs but it seems it's false
logging.debug('Connection reset by peer: %r', self.connector)
neo.logging.debug('Connection reset by peer: %r', self.connector)
self._closure()
except:
logging.debug('Unknown connection error: %r', self.connector)
neo.logging.debug('Unknown connection error: %r', self.connector)
self._closure()
# unhandled connector exception
raise
else:
if not data:
logging.debug('Connection %r closed in recv', self.connector)
neo.logging.debug('Connection %r closed in recv',
self.connector)
self._closure()
return
self.read_buf.append(data)
......@@ -574,16 +575,17 @@ class Connection(BaseConnection):
pass
except ConnectorConnectionClosedException:
# connection resetted by peer
logging.debug('Connection reset by peer: %r', self.connector)
neo.logging.debug('Connection reset by peer: %r', self.connector)
self._closure()
except:
logging.debug('Unknown connection error: %r', self.connector)
neo.logging.debug('Unknown connection error: %r', self.connector)
# unhandled connector exception
self._closure()
raise
else:
if not n:
logging.debug('Connection %r closed in send', self.connector)
neo.logging.debug('Connection %r closed in send',
self.connector)
self._closure()
return
if n == len(msg):
......
......@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from time import time
from neo import logging
import neo
from neo.epoll import Epoll
from neo.profiling import profiler_decorator
......@@ -184,13 +184,14 @@ class EpollEventManager(object):
self.epoll.modify(fd, fd in self.reader_set, 0)
def log(self):
logging.info('Event Manager:')
logging.info(' Readers: %r', [x for x in self.reader_set])
logging.info(' Writers: %r', [x for x in self.writer_set])
logging.info(' Connections:')
neo.logging.info('Event Manager:')
neo.logging.info(' Readers: %r', [x for x in self.reader_set])
neo.logging.info(' Writers: %r', [x for x in self.writer_set])
neo.logging.info(' Connections:')
pending_set = set(self._pending_processing)
for fd, conn in self.connection_dict.items():
logging.info(' %r: %r (pending=%r)', fd, conn, conn in pending_set)
neo.logging.info(' %r: %r (pending=%r)', fd, conn,
conn in pending_set)
# Default to EpollEventManager.
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.protocol import NodeStates, ErrorCodes, Packets, Errors
from neo.protocol import PacketMalformedError, UnexpectedPacketError, \
BrokenNodeDisallowedError, NotReadyError, ProtocolError
......@@ -40,7 +40,7 @@ class EventHandler(object):
else:
message = 'unexpected packet: %s in %s' % (message,
self.__class__.__name__)
logging.error(message)
neo.logging.error(message)
conn.answer(Errors.ProtocolError(message))
conn.abort()
self.peerBroken(conn)
......@@ -58,7 +58,7 @@ class EventHandler(object):
except UnexpectedPacketError, e:
self.__unexpectedPacket(conn, packet, *e.args)
except PacketMalformedError:
logging.error('malformed packet from %r', conn)
neo.logging.error('malformed packet from %r', conn)
conn.notify(Packets.Notify('Malformed packet: %r' % (packet, )))
conn.abort()
self.peerBroken(conn)
......@@ -82,7 +82,7 @@ class EventHandler(object):
def checkClusterName(self, name):
# raise an exception if the fiven name mismatch the current cluster name
if self.app.name != name:
logging.error('reject an alien cluster')
neo.logging.error('reject an alien cluster')
raise ProtocolError('invalid cluster name')
......@@ -94,32 +94,32 @@ class EventHandler(object):
def connectionStarted(self, conn):
"""Called when a connection is started."""
logging.debug('connection started for %r', conn)
neo.logging.debug('connection started for %r', conn)
def connectionCompleted(self, conn):
"""Called when a connection is completed."""
logging.debug('connection completed for %r', conn)
neo.logging.debug('connection completed for %r', conn)
def connectionFailed(self, conn):
"""Called when a connection failed."""
logging.debug('connection failed for %r', conn)
neo.logging.debug('connection failed for %r', conn)
def connectionAccepted(self, conn):
"""Called when a connection is accepted."""
def timeoutExpired(self, conn):
"""Called when a timeout event occurs."""
logging.debug('timeout expired for %r', conn)
neo.logging.debug('timeout expired for %r', conn)
self.connectionLost(conn, NodeStates.TEMPORARILY_DOWN)
def connectionClosed(self, conn):
"""Called when a connection is closed by the peer."""
logging.debug('connection closed for %r', conn)
neo.logging.debug('connection closed for %r', conn)
self.connectionLost(conn, NodeStates.TEMPORARILY_DOWN)
def peerBroken(self, conn):
"""Called when a peer is broken."""
logging.error('%r is broken', conn)
neo.logging.error('%r is broken', conn)
self.connectionLost(conn, NodeStates.BROKEN)
def connectionLost(self, conn, new_state):
......@@ -131,7 +131,7 @@ class EventHandler(object):
# Packet handlers.
def notify(self, conn, message):
logging.info('notification from %r: %s', conn, message)
neo.logging.info('notification from %r: %s', conn, message)
def requestIdentification(self, conn, node_type,
uuid, address, name):
......@@ -395,16 +395,16 @@ class EventHandler(object):
def protocolError(self, conn, message):
# the connection should have been closed by the remote peer
logging.error('protocol error: %s' % (message,))
neo.logging.error('protocol error: %s' % (message,))
def timeoutError(self, conn, message):
logging.error('timeout error: %s' % (message,))
neo.logging.error('timeout error: %s' % (message,))
def brokenNodeDisallowedError(self, conn, message):
raise RuntimeError, 'broken node disallowed error: %s' % (message,)
def ack(self, conn, message):
logging.debug("no error message : %s" % (message))
neo.logging.debug("no error message : %s" % (message))
# Fetch tables initialization
......
......@@ -15,13 +15,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.protocol import PacketMalformedError
from neo.util import dump
from neo.handler import EventHandler
from neo.profiling import profiler_decorator
LOGGER_ENABLED = False
LOGGER_ENABLED = True
class PacketLogger(object):
""" Logger at packet level (for debugging purpose) """
......@@ -37,7 +37,7 @@ class PacketLogger(object):
klass = packet.getType()
uuid = dump(conn.getUUID())
ip, port = conn.getAddress()
logging.debug('#0x%08x %-30s %s %s (%s:%d)', packet.getId(),
neo.logging.debug('#0x%08x %-30s %s %s (%s:%d)', packet.getId(),
packet.__class__.__name__, direction, uuid, ip, port)
# look for custom packet logger
logger = self.packet_dispatch_table.get(klass, None)
......@@ -48,11 +48,11 @@ class PacketLogger(object):
try:
args = packet.decode() or ()
except PacketMalformedError:
logging.warning("Can't decode packet for logging")
neo.logging.warning("Can't decode packet for logging")
return
log_message = logger(conn, *args)
if log_message is not None:
logging.debug('#0x%08x %s', packet.getId(), log_message)
neo.logging.debug('#0x%08x %s', packet.getId(), log_message)
def error(self, conn, code, message):
return "%s (%s)" % (code, message)
......@@ -64,7 +64,7 @@ class PacketLogger(object):
else:
address = '?'
node = (dump(uuid), node_type, address, state)
logging.debug(' ! %s | %8s | %22s | %s' % node)
neo.logging.debug(' ! %s | %8s | %22s | %s' % node)
PACKET_LOGGER = PacketLogger()
if not LOGGER_ENABLED:
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
import os, sys
from time import time
......@@ -60,7 +60,7 @@ class Application(object):
for address in config.getMasters():
self.nm.createMaster(address=address)
logging.debug('IP address is %s, port is %d', *(self.server))
neo.logging.debug('IP address is %s, port is %d', *(self.server))
# Partition table
replicas, partitions = config.getReplicas(), config.getPartitions()
......@@ -69,10 +69,10 @@ class Application(object):
if partitions <= 0:
raise RuntimeError, 'partitions must be more than zero'
self.pt = PartitionTable(partitions, replicas)
logging.info('Configuration:')
logging.info('Partitions: %d', partitions)
logging.info('Replicas : %d', replicas)
logging.info('Name : %s', self.name)
neo.logging.info('Configuration:')
neo.logging.info('Partitions: %d', partitions)
neo.logging.info('Replicas : %d', replicas)
neo.logging.info('Name : %s', self.name)
self.listening_conn = None
self.primary = None
......@@ -105,7 +105,7 @@ class Application(object):
try:
self._run()
except:
logging.info('\nPre-mortem informations:')
neo.logging.info('\nPre-mortem informations:')
self.log()
raise
......@@ -143,7 +143,7 @@ class Application(object):
others while attempting to connect to other master nodes at the
same time. Note that storage nodes and client nodes may connect
to self as well as master nodes."""
logging.info('begin the election of a primary master')
neo.logging.info('begin the election of a primary master')
self.unconnected_master_node_set.clear()
self.negotiating_master_node_set.clear()
......@@ -197,7 +197,7 @@ class Application(object):
for node in self.nm.getMasterList():
if not node.isRunning() and node.getLastStateChange() + \
expiration < current_time:
logging.info('%s is down' % (node, ))
neo.logging.info('%s is down' % (node, ))
node.setDown()
self.unconnected_master_node_set.discard(
node.getAddress())
......@@ -220,7 +220,7 @@ class Application(object):
Broadcast the announce that I'm the primary
"""
# I am the primary.
logging.debug('I am the primary, sending an announcement')
neo.logging.debug('I am the primary, sending an announcement')
for conn in self.em.getClientList():
conn.notify(Packets.AnnouncePrimary())
conn.abort()
......@@ -237,7 +237,7 @@ class Application(object):
"""
Ask other masters to reelect a primary after an election failure.
"""
logging.error('election failed: %s', (m, ))
neo.logging.error('election failed: %s', (m, ))
# Ask all connected nodes to reelect a single primary master.
for conn in self.em.getClientList():
......@@ -286,7 +286,7 @@ class Application(object):
def broadcastPartitionChanges(self, cell_list):
"""Broadcast a Notify Partition Changes packet."""
logging.debug('broadcastPartitionChanges')
neo.logging.debug('broadcastPartitionChanges')
if not cell_list:
return
self.pt.log()
......@@ -304,7 +304,7 @@ class Application(object):
def broadcastLastOID(self):
oid = self.tm.getLastOID()
logging.debug('Broadcast last OID to storages : %s' % dump(oid))
neo.logging.debug('Broadcast last OID to storages : %s' % dump(oid))
packet = Packets.NotifyLastOID(oid)
for node in self.nm.getStorageList(only_identified=True):
node.notify(packet)
......@@ -315,7 +315,7 @@ class Application(object):
and stop the service only if a catastrophy happens or the user commits
a shutdown.
"""
logging.info('provide service')
neo.logging.info('provide service')
em = self.em
self.tm.reset()
......@@ -328,7 +328,7 @@ class Application(object):
except OperationFailure:
# If not operational, send Stop Operation packets to storage
# nodes and client nodes. Abort connections to client nodes.
logging.critical('No longer operational, stopping the service')
neo.logging.critical('No longer operational')
for node in self.nm.getIdentifiedList():
if node.isStorage() or node.isClient():
node.notify(Packets.StopOperation())
......@@ -341,7 +341,7 @@ class Application(object):
return
def playPrimaryRole(self):
logging.info('play the primary role with %r', self.listening_conn)
neo.logging.info('play the primary role with %r', self.listening_conn)
# i'm the primary, send the announcement
self._announcePrimary()
......@@ -378,7 +378,8 @@ class Application(object):
"""
I play a secondary role, thus only wait for a primary master to fail.
"""
logging.info('play the secondary role with %r', self.listening_conn)
neo.logging.info('play the secondary role with %r',
self.listening_conn)
# Wait for an announcement. If this is too long, probably
# the primary master is down.
......@@ -491,7 +492,7 @@ class Application(object):
self.em.poll(1)
if self.cluster_state != ClusterStates.RUNNING:
logging.info("asking all nodes to shutdown")
neo.logging.info("asking all nodes to shutdown")
# This code sends packets but never polls, so they never reach
# network.
for node in self.nm.getIdentifiedList():
......@@ -528,7 +529,7 @@ class Application(object):
# always accept admin nodes
node_ctor = self.nm.createAdmin
handler = administration.AdministrationHandler(self)
logging.info('Accept an admin %s' % (dump(uuid), ))
neo.logging.info('Accept an admin %s' % (dump(uuid), ))
elif node_type == NodeTypes.MASTER:
if node is None:
# unknown master, rejected
......@@ -536,15 +537,15 @@ class Application(object):
# always put other master in waiting state
node_ctor = self.nm.createMaster
handler = secondary.SecondaryMasterHandler(self)
logging.info('Accept a master %s' % (dump(uuid), ))
neo.logging.info('Accept a master %s' % (dump(uuid), ))
elif node_type == NodeTypes.CLIENT:
# refuse any client before running
if self.cluster_state != ClusterStates.RUNNING:
logging.info('Reject a connection from a client')
neo.logging.info('Reject a connection from a client')
raise protocol.NotReadyError
node_ctor = self.nm.createClient
handler = client.ClientServiceHandler(self)
logging.info('Accept a client %s' % (dump(uuid), ))
neo.logging.info('Accept a client %s' % (dump(uuid), ))
elif node_type == NodeTypes.STORAGE:
node_ctor = self.nm.createStorage
if self._current_manager is not None:
......@@ -552,7 +553,7 @@ class Application(object):
(uuid, state, handler) = identify(uuid, node)
else:
(uuid, state, handler) = self.identifyStorageNode(uuid, node)
logging.info('Accept a storage %s (%s)' % (dump(uuid), state))
neo.logging.info('Accept a storage %s (%s)' % (dump(uuid), state))
return (uuid, node, state, handler, node_ctor)
def setStorageNotReady(self, uuid):
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.handler import EventHandler
from neo.protocol import NodeTypes, NodeStates, Packets
......@@ -25,7 +25,7 @@ class MasterHandler(EventHandler):
"""This class implements a generic part of the event handlers."""
def protocolError(self, conn, message):
logging.error('Protocol error %s %s' % (message, conn.getAddress()))
neo.logging.error('Protocol error %s %s', message, conn.getAddress())
def askPrimary(self, conn):
if conn.getConnector() is None:
......@@ -101,7 +101,7 @@ class BaseServiceHandler(MasterHandler):
if new_state != NodeStates.BROKEN and was_pending:
# was in pending state, so drop it from the node manager to forget
# it and do not set in running state when it comes back
logging.info('drop a pending node from the node manager')
neo.logging.info('drop a pending node from the node manager')
self.app.nm.remove(node)
self.app.broadcastNodesInformation([node])
# clean node related data in specialized handlers
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.master.handlers import MasterHandler
from neo.protocol import ClusterStates, NodeStates, Packets, ProtocolError
......@@ -63,7 +63,7 @@ class AdministrationHandler(MasterHandler):
self.app.shutdown()
def setNodeState(self, conn, uuid, state, modify_partition_table):
logging.info("set node state for %s-%s : %s" %
neo.logging.info("set node state for %s-%s : %s" %
(dump(uuid), state, modify_partition_table))
app = self.app
node = app.nm.getByUUID(uuid)
......@@ -119,7 +119,7 @@ class AdministrationHandler(MasterHandler):
def addPendingNodes(self, conn, uuid_list):
uuids = ', '.join([dump(uuid) for uuid in uuid_list])
logging.debug('Add nodes %s' % uuids)
neo.logging.debug('Add nodes %s' % uuids)
app, nm, em, pt = self.app, self.app.nm, self.app.em, self.app.pt
cell_list = []
uuid_set = set()
......@@ -132,11 +132,11 @@ class AdministrationHandler(MasterHandler):
uuid_set = uuid_set.intersection(set(uuid_list))
# nothing to do
if not uuid_set:
logging.warning('No nodes added')
neo.logging.warning('No nodes added')
conn.answer(Errors.Ack('No nodes added'))
return
uuids = ', '.join([dump(uuid) for uuid in uuid_set])
logging.info('Adding nodes %s' % uuids)
neo.logging.info('Adding nodes %s' % uuids)
# switch nodes to running state
node_list = [nm.getByUUID(uuid) for uuid in uuid_set]
for node in node_list:
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.protocol import NodeStates, Packets, ProtocolError
from neo.master.handlers import MasterHandler
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.protocol import NodeTypes, Packets
from neo.protocol import NotReadyError, ProtocolError, UnexpectedPacketError
......@@ -90,7 +90,7 @@ class ClientElectionHandler(MasterHandler):
node = app.nm.getByAddress(conn.getAddress())
if node_type != NodeTypes.MASTER:
# The peer is not a master node!
logging.error('%r is not a master node', conn)
neo.logging.error('%r is not a master node', conn)
app.nm.remove(node)
app.negotiating_master_node_set.discard(node.getAddress())
conn.close()
......@@ -137,7 +137,7 @@ class ClientElectionHandler(MasterHandler):
if primary_node is None:
# I don't know such a node. Probably this information
# is old. So ignore it.
logging.warning('received an unknown primary node UUID')
neo.logging.warning('received an unknown primary node UUID')
else:
# Whatever the situation is, I trust this master.
app.primary = False
......@@ -203,11 +203,11 @@ class ServerElectionHandler(MasterHandler):
self.checkClusterName(name)
app = self.app
if node_type != NodeTypes.MASTER:
logging.info('reject a connection from a non-master')
neo.logging.info('reject a connection from a non-master')
raise NotReadyError
node = app.nm.getByAddress(address)
if node is None:
logging.error('unknown master node: %s' % (address, ))
neo.logging.error('unknown master node: %s' % (address, ))
raise ProtocolError('unknown master node')
# If this node is broken, reject it.
if node.getUUID() == uuid:
......@@ -243,5 +243,5 @@ class ServerElectionHandler(MasterHandler):
app.primary_master_node = node
app.unconnected_master_node_set.clear()
app.negotiating_master_node_set.clear()
logging.info('%s is the primary', node)
neo.logging.info('%s is the primary', node)
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.protocol import NodeTypes, Packets
from neo.protocol import BrokenNodeDisallowedError, ProtocolError
......@@ -25,7 +25,7 @@ class IdentificationHandler(MasterHandler):
"""This class deals with messages from the admin node only"""
def nodeLost(self, conn, node):
logging.warning('lost a node in IdentificationHandler : %s' % node)
neo.logging.warning('lost a node in IdentificationHandler : %s' % node)
def requestIdentification(self, conn, node_type, uuid, address, name):
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo import protocol
from neo.master.handlers import BaseServiceHandler
......@@ -24,15 +24,15 @@ class ShutdownHandler(BaseServiceHandler):
def requestIdentification(self, conn, node_type,
uuid, address, name):
logging.error('reject any new connection')
neo.logging.error('reject any new connection')
raise protocol.ProtocolError('cluster is shutting down')
def askPrimary(self, conn):
logging.error('reject any new demand for primary master')
neo.logging.error('reject any new demand for primary master')
raise protocol.ProtocolError('cluster is shutting down')
def askBeginTransaction(self, conn, tid):
logging.error('reject any new demand for new tid')
neo.logging.error('reject any new demand for new tid')
raise protocol.ProtocolError('cluster is shutting down')
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.protocol import ProtocolError
from neo.protocol import CellStates, Packets
......@@ -39,7 +39,7 @@ class StorageServiceHandler(BaseServiceHandler):
conn.notify(Packets.StartOperation())
def nodeLost(self, conn, node):
logging.info('storage node lost')
neo.logging.info('storage node lost')
assert not node.isRunning(), node.getState()
if not self.app.pt.operational():
......@@ -109,7 +109,7 @@ class StorageServiceHandler(BaseServiceHandler):
def notifyReplicationDone(self, conn, offset):
uuid = conn.getUUID()
node = self.app.nm.getByUUID(uuid)
logging.debug("node %s is up for offset %s" % (dump(uuid), offset))
neo.logging.debug("node %s is up for offset %s" % (dump(uuid), offset))
# check the partition is assigned and known as outdated
for cell in self.app.pt.getCellList(offset):
......
......@@ -17,7 +17,7 @@
from struct import pack
from neo import logging
import neo
from neo.util import dump
from neo.protocol import Packets, ProtocolError, ClusterStates, NodeStates
from neo.protocol import NotReadyError, ZERO_OID, ZERO_TID
......@@ -43,7 +43,7 @@ class RecoveryManager(MasterHandler):
Returns the handler for storage nodes
"""
if uuid is None and not self.app._startup_allowed:
logging.info('reject empty storage node')
neo.logging.info('reject empty storage node')
raise NotReadyError
return (uuid, NodeStates.RUNNING, self)
......@@ -54,7 +54,7 @@ class RecoveryManager(MasterHandler):
back the latest partition table or make a new table from scratch,
if this is the first time.
"""
logging.info('begin the recovery of the status')
neo.logging.info('begin the recovery of the status')
self.app.changeClusterState(ClusterStates.RECOVERING)
em = self.app.em
......@@ -66,7 +66,7 @@ class RecoveryManager(MasterHandler):
while not self.app._startup_allowed:
em.poll(1)
logging.info('startup allowed')
neo.logging.info('startup allowed')
# build a new partition table
if self.app.pt.getID() is None:
......@@ -80,13 +80,14 @@ class RecoveryManager(MasterHandler):
node.setPending()
self.app.broadcastNodesInformation(refused_node_set)
logging.debug('cluster starts with loid=%s and this partition table :',
dump(self.app.tm.getLastOID()))
neo.logging.debug('cluster starts with loid=%s and this partition ' \
'table :', dump(self.app.tm.getLastOID()))
self.app.pt.log()
def buildFromScratch(self):
nm, em, pt = self.app.nm, self.app.em, self.app.pt
logging.debug('creating a new partition table, wait for a storage node')
neo.logging.debug('creating a new partition table, wait for a ' \
'storage node')
# wait for some empty storage nodes, their are accepted
while len(nm.getStorageList()) < REQUIRED_NODE_NUMBER:
em.poll(1)
......@@ -127,7 +128,7 @@ class RecoveryManager(MasterHandler):
def answerPartitionTable(self, conn, ptid, row_list):
if ptid != self.target_ptid:
# If this is not from a target node, ignore it.
logging.warn('Got %s while waiting %s', dump(ptid),
neo.logging.warn('Got %s while waiting %s', dump(ptid),
dump(self.target_ptid))
return
try:
......
......@@ -19,7 +19,7 @@ from time import time, gmtime
from struct import pack, unpack
from datetime import timedelta, datetime
from neo.util import dump
from neo import logging
import neo
class Transaction(object):
"""
......@@ -269,7 +269,7 @@ class TransactionManager(object):
del self._node_dict[node]
def log(self):
logging.info('Transactions:')
neo.logging.info('Transactions:')
for txn in self._tid_dict.itervalues():
logging.info(' %r', txn)
neo.logging.info(' %r', txn)
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.util import dump
from neo.protocol import ClusterStates, Packets, NodeStates
from neo.master.handlers import BaseServiceHandler
......@@ -117,11 +117,11 @@ class VerificationManager(BaseServiceHandler):
em, nm = self.app.em, self.app.nm
# wait for any missing node
logging.debug('waiting for the cluster to be operational')
neo.logging.debug('waiting for the cluster to be operational')
while not self.app.pt.operational():
em.poll(1)
logging.info('start to verify data')
neo.logging.info('start to verify data')
# Gather all unfinished transactions.
self._askStorageNodesAndWait(Packets.AskUnfinishedTransactions(),
......@@ -196,7 +196,7 @@ class VerificationManager(BaseServiceHandler):
def answerUnfinishedTransactions(self, conn, tid_list):
uuid = conn.getUUID()
logging.info('got unfinished transactions %s from %r',
neo.logging.info('got unfinished transactions %s from %r',
[dump(tid) for tid in tid_list], conn)
if not self._gotAnswerFrom(uuid):
return
......@@ -221,19 +221,19 @@ class VerificationManager(BaseServiceHandler):
def tidNotFound(self, conn, message):
uuid = conn.getUUID()
logging.info('TID not found: %s', message)
neo.logging.info('TID not found: %s', message)
if not self._gotAnswerFrom(uuid):
return
self._oid_set = None
def answerObjectPresent(self, conn, oid, tid):
uuid = conn.getUUID()
logging.info('object %s:%s found', dump(oid), dump(tid))
neo.logging.info('object %s:%s found', dump(oid), dump(tid))
self._gotAnswerFrom(uuid)
def oidNotFound(self, conn, message):
uuid = conn.getUUID()
logging.info('OID not found: %s', message)
neo.logging.info('OID not found: %s', message)
app = self.app
if not self._gotAnswerFrom(uuid):
return
......
......@@ -17,7 +17,7 @@
from time import time
from neo import logging
import neo
from neo.util import dump
from neo.protocol import NodeTypes, NodeStates
......@@ -263,7 +263,7 @@ class NodeManager(object):
def add(self, node):
if node in self._node_set:
logging.warning('adding a known node %r, ignoring', node)
neo.logging.warning('adding a known node %r, ignoring', node)
return
self._node_set.add(node)
self._updateAddress(node, None)
......@@ -274,7 +274,7 @@ class NodeManager(object):
def remove(self, node):
if node not in self._node_set:
logging.warning('removing unknown node %r, ignoring', node)
neo.logging.warning('removing unknown node %r, ignoring', node)
return
self._node_set.remove(node)
self.__drop(self._address_dict, node.getAddress())
......@@ -446,11 +446,12 @@ class NodeManager(object):
log_args = (node_type, dump(uuid), addr, state)
if node is None:
if state == NodeStates.DOWN:
logging.debug('NOT creating node %s %s %s %s', *log_args)
neo.logging.debug('NOT creating node %s %s %s %s',
*log_args)
else:
node = self._createNode(klass, address=addr, uuid=uuid,
state=state)
logging.debug('creating node %r', node)
neo.logging.debug('creating node %r', node)
else:
assert isinstance(node, klass), 'node %r is not ' \
'of expected type: %r' % (node, klass)
......@@ -459,14 +460,14 @@ class NodeManager(object):
'Discrepancy between node_by_uuid (%r) and ' \
'node_by_addr (%r)' % (node_by_uuid, node_by_addr)
if state == NodeStates.DOWN:
logging.debug('droping node %r (%r), found with %s %s %s %s',
node, node.isConnected(), *log_args)
neo.logging.debug('droping node %r (%r), found with %s ' \
'%s %s %s', node, node.isConnected(), *log_args)
if node.isConnected():
# cut this connection, node removed by handler
node.getConnection().close()
self.remove(node)
else:
logging.debug('updating node %r to %s %s %s %s',
neo.logging.debug('updating node %r to %s %s %s %s',
node, *log_args)
node.setUUID(uuid)
node.setAddress(addr)
......@@ -474,12 +475,12 @@ class NodeManager(object):
self.log()
def log(self):
logging.info('Node manager : %d nodes' % len(self._node_set))
neo.logging.info('Node manager : %d nodes' % len(self._node_set))
for node in sorted(list(self._node_set)):
uuid = dump(node.getUUID()) or '-' * 32
address = node.getAddress() or ''
if address:
address = '%s:%d' % address
logging.info(' * %32s | %8s | %22s | %s' % (
neo.logging.info(' * %32s | %8s | %22s | %s' % (
uuid, node.getType(), address, node.getState()))
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo import protocol
from neo.protocol import CellStates
......@@ -205,7 +205,7 @@ class PartitionTable(object):
# the node must be known by the node manager
assert node is not None
self.setCell(offset, node, state)
logging.debug('partition table loaded')
neo.logging.debug('partition table loaded')
self.log()
def update(self, ptid, cell_list, nm):
......@@ -215,14 +215,14 @@ class PartitionTable(object):
is not known, it is created in the node manager and set as unavailable
"""
if ptid <= self._id:
logging.warning('ignoring older partition changes')
neo.logging.warning('ignoring older partition changes')
return
self._id = ptid
for offset, uuid, state in cell_list:
node = nm.getByUUID(uuid)
assert node is not None, 'No node found for uuid %r' % (dump(uuid), )
self.setCell(offset, node, state)
logging.debug('partition table updated')
neo.logging.debug('partition table updated')
self.log()
def filled(self):
......@@ -230,7 +230,7 @@ class PartitionTable(object):
def log(self):
for line in self._format():
logging.debug(line)
neo.logging.debug(line)
def format(self):
return '\n'.join(self._format())
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
import sys
from collections import deque
......@@ -58,7 +58,7 @@ class Application(object):
# set the bind address
self.server = config.getBind()
logging.debug('IP address is %s, port is %d', *(self.server))
neo.logging.debug('IP address is %s, port is %d', *(self.server))
# The partition table is initialized after getting the number of
# partitions.
......@@ -126,12 +126,12 @@ class Application(object):
# create a partition table
self.pt = PartitionTable(num_partitions, num_replicas)
logging.info('Configuration loaded:')
logging.info('UUID : %s', dump(self.uuid))
logging.info('PTID : %s', dump(ptid))
logging.info('Name : %s', self.name)
logging.info('Partitions: %s', num_partitions)
logging.info('Replicas : %s', num_replicas)
neo.logging.info('Configuration loaded:')
neo.logging.info('UUID : %s', dump(self.uuid))
neo.logging.info('PTID : %s', dump(ptid))
neo.logging.info('Name : %s', self.name)
neo.logging.info('Partitions: %s', num_partitions)
neo.logging.info('Replicas : %s', num_replicas)
def loadPartitionTable(self):
"""Load a partition table from the database."""
......@@ -156,7 +156,7 @@ class Application(object):
try:
self._run()
except:
logging.info('\nPre-mortem informations:')
neo.logging.info('\nPre-mortem informations:')
self.log()
raise
......@@ -196,9 +196,9 @@ class Application(object):
self.doOperation()
raise RuntimeError, 'should not reach here'
except OperationFailure, msg:
logging.error('operation stopped: %s', msg)
neo.logging.error('operation stopped: %s', msg)
except PrimaryFailure, msg:
logging.error('primary master is down: %s', msg)
neo.logging.error('primary master is down: %s', msg)
self.master_node = None
def connectToPrimary(self):
......@@ -223,7 +223,7 @@ class Application(object):
(node, conn, uuid, num_partitions, num_replicas) = data
self.master_node = node
self.master_conn = conn
logging.info('I am %s', dump(uuid))
neo.logging.info('I am %s', dump(uuid))
self.uuid = uuid
self.dm.setUUID(uuid)
......@@ -245,7 +245,7 @@ class Application(object):
def verifyData(self):
"""Verify data under the control by a primary master node.
Connections from client nodes may not be accepted at this stage."""
logging.info('verifying data')
neo.logging.info('verifying data')
handler = verification.VerificationHandler(self)
self.master_conn.setHandler(handler)
......@@ -256,7 +256,7 @@ class Application(object):
def initialize(self):
""" Retreive partition table and node informations from the primary """
logging.debug('initializing...')
neo.logging.debug('initializing...')
handler = initialization.InitializationHandler(self)
self.master_conn.setHandler(handler)
......@@ -276,7 +276,7 @@ class Application(object):
def doOperation(self):
"""Handle everything, including replications and transactions."""
logging.info('doing operation')
neo.logging.info('doing operation')
em = self.em
......@@ -302,7 +302,7 @@ class Application(object):
def wait(self):
# change handler
logging.info("waiting in hidden state")
neo.logging.info("waiting in hidden state")
handler = hidden.HiddenHandler(self)
for conn in self.em.getConnectionList():
conn.setHandler(handler)
......@@ -330,11 +330,11 @@ class Application(object):
def logQueuedEvents(self):
if self.event_queue is None:
return
logging.info("Pending events:")
neo.logging.info("Pending events:")
for event, _msg_id, _conn, args, _kwargs in self.event_queue:
oid, serial, _compression, _checksum, data, tid, time = args
logging.info(' %r: %r:%r by %r -> %r (%r)', event.__name__, dump(oid),
dump(serial), dump(tid), data, time)
neo.logging.info(' %r: %r:%r by %r -> %r (%r)', event.__name__,
dump(oid), dump(serial), dump(tid), data, time)
def shutdown(self, erase=False):
"""Close all connections and exit"""
......
......@@ -18,7 +18,7 @@
import MySQLdb
from MySQLdb import OperationalError
from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST
from neo import logging
import neo
from array import array
import string
......@@ -68,7 +68,7 @@ class MySQLDatabaseManager(DatabaseManager):
kwd = {'db' : self.db, 'user' : self.user}
if self.passwd is not None:
kwd['passwd'] = self.passwd
logging.info('connecting to MySQL on the database %s with user %s',
neo.logging.info('connecting to MySQL on the database %s with user %s',
self.db, self.user)
self.conn = MySQLdb.connect(**kwd)
self.conn.autocommit(False)
......@@ -78,12 +78,12 @@ class MySQLDatabaseManager(DatabaseManager):
def _commit(self):
if LOG_QUERIES:
logging.debug('committing...')
neo.logging.debug('committing...')
self.conn.commit()
def _rollback(self):
if LOG_QUERIES:
logging.debug('aborting...')
neo.logging.debug('aborting...')
self.conn.rollback()
def query(self, query):
......@@ -97,7 +97,7 @@ class MySQLDatabaseManager(DatabaseManager):
c = '\\x%02x' % ord(c)
printable_char_list.append(c)
query_part = ''.join(printable_char_list)
logging.debug('querying %s...', query_part)
neo.logging.debug('querying %s...', query_part)
conn.query(query)
r = conn.store_result()
......@@ -114,7 +114,7 @@ class MySQLDatabaseManager(DatabaseManager):
except OperationalError, m:
if m[0] in (SERVER_GONE_ERROR, SERVER_LOST):
logging.info('the MySQL server is gone; reconnecting')
neo.logging.info('the MySQL server is gone; reconnecting')
self._connect()
return self.query(query)
raise DatabaseFailure('MySQL error %d: %s' % (m[0], m[1]))
......@@ -303,7 +303,7 @@ class MySQLDatabaseManager(DatabaseManager):
})
compression, checksum, value, next_value_serial = r[0]
if value is None:
logging.info("Multiple levels of indirection when " \
neo.logging.info("Multiple levels of indirection when " \
"searching for object data for oid %d at tid %d. This " \
"causes suboptimal performance." % (oid, value_serial))
value_serial, compression, checksum, value = self._getObjectData(
......@@ -574,7 +574,7 @@ class MySQLDatabaseManager(DatabaseManager):
(self._getPartition(oid), oid, value_serial))
length, value_serial = r[0]
if length is None:
logging.info("Multiple levels of indirection when " \
neo.logging.info("Multiple levels of indirection when " \
"searching for object data for oid %d at tid %d. This " \
"causes suboptimal performance." % (oid, value_serial))
length = self._getObjectLength(oid, value_serial)
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.handler import EventHandler
from neo import protocol
......@@ -35,7 +35,7 @@ class BaseMasterHandler(EventHandler):
raise PrimaryFailure('re-election occurs')
def notifyClusterInformation(self, conn, state):
logging.warning('ignoring notify cluster information in %s' %
neo.logging.warning('ignoring notify cluster information in %s' %
self.__class__.__name__)
def notifyLastOID(self, conn, oid):
......@@ -48,7 +48,7 @@ class BaseMasterHandler(EventHandler):
for node_type, addr, uuid, state in node_list:
if uuid == self.app.uuid:
# This is me, do what the master tell me
logging.info("I was told I'm %s" %(state))
neo.logging.info("I was told I'm %s" %(state))
if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN,
NodeStates.BROKEN):
conn.close()
......@@ -57,7 +57,7 @@ class BaseMasterHandler(EventHandler):
elif state == NodeStates.HIDDEN:
raise OperationFailure
elif node_type == NodeTypes.CLIENT and state != NodeStates.RUNNING:
logging.info('Notified of non-running client, abort (%r)',
neo.logging.info('Notified of non-running client, abort (%r)',
dump(uuid))
self.app.tm.abortFor(uuid)
......@@ -86,14 +86,14 @@ class BaseClientAndStorageOperationHandler(EventHandler):
return
o = self._askObject(oid, serial, tid)
if o is None:
logging.debug('oid = %s does not exist', dump(oid))
neo.logging.debug('oid = %s does not exist', dump(oid))
p = Errors.OidDoesNotExist(dump(oid))
elif o is False:
logging.debug('oid = %s not found', dump(oid))
neo.logging.debug('oid = %s not found', dump(oid))
p = Errors.OidNotFound(dump(oid))
else:
serial, next_serial, compression, checksum, data, data_serial = o
logging.debug('oid = %s, serial = %s, next_serial = %s',
neo.logging.debug('oid = %s, serial = %s, next_serial = %s',
dump(oid), dump(serial), dump(next_serial))
p = Packets.AnswerObject(oid, serial, next_serial,
compression, checksum, data, data_serial)
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo import protocol
from neo.util import dump
from neo.protocol import Packets, LockState, Errors
......@@ -50,7 +50,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
data_serial, tid, request_time):
if tid not in self.app.tm:
# transaction was aborted, cancel this event
logging.info('Forget store of %s:%s by %s delayed by %s',
neo.logging.info('Forget store of %s:%s by %s delayed by %s',
dump(oid), dump(serial), dump(tid),
dump(self.app.tm.getLockingTID(oid)))
# send an answer as the client side is waiting for it
......@@ -71,7 +71,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
if SLOW_STORE is not None:
duration = time.time() - request_time
if duration > SLOW_STORE:
logging.info('StoreObject delay: %.02fs', duration)
neo.logging.info('StoreObject delay: %.02fs', duration)
conn.answer(Packets.AnswerStoreObject(0, oid, serial))
def askStoreObject(self, conn, oid, serial,
......@@ -120,7 +120,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
def askHasLock(self, conn, tid, oid):
locking_tid = self.app.tm.getLockingTID(oid)
logging.info('%r check lock of %r:%r', conn, dump(tid), dump(oid))
neo.logging.info('%r check lock of %r:%r', conn, dump(tid), dump(oid))
if locking_tid is None:
state = LockState.NOT_LOCKED
elif locking_tid is tid:
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.storage.handlers import BaseMasterHandler
from neo.protocol import CellStates
......@@ -29,7 +29,7 @@ class HiddenHandler(BaseMasterHandler):
app = self.app
if ptid <= app.pt.getID():
# Ignore this packet.
logging.debug('ignoring older partition changes')
neo.logging.debug('ignoring older partition changes')
return
# update partition table in memory and the database
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.handler import EventHandler
from neo.protocol import NodeTypes, Packets, NotReadyError
......@@ -26,7 +26,7 @@ class IdentificationHandler(EventHandler):
""" Handler used for incoming connections during operation state """
def connectionLost(self, conn, new_state):
logging.warning('A connection was lost during identification')
neo.logging.warning('A connection was lost during identification')
def requestIdentification(self, conn, node_type,
uuid, address, name):
......@@ -54,7 +54,8 @@ class IdentificationHandler(EventHandler):
from neo.storage.handlers.storage import StorageOperationHandler
handler = StorageOperationHandler
if node is None:
logging.error('reject an unknown storage node %s', dump(uuid))
neo.logging.error('reject an unknown storage node %s',
dump(uuid))
raise NotReadyError
else:
raise ProtocolError('reject non-client-or-storage node')
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.storage.handlers import BaseMasterHandler
from neo import protocol
......@@ -35,7 +35,7 @@ class InitializationHandler(BaseMasterHandler):
pt.load(ptid, row_list, self.app.nm)
if not pt.filled():
raise protocol.ProtocolError('Partial partition table received')
logging.debug('Got the partition table :')
neo.logging.debug('Got the partition table :')
self.app.pt.log()
# Install the partition table into the database for persistency.
cell_list = []
......@@ -48,7 +48,7 @@ class InitializationHandler(BaseMasterHandler):
unassigned_set.remove(offset)
# delete objects database
if unassigned_set:
logging.debug('drop data for partitions %r' % unassigned_set)
neo.logging.debug('drop data for partitions %r' % unassigned_set)
app.dm.dropPartitions(num_partitions, unassigned_set)
app.dm.setPartitionTable(ptid, cell_list)
......@@ -66,4 +66,5 @@ class InitializationHandler(BaseMasterHandler):
# packets in between (or even before asking for node information).
# - this handler will be changed after receiving answerPartitionTable
# and before handling the next packet
logging.debug('ignoring notifyPartitionChanges during initialization')
neo.logging.debug('ignoring notifyPartitionChanges during '\
'initialization')
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.util import dump
from neo.protocol import CellStates, Packets, ProtocolError
from neo.storage.handlers import BaseMasterHandler
......@@ -36,7 +36,7 @@ class MasterOperationHandler(BaseMasterHandler):
app = self.app
if ptid <= app.pt.getID():
# Ignore this packet.
logging.debug('ignoring older partition changes')
neo.logging.debug('ignoring older partition changes')
return
# update partition table in memory and the database
......@@ -67,8 +67,8 @@ class MasterOperationHandler(BaseMasterHandler):
def askPack(self, conn, tid):
app = self.app
logging.info('Pack started, up to %s...', dump(tid))
neo.logging.info('Pack started, up to %s...', dump(tid))
app.dm.pack(tid, app.tm.updateObjectDataForPack)
logging.info('Pack finished.')
neo.logging.info('Pack finished.')
conn.answer(Packets.AnswerPack(True))
......@@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.handler import EventHandler
from neo.protocol import Packets, ZERO_TID, ZERO_OID
......@@ -82,11 +82,11 @@ class ReplicationHandler(EventHandler):
"""This class handles events for replications."""
def connectionLost(self, conn, new_state):
logging.error('replication is stopped due to a connection lost')
neo.logging.error('replication is stopped due to a connection lost')
self.app.replicator.reset()
def connectionFailed(self, conn):
logging.error('replication is stopped due to connection failure')
neo.logging.error('replication is stopped due to connection failure')
self.app.replicator.reset()
def acceptIdentification(self, conn, node_type,
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from neo.storage.handlers import BaseMasterHandler
from neo.protocol import Packets, Errors, ProtocolError
......@@ -48,7 +48,7 @@ class VerificationHandler(BaseMasterHandler):
app = self.app
if ptid <= app.pt.getID():
# Ignore this packet.
logging.debug('ignoring older partition changes')
neo.logging.debug('ignoring older partition changes')
return
# update partition table in memory and the database
app.pt.update(ptid, cell_list, app.nm)
......
......@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import logging
import neo
from random import choice
from neo.storage.handlers import replication
......@@ -209,10 +209,10 @@ class Replicator(object):
try:
partition_list = self.critical_tid_dict.pop(uuid)
except KeyError:
logging.debug("setCriticalTID raised KeyError for %s" %
neo.logging.debug("setCriticalTID raised KeyError for %s" %
(dump(uuid), ))
else:
logging.debug('setting critical TID %s to %s', dump(tid),
neo.logging.debug('setting critical TID %s to %s', dump(tid),
', '.join([str(p.getRID()) for p in partition_list]))
for partition in partition_list:
partition.setCriticalTID(tid)
......@@ -227,7 +227,7 @@ class Replicator(object):
def setUnfinishedTIDList(self, tid_list):
"""This is a callback from MasterOperationHandler."""
logging.debug('setting unfinished TIDs %s',
neo.logging.debug('setting unfinished TIDs %s',
','.join([dump(tid) for tid in tid_list]))
self.waiting_for_unfinished_tids = False
self.unfinished_tid_list = tid_list
......@@ -248,13 +248,13 @@ class Replicator(object):
node = choice(node_list)
except IndexError:
# Not operational.
logging.error('not operational', exc_info = 1)
neo.logging.error('not operational', exc_info = 1)
self.current_partition = None
return
addr = node.getAddress()
if addr is None:
logging.error("no address known for the selected node %s" %
neo.logging.error("no address known for the selected node %s" %
(dump(node.getUUID()), ))
return
if self.current_connection is not None:
......@@ -302,19 +302,19 @@ class Replicator(object):
if self.replication_done and \
not self.current_connection.isPending():
# finish a replication
logging.info('replication is done for %s' %
neo.logging.info('replication is done for %s' %
(self.current_partition.getRID(), ))
self._finishReplication()
return
if self.waiting_for_unfinished_tids:
# Still waiting.
logging.debug('waiting for unfinished tids')
neo.logging.debug('waiting for unfinished tids')
return
if self.unfinished_tid_list is None:
# Ask pending transactions.
logging.debug('asking unfinished tids')
neo.logging.debug('asking unfinished tids')
self._askUnfinishedTIDs()
return
......@@ -330,7 +330,7 @@ class Replicator(object):
else:
# Not yet.
self.unfinished_tid_list = None
logging.debug('not ready yet')
neo.logging.debug('not ready yet')
return
self._startReplication()
......
......@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from time import time
from neo import logging
import neo
from neo.util import dump
......@@ -199,27 +199,27 @@ class TransactionManager(object):
# check if the object if locked
locking_tid = self._store_lock_dict.get(oid)
if locking_tid == tid:
logging.info('Transaction %s storing %s more than once', dump(tid),
dump(oid))
neo.logging.info('Transaction %s storing %s more than once',
dump(tid), dump(oid))
elif locking_tid is None:
# check if this is generated from the latest revision.
history_list = self._app.dm.getObjectHistory(oid)
if history_list and history_list[0][0] != serial:
logging.info('Resolvable conflict on %r:%r', dump(oid),
neo.logging.info('Resolvable conflict on %r:%r', dump(oid),
dump(tid))
raise ConflictError(history_list[0][0])
logging.info('Transaction %s storing %s', dump(tid), dump(oid))
neo.logging.info('Transaction %s storing %s', dump(tid), dump(oid))
self._store_lock_dict[oid] = tid
elif locking_tid < tid:
# a previous transaction lock this object, retry later
logging.info('Store delayed for %r:%r by %r', dump(oid),
neo.logging.info('Store delayed for %r:%r by %r', dump(oid),
dump(tid), dump(locking_tid))
raise DelayedError
else:
# If a newer transaction already locks this object,
# do not try to resolve a conflict, so return immediately.
logging.info('Unresolvable conflict on %r:%r with %r', dump(oid),
dump(tid), dump(locking_tid))
neo.logging.info('Unresolvable conflict on %r:%r with %r',
dump(oid), dump(tid), dump(locking_tid))
raise ConflictError(locking_tid)
# store object
......@@ -275,15 +275,15 @@ class TransactionManager(object):
return oid in self._load_lock_dict
def log(self):
logging.info("Transactions:")
neo.logging.info("Transactions:")
for txn in self._transaction_dict.values():
logging.info(' %r', txn)
logging.info(' Read locks:')
neo.logging.info(' %r', txn)
neo.logging.info(' Read locks:')
for oid, tid in self._load_lock_dict.items():
logging.info(' %r by %r', dump(oid), dump(tid))
logging.info(' Write locks:')
neo.logging.info(' %r by %r', dump(oid), dump(tid))
neo.logging.info(' Write locks:')
for oid, tid in self._store_lock_dict.items():
logging.info(' %r by %r', dump(oid), dump(tid))
neo.logging.info(' %r by %r', dump(oid), dump(tid))
def updateObjectDataForPack(self, oid, orig_serial, new_serial,
getObjectData):
......
......@@ -20,7 +20,7 @@ import random
import unittest
import tempfile
import MySQLdb
from neo import logging
import neo
from mock import Mock
from neo import protocol
from neo.protocol import Packets
......@@ -394,7 +394,7 @@ connector_cpt = 0
class DoNothingConnector(Mock):
def __init__(self, s=None):
logging.info("initializing connector")
neo.logging.info("initializing connector")
self.desc = globals()['connector_cpt']
globals()['connector_cpt'] = globals()['connector_cpt']+ 1
self.packet_cpt = 0
......
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