Skip to content

Commit b53a30e

Browse files
committed
address comments and add ut's
Signed-off-by: Sandeep Kumawat <[email protected]>
1 parent fc368da commit b53a30e

23 files changed

+354
-202
lines changed

plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3BlobStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public Map<Metric, Map<String, Long>> extendedStats() {
245245
}
246246

247247
@Override
248-
public boolean isBlobMetadataSupported() {
248+
public boolean isBlobMetadataEnabled() {
249249
return true;
250250
}
251251

server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ public void addRemoteStoreCustomMetadata(IndexMetadata.Builder tmpImdBuilder, bo
590590
Map<String, String> remoteCustomData = new HashMap<>();
591591

592592
// Determine if the ckp would be stored as translog metadata
593-
boolean isCkpAsTranslogMetadata = remoteStoreCustomMetadataResolver.isCkpAsTranslogMetadata();
594-
remoteCustomData.put(RemoteStoreEnums.CKP_AS_METADATA, Boolean.toString(isCkpAsTranslogMetadata));
593+
boolean isTranslogMetadataEnabled = remoteStoreCustomMetadataResolver.isTranslogMetadataEnabled();
594+
remoteCustomData.put(RemoteStoreEnums.TRANSLOG_METADATA, Boolean.toString(isTranslogMetadataEnabled));
595595

596596
// Determine the path type for use using the remoteStorePathResolver.
597597
RemoteStorePathStrategy newPathStrategy = remoteStoreCustomMetadataResolver.getPathStrategy();

server/src/main/java/org/opensearch/common/blobstore/BlobStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ default Map<Metric, Map<String, Long>> extendedStats() {
7272
default void reload(RepositoryMetadata repositoryMetadata) {}
7373

7474
/**
75-
* Returns a boolean indicating if blobStore support object metadata upload
75+
* Returns a boolean indicating if blobStore has object metadata support enabled
7676
*/
77-
default boolean isBlobMetadataSupported() {
77+
default boolean isBlobMetadataEnabled() {
7878
return false;
7979
}
8080

server/src/main/java/org/opensearch/common/settings/ClusterSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public void apply(Settings value, Settings current, Settings previous) {
740740
RemoteStoreSettings.CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING,
741741
RemoteStoreSettings.CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING,
742742
RemoteStoreSettings.CLUSTER_REMOTE_MAX_TRANSLOG_READERS,
743-
RemoteStoreSettings.CLUSTER_REMOTE_STORE_TRANSLOG_CKP_AS_METADATA
743+
RemoteStoreSettings.CLUSTER_REMOTE_STORE_TRANSLOG_TRANSLOG_METADATA
744744
)
745745
)
746746
);

server/src/main/java/org/opensearch/index/IndexSettings.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ public static IndexMergePolicy fromString(String text) {
763763
private final boolean widenIndexSortType;
764764
private final boolean assignedOnRemoteNode;
765765
private final RemoteStorePathStrategy remoteStorePathStrategy;
766-
private final boolean ckpAsTranslogMetadata;
766+
private final boolean isTranslogMetadataEnabled;
767767

768768
/**
769769
* The maximum age of a retention lease before it is considered expired.
@@ -990,7 +990,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
990990
assignedOnRemoteNode = RemoteStoreNodeAttribute.isRemoteDataAttributePresent(this.getNodeSettings());
991991
remoteStorePathStrategy = RemoteStoreUtils.determineRemoteStorePathStrategy(indexMetadata);
992992

993-
ckpAsTranslogMetadata = RemoteStoreUtils.determineCkpAsTranslogMetadata(indexMetadata);
993+
isTranslogMetadataEnabled = RemoteStoreUtils.determineisTranslogMetadataEnabled(indexMetadata);
994994

995995
setEnableFuzzySetForDocId(scopedSettings.get(INDEX_DOC_ID_FUZZY_SET_ENABLED_SETTING));
996996
setDocIdFuzzySetFalsePositiveProbability(scopedSettings.get(INDEX_DOC_ID_FUZZY_SET_FALSE_POSITIVE_PROBABILITY_SETTING));
@@ -1915,7 +1915,7 @@ public RemoteStorePathStrategy getRemoteStorePathStrategy() {
19151915
return remoteStorePathStrategy;
19161916
}
19171917

1918-
public boolean isCkpAsTranslogMetadata() {
1919-
return ckpAsTranslogMetadata;
1918+
public boolean isTranslogMetadataEnabled() {
1919+
return isTranslogMetadataEnabled;
19201920
}
19211921
}

server/src/main/java/org/opensearch/index/remote/RemoteMigrationIndexMetadataUpdater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public static boolean indexHasRemoteCustomMetadata(IndexMetadata indexMetadata)
171171
Map<String, String> customMetadata = indexMetadata.getCustomData(REMOTE_STORE_CUSTOM_KEY);
172172
return Objects.nonNull(customMetadata)
173173
&& Objects.nonNull(customMetadata.get(PathType.NAME))
174-
&& Objects.nonNull(customMetadata.get(RemoteStoreEnums.CKP_AS_METADATA));
174+
&& Objects.nonNull(customMetadata.get(RemoteStoreEnums.TRANSLOG_METADATA));
175175
}
176176

177177
public static void updateRemoteStoreSettings(Settings.Builder settingsBuilder, String segmentRepository, String translogRepository) {

server/src/main/java/org/opensearch/index/remote/RemoteStoreCustomMetadataResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public RemoteStorePathStrategy getPathStrategy() {
4242
return new RemoteStorePathStrategy(pathType, pathHashAlgorithm);
4343
}
4444

45-
public boolean isCkpAsTranslogMetadata() {
46-
return Version.CURRENT.compareTo(minNodeVersionSupplier.get()) <= 0 && remoteStoreSettings.isCkpAsTranslogMetadata();
45+
public boolean isTranslogMetadataEnabled() {
46+
return Version.V_2_15_0.compareTo(minNodeVersionSupplier.get()) <= 0 && remoteStoreSettings.isTranslogMetadataEnabled();
4747
}
4848

4949
}

server/src/main/java/org/opensearch/index/remote/RemoteStoreEnums.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@ExperimentalApi
3737
public class RemoteStoreEnums {
3838

39-
public static final String CKP_AS_METADATA = "ckp-as-metadata";
39+
public static final String TRANSLOG_METADATA = "translog-metadata";
4040

4141
/**
4242
* Categories of the data in Remote store.

server/src/main/java/org/opensearch/index/remote/RemoteStoreUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
import static org.opensearch.indices.RemoteStoreSettings.CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING;
3434
import static org.opensearch.indices.RemoteStoreSettings.CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING;
35-
import static org.opensearch.indices.RemoteStoreSettings.CLUSTER_REMOTE_STORE_TRANSLOG_CKP_AS_METADATA;
35+
import static org.opensearch.indices.RemoteStoreSettings.CLUSTER_REMOTE_STORE_TRANSLOG_TRANSLOG_METADATA;
3636

3737
/**
3838
* Utils for remote store
@@ -185,11 +185,11 @@ public static RemoteStorePathStrategy determineRemoteStorePathStrategy(IndexMeta
185185
/**
186186
* Determines whether translog ckp upload as metadata allowed or not
187187
*/
188-
public static boolean determineCkpAsTranslogMetadata(IndexMetadata indexMetadata) {
188+
public static boolean determineisTranslogMetadataEnabled(IndexMetadata indexMetadata) {
189189
Map<String, String> remoteCustomData = indexMetadata.getCustomData(IndexMetadata.REMOTE_STORE_CUSTOM_KEY);
190-
assert remoteCustomData == null || remoteCustomData.containsKey(RemoteStoreEnums.CKP_AS_METADATA);
191-
if (remoteCustomData != null && remoteCustomData.containsKey(RemoteStoreEnums.CKP_AS_METADATA)) {
192-
return Boolean.parseBoolean(remoteCustomData.get(RemoteStoreEnums.CKP_AS_METADATA));
190+
assert remoteCustomData == null || remoteCustomData.containsKey(RemoteStoreEnums.TRANSLOG_METADATA);
191+
if (remoteCustomData != null && remoteCustomData.containsKey(RemoteStoreEnums.TRANSLOG_METADATA)) {
192+
return Boolean.parseBoolean(remoteCustomData.get(RemoteStoreEnums.TRANSLOG_METADATA));
193193
}
194194
return false;
195195
}
@@ -209,8 +209,8 @@ public static Map<String, String> determineRemoteStoreCustomMetadataDuringMigrat
209209
Version minNodeVersion = discoveryNodes.getMinNodeVersion();
210210

211211
boolean ckpAsMetadata = Version.CURRENT.compareTo(minNodeVersion) <= 0
212-
&& CLUSTER_REMOTE_STORE_TRANSLOG_CKP_AS_METADATA.get(clusterSettings);
213-
remoteCustomData.put(RemoteStoreEnums.CKP_AS_METADATA, Boolean.toString(ckpAsMetadata));
212+
&& CLUSTER_REMOTE_STORE_TRANSLOG_TRANSLOG_METADATA.get(clusterSettings);
213+
remoteCustomData.put(RemoteStoreEnums.TRANSLOG_METADATA, Boolean.toString(ckpAsMetadata));
214214

215215
RemoteStoreEnums.PathType pathType = Version.CURRENT.compareTo(minNodeVersion) <= 0
216216
? CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.get(clusterSettings)

server/src/main/java/org/opensearch/index/shard/IndexShard.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4982,7 +4982,7 @@ public void deleteTranslogFilesFromRemoteTranslog() throws IOException {
49824982
getThreadPool(),
49834983
indexSettings.getRemoteStorePathStrategy(),
49844984
remoteStoreSettings,
4985-
indexSettings().isCkpAsTranslogMetadata()
4985+
indexSettings().isTranslogMetadataEnabled()
49864986
);
49874987
}
49884988

@@ -5009,7 +5009,7 @@ public void syncTranslogFilesFromRemoteTranslog() throws IOException {
50095009
remoteStoreSettings,
50105010
logger,
50115011
shouldSeedRemoteStore(),
5012-
indexSettings().isCkpAsTranslogMetadata()
5012+
indexSettings().isTranslogMetadataEnabled()
50135013
);
50145014
}
50155015

0 commit comments

Comments
 (0)