Skip to content

Commit 57d1d17

Browse files
authored
Allow upload of translog-1 generation while migrating to remote (#18713)
Signed-off-by: Gaurav Bafna <[email protected]>
1 parent 5d2e8a2 commit 57d1d17

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

server/src/main/java/org/opensearch/index/translog/transfer/BlobStoreTransferService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import java.util.HashMap;
4141
import java.util.List;
4242
import java.util.Map;
43-
import java.util.Objects;
4443
import java.util.Set;
4544

4645
import static org.opensearch.common.blobstore.BlobContainer.BlobNameSortOrder.LEXICOGRAPHIC;
@@ -192,7 +191,8 @@ private void uploadBlob(
192191
listener.onFailure(new FileTransferException(fileSnapshot, ex));
193192
});
194193

195-
Objects.requireNonNull(fileSnapshot.getChecksum());
194+
// Only the first generation doesn't have checksum
195+
assert (fileSnapshot.getChecksum() != null || fileSnapshot.getName().contains("-1."));
196196
uploadBlobAsyncInternal(
197197
fileSnapshot.getName(),
198198
fileSnapshot.getName(),
@@ -226,7 +226,7 @@ void uploadBlobAsyncInternal(
226226
BlobPath blobPath,
227227
WritePriority writePriority,
228228
RemoteTransferContainer.OffsetRangeInputStreamSupplier inputStreamSupplier,
229-
long expectedChecksum,
229+
Long expectedChecksum,
230230
ActionListener<Void> completionListener,
231231
Map<String, String> metadata
232232
) throws IOException {

server/src/main/java/org/opensearch/indices/recovery/RecoveryTarget.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ public void prepareForTranslogOperations(int totalTranslogOps, ActionListener<Vo
224224
indexShard().openEngineAndSkipTranslogRecovery();
225225
// upload to remote store in migration for primary shard
226226
if (indexShard.shouldSeedRemoteStore()) {
227-
// This cleans up remote translog's 0 generation, as we don't want to get that uploaded
228-
indexShard.sync();
227+
logger.info("Remote Store seeding starting for {}", indexShard.shardId());
229228
threadPool.executor(ThreadPool.Names.GENERIC).execute(() -> { indexShard.refresh("remote store migration"); });
230229
indexShard.waitForRemoteStoreSync(this::setLastAccessTime);
231230
logger.info("Remote Store is now seeded for {}", indexShard.shardId());

0 commit comments

Comments
 (0)