Skip to content
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
2e7c5b3
feature: use synthetic recovery source by default for tsdb and logsdb
salvatore-campagna Dec 19, 2024
eb97654
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
116bab3
fix: default synthetic recovery source value
salvatore-campagna Jan 8, 2025
2bebd23
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
5c3507c
fix: handle null pointer exception
salvatore-campagna Jan 8, 2025
4677961
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
1f4bfed
fix: depend on mode setting
salvatore-campagna Jan 8, 2025
f21e8d4
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
3313218
fix: restore original code
salvatore-campagna Jan 8, 2025
6de37a8
nit: remove import MODE
salvatore-campagna Jan 8, 2025
a7ba43a
fix: remove unnecessary setting existence check
salvatore-campagna Jan 8, 2025
f6613d3
fix: move source mode setting to IndexSettings
salvatore-campagna Jan 8, 2025
7bcd751
fix: preserve histogram array in synthetic source
salvatore-campagna Jan 8, 2025
0cfda36
fix: missing _recovery_source field when using synthetic source
salvatore-campagna Jan 8, 2025
95e43e4
Revert "fix: preserve histogram array in synthetic source"
salvatore-campagna Jan 8, 2025
86df003
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 8, 2025
8dd466b
fix: disable testing for empty list
salvatore-campagna Jan 8, 2025
b2bbbf7
fix: exclude _recovery_source_size
salvatore-campagna Jan 9, 2025
1b6b524
fix: exclude _recovery_source_size
salvatore-campagna Jan 9, 2025
a8345c4
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 9, 2025
b87504d
fix: disable rest compatibility test after dropping _recovery_source …
salvatore-campagna Jan 9, 2025
cbb8d7f
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 9, 2025
278ab19
fix: no need to disable empty list test
salvatore-campagna Jan 9, 2025
6ee99fc
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 9, 2025
7118892
test: synthetic source recovery and source mode
salvatore-campagna Jan 9, 2025
d36a6ba
fix: false for bwc
salvatore-campagna Jan 10, 2025
8578832
fix: typo test vs text
salvatore-campagna Jan 10, 2025
6335465
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
2a50974
fix: setting is final
salvatore-campagna Jan 10, 2025
063531d
fix: synthetic recovery index version
salvatore-campagna Jan 10, 2025
73c9d9d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
fff1fe4
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
8a6418a
fix: recover source field unvailable with synthetic source
salvatore-campagna Jan 10, 2025
4934292
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
b5ddc28
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
570ee9c
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
10d8b7d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
b05e061
fix: synthetic recovery only for stateful
salvatore-campagna Jan 10, 2025
71f7186
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
1b03ddb
fix: no recovery source for stateless
salvatore-campagna Jan 10, 2025
aec53bb
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
300e942
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 10, 2025
08df011
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
7e74d4a
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
f705c83
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
65c9a0d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 13, 2025
f3a892d
fix: remove stateless check
salvatore-campagna Jan 13, 2025
52df8c2
Revert "fix: remove stateless check"
salvatore-campagna Jan 14, 2025
3b38eb4
fix: remove serverless handling
salvatore-campagna Jan 14, 2025
b8ac5ae
fix: synthetic recovery source false in serverless
salvatore-campagna Jan 14, 2025
e999fa9
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
4fb4a07
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
fb302cf
Mute org.elasticsearch.repositories.s3.S3RepositoryThirdPartyTests or…
elasticsearchmachine Jan 14, 2025
d3c31d9
Mute org.elasticsearch.repositories.s3.RepositoryS3MinioBasicCredenti…
elasticsearchmachine Jan 14, 2025
61a563a
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
6754d36
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 14, 2025
ee5ae64
fix: introduce a feature flag to gate usage of synthetic recovery
salvatore-campagna Jan 30, 2025
e2f1926
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
fd2b1f0
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
9242373
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
2cf0ced
Revert "fix: recover source field unvailable with synthetic source"
salvatore-campagna Jan 30, 2025
62fb995
fix: check test result based on synthetic source recovery feature flag
salvatore-campagna Jan 30, 2025
201dff2
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
1814a5b
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 30, 2025
9936a10
fix: lucene version
salvatore-campagna Jan 30, 2025
49f4715
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
137e253
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
957fd47
fix: disable synthetic recovery yaml tests
salvatore-campagna Jan 31, 2025
a9ef0f5
fix: disable synthetic recovery yaml tests
salvatore-campagna Jan 31, 2025
c140cfb
fix: rename task
salvatore-campagna Jan 31, 2025
96502e3
fix: gate yaml test execution
salvatore-campagna Jan 31, 2025
fa9fd70
fix: use a better feature name and description
salvatore-campagna Jan 31, 2025
810ddbe
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
502c710
fix: push missing file
salvatore-campagna Jan 31, 2025
c56ec16
not: add a comment
salvatore-campagna Jan 31, 2025
5c2a1b9
fix: refactor feature selection logic
salvatore-campagna Jan 31, 2025
d865ff5
nit: avoid creating another static set
salvatore-campagna Jan 31, 2025
14997b7
fix: exclude tests from release build
salvatore-campagna Jan 31, 2025
ad7d742
fix: exlude from rest compatibility tests
salvatore-campagna Jan 31, 2025
7d0b3da
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
e99b549
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
e72b3a8
fix: try to disable tests
salvatore-campagna Jan 31, 2025
8fe2f3e
fix: use correct class
salvatore-campagna Jan 31, 2025
fc8d430
fix: restore previous feature name
salvatore-campagna Jan 31, 2025
4afd0fa
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Jan 31, 2025
e70a02b
fix: test patch
salvatore-campagna Jan 31, 2025
09e523d
fix: add TODO to muted-tests
salvatore-campagna Jan 31, 2025
a7f0e9c
fix: add TODO to muted-tests
salvatore-campagna Jan 31, 2025
c9bbbcc
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
bce5b19
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
a532297
fix: yaml instead of p0
salvatore-campagna Feb 3, 2025
c44e096
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
6d221e3
fix: missing backport version
salvatore-campagna Feb 3, 2025
98657ed
fix: try to exclude tests
salvatore-campagna Feb 3, 2025
c46b21d
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 3, 2025
ee4e4f2
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 4, 2025
ecd0b6c
Merge branch 'main' into feature/synthtic-source-recovery-default
salvatore-campagna Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ tests:
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
method: test {p0=data_stream/120_data_streams_stats/Multiple data stream}
issue: https://github.com/elastic/elasticsearch/issues/118217
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
method: test {p0=update/100_synthetic_source/keyword}
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
method: test {p0=update/100_synthetic_source/stored text}
- class: org.elasticsearch.action.search.SearchQueryThenFetchAsyncActionTests
method: testBottomFieldSort
issue: https://github.com/elastic/elasticsearch/issues/118214
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ setup:
---
keyword:
- requires:
cluster_features: ["gte_v8.4.0"]
reason: introduced in 8.4.0
cluster_features: [ "index.recovery.synthetic_source_default" ]
reason: requires synthetic recovery source by default

- do:
indices.create:
Expand Down Expand Up @@ -60,13 +60,14 @@ keyword:
index: test
run_expensive_tasks: true
- is_false: test.fields._source
- is_true: test.fields._recovery_source
# When synthetic source is used there is no _recovery_source field
- match: { test.fields._recovery_source: null }

---
stored text:
- requires:
cluster_features: ["gte_v8.5.0"]
reason: introduced in 8.5.0
cluster_features: [ "index.recovery.synthetic_source_default" ]
reason: requires synthetic recovery source by default

- do:
indices.create:
Expand Down Expand Up @@ -121,4 +122,5 @@ stored text:
index: test
run_expensive_tasks: true
- is_false: test.fields._source
- is_true: test.fields._recovery_source
# When synthetic source is used there is no _recovery_source field
- match: { test.fields._recovery_source: null }
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,15 @@ public static Setting<Boolean> boolSetting(String key, boolean defaultValue, Val
return new Setting<>(key, Boolean.toString(defaultValue), booleanParser(key, properties), validator, properties);
}

public static Setting<Boolean> boolSetting(
String key,
Function<Settings, String> defaultValueFn,
Validator<Boolean> validator,
Property... properties
) {
return new Setting<>(key, defaultValueFn, booleanParser(key, properties), validator, properties);
}

public static Setting<Boolean> boolSetting(String key, Function<Settings, String> defaultValueFn, Property... properties) {
return new Setting<>(key, defaultValueFn, booleanParser(key, properties), properties);
}
Expand Down
23 changes: 21 additions & 2 deletions server/src/main/java/org/elasticsearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.elasticsearch.common.time.DateUtils;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.util.FeatureFlag;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.mapper.IgnoredSourceFieldMapper;
import org.elasticsearch.index.mapper.Mapper;
Expand All @@ -39,6 +40,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;

Expand Down Expand Up @@ -722,9 +724,25 @@ public Iterator<Setting<?>> settings() {
Setting.Property.ServerlessPublic
);

public static final FeatureFlag RECOVERY_USE_SYNTHETIC_SOURCE = new FeatureFlag("index_recovery_use_synthetic_source");
public static final Setting<Boolean> RECOVERY_USE_SYNTHETIC_SOURCE_SETTING = Setting.boolSetting(
"index.recovery.use_synthetic_source",
false,
settings -> {
boolean isSyntheticSourceRecoveryFeatureFlagEnabled = RECOVERY_USE_SYNTHETIC_SOURCE.isEnabled();
boolean isNewIndexVersion = SETTING_INDEX_VERSION_CREATED.get(settings)
.onOrAfter(IndexVersions.USE_SYNTHETIC_SOURCE_FOR_RECOVERY_BY_DEFAULT);
boolean isIndexVersionInBackportRange = SETTING_INDEX_VERSION_CREATED.get(settings)
.between(IndexVersions.USE_SYNTHETIC_SOURCE_FOR_RECOVERY_BY_DEFAULT_BACKPORT, IndexVersions.UPGRADE_TO_LUCENE_10_0_0);

boolean useSyntheticRecoverySource = isSyntheticSourceRecoveryFeatureFlagEnabled
&& (isNewIndexVersion || isIndexVersionInBackportRange);

return String.valueOf(
useSyntheticRecoverySource
&& Objects.equals(INDEX_MAPPER_SOURCE_MODE_SETTING.get(settings), SourceFieldMapper.Mode.SYNTHETIC)
);

},
new Setting.Validator<>() {
@Override
public void validate(Boolean value) {}
Expand Down Expand Up @@ -1083,7 +1101,8 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
skipIgnoredSourceRead = scopedSettings.get(IgnoredSourceFieldMapper.SKIP_IGNORED_SOURCE_READ_SETTING);
indexMappingSourceMode = scopedSettings.get(INDEX_MAPPER_SOURCE_MODE_SETTING);
recoverySourceEnabled = RecoverySettings.INDICES_RECOVERY_SOURCE_ENABLED_SETTING.get(nodeSettings);
recoverySourceSyntheticEnabled = scopedSettings.get(RECOVERY_USE_SYNTHETIC_SOURCE_SETTING);
recoverySourceSyntheticEnabled = DiscoveryNode.isStateless(nodeSettings) == false
&& scopedSettings.get(RECOVERY_USE_SYNTHETIC_SOURCE_SETTING);
if (recoverySourceSyntheticEnabled) {
if (DiscoveryNode.isStateless(settings)) {
throw new IllegalArgumentException("synthetic recovery source is only allowed in stateful");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private static Version parseUnchecked(String version) {
public static final IndexVersion UPGRADE_TO_LUCENE_9_12_1 = def(8_523_00_0, parseUnchecked("9.12.1"));
public static final IndexVersion INFERENCE_METADATA_FIELDS_BACKPORT = def(8_524_00_0, parseUnchecked("9.12.1"));
public static final IndexVersion LOGSB_OPTIONAL_SORTING_ON_HOST_NAME_BACKPORT = def(8_525_00_0, parseUnchecked("9.12.1"));
public static final IndexVersion USE_SYNTHETIC_SOURCE_FOR_RECOVERY_BY_DEFAULT_BACKPORT = def(8_526_00_0, parseUnchecked("9.12.1"));
public static final IndexVersion UPGRADE_TO_LUCENE_10_0_0 = def(9_000_00_0, Version.LUCENE_10_0_0);
public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def(9_001_00_0, Version.LUCENE_10_0_0);
public static final IndexVersion TIME_BASED_K_ORDERED_DOC_ID = def(9_002_00_0, Version.LUCENE_10_0_0);
Expand All @@ -145,6 +146,7 @@ private static Version parseUnchecked(String version) {
public static final IndexVersion SOURCE_MAPPER_MODE_ATTRIBUTE_NOOP = def(9_007_00_0, Version.LUCENE_10_0_0);
public static final IndexVersion HOSTNAME_DOC_VALUES_SPARSE_INDEX = def(9_008_00_0, Version.LUCENE_10_0_0);
public static final IndexVersion UPGRADE_TO_LUCENE_10_1_0 = def(9_009_00_0, Version.LUCENE_10_1_0);
public static final IndexVersion USE_SYNTHETIC_SOURCE_FOR_RECOVERY_BY_DEFAULT = def(9_010_00_0, Version.LUCENE_10_1_0);
/*
* STOP! READ THIS FIRST! No, really,
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2427,8 +2427,14 @@ protected void validateRoundTripReader(String syntheticSource, DirectoryReader r
// and since the copy is exact, contents of ignored source are different.
assertReaderEquals(
"round trip " + syntheticSource,
new FieldMaskingReader(Set.of(SourceFieldMapper.RECOVERY_SOURCE_NAME, IgnoredSourceFieldMapper.NAME), reader),
new FieldMaskingReader(Set.of(SourceFieldMapper.RECOVERY_SOURCE_NAME, IgnoredSourceFieldMapper.NAME), roundTripReader)
new FieldMaskingReader(
Set.of(SourceFieldMapper.RECOVERY_SOURCE_NAME, IgnoredSourceFieldMapper.NAME, SourceFieldMapper.RECOVERY_SOURCE_SIZE_NAME),
reader
),
new FieldMaskingReader(
Set.of(SourceFieldMapper.RECOVERY_SOURCE_NAME, IgnoredSourceFieldMapper.NAME, SourceFieldMapper.RECOVERY_SOURCE_SIZE_NAME),
roundTripReader
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

@salvatore-campagna salvatore-campagna Jan 30, 2025

Choose a reason for hiding this comment

The 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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,11 @@ protected void validateRoundTripReader(String syntheticSource, DirectoryReader r
throws IOException {
assertReaderEquals(
"round trip " + syntheticSource,
new FieldMaskingReader(SourceFieldMapper.RECOVERY_SOURCE_NAME, reader),
new FieldMaskingReader(SourceFieldMapper.RECOVERY_SOURCE_NAME, roundTripReader)
new FieldMaskingReader(Set.of(SourceFieldMapper.RECOVERY_SOURCE_NAME, SourceFieldMapper.RECOVERY_SOURCE_SIZE_NAME), reader),
new FieldMaskingReader(
Set.of(SourceFieldMapper.RECOVERY_SOURCE_NAME, SourceFieldMapper.RECOVERY_SOURCE_SIZE_NAME),
roundTripReader
)
);
}

Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugin/logsdb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at other usages, I think this should just be: '60_synthetic_source_recovery/*'?

].join(',')
}
}


Loading