cdrs-tokio: schema change event is never received
Consider the following code:
let user = "cassandra";
let password = "cassandra";
let auth = StaticPasswordAuthenticatorProvider::new(&user, &password);
let config = NodeTcpConfigBuilder::new()
.with_contact_point("127.0.0.1:9042".into())
.with_authenticator_provider(Arc::new(auth))
.build()
.await
.unwrap();
let session = TcpSessionBuilder::new(RoundRobinLoadBalancingStrategy::new(), config)
.build()
.unwrap();
let mut event_recv = session.create_event_receiver();
sleep(Duration::from_secs(3)).await; // let the driver finish connecting to the cluster and registering for the events
let create_ks = "CREATE KEYSPACE IF NOT EXISTS test_events_ks WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
session.query(create_ks).await.unwrap();
let event = timeout(Duration::from_secs(10), event_recv.recv())
.await
.unwrap()
.unwrap();
Before https://github.com/krojew/cdrs-tokio/commit/bc021f4ee93c87bef922f5bf6cbac7b9780c10f6 event_recv.recv() would complete, with that commit it now times out
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (16 by maintainers)
@vaikzs I think there should be a fix next week.
You might be having a race condition somewhere.
That explains why the events are not delivered - the control connection is down, because
system.peers_v2doesn’t exist. CDRS should switch to usingsystem.peers, but it fails for some reason. Probably there’s an execution path inClusterMetadataManagerwhere that doesn’t happen. Will investigate.Hold on - my mistake. The change refers to DDL, not current schema, so there should be an event present.