[Transaction] Fix transaction flaky test testMaxReadPositionForNormalPublish
## Motivation
fix flaky test
`publishContext.completed(null, position.getLedgerId(), position.getEntryId())` before `transactionBuffer.syncMaxReadPositionForNormalPublish((PositionImpl) ledger.getLastConfirmedEntry())`
so return messageId for client, dont represent broker syncMaxReadPositionForNormalPublish complete
@@ -501,10 +501,10 @@ public class PersistentTopic extends AbstractTopic
lastDataMessagePublishedTimestamp = Clock.systemUTC().millis();
}
- publishContext.setMetadataFromEntryData(entryData);
- publishContext.completed(null, position.getLedgerId(), position.getEntryId());
// in order to sync the max position when cursor read entries
transactionBuffer.syncMaxReadPositionForNormalPublish((PositionImpl) ledger.getLastConfirmedEntry());
+ publishContext.setMetadataFromEntryData(entryData);
+ publishContext.completed(null, position.getLedgerId(), position.getEntryId());
decrementPendingWriteOpsAndCheck();
}
