Skip to content

Commit f8f8cbf

Browse files
csouliostalevy
andauthored
[7.x] [RollupV2] Move rollup metadata to field mappings (#70647)
Backports #69921 to 7.x This PR moves field related rollup metadata from the index metadata to the field mapping metadata. date_histogram fields is moved to the timestamp field (fields are fixed_interval or calendar_interval, time_zone) histogram fields are moved to the numeric field on which the the histogram is computed (the field is named interval) Also, the index uuid has been added to the index rollup settings as index.rollup.source.uuid and index.rollup.source.name The rest of the RollupMetadata has been removed. Finally, no rollup metadata exists in the global cluster state Co-authored-by: Tal Levy <[email protected]>
1 parent 6c973c1 commit f8f8cbf

File tree

11 files changed

+298
-585
lines changed

11 files changed

+298
-585
lines changed

server/src/main/java/org/elasticsearch/cluster/ClusterModule.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.elasticsearch.cluster.metadata.MetadataMappingService;
2424
import org.elasticsearch.cluster.metadata.MetadataUpdateSettingsService;
2525
import org.elasticsearch.cluster.metadata.RepositoriesMetadata;
26-
import org.elasticsearch.cluster.metadata.RollupMetadata;
2726
import org.elasticsearch.cluster.routing.DelayedAllocationService;
2827
import org.elasticsearch.cluster.routing.allocation.AllocationService;
2928
import org.elasticsearch.cluster.routing.allocation.ExistingShardsAllocator;
@@ -66,7 +65,6 @@
6665
import org.elasticsearch.persistent.PersistentTasksCustomMetadata;
6766
import org.elasticsearch.persistent.PersistentTasksNodeService;
6867
import org.elasticsearch.plugins.ClusterPlugin;
69-
import org.elasticsearch.rollup.RollupV2;
7068
import org.elasticsearch.script.ScriptMetadata;
7169
import org.elasticsearch.snapshots.SnapshotsInfoService;
7270
import org.elasticsearch.tasks.Task;
@@ -138,9 +136,6 @@ public static List<Entry> getNamedWriteables() {
138136
ComposableIndexTemplateMetadata::readDiffFrom);
139137
registerMetadataCustom(entries, DataStreamMetadata.TYPE, DataStreamMetadata::new, DataStreamMetadata::readDiffFrom);
140138

141-
if (RollupV2.isEnabled()) {
142-
registerMetadataCustom(entries, RollupMetadata.TYPE, RollupMetadata::new, RollupMetadata::readDiffFrom);
143-
}
144139
// Task Status (not Diffable)
145140
entries.add(new Entry(Task.Status.class, PersistentTasksNodeService.Status.NAME, PersistentTasksNodeService.Status::new));
146141
return entries;
@@ -194,10 +189,6 @@ public static List<NamedXContentRegistry.Entry> getNamedXWriteables() {
194189
ComposableIndexTemplateMetadata::fromXContent));
195190
entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(DataStreamMetadata.TYPE),
196191
DataStreamMetadata::fromXContent));
197-
if (RollupV2.isEnabled()) {
198-
entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(RollupMetadata.TYPE),
199-
RollupMetadata::fromXContent));
200-
}
201192
return entries;
202193
}
203194

server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static Setting<Integer> buildNumberOfShardsSetting() {
146146
public static final Setting<Integer> INDEX_ROUTING_PARTITION_SIZE_SETTING =
147147
Setting.intSetting(SETTING_ROUTING_PARTITION_SIZE, 1, 1, Property.IndexScope);
148148

149+
@SuppressWarnings("Convert2Diamond") // since some IntelliJs mysteriously report an error if an <Integer> is replaced with <> here:
149150
public static final Setting<Integer> INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING = Setting.intSetting(
150151
"index.number_of_routing_shards",
151152
INDEX_NUMBER_OF_SHARDS_SETTING,
@@ -591,6 +592,13 @@ public Index getResizeSourceIndex() {
591592
INDEX_RESIZE_SOURCE_UUID.get(settings)) : null;
592593
}
593594

595+
public static final String INDEX_ROLLUP_SOURCE_UUID_KEY = "index.rollup.source.uuid";
596+
public static final String INDEX_ROLLUP_SOURCE_NAME_KEY = "index.rollup.source.name";
597+
public static final Setting<String> INDEX_ROLLUP_SOURCE_UUID = Setting.simpleString(INDEX_ROLLUP_SOURCE_UUID_KEY,
598+
Property.IndexScope, Property.PrivateIndex);
599+
public static final Setting<String> INDEX_ROLLUP_SOURCE_NAME = Setting.simpleString(INDEX_ROLLUP_SOURCE_NAME_KEY,
600+
Property.IndexScope, Property.PrivateIndex);
601+
594602
/**
595603
* Sometimes, the default mapping exists and an actual mapping is not created yet (introduced),
596604
* in this case, we want to return the default mapping in case it has some default mapping definitions.

server/src/main/java/org/elasticsearch/cluster/metadata/RollupGroup.java

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)