use of org.apache.cassandra.hints.HintMessage in project cassandra by apache.
the class MessageFiltersTest method hintSerializationTest.
@Test
public void hintSerializationTest() throws Exception {
try (Cluster cluster = init(builder().withNodes(3).withConfig(config -> config.with(GOSSIP).with(NETWORK).set("hinted_handoff_enabled", true)).start())) {
cluster.schemaChange(withKeyspace("CREATE TABLE %s.tbl (k int PRIMARY KEY, v int)"));
executeWithWriteFailure(cluster, withKeyspace("INSERT INTO %s.tbl (k, v) VALUES (1,1)"), ConsistencyLevel.QUORUM, 1);
CountDownLatch latch = new CountDownLatch(1);
cluster.filters().verbs(Verb.HINT_REQ.id).messagesMatching((a, b, msg) -> {
cluster.get(1).acceptsOnInstance((IIsolatedExecutor.SerializableConsumer<IMessage>) (m) -> {
HintMessage hintMessage = (HintMessage) Instance.deserializeMessage(m).payload;
assert hintMessage != null;
}).accept(msg);
latch.countDown();
return false;
}).drop().on();
cluster.schemaChange(withKeyspace("DROP TABLE %s.tbl"));
latch.await();
}
}
Aggregations