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

ethdb/s3: segment storage #235

Merged
merged 7 commits into from
Sep 2, 2018
Merged

ethdb/s3: segment storage #235

merged 7 commits into from
Sep 2, 2018

Conversation

benbjohnson
Copy link
Contributor

Overview

This pull request adds support for S3-backed tiered storage for ethdb. It works by injecting an ethdb.SegmentOpener & ethdb.SegmentCompactor into ethdb.DB so that segments can be backed up upon compaction and fetched as necessary. The ethdb.Table holds a reference to the s3.Segment which will open/fetch segments on request.

This pull request does not include the LRU cache to limit the maximum space used. That will come in a later PR.

Usage

The S3 configuration can be set from the CLI or configuration:

$ gochain console --ethdb.endpoint ENDPOINT --ethdb.bucket BUCKET --ethdb.accesskeyid ACCESSKEYID --ethdb.secretaccesskey SECRETACCESSKEY

The archive tool has been removed. The configuration fields are now in the node.Config.

Testing

An integration test has been added to the ethdb/s3 package to test the uploading & fetching. It can be run by specifying the integration build tag and passing in the appropriate flags:

$ test -tags integration ./ethdb/s3 -endpoint ENDPOINT -bucket BUCKET -access-key-id ACCESSKEYID -secret-access-key SECRETACCESSKEY

@benbjohnson benbjohnson self-assigned this Jul 20, 2018
semaphore: semaphore.NewWeighted(int64(maxOpenCount)),
segments: make(map[string]Segment),
}
ss.cache, _ = lru.NewWithEvict(maxOpenCount, ss.onEvicted)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to ignore this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it only returns an error if maxOpenCount is less than 1. I added a default at the top of this function: https://github.com/gochain-io/gochain/pull/235/files/0a6dbc9ae552b875cd0450627b9c8f1c89976a23#diff-4a5dc09daf342ff846651415bb5cc7c2R22

@benbjohnson benbjohnson merged commit 4a7b49d into ethdb Sep 2, 2018
@treeder treeder added enhancement major Major changes or enhancements. labels Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement major Major changes or enhancements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants