-
Notifications
You must be signed in to change notification settings - Fork 12
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
Sharded store #53
Conversation
Current coverage is 64.44% (diff: 63.63%)@@ 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
|
* 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
Merging this since we need it for our finder benchmarks. Please share any feedback, I'll fix them in a separate PR. |
when(hash.hash("1".getBytes)).thenReturn(1) | ||
when(hash.hash("2".getBytes)).thenReturn(2) | ||
|
||
val store1 = mock(classOf[Store]) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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 thescan
interface on store, it's not possible to write a generic utility that can do this for us.@brewkode Please check this out.