Skip to content

Commit

Permalink
[controller] Fixed a bug that logger is trying to access a removed ma…
Browse files Browse the repository at this point in the history
…p entry (#1298)

The top store admin operation entry is already removed before the logger trying
to access the top entry. This PR fixes this bug by storing the offset of
top entry before hand.
  • Loading branch information
huangminchn authored Nov 12, 2024
1 parent 5752ad4 commit 78de20c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ private void executeMessagesAndCollectResults() throws InterruptedException {
boolean skipOffsetCommandHasBeenProcessed = false;
for (Map.Entry<String, Queue<AdminOperationWrapper>> entry: storeAdminOperationsMapWithOffset.entrySet()) {
if (!entry.getValue().isEmpty()) {
if (checkOffsetToSkip(entry.getValue().peek().getOffset(), false)) {
long adminMessageOffset = entry.getValue().peek().getOffset();
if (checkOffsetToSkip(adminMessageOffset, false)) {
entry.getValue().remove();
skipOffsetCommandHasBeenProcessed = true;
}
Expand All @@ -526,7 +527,7 @@ private void executeMessagesAndCollectResults() throws InterruptedException {
LOGGER.info(
"Adding admin message from store {} with offset {} to the task list",
entry.getKey(),
entry.getValue().peek().getOffset());
adminMessageOffset);
this.tasks.add(newTask);
stores.add(entry.getKey());
}
Expand Down

0 comments on commit 78de20c

Please sign in to comment.