private long getPrimaryTerm() { return engineConfig.getPrimaryTermSupplier().getAsLong(); }
private Translog openTranslog(EngineConfig engineConfig, TranslogDeletionPolicy translogDeletionPolicy, LongSupplier globalCheckpointSupplier) throws IOException { final TranslogConfig translogConfig = engineConfig.getTranslogConfig(); final String translogUUID = loadTranslogUUIDFromLastCommit(); // A translog checkpoint from 5.x index does not have translog_generation_key and Translog's ctor will read translog gen values // from translogDeletionPolicy. We need to bootstrap these values from the recovering commit before calling Translog ctor. if (engineConfig.getIndexSettings().getIndexVersionCreated().before(Version.V_6_0_0)) { final SegmentInfos lastCommitInfo = store.readLastCommittedSegmentsInfo(); final long minRequiredTranslogGen = Long.parseLong(lastCommitInfo.userData.get(Translog.TRANSLOG_GENERATION_KEY)); translogDeletionPolicy.setTranslogGenerationOfLastCommit(minRequiredTranslogGen); translogDeletionPolicy.setMinTranslogGenerationForRecovery(minRequiredTranslogGen); } // We expect that this shard already exists, so it must already have an existing translog else something is badly wrong! return new Translog(translogConfig, translogUUID, translogDeletionPolicy, globalCheckpointSupplier, engineConfig.getPrimaryTermSupplier()); }
private long getPrimaryTerm() { return engineConfig.getPrimaryTermSupplier().getAsLong(); }
private Translog openTranslog(EngineConfig engineConfig, TranslogDeletionPolicy translogDeletionPolicy, LongSupplier globalCheckpointSupplier) throws IOException { final TranslogConfig translogConfig = engineConfig.getTranslogConfig(); final String translogUUID = loadTranslogUUIDFromLastCommit(); // A translog checkpoint from 5.x index does not have translog_generation_key and Translog's ctor will read translog gen values // from translogDeletionPolicy. We need to bootstrap these values from the recovering commit before calling Translog ctor. if (engineConfig.getIndexSettings().getIndexVersionCreated().before(Version.V_6_0_0)) { final SegmentInfos lastCommitInfo = store.readLastCommittedSegmentsInfo(); final long minRequiredTranslogGen = Long.parseLong(lastCommitInfo.userData.get(Translog.TRANSLOG_GENERATION_KEY)); translogDeletionPolicy.setTranslogGenerationOfLastCommit(minRequiredTranslogGen); translogDeletionPolicy.setMinTranslogGenerationForRecovery(minRequiredTranslogGen); } // We expect that this shard already exists, so it must already have an existing translog else something is badly wrong! return new Translog(translogConfig, translogUUID, translogDeletionPolicy, globalCheckpointSupplier, engineConfig.getPrimaryTermSupplier()); }