Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add filter function for AbstractQueryBuilder, BoolQueryBuilder, ConstantScoreQueryBuilder([#17409](https://github.com/opensearch-project/OpenSearch/pull/17409))
- [Star Tree] [Search] Resolving keyword & numeric bucket aggregation with metric aggregation using star-tree ([#17165](https://github.com/opensearch-project/OpenSearch/pull/17165))
- Added error handling support for the pull-based ingestion ([#17427](https://github.com/opensearch-project/OpenSearch/pull/17427))
- Added Warm index setting and Updated nomenclature to differentiate between hot and warm tiering implementation ([#17490](https://github.com/opensearch-project/OpenSearch/pull/17490))


### Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected Settings nodeSettings(int nodeOrdinal) {
@Override
protected Settings featureFlagSettings() {
Settings.Builder featureSettings = Settings.builder();
featureSettings.put(FeatureFlags.TIERED_REMOTE_INDEX, true);
featureSettings.put(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG, true);
return featureSettings.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected boolean addMockIndexStorePlugin() {
@Override
protected Settings featureFlagSettings() {
Settings.Builder featureSettings = Settings.builder();
featureSettings.put(FeatureFlags.TIERED_REMOTE_INDEX, true);
featureSettings.put(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG, true);
return featureSettings.build();
}

Expand All @@ -77,15 +77,19 @@ protected Settings nodeSettings(int nodeOrdinal) {
}

public void testWritableWarmFeatureFlagDisabled() {
Settings clusterSettings = Settings.builder().put(super.nodeSettings(0)).put(FeatureFlags.TIERED_REMOTE_INDEX, false).build();
Settings clusterSettings = Settings.builder()
.put(super.nodeSettings(0))
.put(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG, false)
.build();

InternalTestCluster internalTestCluster = internalCluster();
internalTestCluster.startClusterManagerOnlyNode(clusterSettings);
internalTestCluster.startDataAndSearchNodes(1);

Settings indexSettings = Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put(IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey(), IndexModule.DataLocalityType.PARTIAL.name())
.put(IndexModule.IS_WARM_INDEX_SETTING.getKey(), false)
.build();

try {
Expand All @@ -94,7 +98,7 @@ public void testWritableWarmFeatureFlagDisabled() {
} catch (SettingsException ex) {
assertEquals(
"unknown setting ["
+ IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey()
+ IndexModule.IS_WARM_INDEX_SETTING.getKey()
+ "] please check that any required plugins are installed, or check the "
+ "breaking changes documentation for removed settings",
ex.getMessage()
Expand All @@ -109,7 +113,7 @@ public void testWritableWarmBasic() throws Exception {
Settings settings = Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put(IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey(), IndexModule.DataLocalityType.PARTIAL.name())
.put(IndexModule.IS_WARM_INDEX_SETTING.getKey(), true)
.build();
assertAcked(client().admin().indices().prepareCreate(INDEX_NAME).setSettings(settings).get());

Expand All @@ -119,7 +123,7 @@ public void testWritableWarmBasic() throws Exception {
.getIndex(new GetIndexRequest().indices(INDEX_NAME).includeDefaults(true))
.get();
Settings indexSettings = getIndexResponse.settings().get(INDEX_NAME);
assertEquals(IndexModule.DataLocalityType.PARTIAL.name(), indexSettings.get(IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey()));
assertTrue(indexSettings.getAsBoolean(IndexModule.IS_WARM_INDEX_SETTING.getKey(), false));

// Ingesting some docs
indexBulk(INDEX_NAME, NUM_DOCS_IN_BULK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public <Request extends ActionRequest, Response extends ActionResponse> void reg
actions.register(CreateSnapshotAction.INSTANCE, TransportCreateSnapshotAction.class);
actions.register(CloneSnapshotAction.INSTANCE, TransportCloneSnapshotAction.class);
actions.register(RestoreSnapshotAction.INSTANCE, TransportRestoreSnapshotAction.class);
if (FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX)) {
if (FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG)) {
actions.register(HotToWarmTieringAction.INSTANCE, TransportHotToWarmTieringAction.class);
}
actions.register(SnapshotsStatusAction.INSTANCE, TransportSnapshotsStatusAction.class);
Expand Down Expand Up @@ -996,7 +996,7 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
registerHandler.accept(new RestNodeAttrsAction());
registerHandler.accept(new RestRepositoriesAction());
registerHandler.accept(new RestSnapshotAction());
if (FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX)) {
if (FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG)) {
registerHandler.accept(new RestWarmTieringAction());
}
registerHandler.accept(new RestTemplatesAction());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,25 @@ public class TieringUtils {

/**
* Checks if the specified shard is a partial shard by
* checking the INDEX_STORE_LOCALITY_SETTING for its index.
* see {@link #isPartialIndex(IndexMetadata)}
* checking the WARM_INDEX_ENABLED_SETTING for its index.
* see {@link #isWarmIndex(IndexMetadata)} (IndexMetadata)}
* @param shard ShardRouting object representing the shard
* @param allocation RoutingAllocation object representing the allocation
* @return true if the shard is a partial shard, false otherwise
*/
public static boolean isPartialShard(ShardRouting shard, RoutingAllocation allocation) {
IndexMetadata indexMetadata = allocation.metadata().getIndexSafe(shard.index());
return isPartialIndex(indexMetadata);
return isWarmIndex(indexMetadata);
}

/**
* Checks if the specified index is a partial index by
* checking the INDEX_STORE_LOCALITY_SETTING for the index.
* Checks if the specified index is a warm index by
* checking the WARM_INDEX_ENABLED_SETTING for the index.
*
* @param indexMetadata the metadata of the index
* @return true if the index is a partial index, false otherwise
* @return true if the index is a warm index, false otherwise
*/
public static boolean isPartialIndex(final IndexMetadata indexMetadata) {
return IndexModule.DataLocalityType.PARTIAL.name()
.equals(indexMetadata.getSettings().get(IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey()));
public static boolean isWarmIndex(final IndexMetadata indexMetadata) {
return indexMetadata.getSettings().getAsBoolean(IndexModule.IS_WARM_INDEX_SETTING.getKey(), false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public GroupShardsIterator<ShardIterator> searchShards(
preference = Preference.PRIMARY.type();
}

if (FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX)
if (FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG)
&& IndexModule.DataLocalityType.PARTIAL.name()
.equals(indexMetadataForShard.getSettings().get(IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey()))
&& (preference == null || preference.isEmpty())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.opensearch.cluster.routing.allocation.RoutingAllocation;
import org.opensearch.common.util.FeatureFlags;

import static org.opensearch.action.admin.indices.tiering.TieringUtils.isPartialIndex;
import static org.opensearch.action.admin.indices.tiering.TieringUtils.isWarmIndex;

/**
* {@link RoutingPool} defines the different node types based on the assigned capabilities. The methods
Expand Down Expand Up @@ -62,6 +62,9 @@ public static RoutingPool getShardPool(ShardRouting shard, RoutingAllocation all
*/
public static RoutingPool getIndexPool(IndexMetadata indexMetadata) {
return indexMetadata.isRemoteSnapshot()
|| (FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX) && isPartialIndex(indexMetadata)) ? REMOTE_CAPABLE : LOCAL_ONLY;
|| (FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG) && isWarmIndex(indexMetadata))
? REMOTE_CAPABLE
: LOCAL_ONLY;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ private void checkAndAddInEligibleTargetNode(RoutingNode targetNode) {
*/
private boolean canShardBeSkipped(ShardRouting shardRouting) {
return (RoutingPool.REMOTE_CAPABLE.equals(RoutingPool.getShardPool(shardRouting, allocation))
&& !(FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX) && isPartialShard(shardRouting, allocation)));
&& !(FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG) && isPartialShard(shardRouting, allocation)));
}

/**
Expand Down Expand Up @@ -771,7 +771,7 @@ private Map<String, BalancedShardsAllocator.ModelNode> buildModelFromAssigned()
assert rn.nodeId().equals(shard.currentNodeId());
/* we skip relocating shards here since we expect an initializing shard with the same id coming in */
if ((RoutingPool.LOCAL_ONLY.equals(RoutingPool.getShardPool(shard, allocation))
|| (FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX) && isPartialShard(shard, allocation)))
|| (FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG) && isPartialShard(shard, allocation)))
&& shard.state() != RELOCATING) {
node.addShard(shard);
++totalShardCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.Queue;
import java.util.Set;

import static org.opensearch.action.admin.indices.tiering.TieringUtils.isPartialIndex;
import static org.opensearch.action.admin.indices.tiering.TieringUtils.isWarmIndex;

/**
* A {@link RemoteShardsBalancer} used by the {@link BalancedShardsAllocator} to perform allocation operations
Expand Down Expand Up @@ -348,7 +348,7 @@ private void unassignIgnoredRemoteShards(RoutingAllocation routingAllocation) {
// to re-fetch any shard blocks from the repository.
if (shard.primary()) {
if (RecoverySource.Type.SNAPSHOT.equals(shard.recoverySource().getType()) == false
&& isPartialIndex(allocation.metadata().getIndexSafe(shard.index())) == false) {
&& isWarmIndex(allocation.metadata().getIndexSafe(shard.index())) == false) {
unassignedShard = shard.updateUnassigned(shard.unassignedInfo(), RecoverySource.EmptyStoreRecoverySource.INSTANCE);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected FeatureFlagSettings(
FeatureFlags.EXTENSIONS_SETTING,
FeatureFlags.TELEMETRY_SETTING,
FeatureFlags.DATETIME_FORMATTER_CACHING_SETTING,
FeatureFlags.TIERED_REMOTE_INDEX_SETTING,
FeatureFlags.WRITABLE_WARM_INDEX_SETTING,
FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING,
FeatureFlags.STAR_TREE_INDEX_SETTING,
FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
* setting should be moved to {@link #BUILT_IN_INDEX_SETTINGS}.
*/
public static final Map<String, List<Setting>> FEATURE_FLAGGED_INDEX_SETTINGS = Map.of(
FeatureFlags.TIERED_REMOTE_INDEX,
List.of(IndexModule.INDEX_STORE_LOCALITY_SETTING, IndexModule.INDEX_TIERING_STATE),
FeatureFlags.WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG,
// TODO: Create a separate feature flag for hot tiering index state.
List.of(IndexModule.INDEX_STORE_LOCALITY_SETTING, IndexModule.INDEX_TIERING_STATE, IndexModule.IS_WARM_INDEX_SETTING),
FeatureFlags.READER_WRITER_SPLIT_EXPERIMENTAL,
List.of(IndexMetadata.INDEX_NUMBER_OF_SEARCH_REPLICAS_SETTING)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public class FeatureFlags {
public static final String DATETIME_FORMATTER_CACHING = "opensearch.experimental.optimization.datetime_formatter_caching.enabled";

/**
* Gates the functionality of remote index having the capability to move across different tiers
* Gates the functionality of warm index having the capability to store data remotely.
* Once the feature is ready for release, this feature flag can be removed.
*/
public static final String TIERED_REMOTE_INDEX = "opensearch.experimental.feature.tiered_remote_index.enabled";
public static final String WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG = "opensearch.experimental.feature.writable_warm_index.enabled";

/**
* Gates the functionality of background task execution.
Expand All @@ -79,7 +79,11 @@ public class FeatureFlags {
Property.NodeScope
);

public static final Setting<Boolean> TIERED_REMOTE_INDEX_SETTING = Setting.boolSetting(TIERED_REMOTE_INDEX, false, Property.NodeScope);
public static final Setting<Boolean> WRITABLE_WARM_INDEX_SETTING = Setting.boolSetting(
WRITABLE_WARM_INDEX_EXPERIMENTAL_FLAG,
false,
Property.NodeScope
);

public static final Setting<Boolean> READER_WRITER_SPLIT_EXPERIMENTAL_SETTING = Setting.boolSetting(
READER_WRITER_SPLIT_EXPERIMENTAL,
Expand Down Expand Up @@ -128,7 +132,7 @@ public class FeatureFlags {
EXTENSIONS_SETTING,
TELEMETRY_SETTING,
DATETIME_FORMATTER_CACHING_SETTING,
TIERED_REMOTE_INDEX_SETTING,
WRITABLE_WARM_INDEX_SETTING,
STAR_TREE_INDEX_SETTING,
APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING,
READER_WRITER_SPLIT_EXPERIMENTAL_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public final class IndexModule {
);

/**
* Index setting which used to determine how the data is cached locally fully or partially
* Index setting which used to determine how the data is cached locally fully or partially.
*/
public static final Setting<DataLocalityType> INDEX_STORE_LOCALITY_SETTING = new Setting<>(
"index.store.data_locality",
Expand All @@ -155,6 +155,8 @@ public final class IndexModule {
Property.NodeScope
);

public static final Setting<Boolean> IS_WARM_INDEX_SETTING = Setting.boolSetting("index.warm", false, Property.IndexScope);

public static final Setting<String> INDEX_RECOVERY_TYPE_SETTING = new Setting<>(
"index.recovery.type",
"",
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/org/opensearch/index/IndexService.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,9 @@ protected void closeInternal() {
}

Directory directory = null;
if (FeatureFlags.isEnabled(FeatureFlags.TIERED_REMOTE_INDEX_SETTING) &&
if (FeatureFlags.isEnabled(FeatureFlags.WRITABLE_WARM_INDEX_SETTING) &&
// TODO : Need to remove this check after support for hot indices is added in Composite Directory
this.indexSettings.isStoreLocalityPartial()) {
this.indexSettings.isWarmIndex()) {
Directory localDirectory = directoryFactory.newDirectory(this.indexSettings, path);
directory = new CompositeDirectory(localDirectory, remoteDirectory, fileCache);
} else {
Expand Down
16 changes: 8 additions & 8 deletions server/src/main/java/org/opensearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ public static IndexMergePolicy fromString(String text) {
private final int numberOfShards;
private final ReplicationType replicationType;
private volatile boolean isRemoteStoreEnabled;
private final boolean isStoreLocalityPartial;
// For warm index we would partially store files in local.
private final boolean isWarmIndex;
private volatile TimeValue remoteTranslogUploadBufferInterval;
private volatile String remoteStoreTranslogRepository;
private volatile String remoteStoreRepository;
Expand Down Expand Up @@ -994,10 +995,9 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
numberOfShards = settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_SHARDS, null);
replicationType = IndexMetadata.INDEX_REPLICATION_TYPE_SETTING.get(settings);
isRemoteStoreEnabled = settings.getAsBoolean(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, false);
isStoreLocalityPartial = settings.get(
IndexModule.INDEX_STORE_LOCALITY_SETTING.getKey(),
IndexModule.DataLocalityType.FULL.toString()
).equalsIgnoreCase(IndexModule.DataLocalityType.PARTIAL.toString());

Copy link
Copy Markdown
Contributor

@skumawat2025 skumawat2025 Apr 16, 2025

Choose a reason for hiding this comment

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

I am sorry if i missed anything earlier. but why are we removing this setting?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We are not removing , but renaming the setting .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok. So after this change. To create a warm index we need to provide setting
warm.index: true and no need to specify the data_locality setting is it?
In this case it should pick up the index.data_locality: PARTIAL value by default?

isWarmIndex = settings.getAsBoolean(IndexModule.IS_WARM_INDEX_SETTING.getKey(), false);

remoteStoreTranslogRepository = settings.get(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY);
remoteTranslogUploadBufferInterval = INDEX_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING.get(settings);
remoteStoreRepository = settings.get(IndexMetadata.SETTING_REMOTE_SEGMENT_STORE_REPOSITORY);
Expand Down Expand Up @@ -1372,10 +1372,10 @@ public String getRemoteStoreTranslogRepository() {
}

/**
* Returns true if the store locality is partial
* Returns true if the index is writable warm index and has partial store locality.
*/
public boolean isStoreLocalityPartial() {
return isStoreLocalityPartial;
public boolean isWarmIndex() {
return isWarmIndex;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public void flush(boolean force, boolean waitIfOngoing) throws EngineException {
ensureOpen();
// Skip flushing for indices with partial locality (warm indices)
// For these indices, we don't need to commit as we will sync from the remote store on re-open
if (engineConfig.getIndexSettings().isStoreLocalityPartial()) {
if (engineConfig.getIndexSettings().isWarmIndex()) {
return;
}
// readLock is held here to wait/block any concurrent close that acquires the writeLock.
Expand Down Expand Up @@ -447,7 +447,7 @@ protected final void closeNoLock(String reason, CountDownLatch closedLatch) {
latestSegmentInfos.changed();
}
try {
if (engineConfig.getIndexSettings().isStoreLocalityPartial() == false) {
if (engineConfig.getIndexSettings().isWarmIndex() == false) {
commitSegmentInfos(latestSegmentInfos);
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5142,7 +5142,7 @@ public void syncSegmentsFromRemoteSegmentStore(boolean overrideLocal, final Runn
} else {
storeDirectory = store.directory();
}
if (indexSettings.isStoreLocalityPartial() == false) {
if (indexSettings.isWarmIndex() == false) {
copySegmentFiles(storeDirectory, remoteDirectory, null, uploadedSegments, overrideLocal, onFileSync);
}

Expand All @@ -5160,7 +5160,7 @@ public void syncSegmentsFromRemoteSegmentStore(boolean overrideLocal, final Runn
}
}
assert Arrays.stream(store.directory().listAll()).filter(f -> f.startsWith(IndexFileNames.SEGMENTS)).findAny().isEmpty()
|| indexSettings.isStoreLocalityPartial() : "There should not be any segments file in the dir";
|| indexSettings.isWarmIndex() : "There should not be any segments file in the dir";
store.commitSegmentInfos(infosSnapshot, processedLocalCheckpoint, processedLocalCheckpoint);
}
syncSegmentSuccess = true;
Expand Down
Loading
Loading