-
Notifications
You must be signed in to change notification settings - Fork 38
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
3.x: Make driver invalidate tablets #378
Comments
Registers an event listener dedicated to updating the `TabletMap` held by `Metadata`. It will trigger removal of relevant mappings whenever it's notified of any change to the table schema or keyspace schema including dropping them. Introduces an integration test that verifies this listener's behaviour. Addresses scylladb#378.
Created #382 . Regarding invalidation on node removal, the tablet map already skips the replicas that are not currently recognized hosts as seen by Do you think I should proceed with removing stale hosts when encountered or is it fine as it is? |
What do you mean by "skips the replicas that are not currently recognized hosts as seen by If this is the case, then note that driver won't receive new tablet custom payload - because A and B are still replicas so queries made to them won't result in tablet feedback. This is the reason for removing tablets with removed replicas. This is not only important for downscaling, but also for replacing nodes, which is a more frequent operation afaik. |
Alternative to actively removing those tablets is ignoring them: during the query, after determining tablet for this query, check if all replicas are still in the cluster. If there is a stale replica, proceed as if the tablet was not present at all. I'm not convinced this will be a better solution performance-wise, because now you have those checks in a hot-path (query execution). If there is only one thread / worker (or whatever is the correct terminology here) that modifies tablets, then you can apply a similar strategy as we did in Rust Driver: copy on write: copy all the tablet data, modify the copy, switch the object to be used by queries. This eliminates any need for any locking. |
The tablet map will just return [A,B] even though it has C somewhere internally too, because the Metadata instance does not see C as alive host.
That's right. I see now that the intention was to drop the whole tablet, not just remove stale host from the replica list. |
I think I'll proceed with that. In java driver I need to ask Metadata instance about the hosts anyway. I do that in order to translate the UUIDs saved from tablets_routing_v1 payloads into already existing instances of And invalidating a whole tablet does not require a write lock unlike modifying part of it. |
I got the granularity in my comment wrong again: removing a mapping for a whole table does not require lock. For a singular tablet from the set of many for a specific table it does. |
Why would that be the case? Let's say that you have 20 nodes and RF=3. In that case a node will be a replica for ~15% of the tablets. You can calculate it here: https://opensource.docs.scylladb.com/stable/cql/consistency-calculator.html . This number will only go down for bigger clusters. Invalidating <15% of tablets sounds much better than invalidating 100% right? |
Yeah 15% is way too small to justify that (by that I mean throwing 100% away). Thanks for the clarifications. |
Makes TabletMap return empty collection for some calls to `getReplicas()`. If the current replica list for a tablet turns out to contain a host that is not present in current Metadata then empty collection is returned in an effort to misroute the query. This query will cause the tablet information to be updated when the result with the up to date information is received. It is possible that the query will be randomly routed correctly, but this case is significantly less likely with each subsequent query, although this can depend on underlying load balancing policy. This covers the node removal/replacement case of scylladb#378.
Makes TabletMap return empty collection for some calls to `getReplicas()`. If the current replica list for a tablet turns out to contain a host that is not present in current Metadata then empty collection is returned in an effort to misroute the query. This query will cause the tablet information to be updated when the result with the up to date information is received. It is possible that the query will be randomly routed correctly, but this case is significantly less likely with each subsequent query, although this can depend on underlying load balancing policy. This covers the node removal/replacement case of scylladb#378.
Registers an event listener dedicated to updating the `TabletMap` held by `Metadata`. It will trigger removal of relevant mappings whenever it's notified of any change to the table schema or keyspace schema including dropping them. Introduces an integration test that verifies this listener's behaviour. Addresses scylladb#378.
Registers an event listener dedicated to updating the `TabletMap` held by `Metadata`. It will trigger removal of relevant mappings whenever it's notified of any change to the table schema or keyspace schema including dropping them. Introduces an integration test that verifies this listener's behaviour. Addresses #378.
Makes TabletMap return empty collection for some calls to `getReplicas()`. If the current replica list for a tablet turns out to contain a host that is not present in current Metadata then empty collection is returned in an effort to misroute the query. This query will cause the tablet information to be updated when the result with the up to date information is received. It is possible that the query will be randomly routed correctly, but this case is significantly less likely with each subsequent query, although this can depend on underlying load balancing policy. This covers the node removal/replacement case of scylladb#378.
Makes TabletMap return empty collection for some calls to `getReplicas()`. If the current replica list for a tablet turns out to contain a host that is not present in current Metadata then empty collection is returned in an effort to misroute the query. This query will cause the tablet information to be updated when the result with the up to date information is received. It is possible that the query will be randomly routed correctly, but this case is significantly less likely with each subsequent query, although this can depend on underlying load balancing policy. This covers the node removal/replacement case of #378.
Invalidation on events
SCHEMA_CHANGE
, for targetkeyspace
+table
, for all change types:UPDATED
orDROPPED
drop related tablet records.TOPOLOGY_CHANGE
, forREMOVED_NODE
(and probablychange type, all tablet records that contains this node, to be removed.MOVED_NODE
)Possible optimizations:OnSCHEMA_CHANGE
change types:UPDATED
driver can look at what have changed and if nothing that can trigger tablet migration (say, ks replication factor and tablet feature on the table) is touched, then invalidation to be voidedInvalidation on control connection reconnect
When cc is lost, driver can miss some of the events.
So we need some logic to catch up:
SCHEMA_CHANGE
event.system.peers
to find if any node was removed and do the same what should be done forTOPOLOGY_CHANGE
event.The text was updated successfully, but these errors were encountered: