Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist sequence number checkpoints #18949

Merged
merged 12 commits into from
Jun 22, 2016
Merged

Persist sequence number checkpoints #18949

merged 12 commits into from
Jun 22, 2016

Conversation

jasontedor
Copy link
Member

This commit adds persistence for local and global sequence number
checkpoints. We also recover the max sequence number in a shard,
although there will be loss here today from delete operations. This will
be addressed in a follow-up.

Relates #10708

currentMin = Math.min(currentMin, value);
currentMax = Math.max(currentMax, value);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant think of any place where we would want a full top level scan like this. Can we return -1 or null or throw uoe? This acts O(n^2) in a near real time system. Do we know of any other loops like this in this stats code?

Copy link
Member Author

@jasontedor jasontedor Jun 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation will not be the permanent implementation, it is temporary as we iterate in this feature branch. This method is only used when starting an engine, and is needed for recovery (either locally or from a peer).

This commit adds persistence for local and global sequence number
checkpoints. We also recover the max sequence number in a shard,
although there will be loss here today from delete operations. This will
be addressed in a follow-up.
mergeScheduler = scheduler = new EngineMergeScheduler(engineConfig.getShardId(), engineConfig.getIndexSettings());
throttle = new IndexThrottle();
this.searcherFactory = new SearchFactory(logger, isClosed, engineConfig);
try {
writer = createWriter(openMode == EngineConfig.OpenMode.CREATE_INDEX_AND_TRANSLOG);
final long localCheckpoint = loadLocalCheckpointFromCommit(writer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe load a SeqNoStats with one method? this is probably how it's going to be?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed 5032fa7.

@bleskes
Copy link
Contributor

bleskes commented Jun 20, 2016

looks good! left some minor comments

This commit adds a nocommit to the SeqNoFieldType#stats method as the
implementation is temporary until late-binding commits are available.
This commit moves the global checkpoint commit key from the global
checkpoint service to the internal engine where it is better placed for
clarity. This commit also enables marking this field as having default
access.
This commit moves the local checkpoint commit key from the local
checkpoint service to the internal engine where it is better placed for
clarity. This commit also enables marking this field as having default
access.
This commit removes a constructor from the global checkpoint service
that was only used in tests.
This commit removes a constructor from the local checkpoint service that
was only used in tests.
This commit reduces the visibility of certain fields and methods in the
local and global checkpoint services.
This commit simplifies the loading of sequence number stats from a
commit point by combining all the logic for loading into a single method
that returns an instance of SeqNoStats rather than three separate
methods that return longs.
This commit fixes an issue with the calculation of sequence number field
stats when all docs are deleted. Namely, when all docs are deleted we
would return a FieldStats instance when the intention is to return null.
This commit clarifies local and global checkpoint service initialization
by adding Javadocs and rewriting some of the field initialization to
clarify the initial values.
This commit simplifies an internal engine test for sequence number
checkpoint persistence. For now, we will ignore the issues surrounding
delete which will be addressed in follow-up work. We also remove the
complexity of the interaction between a primary shard and a replica
(although we simulate advancing the local checkpoint on a replica and
the corresponding advancement of the global checkpoint). Finally, we add
a translog recovery component to the test.
This commit adds a test for global checkpoint persistence to the commit
stats internal engine test. Note that this test now randomizes the
values of the local and global checkpoints.
@jasontedor
Copy link
Member Author

jasontedor commented Jun 21, 2016

looks good! left some minor comments

@bleskes I've responded to all of your feedback.

@bleskes
Copy link
Contributor

bleskes commented Jun 22, 2016

LGTM

@jasontedor jasontedor merged commit 275ea68 into elastic:feature/seq_no Jun 22, 2016
@jasontedor jasontedor deleted the checkpoint-persistence branch June 22, 2016 15:05
@clintongormley clintongormley added :Engine :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Sequence IDs labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement v5.0.0-alpha4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants