2424import com .carrotsearch .hppc .cursors .ObjectLongCursor ;
2525import org .apache .logging .log4j .Logger ;
2626import org .elasticsearch .index .IndexSettings ;
27+ import org .elasticsearch .index .shard .AbstractIndexShardComponent ;
28+ import org .elasticsearch .index .shard .ShardId ;
2729
2830import java .util .HashSet ;
2931import java .util .Locale ;
4042 * <p>
4143 * The global checkpoint is maintained by the primary shard and is replicated to all the replicas (via {@link GlobalCheckpointSyncAction}).
4244 */
43- public class GlobalCheckpointTracker {
45+ public class GlobalCheckpointTracker extends AbstractIndexShardComponent {
4446
4547 /*
4648 * This map holds the last known local checkpoint for every active shard and initializing shard copies that has been brought up to speed
@@ -62,22 +64,20 @@ public class GlobalCheckpointTracker {
6264 */
6365 private long globalCheckpoint ;
6466
65- private final Logger logger ;
66-
6767 /**
6868 * Initialize the global checkpoint service. The specified global checkpoint should be set to the last known global checkpoint, or
6969 * {@link SequenceNumbersService#UNASSIGNED_SEQ_NO}.
7070 *
71+ * @param shardId the shard ID
7172 * @param indexSettings the index settings
7273 * @param globalCheckpoint the last known global checkpoint for this shard, or {@link SequenceNumbersService#UNASSIGNED_SEQ_NO}
73- * @param logger a component logger
7474 */
75- GlobalCheckpointTracker (final IndexSettings indexSettings , final long globalCheckpoint , final Logger logger ) {
75+ GlobalCheckpointTracker (final ShardId shardId , final IndexSettings indexSettings , final long globalCheckpoint ) {
76+ super (shardId , indexSettings );
7677 assert globalCheckpoint >= UNASSIGNED_SEQ_NO : "illegal initial global checkpoint: " + globalCheckpoint ;
7778 inSyncLocalCheckpoints = new ObjectLongHashMap <>(1 + indexSettings .getNumberOfReplicas ());
7879 assignedAllocationIds = new HashSet <>(1 + indexSettings .getNumberOfReplicas ());
7980 this .globalCheckpoint = globalCheckpoint ;
80- this .logger = logger ;
8181 }
8282
8383 /**
0 commit comments