Skip to content

Commit

Permalink
fix deserializeBrokerEntryMetaDataFirst not found (apache#11220)
Browse files Browse the repository at this point in the history
### Motivation

apache#11014 introduced `getEntryTimestamp` and removed `deserializeBrokerEntryMetaDataFirst`, but apache#11139 is still using `deserializeBrokerEntryMetaDataFirst`, and it breaks master branch.

### Modifications

use `entryTimestamp` for expiry checking in `internalGetMessageIdByTimestamp`

### Verifying this change

- [x] Make sure that the change passes the CI checks.
  • Loading branch information
freeznet authored and ciaocloud committed Oct 16, 2021
1 parent 52f2f13 commit e147b34
Showing 1 changed file with 2 additions and 6 deletions.
Expand Up @@ -2355,17 +2355,13 @@ protected CompletableFuture<MessageId> internalGetMessageIdByTimestamp(long time

ManagedLedger ledger = ((PersistentTopic) topic).getManagedLedger();
return ledger.asyncFindPosition(entry -> {
MessageImpl<byte[]> msg = null;
try {
msg = MessageImpl.deserializeBrokerEntryMetaDataFirst(entry.getDataBuffer());
return msg.publishedEarlierThan(timestamp);
long entryTimestamp = MessageImpl.getEntryTimestamp(entry.getDataBuffer());
return MessageImpl.isEntryPublishedEarlierThan(entryTimestamp, timestamp);
} catch (Exception e) {
log.error("[{}] Error deserializing message for message position find", topicName, e);
} finally {
entry.release();
if (msg != null) {
msg.recycle();
}
}
return false;
}).thenApply(position -> {
Expand Down

0 comments on commit e147b34

Please sign in to comment.