-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Remove dangling index auto import functionality #59698
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
Remove dangling index auto import functionality #59698
Conversation
Closes 48366.
Pinging @elastic/es-distributed (:Distributed/Recovery) |
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 left a few very minor comments.
truly represents the latest state of the data when the index was still part | ||
of the cluster. | ||
|
||
WARNING: You should avoid situations that result in dangling indices (e.g. |
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 don't think we need this warning any more; at least, you probably already know you're doing something wrong before you get to the question of importing dangling indices.
*/ | ||
void findNewAndAddDanglingIndices(final Metadata metadata) { | ||
final IndexGraveyard graveyard = metadata.indexGraveyard(); | ||
// Extracted from getDanglingIndices() as a package-private method to allow easier testing testing |
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 like the tests already mock out the ClusterService
, so I think we could pass in the metadata via that mock, have them call getDanglingIndices()
and thereby inline this. Or have DanglingIndicesState
track a Supplier<ClusterState>
rather than the full ClusterService
and pass that in for the tests. Not sure which I prefer really, up to you.
private DanglingIndicesState createDanglingIndicesState(NodeEnvironment env, MetaStateService metaStateService) { | ||
final Settings allocateSettings = Settings.builder().put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true).build(); | ||
private DanglingIndicesState createDanglingIndicesState(MetaStateService metaStateService) { | ||
final Settings allocateSettings = Settings.builder().build(); | ||
|
||
final ClusterService clusterServiceMock = mock(ClusterService.class); | ||
when(clusterServiceMock.getSettings()).thenReturn(allocateSettings); |
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.
Don't think we need to mock this any more.
when(clusterServiceMock.getSettings()).thenReturn(allocateSettings); |
} catch (IOException e) { | ||
logger.warn("failed to list dangling indices", e); | ||
logger.warn("Failed to list dangling indices", e); |
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 prefer the original:
logger.warn("Failed to list dangling indices", e); | |
logger.warn("failed to list dangling indices", e); |
*/ | ||
public class DanglingIndicesState implements ClusterStateListener { | ||
public class DanglingIndicesState { |
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.
Hurrah!
Thanks for the review @DaveCTurner, I've addressed your comments. |
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.
Checkstyle seems unhappy but LGTM once CI is green.
…ndex-auto-import-v2
@elasticmachine run elasticsearch-ci/1 |
Adds an 8.0 breaking change for PR #59698.
Closes #48366. Remove all traces of automatically importing dangling indices. This change will not be backported, though this functionality is deprecated as of 7.9.0.