Skip to content

Commit cdd3a31

Browse files
committed
Resolved the comments.
Signed-off-by: Sriram Ganesh <srignsh22@gmail.com>
1 parent 5eef962 commit cdd3a31

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public Iterator<Setting<?>> settings() {
505505
}
506506
},
507507
Property.IndexScope,
508-
Property.InternalIndex,
508+
Property.PrivateIndex,
509509
Property.Dynamic
510510
);
511511

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ public static class ShardDataPathInput extends PathInput {
230230
private final String shardId;
231231
private final DataCategory dataCategory;
232232
private final DataType dataType;
233-
private final String writerNodeId;
233+
private final String indexFixedPrefix;
234234

235235
public ShardDataPathInput(Builder builder) {
236236
super(builder);
237237
this.shardId = Objects.requireNonNull(builder.shardId);
238238
this.dataCategory = Objects.requireNonNull(builder.dataCategory);
239239
this.dataType = Objects.requireNonNull(builder.dataType);
240-
this.writerNodeId = builder.writerNodeId; // Can be null
240+
this.indexFixedPrefix = builder.indexFixedPrefix; // Can be null
241241
assert dataCategory.isSupportedDataType(dataType) : "category:"
242242
+ dataCategory
243243
+ " type:"
@@ -261,9 +261,9 @@ DataType dataType() {
261261
@Override
262262
BlobPath fixedSubPath() {
263263
BlobPath path = super.fixedSubPath().add(shardId);
264-
// Only add writer node ID if it's explicitly set and not empty
265-
if (writerNodeId != null && !writerNodeId.trim().isEmpty()) {
266-
path = path.add(writerNodeId);
264+
// Only add index fixed prefix if it's explicitly set and not empty
265+
if (indexFixedPrefix != null && !indexFixedPrefix.trim().isEmpty()) {
266+
path = path.add(indexFixedPrefix);
267267
}
268268
return path.add(dataCategory.getName()).add(dataType.getName());
269269
}
@@ -286,7 +286,7 @@ public static class Builder extends PathInput.Builder<Builder> {
286286
private String shardId;
287287
private DataCategory dataCategory;
288288
private DataType dataType;
289-
private String writerNodeId;
289+
private String indexFixedPrefix;
290290

291291
public Builder shardId(String shardId) {
292292
this.shardId = shardId;
@@ -303,8 +303,8 @@ public Builder dataType(DataType dataType) {
303303
return this;
304304
}
305305

306-
public Builder writerNodeId(String writerNodeId) {
307-
this.writerNodeId = writerNodeId;
306+
public Builder indexFixedPrefix(String indexFixedPrefix) {
307+
this.indexFixedPrefix = indexFixedPrefix;
308308
return this;
309309
}
310310

server/src/main/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Directory newDirectory(
7171
String indexUUID,
7272
ShardId shardId,
7373
RemoteStorePathStrategy pathStrategy,
74-
String writerNodeId
74+
String indexFixedPrefix
7575
) throws IOException {
7676
assert Objects.nonNull(pathStrategy);
7777
try (Repository repository = repositoriesService.get().repository(repositoryName)) {
@@ -88,7 +88,7 @@ public Directory newDirectory(
8888
.dataCategory(SEGMENTS)
8989
.dataType(DATA)
9090
.fixedPrefix(segmentsPathFixedPrefix)
91-
.writerNodeId(writerNodeId)
91+
.indexFixedPrefix(indexFixedPrefix)
9292
.build();
9393
// Derive the path for data directory of SEGMENTS
9494
BlobPath dataPath = pathStrategy.generatePath(dataPathInput);
@@ -106,7 +106,7 @@ public Directory newDirectory(
106106
.dataCategory(SEGMENTS)
107107
.dataType(METADATA)
108108
.fixedPrefix(segmentsPathFixedPrefix)
109-
.writerNodeId(writerNodeId)
109+
.indexFixedPrefix(indexFixedPrefix)
110110
.build();
111111
// Derive the path for metadata directory of SEGMENTS
112112
BlobPath mdPath = pathStrategy.generatePath(mdPathInput);
@@ -120,7 +120,7 @@ public Directory newDirectory(
120120
shardIdStr,
121121
pathStrategy,
122122
segmentsPathFixedPrefix,
123-
writerNodeId
123+
indexFixedPrefix
124124
);
125125

126126
return new RemoteSegmentStoreDirectory(dataDirectory, metadataDirectory, mdLockManager, threadPool, shardId);

server/src/main/java/org/opensearch/index/store/lockmanager/RemoteStoreLockManagerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static RemoteStoreMetadataLockManager newLockManager(
6565
String shardId,
6666
RemoteStorePathStrategy pathStrategy,
6767
String segmentsPathFixedPrefix,
68-
String writerNodeId
68+
String indexFixedPrefix
6969
) {
7070
try (Repository repository = repositoriesService.repository(repositoryName)) {
7171
assert repository instanceof BlobStoreRepository : "repository should be instance of BlobStoreRepository";
@@ -78,7 +78,7 @@ public static RemoteStoreMetadataLockManager newLockManager(
7878
.dataCategory(SEGMENTS)
7979
.dataType(LOCK_FILES)
8080
.fixedPrefix(segmentsPathFixedPrefix)
81-
.writerNodeId(writerNodeId)
81+
.indexFixedPrefix(indexFixedPrefix)
8282
.build();
8383
BlobPath lockDirectoryPath = pathStrategy.generatePath(lockFilesPathInput);
8484
BlobContainer lockDirectoryBlobContainer = ((BlobStoreRepository) repository).blobStore().blobContainer(lockDirectoryPath);

server/src/test/java/org/opensearch/index/remote/RemoteStorePathStrategyTests.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void testSnapshotShardPathInputHashPath() {
128128
assertEquals(BlobPath.cleanPath().add(SHARD_ID).add(INDEX_UUID), input.hashPath());
129129
}
130130

131-
public void testShardDataPathInputWithWriterNodeId() {
131+
public void testShardDataPathInputWithIndexFixedPrefix() {
132132
RemoteStorePathStrategy pathStrategy = new RemoteStorePathStrategy(PathType.FIXED);
133133

134134
RemoteStorePathStrategy.ShardDataPathInput pathInput = RemoteStorePathStrategy.ShardDataPathInput.builder()
@@ -137,17 +137,17 @@ public void testShardDataPathInputWithWriterNodeId() {
137137
.shardId("0")
138138
.dataCategory(DataCategory.SEGMENTS)
139139
.dataType(DataType.DATA)
140-
.writerNodeId("writer-node-1")
140+
.indexFixedPrefix("writer-node-1")
141141
.build();
142142

143143
BlobPath result = pathStrategy.generatePath(pathInput);
144144
String pathString = result.buildAsString();
145145

146-
assertTrue("Path should contain writer node ID", pathString.contains("writer-node-1"));
146+
assertTrue("Path should contain index fixed prefix", pathString.contains("writer-node-1"));
147147
assertTrue("Path should follow expected structure", pathString.contains("test-repo/test-index-uuid/0/writer-node-1/segments/data"));
148148
}
149149

150-
public void testShardDataPathInputWithoutWriterNodeId() {
150+
public void testShardDataPathInputWithoutIndexFixedPrefix() {
151151
RemoteStorePathStrategy pathStrategy = new RemoteStorePathStrategy(PathType.FIXED);
152152

153153
RemoteStorePathStrategy.ShardDataPathInput pathInput = RemoteStorePathStrategy.ShardDataPathInput.builder()
@@ -161,11 +161,11 @@ public void testShardDataPathInputWithoutWriterNodeId() {
161161
BlobPath result = pathStrategy.generatePath(pathInput);
162162
String pathString = result.buildAsString();
163163

164-
assertFalse("Path should not contain writer node ID", pathString.contains("writer-node-1"));
164+
assertFalse("Path should not contain index fixed prefix", pathString.contains("writer-node-1"));
165165
assertTrue("Path should follow expected structure", pathString.contains("test-repo/test-index-uuid/0/segments/data"));
166166
}
167167

168-
public void testShardDataPathInputWithEmptyWriterNodeId() {
168+
public void testShardDataPathInputWithEmptyIndexFixedPrefix() {
169169
RemoteStorePathStrategy pathStrategy = new RemoteStorePathStrategy(PathType.FIXED);
170170

171171
RemoteStorePathStrategy.ShardDataPathInput pathInput = RemoteStorePathStrategy.ShardDataPathInput.builder()
@@ -174,19 +174,19 @@ public void testShardDataPathInputWithEmptyWriterNodeId() {
174174
.shardId("0")
175175
.dataCategory(DataCategory.SEGMENTS)
176176
.dataType(DataType.DATA)
177-
.writerNodeId("")
177+
.indexFixedPrefix("")
178178
.build();
179179

180180
BlobPath result = pathStrategy.generatePath(pathInput);
181181
String pathString = result.buildAsString();
182182

183-
assertFalse("Path should not contain empty writer node ID", pathString.contains("//"));
183+
assertFalse("Path should not contain empty index fixed prefix", pathString.contains("//"));
184184
assertTrue("Path should contain shard ID", pathString.contains("/0/"));
185185
assertTrue("Path should contain segments", pathString.contains("/segments/"));
186186
assertTrue("Path should contain data", pathString.contains("/data/"));
187187
}
188188

189-
public void testShardDataPathInputWithWhitespaceOnlyWriterNodeId() {
189+
public void testShardDataPathInputWithWhitespaceOnlyIndexFixedPrefix() {
190190
RemoteStorePathStrategy pathStrategy = new RemoteStorePathStrategy(PathType.FIXED);
191191

192192
RemoteStorePathStrategy.ShardDataPathInput pathInput = RemoteStorePathStrategy.ShardDataPathInput.builder()
@@ -195,17 +195,17 @@ public void testShardDataPathInputWithWhitespaceOnlyWriterNodeId() {
195195
.shardId("0")
196196
.dataCategory(DataCategory.SEGMENTS)
197197
.dataType(DataType.DATA)
198-
.writerNodeId(" ")
198+
.indexFixedPrefix(" ")
199199
.build();
200200

201201
BlobPath result = pathStrategy.generatePath(pathInput);
202202
String pathString = result.buildAsString();
203203

204-
assertFalse("Path should not contain whitespace-only writer node ID", pathString.contains("//"));
204+
assertFalse("Path should not contain whitespace-only index fixed prefix", pathString.contains("//"));
205205
assertTrue("Path should follow expected structure", pathString.contains("test-repo/test-index-uuid/0/segments/data"));
206206
}
207207

208-
public void testHashedPathWithWriterNodeId() {
208+
public void testHashedPathWithIndexFixedPrefix() {
209209
RemoteStorePathStrategy pathStrategy = new RemoteStorePathStrategy(PathType.HASHED_PREFIX, PathHashAlgorithm.FNV_1A_BASE64);
210210

211211
RemoteStorePathStrategy.ShardDataPathInput pathInput = RemoteStorePathStrategy.ShardDataPathInput.builder()
@@ -214,13 +214,13 @@ public void testHashedPathWithWriterNodeId() {
214214
.shardId("0")
215215
.dataCategory(DataCategory.SEGMENTS)
216216
.dataType(DataType.DATA)
217-
.writerNodeId("writer-node-1")
217+
.indexFixedPrefix("writer-node-1")
218218
.build();
219219

220220
BlobPath result = pathStrategy.generatePath(pathInput);
221221
String pathString = result.buildAsString();
222222

223-
assertTrue("Path should contain writer node ID", pathString.contains("writer-node-1"));
223+
assertTrue("Path should contain index fixed prefix", pathString.contains("writer-node-1"));
224224
assertTrue("Path should follow expected structure", pathString.contains("test-repo/test-index-uuid/0/writer-node-1/segments/data"));
225225
}
226226
}

0 commit comments

Comments
 (0)