-
Notifications
You must be signed in to change notification settings - Fork 25.5k
[test] Track index commits internally acquired by the commits listener in CombinedDeletionPolicy #112507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] Track index commits internally acquired by the commits listener in CombinedDeletionPolicy #112507
Conversation
…mbinedDeletionPolicy
b681d48
to
7d588c7
Compare
Pinging @elastic/es-distributed (Team:Distributed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me though it is slightly controversial.
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
…cquired-by-commits-listener
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep the acquiredIndexCommits
map as it's today but maybe add an extra Set<IndexCommit> listenerAcquiredCommits
or something like that that only gets populated with the commits acquired for the listener and we could simply remove them from that new set whenever the refCount reaches 0 in releaseCommit
. That feels more correct to me.
In fact that was your original approach @arteam :D |
@fcofdez Yes, it was! I'm happy to proceed with either approach. I'm going to wait for an additional opinion from @henningandersen or @ywangd . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I also like @fcofdez 's comment on leaving acquiredIndexCommits as it was (with both internally/externally acquired commits), thus reducing risk for bugs in that crucial part of the code, and having a separate Set for externally acquired commits that will just be used for our test assertions (meaning any bug in the new code will only affect tests). Not saying there's a bug, but just feels safer.
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a question.
Personally I'd prefer to keep the production code changes as minimal as possible. So a separate set for tracking works better for me. I'd also suggest we wrap relevant logic with Assertions.ENABLED
check when applicable.
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and I am ok with reverting to the previous direction based on majority vote 🙂 .
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/engine/CombinedDeletionPolicy.java
Outdated
Show resolved
Hide resolved
…letionPolicy.java Co-authored-by: Yang Wang <ywangd@gmail.com>
…letionPolicy.java Co-authored-by: Yang Wang <ywangd@gmail.com>
…letionPolicy.java Co-authored-by: Yang Wang <ywangd@gmail.com>
…cquired-by-commits-listener
@elasticmachine update branch |
After finishing an integration test, we run some checks against the test cluster, among others we assert there are no leaky acquired index commits left in
InternalTestCluster#beforeIndexDeletion
. The issue is that while we check the test cluster before we shut it down, we can't guarantee that there wouldn't be a new commit triggered by a background merge which will acquire an index commit. But we actually don't care about these commits acquired internally as part ofCombinedDeletionPolicy#commitsListener
callbacks. We just want to make sure that all index commits that have been acquired explicitly are also released. So, we make an explicit distinction between external and internal index commits that are tracked inCombinedDeletionPolicy
.ES-8407