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

4.x: Make driver invalidate tablets #377

Open
dkropachev opened this issue Nov 22, 2024 · 0 comments
Open

4.x: Make driver invalidate tablets #377

dkropachev opened this issue Nov 22, 2024 · 0 comments
Assignees

Comments

@dkropachev
Copy link
Collaborator

dkropachev commented Nov 22, 2024

Invalidation on events

  • On SCHEMA_CHANGE, for target keyspace + table, for all change types: UPDATED or DROPPED drop related tablet records.
  • On TOPOLOGY_CHANGE, for REMOVED_NODE (and probably MOVED_NODE) change type, all tablet records that contains this node, to be removed.

Possible optimizations:

  • On SCHEMA_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 voided

Invalidation on control connection reconnect

When cc is lost, driver can miss some of the events.
So we need some logic to catch up:

  • Read keyspace and table descriptions to find if any keyspace or table was removed or updated, doing exactly the same what should be done for SCHEMA_CHANGE event.
  • Read system.peers to find if any node was removed and do the same what should be done for TOPOLOGY_CHANGE event.
Bouncheck added a commit to Bouncheck/java-driver that referenced this issue Nov 28, 2024
Previously the tablet map would be completely emptied on node removal,
necessitating full rebuild of it. With this change the TabletMap will
be scanned through on node removals (`RemoveNodeRefresh`) in order to delete
only those tablets, that contain removed node as one of the replicas.

Additionally we introduce `TabletMapSchemaChangeListener` which will be
automatically registered on context initialization as long as schema metadata
is enabled. It won't be added if the schema metadata is enabled later at
runtime. This listener ensures that relevant tablets will be removed
on removals and updates of both keyspaces and tables.
The `TabletMapSchemaChangesIT` tests its behaviour.

Addresses scylladb#377.
Bouncheck added a commit to Bouncheck/java-driver that referenced this issue Nov 28, 2024
Previously the tablet map would be completely emptied on node removal,
necessitating full rebuild of it. With this change the TabletMap will
be scanned through on node removals (`RemoveNodeRefresh`) in order to delete
only those tablets, that contain removed node as one of the replicas.

Additionally we introduce `TabletMapSchemaChangeListener` which will be
automatically registered on context initialization as long as schema metadata
is enabled. It won't be added if the schema metadata is enabled later at
runtime. This listener ensures that relevant tablets will be removed
on removals and updates of both keyspaces and tables.
The `TabletMapSchemaChangesIT` tests its behaviour.

Addresses scylladb#377.
dkropachev pushed a commit that referenced this issue Nov 29, 2024
Previously the tablet map would be completely emptied on node removal,
necessitating full rebuild of it. With this change the TabletMap will
be scanned through on node removals (`RemoveNodeRefresh`) in order to delete
only those tablets, that contain removed node as one of the replicas.

Additionally we introduce `TabletMapSchemaChangeListener` which will be
automatically registered on context initialization as long as schema metadata
is enabled. It won't be added if the schema metadata is enabled later at
runtime. This listener ensures that relevant tablets will be removed
on removals and updates of both keyspaces and tables.
The `TabletMapSchemaChangesIT` tests its behaviour.

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

No branches or pull requests

2 participants