diff --git a/bin/pulsar-managed-ledger-admin b/bin/pulsar-managed-ledger-admin index 22b4531e92601..9e93e51344c1c 100755 --- a/bin/pulsar-managed-ledger-admin +++ b/bin/pulsar-managed-ledger-admin @@ -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: @@ -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: @@ -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: @@ -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()