Java Code Examples for org.elasticsearch.index.seqno.SequenceNumbers#NO_OPS_PERFORMED

The following examples show how to use org.elasticsearch.index.seqno.SequenceNumbers#NO_OPS_PERFORMED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoftDeletesPolicy.java    From crate with Apache License 2.0 5 votes vote down vote up
SoftDeletesPolicy(LongSupplier globalCheckpointSupplier, long minRetainedSeqNo, long retentionOperations) {
    this.globalCheckpointSupplier = globalCheckpointSupplier;
    this.retentionOperations = retentionOperations;
    this.minRetainedSeqNo = minRetainedSeqNo;
    this.localCheckpointOfSafeCommit = SequenceNumbers.NO_OPS_PERFORMED;
    this.retentionLockCount = 0;
}
 
Example 2
Source File: Checkpoint.java    From crate with Apache License 2.0 5 votes vote down vote up
static Checkpoint emptyTranslogCheckpoint(final long offset, final long generation, final long globalCheckpoint,
                                          long minTranslogGeneration) {
    final long minSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
    final long maxSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
    final long trimmedAboveSeqNo = SequenceNumbers.UNASSIGNED_SEQ_NO;
    return new Checkpoint(offset, 0, generation, minSeqNo, maxSeqNo, globalCheckpoint, minTranslogGeneration, trimmedAboveSeqNo);
}
 
Example 3
Source File: Checkpoint.java    From crate with Apache License 2.0 5 votes vote down vote up
static Checkpoint readCheckpointV5_0_0(final DataInput in) throws IOException {
    final long offset = in.readLong();
    final int numOps = in.readInt();
    final long generation = in.readLong();
    final long minSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
    final long maxSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
    final long globalCheckpoint = SequenceNumbers.UNASSIGNED_SEQ_NO;
    final long minTranslogGeneration = -1;
    final long trimmedAboveSeqNo = SequenceNumbers.UNASSIGNED_SEQ_NO;
    return new Checkpoint(offset, numOps, generation, minSeqNo, maxSeqNo, globalCheckpoint, minTranslogGeneration, trimmedAboveSeqNo);
}
 
Example 4
Source File: EngineTestCase.java    From crate with Apache License 2.0 5 votes vote down vote up
protected Translog createTranslog(Path translogPath, LongSupplier primaryTermSupplier) throws IOException {
    TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, INDEX_SETTINGS, BigArrays.NON_RECYCLING_INSTANCE);
    String translogUUID = Translog.createEmptyTranslog(translogPath, SequenceNumbers.NO_OPS_PERFORMED, shardId,
        primaryTermSupplier.getAsLong());
    return new Translog(translogConfig, translogUUID, createTranslogDeletionPolicy(INDEX_SETTINGS),
        () -> SequenceNumbers.NO_OPS_PERFORMED, primaryTermSupplier, seqNo -> {});
}
 
Example 5
Source File: EngineTestCase.java    From crate with Apache License 2.0 5 votes vote down vote up
static long maxSeqNosInReader(DirectoryReader reader) throws IOException {
    long maxSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
    for (LeafReaderContext leaf : reader.leaves()) {
        final NumericDocValues seqNoDocValues = leaf.reader().getNumericDocValues(SeqNoFieldMapper.NAME);
        while (seqNoDocValues.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
            maxSeqNo = SequenceNumbers.max(maxSeqNo, seqNoDocValues.longValue());
        }
    }
    return maxSeqNo;
}
 
Example 6
Source File: EngineTestCase.java    From crate with Apache License 2.0 4 votes vote down vote up
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, MergePolicy mergePolicy,
                           ReferenceManager.RefreshListener externalRefreshListener,
                           ReferenceManager.RefreshListener internalRefreshListener,
                           LongSupplier globalCheckpointSupplier) {
    IndexWriterConfig iwc = newIndexWriterConfig();
    TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE);
    Engine.EventListener listener = new Engine.EventListener() {
        @Override
        public void onFailedEngine(String reason, @Nullable Exception e) {
            // we don't need to notify anybody in this test
        }
    };
    final List<ReferenceManager.RefreshListener> extRefreshListenerList =
        externalRefreshListener == null ? emptyList() : Collections.singletonList(externalRefreshListener);
    final List<ReferenceManager.RefreshListener> intRefreshListenerList =
        internalRefreshListener == null ? emptyList() : Collections.singletonList(internalRefreshListener);

    if (globalCheckpointSupplier == null) {
        globalCheckpointSupplier = new ReplicationTracker(shardId, allocationId.getId(), indexSettings, SequenceNumbers.NO_OPS_PERFORMED, update -> {
        });
    }

    return new EngineConfig(
        shardId,
        allocationId.getId(),
        threadPool,
        indexSettings,
        store,
        mergePolicy,
        iwc.getAnalyzer(),
        new CodecService(null, logger),
        listener,
        IndexSearcher.getDefaultQueryCache(),
        IndexSearcher.getDefaultQueryCachingPolicy(),
        translogConfig,
        TimeValue.timeValueMinutes(5),
        extRefreshListenerList,
        intRefreshListenerList,
        new NoneCircuitBreakerService(),
        globalCheckpointSupplier,
        primaryTerm,
        tombstoneDocSupplier());
}