Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managed-ledger admin update zk with the stat-version #741

Merged
merged 1 commit into from
Sep 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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