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
[Do not merge] First cut at dynamic sharding support #392
[Do not merge] First cut at dynamic sharding support #392
Conversation
+1 very clever approach :) Generally speaking, don't you think the ShardIdentifierProvider should superseed the IndexShardingStrategy ? I add some more details in the code as comments. |
IndexManagerHolder indexManagerHolder, | ||
IndexManagerFactory indexManagerFactory) { | ||
if ( !isDynamicSharding && providers.length == 0 ) { | ||
throw log.entityWithNoShard( type ); |
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 a zero-shards entity invalid?
I'm wondering about the multitenancy use case, if the application should not be able to deploy with an initial state of zero tenants.
Queries would return zero elements; while on an add operation the ShardIdentifierProvider has to return an id anyway.. which would trigger creation of an indexmanager.
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.
0 shard is not legal for static shards as ti will always stay 0 :). In case of dynamic sharding (value set to dynamic
), we don't throw the exception.
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.
right :)
misinterpreted the condition.
I've added many more comments on the code - this is just to make sure you see them as I'm not sure it will notify you as I closed the issue initially. |
I did not think about deprecating |
We could use ShardIdentifierProvider#getAllShardIdentifiers for that? Since we validate IndexManager configuration options only when it's started it would be good to be eager on initializing those for which it's possible. |
Different thought: looks like the user code should be able to interact directly with the ShardIdentifierProvider instance, right? I mean in the multi-tenant use case you want to be able to let it know you are creating a new tenant. another nice use case coming to mind is per-language independent indexes.. would it make sense to combine two levels of dynamic sharding? |
Yes, in an ideal world
Not entirely satisfactory, would be nice to enlist a callback.
Dow we need to have built-in layers of sharding or leave that to the |
It turns out, when building the SF, we call EIB.getIndexManagers() and thus eagerly initialize the indexes. so we are good. |
what you called
is ~ available today as
but I agree the getMetada() is looking better.. just we don't have that yet. |
From today's forum posts, I'm convinced it would be awesome to have a dynamic sharding option working out of the box for multiple languages, extending the use case we documented for dynamic analyzers: http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/#d0e3840 As the tricky part for the above link is actually running queries on the appropriate index: needs to use a shard sensitive filter. |
I need to write down tests to finish that up but @Sanne could you give me your first impression on the proposal. I did not have to break any existing public interface. I even reuse the
IndexShardingStrategy
.If you have some advice on making the structure more scalable concurrency wise, I'm interested too.