-
Notifications
You must be signed in to change notification settings - Fork 39
Description
I'm not sure maybe I'm doing something wrong, but in all use cases TabletMap is empty. I did try with different RF, single and multi node cluster - the result was the same.
According to the implementation TabletMap can only be obtained on SELECT response, therefore I'm also doing read query, but incoming payload is always empty https://github.com/scylladb/java-driver/blob/scylla-4.x/core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandler.java#L483
Also, because implementation updates the TabletMap only on the read path, it makes impossible to use correct routing for write-only applications (for example, ETL, like reading from Kafka and writing to Scylla and never read from it).
This extension adds support for sending tablet info to the drivers if the request was routed to the wrong node/shard.
And in meanwhile below
The info is send when driver asks about the information that the specific tablet contains and it is directed to the wrong node/shard
Maybe because what is "request" and "asks" means does not specified, then implementation decided to update TableMap only for the read path, but maybe the same implementation on the server side, I'm not sure
Relates to: #497
Example:
val session = CqlSessionBuilder()
.addContactPoints(listOf(InetSocketAddress("127.0.1.1", 9042)))
.withLocalDatacenter("datacenter1")
.build()
session.execute(
"""
CREATE KEYSPACE IF NOT EXISTS my_keyspace
WITH replication = { 'class': 'NetworkTopologyStrategy', 'replication_factor': 1 }
AND tablets = { 'enabled': true }
AND durable_writes = true;
"""
)
session.execute(
"""
CREATE TABLE IF NOT EXISTS my_keyspace.my_table
(
p text,
c text,
v text,
PRIMARY KEY (p, c)
) WITH CLUSTERING ORDER BY (c ASC)
AND compaction = { 'class' : 'SizeTieredCompactionStrategy' };
"""
)
session.execute(
"""
INSERT INTO my_keyspace.my_table(p,c,v) VALUES ('hello','world','!');
"""
)
session.execute(
"""
SELECT * FROM my_keyspace.my_table;
"""
)
val tablets = session.metadata.tabletMap.mapping
require(tablets.isNotEmpty())