Commit fe83d9ca authored by Iliya Manolov's avatar Iliya Manolov Committed by Iliya Manolov

Made neoctl ... print ids more understandable with the unpackTID function (it...

Made neoctl ... print ids more understandable with the unpackTID function (it now prints date and time, as well as the hex values for backup_tid and last_tid)
parent c39d5c67
Pipeline #3055 skipped
...@@ -81,6 +81,16 @@ def unpackTID(ptid): ...@@ -81,6 +81,16 @@ def unpackTID(ptid):
higher.reverse() higher.reverse()
return (tuple(higher), lower) return (tuple(higher), lower)
def timeStringFromTID(ptid):
"""
Returns a string in the format "yyyy-mm-dd hh:mm:ss" from a TID
"""
higher, lower = unpackTID(ptid)
seconds = lower * SECOND_PER_TID_LOW
return '%04d-%02d-%02d %02d:%02d:%09.6f' % (higher[0], higher[1], higher[2],
higher[3], higher[4], seconds)
def addTID(ptid, offset): def addTID(ptid, offset):
""" """
Offset given packed TID. Offset given packed TID.
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
from operator import itemgetter from operator import itemgetter
from .neoctl import NeoCTL, NotReadyException from .neoctl import NeoCTL, NotReadyException
from neo.lib.util import p64, u64, tidFromTime from neo.lib.util import p64, u64, tidFromTime, timeStringFromTID
from neo.lib.protocol import uuid_str, ClusterStates, NodeTypes, \ from neo.lib.protocol import uuid_str, ClusterStates, NodeTypes, \
UUID_NAMESPACES, ZERO_TID UUID_NAMESPACES, ZERO_TID
...@@ -89,11 +89,13 @@ class TerminalNeoCTL(object): ...@@ -89,11 +89,13 @@ class TerminalNeoCTL(object):
ptid, backup_tid, truncate_tid = self.neoctl.getRecovery() ptid, backup_tid, truncate_tid = self.neoctl.getRecovery()
if backup_tid: if backup_tid:
ltid = self.neoctl.getLastTransaction() ltid = self.neoctl.getLastTransaction()
r = "backup_tid = 0x%x" % u64(backup_tid) r = "backup_tid = 0x%x (%s)" % (u64(backup_tid),
timeStringFromTID(backup_tid))
else: else:
loid, ltid = self.neoctl.getLastIds() loid, ltid = self.neoctl.getLastIds()
r = "last_oid = 0x%x" % u64(loid) r = "last_oid = 0x%x" % (u64(loid))
return r + "\nlast_tid = 0x%x\nlast_ptid = %u" % (u64(ltid), ptid) return r + "\nlast_tid = 0x%x (%s)\nlast_ptid = %u" % \
(u64(ltid), timeStringFromTID(ltid), ptid)
def getPartitionRowList(self, params): def getPartitionRowList(self, params):
""" """
...@@ -311,4 +313,3 @@ class Application(object): ...@@ -311,4 +313,3 @@ class Application(object):
" e.g. '257684787499560686', '0x3937af2eeeeeeee' or '1325421296.'" " e.g. '257684787499560686', '0x3937af2eeeeeeee' or '1325421296.'"
" for 2012-01-01 12:34:56 UTC") " for 2012-01-01 12:34:56 UTC")
return '\n'.join(output_list) return '\n'.join(output_list)
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