Skip to content

Commit

Permalink
Managed-ledger admin update zk with the stat-version (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdhabalia authored Sep 1, 2017
1 parent 6ca3373 commit dec05d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/pulsar-managed-ledger-admin
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ deleteLedgerIds : str
def deleteLedgerIdsFromManagedLedgerInfo(zk, mlPath, deletLedgerIds):
try:
# get managed-ledger info
mlData = zk.get(mlPath)[0]
(mlData, mlStat) = zk.get(mlPath)
mlInfo = MLDataFormats_pb2.ManagedLedgerInfo()
isTextFormat = False
try:
Expand All @@ -106,7 +106,7 @@ def deleteLedgerIdsFromManagedLedgerInfo(zk, mlPath, deletLedgerIds):
updatedMlInfo = MessageToString(mlInfo, True)
else:
updatedMlInfo = mlInfo.SerializeToString();
zk.set(mlPath, updatedMlInfo, -1)
zk.set(mlPath, updatedMlInfo, version=mlStat.version)
print 'Updated {} with value\n{}'.format(mlPath, str(mlInfo))

except Exception as e:
Expand Down Expand Up @@ -157,7 +157,7 @@ markDeletePosition: str
'''
def updateCursorMarkDelete(zk, cursorPath, markDeleteLedgerId, markDeleteEntryId):
try:
cursorData = zk.get(cursorPath)[0]
(cursorData, cursorStat) = zk.get(cursorPath)
cursorInfo = MLDataFormats_pb2.ManagedCursorInfo()
isTextFormat = False
try:
Expand All @@ -172,7 +172,7 @@ def updateCursorMarkDelete(zk, cursorPath, markDeleteLedgerId, markDeleteEntryId
sData = MessageToString(cursorInfo, True)
else:
sData = cursorInfo.SerializeToString()
zk.set(cursorPath, sData, -1)
zk.set(cursorPath, sData, version=cursorStat.version)
print 'Updated {} with value \n{}'.format(cursorPath, cursorInfo)
except Exception as e:
traceback.print_exc()
Expand Down

0 comments on commit dec05d8

Please sign in to comment.