@@ -80,7 +80,7 @@ public abstract class ShardFollowNodeTask extends AllocatedPersistentTask {
80
80
private long followerMaxSeqNo = 0 ;
81
81
private int numConcurrentReads = 0 ;
82
82
private int numConcurrentWrites = 0 ;
83
- private long currentIndexMetadataVersion = 0 ;
83
+ private long currentMappingVersion = 0 ;
84
84
private long totalFetchTimeMillis = 0 ;
85
85
private long numberOfSuccessfulFetches = 0 ;
86
86
private long numberOfFailedFetches = 0 ;
@@ -131,14 +131,13 @@ void start(
131
131
this .lastRequestedSeqNo = followerGlobalCheckpoint ;
132
132
}
133
133
134
- // Forcefully updates follower mapping, this gets us the leader imd version and
135
- // makes sure that leader and follower mapping are identical.
136
- updateMapping (imdVersion -> {
134
+ // updates follower mapping, this gets us the leader mapping version and makes sure that leader and follower mapping are identical
135
+ updateMapping (mappingVersion -> {
137
136
synchronized (ShardFollowNodeTask .this ) {
138
- currentIndexMetadataVersion = imdVersion ;
137
+ currentMappingVersion = mappingVersion ;
139
138
}
140
- LOGGER .info ("{} Started to follow leader shard {}, followGlobalCheckPoint={}, indexMetaDataVersion ={}" ,
141
- params .getFollowShardId (), params .getLeaderShardId (), followerGlobalCheckpoint , imdVersion );
139
+ LOGGER .info ("{} Started to follow leader shard {}, followGlobalCheckPoint={}, mappingVersion ={}" ,
140
+ params .getFollowShardId (), params .getLeaderShardId (), followerGlobalCheckpoint , mappingVersion );
142
141
coordinateReads ();
143
142
});
144
143
}
@@ -258,7 +257,7 @@ private void sendShardChangesRequest(long from, int maxOperationCount, long maxR
258
257
}
259
258
260
259
void handleReadResponse (long from , long maxRequiredSeqNo , ShardChangesAction .Response response ) {
261
- maybeUpdateMapping (response .getIndexMetadataVersion (), () -> innerHandleReadResponse (from , maxRequiredSeqNo , response ));
260
+ maybeUpdateMapping (response .getMappingVersion (), () -> innerHandleReadResponse (from , maxRequiredSeqNo , response ));
262
261
}
263
262
264
263
/** Called when some operations are fetched from the leading */
@@ -344,16 +343,16 @@ private synchronized void handleWriteResponse(final BulkShardOperationsResponse
344
343
coordinateReads ();
345
344
}
346
345
347
- private synchronized void maybeUpdateMapping (Long minimumRequiredIndexMetadataVersion , Runnable task ) {
348
- if (currentIndexMetadataVersion >= minimumRequiredIndexMetadataVersion ) {
349
- LOGGER .trace ("{} index metadata version [{}] is higher or equal than minimum required index metadata version [{}]" ,
350
- params .getFollowShardId (), currentIndexMetadataVersion , minimumRequiredIndexMetadataVersion );
346
+ private synchronized void maybeUpdateMapping (Long minimumRequiredMappingVersion , Runnable task ) {
347
+ if (currentMappingVersion >= minimumRequiredMappingVersion ) {
348
+ LOGGER .trace ("{} mapping version [{}] is higher or equal than minimum required mapping version [{}]" ,
349
+ params .getFollowShardId (), currentMappingVersion , minimumRequiredMappingVersion );
351
350
task .run ();
352
351
} else {
353
- LOGGER .trace ("{} updating mapping, index metadata version [{}] is lower than minimum required index metadata version [{}]" ,
354
- params .getFollowShardId (), currentIndexMetadataVersion , minimumRequiredIndexMetadataVersion );
355
- updateMapping (imdVersion -> {
356
- currentIndexMetadataVersion = imdVersion ;
352
+ LOGGER .trace ("{} updating mapping, mapping version [{}] is lower than minimum required mapping version [{}]" ,
353
+ params .getFollowShardId (), currentMappingVersion , minimumRequiredMappingVersion );
354
+ updateMapping (mappingVersion -> {
355
+ currentMappingVersion = mappingVersion ;
357
356
task .run ();
358
357
});
359
358
}
@@ -422,7 +421,7 @@ public synchronized Status getStatus() {
422
421
numConcurrentReads ,
423
422
numConcurrentWrites ,
424
423
buffer .size (),
425
- currentIndexMetadataVersion ,
424
+ currentMappingVersion ,
426
425
totalFetchTimeMillis ,
427
426
numberOfSuccessfulFetches ,
428
427
numberOfFailedFetches ,
@@ -448,7 +447,7 @@ public static class Status implements Task.Status {
448
447
static final ParseField NUMBER_OF_CONCURRENT_READS_FIELD = new ParseField ("number_of_concurrent_reads" );
449
448
static final ParseField NUMBER_OF_CONCURRENT_WRITES_FIELD = new ParseField ("number_of_concurrent_writes" );
450
449
static final ParseField NUMBER_OF_QUEUED_WRITES_FIELD = new ParseField ("number_of_queued_writes" );
451
- static final ParseField INDEX_METADATA_VERSION_FIELD = new ParseField ("index_metadata_version " );
450
+ static final ParseField MAPPING_VERSION_FIELD = new ParseField ("mapping_version " );
452
451
static final ParseField TOTAL_FETCH_TIME_MILLIS_FIELD = new ParseField ("total_fetch_time_millis" );
453
452
static final ParseField NUMBER_OF_SUCCESSFUL_FETCHES_FIELD = new ParseField ("number_of_successful_fetches" );
454
453
static final ParseField NUMBER_OF_FAILED_FETCHES_FIELD = new ParseField ("number_of_failed_fetches" );
@@ -504,7 +503,7 @@ public static class Status implements Task.Status {
504
503
STATUS_PARSER .declareInt (ConstructingObjectParser .constructorArg (), NUMBER_OF_CONCURRENT_READS_FIELD );
505
504
STATUS_PARSER .declareInt (ConstructingObjectParser .constructorArg (), NUMBER_OF_CONCURRENT_WRITES_FIELD );
506
505
STATUS_PARSER .declareInt (ConstructingObjectParser .constructorArg (), NUMBER_OF_QUEUED_WRITES_FIELD );
507
- STATUS_PARSER .declareLong (ConstructingObjectParser .constructorArg (), INDEX_METADATA_VERSION_FIELD );
506
+ STATUS_PARSER .declareLong (ConstructingObjectParser .constructorArg (), MAPPING_VERSION_FIELD );
508
507
STATUS_PARSER .declareLong (ConstructingObjectParser .constructorArg (), TOTAL_FETCH_TIME_MILLIS_FIELD );
509
508
STATUS_PARSER .declareLong (ConstructingObjectParser .constructorArg (), NUMBER_OF_SUCCESSFUL_FETCHES_FIELD );
510
509
STATUS_PARSER .declareLong (ConstructingObjectParser .constructorArg (), NUMBER_OF_FAILED_FETCHES_FIELD );
@@ -582,10 +581,10 @@ public int numberOfQueuedWrites() {
582
581
return numberOfQueuedWrites ;
583
582
}
584
583
585
- private final long indexMetadataVersion ;
584
+ private final long mappingVersion ;
586
585
587
- public long indexMetadataVersion () {
588
- return indexMetadataVersion ;
586
+ public long mappingVersion () {
587
+ return mappingVersion ;
589
588
}
590
589
591
590
private final long totalFetchTimeMillis ;
@@ -658,7 +657,7 @@ public NavigableMap<Long, ElasticsearchException> fetchExceptions() {
658
657
final int numberOfConcurrentReads ,
659
658
final int numberOfConcurrentWrites ,
660
659
final int numberOfQueuedWrites ,
661
- final long indexMetadataVersion ,
660
+ final long mappingVersion ,
662
661
final long totalFetchTimeMillis ,
663
662
final long numberOfSuccessfulFetches ,
664
663
final long numberOfFailedFetches ,
@@ -678,7 +677,7 @@ public NavigableMap<Long, ElasticsearchException> fetchExceptions() {
678
677
this .numberOfConcurrentReads = numberOfConcurrentReads ;
679
678
this .numberOfConcurrentWrites = numberOfConcurrentWrites ;
680
679
this .numberOfQueuedWrites = numberOfQueuedWrites ;
681
- this .indexMetadataVersion = indexMetadataVersion ;
680
+ this .mappingVersion = mappingVersion ;
682
681
this .totalFetchTimeMillis = totalFetchTimeMillis ;
683
682
this .numberOfSuccessfulFetches = numberOfSuccessfulFetches ;
684
683
this .numberOfFailedFetches = numberOfFailedFetches ;
@@ -701,7 +700,7 @@ public Status(final StreamInput in) throws IOException {
701
700
this .numberOfConcurrentReads = in .readVInt ();
702
701
this .numberOfConcurrentWrites = in .readVInt ();
703
702
this .numberOfQueuedWrites = in .readVInt ();
704
- this .indexMetadataVersion = in .readVLong ();
703
+ this .mappingVersion = in .readVLong ();
705
704
this .totalFetchTimeMillis = in .readVLong ();
706
705
this .numberOfSuccessfulFetches = in .readVLong ();
707
706
this .numberOfFailedFetches = in .readVLong ();
@@ -730,7 +729,7 @@ public void writeTo(final StreamOutput out) throws IOException {
730
729
out .writeVInt (numberOfConcurrentReads );
731
730
out .writeVInt (numberOfConcurrentWrites );
732
731
out .writeVInt (numberOfQueuedWrites );
733
- out .writeVLong (indexMetadataVersion );
732
+ out .writeVLong (mappingVersion );
734
733
out .writeVLong (totalFetchTimeMillis );
735
734
out .writeVLong (numberOfSuccessfulFetches );
736
735
out .writeVLong (numberOfFailedFetches );
@@ -756,7 +755,7 @@ public XContentBuilder toXContent(final XContentBuilder builder, final Params pa
756
755
builder .field (NUMBER_OF_CONCURRENT_READS_FIELD .getPreferredName (), numberOfConcurrentReads );
757
756
builder .field (NUMBER_OF_CONCURRENT_WRITES_FIELD .getPreferredName (), numberOfConcurrentWrites );
758
757
builder .field (NUMBER_OF_QUEUED_WRITES_FIELD .getPreferredName (), numberOfQueuedWrites );
759
- builder .field (INDEX_METADATA_VERSION_FIELD .getPreferredName (), indexMetadataVersion );
758
+ builder .field (MAPPING_VERSION_FIELD .getPreferredName (), mappingVersion );
760
759
builder .humanReadableField (
761
760
TOTAL_FETCH_TIME_MILLIS_FIELD .getPreferredName (),
762
761
"total_fetch_time" ,
@@ -815,7 +814,7 @@ public boolean equals(final Object o) {
815
814
numberOfConcurrentReads == that .numberOfConcurrentReads &&
816
815
numberOfConcurrentWrites == that .numberOfConcurrentWrites &&
817
816
numberOfQueuedWrites == that .numberOfQueuedWrites &&
818
- indexMetadataVersion == that .indexMetadataVersion &&
817
+ mappingVersion == that .mappingVersion &&
819
818
totalFetchTimeMillis == that .totalFetchTimeMillis &&
820
819
numberOfSuccessfulFetches == that .numberOfSuccessfulFetches &&
821
820
numberOfFailedFetches == that .numberOfFailedFetches &&
@@ -837,7 +836,7 @@ public int hashCode() {
837
836
numberOfConcurrentReads ,
838
837
numberOfConcurrentWrites ,
839
838
numberOfQueuedWrites ,
840
- indexMetadataVersion ,
839
+ mappingVersion ,
841
840
totalFetchTimeMillis ,
842
841
numberOfSuccessfulFetches ,
843
842
numberOfFailedFetches ,
0 commit comments