-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use synthetic recovery source by default if synthetic source is enabled #119110
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
Changes from 83 commits
2e7c5b3
eb97654
116bab3
2bebd23
5c3507c
4677961
1f4bfed
f21e8d4
3313218
6de37a8
a7ba43a
f6613d3
7bcd751
0cfda36
95e43e4
86df003
8dd466b
b2bbbf7
1b6b524
a8345c4
b87504d
cbb8d7f
278ab19
6ee99fc
7118892
d36a6ba
8578832
6335465
2a50974
063531d
73c9d9d
fff1fe4
8a6418a
4934292
b5ddc28
570ee9c
10d8b7d
b05e061
71f7186
1b03ddb
aec53bb
300e942
08df011
7e74d4a
f705c83
65c9a0d
f3a892d
52df8c2
3b38eb4
b8ac5ae
e999fa9
4fb4a07
fb302cf
d3c31d9
61a563a
6754d36
ee5ae64
e2f1926
fd2b1f0
9242373
2cf0ced
62fb995
201dff2
1814a5b
9936a10
49f4715
137e253
957fd47
a9ef0f5
c140cfb
96502e3
fa9fd70
810ddbe
502c710
c56ec16
5c2a1b9
d865ff5
14997b7
ad7d742
7d0b3da
e99b549
e72b3a8
8fe2f3e
fc8d430
4afd0fa
e70a02b
09e523d
a7f0e9c
c9bbbcc
bce5b19
a532297
c44e096
6d221e3
98657ed
c46b21d
ee4e4f2
ecd0b6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -489,8 +489,13 @@ public void testRecoverySourceWithSyntheticSource() throws IOException { | |
| MapperService mapperService = createMapperService(settings, topMapping(b -> {})); | ||
| DocumentMapper docMapper = mapperService.documentMapper(); | ||
| ParsedDocument doc = docMapper.parse(source(b -> b.field("field1", "value1"))); | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat(doc.rootDoc().getField("_recovery_source").binaryValue(), equalTo(new BytesRef("{\"field1\":\"value1\"}"))); | ||
| if (IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE.isEnabled() == false) { | ||
| // TODO: remove this if branch when removing the 'index_recovery_use_synthetic_source' feature flag | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did something like this to make sure we check the result based on whether synthetic source recovery is enabled or not. Also, when removing the feature flag we can just remove the if branch. |
||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat(doc.rootDoc().getField("_recovery_source").binaryValue(), equalTo(new BytesRef("{\"field1\":\"value1\"}"))); | ||
| } else { | ||
| assertNull(doc.rootDoc().getField("_recovery_source")); | ||
| } | ||
| } | ||
| { | ||
| Settings settings = Settings.builder() | ||
|
|
@@ -521,8 +526,16 @@ public void testRecoverySourceWithLogs() throws IOException { | |
| MapperService mapperService = createMapperService(settings, mapping(b -> {})); | ||
| DocumentMapper docMapper = mapperService.documentMapper(); | ||
| ParsedDocument doc = docMapper.parse(source(b -> { b.field("@timestamp", "2012-02-13"); })); | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat(doc.rootDoc().getField("_recovery_source").binaryValue(), equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\"}"))); | ||
| if (IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE.isEnabled() == false) { | ||
| // TODO: remove this if branch when removing the 'index_recovery_use_synthetic_source' feature flag | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat( | ||
| doc.rootDoc().getField("_recovery_source").binaryValue(), | ||
| equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\"}")) | ||
| ); | ||
| } else { | ||
| assertNull(doc.rootDoc().getField("_recovery_source")); | ||
| } | ||
| } | ||
| { | ||
| Settings settings = Settings.builder() | ||
|
|
@@ -715,8 +728,16 @@ public void testRecoverySourceWithLogsCustom() throws IOException { | |
| MapperService mapperService = createMapperService(settings, mappings); | ||
| DocumentMapper docMapper = mapperService.documentMapper(); | ||
| ParsedDocument doc = docMapper.parse(source(b -> { b.field("@timestamp", "2012-02-13"); })); | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat(doc.rootDoc().getField("_recovery_source").binaryValue(), equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\"}"))); | ||
| if (IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE.isEnabled() == false) { | ||
| // TODO: remove this if branch when removing the 'index_recovery_use_synthetic_source' feature flag | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat( | ||
| doc.rootDoc().getField("_recovery_source").binaryValue(), | ||
| equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\"}")) | ||
| ); | ||
| } else { | ||
| assertNull(doc.rootDoc().getField("_recovery_source")); | ||
| } | ||
| } | ||
| { | ||
| Settings settings = Settings.builder() | ||
|
|
@@ -742,11 +763,16 @@ public void testRecoverySourceWithTimeSeries() throws IOException { | |
| })); | ||
| DocumentMapper docMapper = mapperService.documentMapper(); | ||
| ParsedDocument doc = docMapper.parse(source("123", b -> b.field("@timestamp", "2012-02-13").field("field", "value1"), null)); | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat( | ||
| doc.rootDoc().getField("_recovery_source").binaryValue(), | ||
| equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\",\"field\":\"value1\"}")) | ||
| ); | ||
| if (IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE.isEnabled() == false) { | ||
| // TODO: remove this if branch when removing the 'index_recovery_use_synthetic_source' feature flag | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat( | ||
| doc.rootDoc().getField("_recovery_source").binaryValue(), | ||
| equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\",\"field\":\"value1\"}")) | ||
| ); | ||
| } else { | ||
| assertNull(doc.rootDoc().getField("_recovery_source")); | ||
| } | ||
| } | ||
| { | ||
| Settings settings = Settings.builder() | ||
|
|
@@ -790,11 +816,16 @@ public void testRecoverySourceWithTimeSeriesCustom() throws IOException { | |
| MapperService mapperService = createMapperService(settings, mappings); | ||
| DocumentMapper docMapper = mapperService.documentMapper(); | ||
| ParsedDocument doc = docMapper.parse(source("123", b -> b.field("@timestamp", "2012-02-13").field("field", "value1"), null)); | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat( | ||
| doc.rootDoc().getField("_recovery_source").binaryValue(), | ||
| equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\",\"field\":\"value1\"}")) | ||
| ); | ||
| if (IndexSettings.RECOVERY_USE_SYNTHETIC_SOURCE.isEnabled() == false) { | ||
| // TODO: remove this if branch when removing the 'index_recovery_use_synthetic_source' feature flag | ||
| assertNotNull(doc.rootDoc().getField("_recovery_source")); | ||
| assertThat( | ||
| doc.rootDoc().getField("_recovery_source").binaryValue(), | ||
| equalTo(new BytesRef("{\"@timestamp\":\"2012-02-13\",\"field\":\"value1\"}")) | ||
| ); | ||
| } else { | ||
| assertNull(doc.rootDoc().getField("_recovery_source")); | ||
| } | ||
| } | ||
| { | ||
| Settings settings = Settings.builder() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,3 +42,13 @@ tasks.named("javaRestTest").configure { | |
| tasks.named('yamlRestTest') { | ||
| usesDefaultDistribution() | ||
| } | ||
|
|
||
| tasks.named("yamlRestTest") { | ||
| if (buildParams.isSnapshotBuild() == false) { | ||
| systemProperty 'tests.rest.blacklist', [ | ||
| "resources/rest-api-spec/test/60_synthetic_source_recovery.yml" | ||
|
||
| ].join(',') | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.