-
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
Logsdb and source only snapshots. #122199
Logsdb and source only snapshots. #122199
Conversation
Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. * Avoid initializing _source.mode, because otherwise an empty _source:{} gets serialized in the restored mapping. Also added a few more tests that snapshot and restore logsdb data streams.
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Hi @martijnvg, I've created a changelog YAML for you. |
9bd067a
to
385e821
Compare
…on based on default instances being returned.
@@ -176,7 +176,8 @@ public Builder( | |||
true, | |||
() -> null, | |||
(n, c, o) -> Mode.valueOf(o.toString().toUpperCase(Locale.ROOT)), | |||
m -> toType(m).enabled.explicit() ? null : toType(m).mode, | |||
// Avoid initializing _source.mode if it doesn't need to be serialized: | |||
m -> toType(m).enabled.explicit() ? null : toType(m).serializeMode ? toType(m).mode : null, |
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.
Nit: let's add parentheses to denote the sequence of the conditional branches.
assertDocCount(client(), dataStreamName, 100); | ||
} | ||
|
||
static void snapshotAndFail(String sourceMode, String arrayType, boolean sourceOnly) throws IOException { |
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.
Params need to be "synthetic" and false, for this to fail?
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.
Yes, the issues are with sourceOnly snapshots.
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.
Let's then hard-code these and remove them from method args.
|
||
restoreSnapshot(repositoryName, snapshotName, true); | ||
assertDataStream(dataStreamName, sourceMode); | ||
assertDocCount(client(), dataStreamName, 100); |
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.
Shall we also compare the source for the two old and the new index?
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.
Nice, a few minor comments and questions.
…e for assertions for LogsdbSnapshotRestoreIT now.
String dataStreamName = "logs-my-test"; | ||
String repositoryName = "my-repository"; | ||
if (sourceOnly) { | ||
if (true) { | ||
var repositorySettings = Settings.builder().put("delegate_type", "fs").put("location", getRepoPath()).build(); | ||
registerRepository(repositoryName, "source", true, repositorySettings); | ||
} else { |
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.
Nit: remove, redundant.
.setting("xpack.license.self_generated.type", "trial") | ||
// TODO: remove when initializing / serializing default SourceFieldMapper instance have been fixed: | ||
// (SFM's mode attribute often gets initialized, even when mode attribute isn't set) | ||
.jvmArg("-da:org.elasticsearch.index.mapper.DocumentMapper") |
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 is an issue that we need to address. We always serialize an empty _source, because the mode
attribute's initializer initializes the mode even if we don't need to include/serialize the mode
attribute. Changing that is tricky and we need to take bwc into account, because DocumentMapper
's assertion will trip on older nodes.
The reason why we need to disable DocumentMapper
's and MapperService
's assertions, is because the mapping update that happens when source only snapshots (in SourceOnlySnapshotRepository#metadataToSnapshot(...)
). Which is metadata only mapping update that triggers the mentioned assertions to trip. This isn't an issue in production, but should fixed.
I will work on a follow up pr that avoids serializing an empty source if _source
defaults are active. That fixes the assertion from tripping (like the initial commit did in this PR). But given the trickiness is better to do in a followup pr.
Backporting elastic#122199 to 8.x branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams.
Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams.
Backporting #122199 to 9.0 branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams.
* [8.x] Logsdb and source only snapshots. Backporting #122199 to 8.x branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams. * fix test
* [8.x] Logsdb and source only snapshots. Backporting elastic#122199 to 8.x branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams. * fix test
* [8.x] Logsdb and source only snapshots. Backporting elastic#122199 to 8.x branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams. * fix test
* [8.x] Logsdb and source only snapshots. Backporting #122199 to 8.x branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams. * fix test
* [8.x] Logsdb and source only snapshots. Backporting #122199 to 8.x branch. Addresses a few issues with logsdb and source only snapshots: * Avoid initializing index sorting, because sort fields will not have doc values. * Also disable doc value skippers when doc values get disabled. * As part of source only validation figure out what the nested parent field is. Also added a few more tests that snapshot and restore logsdb data streams. * fix test
Addresses a few issues with logsdb and source only snapshots: