-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Compact index when closing #42445
Comments
Pinging @elastic/es-distributed |
Pinging @elastic/es-core-features |
I definitely don't think we should do this by default. Imagine having a cluster that's experiencing heavy load, so badly that you need to close some indices to bring it back from the edge. If we were to force-merge when an index was closed, that introduces more load into the cluster (not to mention a potential wait time depending on the number of segments we force merge to) when it is in a precarious state. |
We discussed this today as a team and agreed with @dakrone about not force-merging while closing an index because this would make closing an index far too heavyweight an operation. The discussion also touched again on the idea of being able to force-merge a read-only index (#41624):
However, we concluded that trimming the translog on close is a reasonable thing to do:
We noted that it may not be trivial to trim the translog at close, because there may be something still holding onto the generations that we want to trim (e.g. an ongoing peer recovery). |
ILM does this automatically currently. @DaveCTurner I think after the discussions this can drop the ILM tag, is that right? Since we would automatically trim the translog on close? |
Yes, I think so. ILM's force-merge action sets |
just for clarification, we don't use the translog anymore for primary replica sync, right? do you mean something else? |
Today we read operations from the translog on the primary during peer recovery. For a while we had moved to reading them from Lucene but we reverted that in #38904. |
Today when an index is closed all its shards are forced flushed but the translog files are left around. As explained in #42445 we'd like to trim the translog for closed indices in order to consume less disk space. This commit reuses the existing AsyncTrimTranslogTask task and reenables it for closed indices. At the time the task is executed, we should have the guarantee that nothing holds the translog files that are going to be removed. It also leaves a short period of time (10 min) during which translog files of a recently closed index are still present on disk. This could also help in some cases where the closed index is reopened shortly after being closed (in order to update an index setting for example). Relates to #42445
Today when an index is closed all its shards are forced flushed but the translog files are left around. As explained in #42445 we'd like to trim the translog for closed indices in order to consume less disk space. This commit reuses the existing AsyncTrimTranslogTask task and reenables it for closed indices. At the time the task is executed, we should have the guarantee that nothing holds the translog files that are going to be removed. It also leaves a short period of time (10 min) during which translog files of a recently closed index are still present on disk. This could also help in some cases where the closed index is reopened shortly after being closed (in order to update an index setting for example). Relates to #42445
@tlrx can this be closed now? |
A spin-off from #33888.
Should we trim/clean translog and force-merge when closing an index? These actions can be done via the verifying-before-close step. Another option is to integrate these actions with ILM.
Should we also enforce a single commit when closing? This property does not always hold for follower indices and primaries with ongoing peer recoveries.
Relates #33888
The text was updated successfully, but these errors were encountered: