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

Reimplement snapshots as a new implementation of Engine interface. #256

Merged
merged 2 commits into from
Jan 15, 2015

Conversation

spencerkimball
Copy link
Member

This fixes a TODO in the code and helpful to upcoming changes to
implement asynchronous scans of ranges for custodial work. Without,
more Engine method variants taking snapshot IDs would be necessary.
This change is more in keeping with how we do Batch engines and is
simpler.

Also remove the InternalSnapshotCopy method, which will be replaced
by an in-Raft mechanism whereby the leader feeds the snapshot directly
to a requesting follower.

This fixes a TODO in the code and helpful to upcoming changes to
implement asynchronous scans of ranges for custodial work. Without,
more Engine method variants taking snapshot IDs would be necessary.
This change is more in keeping with how we do Batch engines and is
simpler.

Also remove the InternalSnapshotCopy method, which will be replaced
by an in-Raft mechanism whereby the leader feeds the snapshot directly
to a requesting follower.
@spencerkimball
Copy link
Member Author

@bdarnell

@@ -835,113 +816,6 @@ func TestRangeIdempotence(t *testing.T) {
}
}

// TestRangeSnapshot.
func TestRangeSnapshot(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would think you'd want some tests that the various snapshot methods do what you expect. Am I just missing where this testing is being done?

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, added unittests for all snapshot methods.

Changed NewSnapshot behavior to log an error and return nil if called
from a snapshot.
spencerkimball added a commit that referenced this pull request Jan 15, 2015
Reimplement snapshots as a new implementation of Engine interface.
@spencerkimball spencerkimball merged commit cf09deb into master Jan 15, 2015
@spencerkimball spencerkimball deleted the spencerkimball/snapshot-engine branch January 15, 2015 16:26
// read-only rocksDBSnapshot engine.
func (r *RocksDB) NewSnapshot() Engine {
if r.rdb == nil {
log.Errorf("RocksDB is not initialized yet")
Copy link
Contributor

Choose a reason for hiding this comment

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

In general I think it's better to panic than to log an error and return nil (when we cannot return an error) (here and inMemSnapshot.New{Batch,Snapshot})

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in #257

@bdarnell
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants