Skip to content

Commit 1de77c9

Browse files
author
Aditi Goyal
committed
Applied spotless correction
1 parent 1746bfa commit 1de77c9

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4085,7 +4085,8 @@ private EngineConfig newEngineConfig(LongSupplier globalCheckpointSupplier) thro
40854085
this,
40864086
this.checkpointPublisher,
40874087
remoteStoreStatsTrackerFactory.getRemoteSegmentTransferTracker(shardId()),
4088-
remoteStoreSettings);
4088+
remoteStoreSettings
4089+
);
40894090

40904091
internalRefreshListener.add(
40914092
new RemoteStoreRefreshListener(

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

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,30 @@
99
package org.opensearch.index.shard;
1010

1111
import org.apache.logging.log4j.Logger;
12-
import org.apache.logging.log4j.message.ParameterizedMessage;
1312
import org.apache.lucene.codecs.CodecUtil;
14-
import org.apache.lucene.index.CorruptIndexException;
1513
import org.apache.lucene.index.SegmentInfos;
1614
import org.apache.lucene.store.Directory;
1715
import org.apache.lucene.store.FilterDirectory;
1816
import org.apache.lucene.store.IOContext;
1917
import org.apache.lucene.store.IndexInput;
20-
import org.opensearch.action.LatchedActionListener;
2118
import org.opensearch.action.bulk.BackoffPolicy;
22-
import org.opensearch.action.support.GroupedActionListener;
2319
import org.opensearch.cluster.routing.RecoverySource;
2420
import org.opensearch.common.concurrent.GatedCloseable;
2521
import org.opensearch.common.logging.Loggers;
2622
import org.opensearch.common.unit.TimeValue;
27-
import org.opensearch.common.util.UploadListener;
28-
import org.opensearch.core.action.ActionListener;
29-
import org.opensearch.index.engine.EngineException;
30-
import org.opensearch.index.engine.InternalEngine;
3123
import org.opensearch.index.remote.RemoteSegmentTransferTracker;
32-
import org.opensearch.index.seqno.SequenceNumbers;
33-
import org.opensearch.index.store.CompositeDirectory;
3424
import org.opensearch.index.store.RemoteSegmentStoreDirectory;
3525
import org.opensearch.index.store.remote.metadata.RemoteSegmentMetadata;
36-
import org.opensearch.index.translog.Translog;
3726
import org.opensearch.indices.RemoteStoreSettings;
38-
import org.opensearch.indices.replication.checkpoint.ReplicationCheckpoint;
3927
import org.opensearch.indices.replication.checkpoint.SegmentReplicationCheckpointPublisher;
4028
import org.opensearch.threadpool.ThreadPool;
4129

4230
import java.io.IOException;
4331
import java.util.Collection;
4432
import java.util.HashMap;
4533
import java.util.Iterator;
46-
import java.util.Locale;
4734
import java.util.Map;
4835
import java.util.Set;
49-
import java.util.concurrent.CountDownLatch;
50-
import java.util.concurrent.TimeUnit;
51-
import java.util.concurrent.atomic.AtomicBoolean;
52-
import java.util.stream.Collectors;
53-
54-
import static org.opensearch.index.seqno.SequenceNumbers.LOCAL_CHECKPOINT_KEY;
5536

5637
/**
5738
* RefreshListener implementation to upload newly created segment files to the remote store
@@ -120,8 +101,7 @@ public RemoteStoreRefreshListener(
120101
}
121102
// initializing primary term with the primary term of latest metadata in remote store.
122103
// if no metadata is present, this value will be initialized with -1.
123-
this.primaryTerm = remoteSegmentMetadata != null ? remoteSegmentMetadata.getPrimaryTerm() :
124-
INVALID_PRIMARY_TERM;
104+
this.primaryTerm = remoteSegmentMetadata != null ? remoteSegmentMetadata.getPrimaryTerm() : INVALID_PRIMARY_TERM;
125105
this.segmentTracker = segmentTracker;
126106
resetBackOffDelayIterator();
127107
this.checkpointPublisher = checkpointPublisher;
@@ -233,7 +213,7 @@ protected String getRetryThreadPoolName() {
233213
return ThreadPool.Names.REMOTE_REFRESH_RETRY;
234214
}
235215

236-
//todo: create a common class
216+
// todo: create a common class
237217
private boolean isRefreshAfterCommit() throws IOException {
238218
String lastCommittedLocalSegmentFileName = SegmentInfos.getLastCommitSegmentsFileName(storeDirectory);
239219
return (lastCommittedLocalSegmentFileName != null
@@ -253,7 +233,7 @@ private boolean isRefreshAfterCommitSafe() {
253233
return false;
254234
}
255235

256-
//todo
236+
// todo
257237
boolean isLowPriorityUpload() {
258238
return isLocalOrSnapshotRecoveryOrSeeding();
259239
}
@@ -264,7 +244,7 @@ boolean isLowPriorityUpload() {
264244
* @param file that needs to be uploaded.
265245
* @return true if the upload has to be skipped for the file.
266246
*/
267-
//todo: create a common class
247+
// todo: create a common class
268248
private boolean skipUpload(String file) {
269249
try {
270250
// Exclude files that are already uploaded and the exclude files to come up with the list of files to be uploaded.
@@ -295,7 +275,7 @@ private String getChecksumOfLocalFile(String file) throws IOException {
295275
*
296276
* @return updated map of local segment files and filesize
297277
*/
298-
//todo: create a common class
278+
// todo: create a common class
299279
private Map<String, Long> updateLocalSizeMapAndTracker(Collection<String> segmentFiles) {
300280
return segmentTracker.updateLatestLocalFileNameLengthMap(segmentFiles, storeDirectory::fileLength);
301281
}
@@ -305,7 +285,7 @@ private Map<String, Long> updateLocalSizeMapAndTracker(Collection<String> segmen
305285
* returned value of this method for scheduling retries in syncSegments method.
306286
* @return true iff the shard is a started with primary mode true or it is local or snapshot recovery.
307287
*/
308-
//todo: create a common class
288+
// todo: create a common class
309289
private boolean isReadyForUpload() {
310290
boolean isReady = indexShard.isStartedPrimary() || isLocalOrSnapshotRecoveryOrSeeding();
311291

@@ -329,7 +309,7 @@ private boolean isReadyForUpload() {
329309
return isReady;
330310
}
331311

332-
//todo: create a common class
312+
// todo: create a common class
333313
boolean isLocalOrSnapshotRecoveryOrSeeding() {
334314
// In this case when the primary mode is false, we need to upload segments to Remote Store
335315
// This is required in case of remote migration seeding/snapshots/shrink/ split/clone where we need to durable persist

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
import org.opensearch.index.engine.InternalEngine;
3131
import org.opensearch.index.remote.RemoteSegmentTransferTracker;
3232
import org.opensearch.index.seqno.SequenceNumbers;
33-
import static org.opensearch.index.seqno.SequenceNumbers.LOCAL_CHECKPOINT_KEY;
34-
import static org.opensearch.index.shard.RemoteStoreRefreshListener.EXCLUDE_FILES;
3533
import org.opensearch.index.store.CompositeDirectory;
3634
import org.opensearch.index.store.RemoteSegmentStoreDirectory;
3735
import org.opensearch.index.store.remote.metadata.RemoteSegmentMetadata;
@@ -51,6 +49,8 @@
5149
import java.util.concurrent.atomic.AtomicBoolean;
5250
import java.util.stream.Collectors;
5351

52+
import static org.opensearch.index.seqno.SequenceNumbers.LOCAL_CHECKPOINT_KEY;
53+
import static org.opensearch.index.shard.RemoteStoreRefreshListener.EXCLUDE_FILES;
5454

5555
public class RemoteUploaderService {
5656

@@ -411,8 +411,8 @@ boolean isLocalOrSnapshotRecoveryOrSeeding() {
411411
return (indexShard.state() == IndexShardState.RECOVERING && indexShard.shardRouting.primary())
412412
&& indexShard.recoveryState() != null
413413
&& (indexShard.recoveryState().getRecoverySource().getType() == RecoverySource.Type.LOCAL_SHARDS
414-
|| indexShard.recoveryState().getRecoverySource().getType() == RecoverySource.Type.SNAPSHOT
415-
|| indexShard.shouldSeedRemoteStore());
414+
|| indexShard.recoveryState().getRecoverySource().getType() == RecoverySource.Type.SNAPSHOT
415+
|| indexShard.shouldSeedRemoteStore());
416416
}
417417

418418
private String getChecksumOfLocalFile(String file) throws IOException {

0 commit comments

Comments
 (0)