Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Brooks committed Apr 30, 2023
1 parent 2cb9e09 commit 88bb509
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,7 @@ private void refreshUnpromotables(
engineOrNull.addFlushListener(location, ActionListener.wrap(new ActionListener<>() {
@Override
public void onResponse(Long generation) {
engineOrNull.addFlushDurabilityListener(generation, ActionListener.wrap(new ActionListener<>() {
@Override
public void onResponse(Void unused) {
sendUnpromotableRequests(indexShard, generation, forced, listener, postWriteRefreshTimeout);
}

@Override
public void onFailure(Exception e) {
listener.onFailure(e);
}
}));
sendUnpromotableRequests(indexShard, generation, forced, listener, postWriteRefreshTimeout);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1985,15 +1985,6 @@ public void addFlushListener(Translog.Location location, ActionListener<Long> li
listener.onFailure(new UnsupportedOperationException("Engine type " + this.getClass() + " does not support flush listeners."));
}

/**
* Adds a listener which will be executed once the request generation has been durably persisted.
*/
public void addFlushDurabilityListener(long generation, ActionListener<Void> listener) {
listener.onFailure(
new UnsupportedOperationException("Engine type " + this.getClass() + " does not support generation durability listeners.")
);
}

/**
* Captures the result of a refresh operation on the index shard.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3159,15 +3159,16 @@ public void onFailure(Exception e) {
}

protected void waitForCommitDurability(long generation, ActionListener<Void> listener) {
listener.onResponse(null);
}

@Override
public void addFlushDurabilityListener(long generation, ActionListener<Void> listener) {
ensureOpen();
try {
ensureOpen();
} catch (AlreadyClosedException e) {
listener.onFailure(e);
return;
}
if (lastCommittedSegmentInfos.getGeneration() < generation) {
listener.onFailure(new IllegalStateException("Cannot wait on generation which has not been committed"));
} else {
listener.onResponse(null);
}
listener.onResponse(null);
}
}

0 comments on commit 88bb509

Please sign in to comment.