@@ -3186,6 +3186,7 @@ private void writeAtomic(
31863186
31873187 @ Override
31883188 public void snapshotShard (SnapshotShardContext context ) {
3189+ context .status ().updateStatusDescription ("queued in snapshot task runner" );
31893190 shardSnapshotTaskRunner .enqueueShardSnapshot (context );
31903191 }
31913192
@@ -3198,6 +3199,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
31983199 final ShardId shardId = store .shardId ();
31993200 final SnapshotId snapshotId = context .snapshotId ();
32003201 final IndexShardSnapshotStatus snapshotStatus = context .status ();
3202+ snapshotStatus .updateStatusDescription ("snapshot task runner: setting up shard snapshot" );
32013203 final long startTime = threadPool .absoluteTimeInMillis ();
32023204 try {
32033205 final ShardGeneration generation = snapshotStatus .generation ();
@@ -3206,6 +3208,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
32063208 final Set <String > blobs ;
32073209 if (generation == null ) {
32083210 snapshotStatus .ensureNotAborted ();
3211+ snapshotStatus .updateStatusDescription ("snapshot task runner: listing blob prefixes" );
32093212 try {
32103213 blobs = shardContainer .listBlobsByPrefix (OperationPurpose .SNAPSHOT_METADATA , SNAPSHOT_INDEX_PREFIX ).keySet ();
32113214 } catch (IOException e ) {
@@ -3216,6 +3219,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
32163219 }
32173220
32183221 snapshotStatus .ensureNotAborted ();
3222+ snapshotStatus .updateStatusDescription ("snapshot task runner: loading snapshot blobs" );
32193223 Tuple <BlobStoreIndexShardSnapshots , ShardGeneration > tuple = buildBlobStoreIndexShardSnapshots (
32203224 context .indexId (),
32213225 shardId .id (),
@@ -3316,6 +3320,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
33163320 indexCommitPointFiles = filesFromSegmentInfos ;
33173321 }
33183322
3323+ snapshotStatus .updateStatusDescription ("snapshot task runner: starting shard snapshot" );
33193324 snapshotStatus .moveToStarted (
33203325 startTime ,
33213326 indexIncrementalFileCount ,
@@ -3342,6 +3347,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
33423347 BlobStoreIndexShardSnapshot .FileInfo .SERIALIZE_WRITER_UUID ,
33433348 Boolean .toString (writeFileInfoWriterUUID )
33443349 );
3350+ snapshotStatus .updateStatusDescription ("snapshot task runner: updating blob store with new shard generation" );
33453351 INDEX_SHARD_SNAPSHOTS_FORMAT .write (
33463352 updatedBlobStoreIndexShardSnapshots ,
33473353 shardContainer ,
@@ -3387,6 +3393,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
33873393 BlobStoreIndexShardSnapshot .FileInfo .SERIALIZE_WRITER_UUID ,
33883394 Boolean .toString (writeFileInfoWriterUUID )
33893395 );
3396+ snapshotStatus .updateStatusDescription ("no shard generations: writing new index-${N} file" );
33903397 writeShardIndexBlobAtomic (shardContainer , newGen , updatedBlobStoreIndexShardSnapshots , serializationParams );
33913398 } catch (IOException e ) {
33923399 throw new IndexShardSnapshotFailedException (
@@ -3401,6 +3408,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
34013408 }
34023409 snapshotStatus .addProcessedFiles (finalFilesInShardMetadataCount , finalFilesInShardMetadataSize );
34033410 try {
3411+ snapshotStatus .updateStatusDescription ("no shard generations: deleting blobs" );
34043412 deleteFromContainer (OperationPurpose .SNAPSHOT_METADATA , shardContainer , blobsToDelete .iterator ());
34053413 } catch (IOException e ) {
34063414 logger .warn (
@@ -3414,6 +3422,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
34143422 // filesToSnapshot will be emptied while snapshotting the file. We make a copy here for cleanup purpose in case of failure.
34153423 final AtomicReference <List <FileInfo >> fileToCleanUp = new AtomicReference <>(List .copyOf (filesToSnapshot ));
34163424 final ActionListener <Collection <Void >> allFilesUploadedListener = ActionListener .assertOnce (ActionListener .wrap (ignore -> {
3425+ snapshotStatus .updateStatusDescription ("all files uploaded: finalizing" );
34173426 final IndexShardSnapshotStatus .Copy lastSnapshotStatus = snapshotStatus .moveToFinalize ();
34183427
34193428 // now create and write the commit point
@@ -3435,6 +3444,7 @@ private void doSnapshotShard(SnapshotShardContext context) {
34353444 BlobStoreIndexShardSnapshot .FileInfo .SERIALIZE_WRITER_UUID ,
34363445 Boolean .toString (writeFileInfoWriterUUID )
34373446 );
3447+ snapshotStatus .updateStatusDescription ("all files uploaded: writing to index shard file" );
34383448 INDEX_SHARD_SNAPSHOT_FORMAT .write (
34393449 blobStoreIndexShardSnapshot ,
34403450 shardContainer ,
@@ -3451,10 +3461,12 @@ private void doSnapshotShard(SnapshotShardContext context) {
34513461 ByteSizeValue .ofBytes (blobStoreIndexShardSnapshot .totalSize ()),
34523462 getSegmentInfoFileCount (blobStoreIndexShardSnapshot .indexFiles ())
34533463 );
3464+ snapshotStatus .updateStatusDescription ("all files uploaded: done" );
34543465 snapshotStatus .moveToDone (threadPool .absoluteTimeInMillis (), shardSnapshotResult );
34553466 context .onResponse (shardSnapshotResult );
34563467 }, e -> {
34573468 try {
3469+ snapshotStatus .updateStatusDescription ("all files uploaded: cleaning up data files, exception while finalizing: " + e );
34583470 shardContainer .deleteBlobsIgnoringIfNotExists (
34593471 OperationPurpose .SNAPSHOT_DATA ,
34603472 Iterators .flatMap (fileToCleanUp .get ().iterator (), f -> Iterators .forRange (0 , f .numberOfParts (), f ::partName ))
@@ -3517,6 +3529,7 @@ protected void snapshotFiles(
35173529 ) {
35183530 final int noOfFilesToSnapshot = filesToSnapshot .size ();
35193531 final ActionListener <Void > filesListener = fileQueueListener (filesToSnapshot , noOfFilesToSnapshot , allFilesUploadedListener );
3532+ context .status ().updateStatusDescription ("enqueued file snapshot tasks: threads running concurrent file uploads" );
35203533 for (int i = 0 ; i < noOfFilesToSnapshot ; i ++) {
35213534 shardSnapshotTaskRunner .enqueueFileSnapshot (context , filesToSnapshot ::poll , filesListener );
35223535 }
0 commit comments