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

Sharded store #53

Merged
merged 4 commits into from
Oct 13, 2016
Merged

Sharded store #53

merged 4 commits into from
Oct 13, 2016

Conversation

ashwanthkumar
Copy link
Owner

For some use-cases where we can't have one large database (like RocksDB) for storing multi-terrabyte data. It would be great to have sharding of the Store and a wrapper store that manages it for us automatically.

ShardedStore extends Store, so it's a drop-in replacement for all of the existing stores and you would start having multiple shards automatically. If the existing store already has some data, they might have to be re-played or converted to the newer format. I would have written a tool for migration but since we still don't expose the scan interface on store, it's not possible to write a generic utility that can do this for us.

@brewkode Please check this out.

@codecov-io
Copy link

codecov-io commented Oct 11, 2016

Current coverage is 64.44% (diff: 63.63%)

Merging #53 into master will increase coverage by 0.57%

@@             master        #53   diff @@
==========================================
  Files            26         27     +1   
  Lines           465        481    +16   
  Methods           0          0          
  Messages          0          0          
  Branches         74         80     +6   
==========================================
+ Hits            297        310    +13   
+ Misses          126        123     -3   
- Partials         42         48     +6   

Sunburst

Powered by Codecov. Last update 265d308...7c1e69f

* Take care to not throw exceptions in this method. If it does,
* we propagate that error back to the service who invoked us.
*/
class ShardedStore(partitionsPerNode: Int, hashFn: Hash, createStore: (Int) => Store) extends Store with Logging {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is createStore() a function?

Copy link
Owner Author

Choose a reason for hiding this comment

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

We should be lazily creating a new store for each partition la?

@ashwanthkumar
Copy link
Owner Author

Merging this since we need it for our finder benchmarks. Please share any feedback, I'll fix them in a separate PR.

@ashwanthkumar ashwanthkumar merged commit b1324d6 into master Oct 13, 2016
@ashwanthkumar ashwanthkumar deleted the sharded-store branch October 13, 2016 20:28
when(hash.hash("1".getBytes)).thenReturn(1)
when(hash.hash("2".getBytes)).thenReturn(2)

val store1 = mock(classOf[Store])
Copy link
Collaborator

@brewkode brewkode Oct 14, 2016

Choose a reason for hiding this comment

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

why can't we pass in-memory store and avoid the mocking here? Applies for all tests for ShardedStore

Copy link
Owner Author

Choose a reason for hiding this comment

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

Actually you're right, We could use that. I was thinking more from just interactions that's why I went with mocks. In this case we could use that too.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Tracking it as part of #55

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

Successfully merging this pull request may close these issues.

3 participants