Skip to content

Commit a00558e

Browse files
authored
Merge branch 'main' into fix-async-stop-result
2 parents 4199dc8 + 743e5d4 commit a00558e

File tree

14 files changed

+253
-40
lines changed

14 files changed

+253
-40
lines changed

docs/changelog/121805.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121805
2+
summary: Support subset of metrics in aggregate metric double
3+
area: "ES|QL"
4+
type: enhancement
5+
issues: []

docs/changelog/122047.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122047
2+
summary: Fork post-snapshot-delete cleanup off master thread
3+
area: Snapshot/Restore
4+
type: bug
5+
issues: []

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTreeTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ public void testForwardSlashes() {
102102
// Forward slashes also work
103103
assertThat(tree.canRead(path("a/b")), is(true));
104104
assertThat(tree.canRead(path("m/n")), is(true));
105-
106-
// In case the native separator is a backslash, don't treat that as an escape
107-
assertThat(tree.canRead(path("m\n")), is(false));
108105
}
109106

110107
FilesEntitlement entitlement(String... values) {

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SourceModeRollingUpgradeIT.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ private void assertDeprecationWarningForTemplate(String templateName) throws IOE
8585
assertThat(response.containsKey("templates"), equalTo(true));
8686
Map<?, ?> issuesByTemplate = (Map<?, ?>) response.get("templates");
8787
assertThat(issuesByTemplate.containsKey(templateName), equalTo(true));
88-
var templateIssues = (List<?>) issuesByTemplate.get(templateName);
89-
assertThat(((Map<?, ?>) templateIssues.getFirst()).get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
88+
var templateIssue = (Map<?, ?>) ((List<?>) issuesByTemplate.get(templateName)).getFirst();
89+
// Bwc compatible logic until backports are complete.
90+
if (templateIssue.containsKey("details")) {
91+
assertThat(templateIssue.get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING_TITLE));
92+
assertThat(templateIssue.get("details"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
93+
} else {
94+
assertThat(templateIssue.get("message"), equalTo(SourceFieldMapper.DEPRECATION_WARNING));
95+
}
9096
}
9197
}

server/src/internalClusterTest/java/org/elasticsearch/snapshots/RepositoriesIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,12 @@ public void taskSucceeded(ClusterStateTaskListener clusterStateTaskListener, Obj
508508
.orElseThrow()
509509
.queue();
510510

511+
// There is one task in the queue for computing and forking the cleanup work.
512+
assertThat(queueLength.getAsInt(), equalTo(1));
513+
514+
safeAwait(barrier); // unblock the barrier thread and let it process the queue
515+
safeAwait(barrier); // wait for the queue to be processed
516+
511517
// There are indexCount (=3*snapshotPoolSize) index-deletion tasks, plus one for cleaning up the root metadata. However, the
512518
// throttled runner only enqueues one task per SNAPSHOT thread to start with, and then the eager runner adds another one. This shows
513519
// we are not spamming the threadpool with all the tasks at once, which means that other snapshot activities can run alongside this

server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public class SourceFieldMapper extends MetadataFieldMapper {
5858

5959
public static final String LOSSY_PARAMETERS_ALLOWED_SETTING_NAME = "index.lossy.source-mapping-parameters";
6060

61+
public static final String DEPRECATION_WARNING_TITLE = "Configuring source mode in mappings is deprecated.";
62+
6163
public static final String DEPRECATION_WARNING = "Configuring source mode in mappings is deprecated and will be removed "
6264
+ "in future versions. Use [index.mapping.source.mode] index setting instead.";
6365

server/src/main/java/org/elasticsearch/repositories/RepositoryData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.elasticsearch.snapshots.SnapshotInfo;
3030
import org.elasticsearch.snapshots.SnapshotState;
3131
import org.elasticsearch.snapshots.SnapshotsService;
32+
import org.elasticsearch.threadpool.ThreadPool;
3233
import org.elasticsearch.xcontent.XContentBuilder;
3334
import org.elasticsearch.xcontent.XContentParser;
3435

@@ -377,6 +378,7 @@ private static boolean isIndexToUpdateAfterRemovingSnapshots(
377378
* @return map of index to index metadata blob id to delete
378379
*/
379380
public Map<IndexId, Collection<String>> indexMetaDataToRemoveAfterRemovingSnapshots(Collection<SnapshotId> snapshotIds) {
381+
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.SNAPSHOT);
380382
Iterator<IndexId> indicesForSnapshot = indicesToUpdateAfterRemovingSnapshot(snapshotIds);
381383
final Set<String> allRemainingIdentifiers = indexMetaDataGenerations.lookup.entrySet()
382384
.stream()

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,14 +1134,20 @@ private void runWithUniqueShardMetadataNaming(ActionListener<RepositoryData> rep
11341134
);
11351135
})
11361136

1137-
.<RepositoryData>andThen((l, newRepositoryData) -> {
1138-
l.onResponse(newRepositoryData);
1139-
// Once we have updated the repository, run the unreferenced blobs cleanup in parallel to shard-level snapshot deletion
1140-
try (var refs = new RefCountingRunnable(onCompletion)) {
1141-
cleanupUnlinkedRootAndIndicesBlobs(newRepositoryData, refs.acquireListener());
1142-
cleanupUnlinkedShardLevelBlobs(refs.acquireListener());
1137+
.<RepositoryData>andThen(
1138+
// writeIndexGen finishes on master-service thread so must fork here.
1139+
snapshotExecutor,
1140+
threadPool.getThreadContext(),
1141+
(l, newRepositoryData) -> {
1142+
l.onResponse(newRepositoryData);
1143+
// Once we have updated the repository, run the unreferenced blobs cleanup in parallel to shard-level snapshot
1144+
// deletion
1145+
try (var refs = new RefCountingRunnable(onCompletion)) {
1146+
cleanupUnlinkedRootAndIndicesBlobs(newRepositoryData, refs.acquireListener());
1147+
cleanupUnlinkedShardLevelBlobs(refs.acquireListener());
1148+
}
11431149
}
1144-
})
1150+
)
11451151

11461152
.addListener(repositoryDataUpdateListener);
11471153
}

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/TemplateDeprecationChecker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ private DeprecationIssue checkSourceModeInComponentTemplates(ComponentTemplate t
122122
if (sourceMap.containsKey("mode")) {
123123
return new DeprecationIssue(
124124
DeprecationIssue.Level.CRITICAL,
125+
SourceFieldMapper.DEPRECATION_WARNING_TITLE,
126+
"https://ela.st/migrate-source-mode",
125127
SourceFieldMapper.DEPRECATION_WARNING,
126-
"https://github.com/elastic/elasticsearch/pull/117172",
127-
null,
128128
false,
129129
null
130130
);

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/TemplateDeprecationCheckerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public void testCheckSourceModeInComponentTemplates() throws IOException {
5151
Map<String, List<DeprecationIssue>> issuesByComponentTemplate = checker.check(clusterState);
5252
final DeprecationIssue expected = new DeprecationIssue(
5353
DeprecationIssue.Level.CRITICAL,
54+
SourceFieldMapper.DEPRECATION_WARNING_TITLE,
55+
"https://ela.st/migrate-source-mode",
5456
SourceFieldMapper.DEPRECATION_WARNING,
55-
"https://github.com/elastic/elasticsearch/pull/117172",
56-
null,
5757
false,
5858
null
5959
);

0 commit comments

Comments
 (0)