Caleb Rackliffe created CASSANDRA-20397:
-------------------------------------------
Summary: FQL does not handle explicit null/tombstones in prepared
statements
Key: CASSANDRA-20397
URL: https://issues.apache.org/jira/browse/CASSANDRA-20397
Project: Apache Cassandra
Issue Type: Bug
Components: Tool/fql
Reporter: Caleb Rackliffe
Assignee: Caleb Rackliffe
FQL will throw an NPE if it attempts to record a successful batch operation
containing a null bind value, which we obviously interpret as a tombstone. This
means it will be missing from any subsequent dump and completely ignored by
replay.
{noformat}
ERROR [node1_Binary Log thread:1] 2025-03-04 14:23:15,372 BinLog.java:271 -
Unexpected exception in binary log thread
java.lang.NullPointerException: null
at net.openhft.chronicle.bytes.BytesStore.wrap(BytesStore.java:131)
at
org.apache.cassandra.fql.FullQueryLogger$Batch.writeMarshallablePayload(FullQueryLogger.java:459)
at
org.apache.cassandra.utils.binlog.BinLog$ReleaseableWriteMarshallable.writeMarshallable(BinLog.java:364)
at
net.openhft.chronicle.wire.MarshallableOut.writeDocument(MarshallableOut.java:152)
at
org.apache.cassandra.utils.binlog.BinLog.processTasks(BinLog.java:250)
at org.apache.cassandra.utils.binlog.BinLog.run(BinLog.java:267)
{noformat}
The following quick test should hit it...
{noformat}
@Test
public void test() throws InterruptedException
{
CLUSTER.get(1).nodetool("enablefullquerylog", "--path",
temporaryFolder.getRoot().getAbsolutePath());
com.datastax.driver.core.Cluster.Builder builder1 =
com.datastax.driver.core.Cluster.builder().addContactPoint("127.0.0.1");
try (com.datastax.driver.core.Cluster cluster1 = builder1.build();
Session session1 = cluster1.connect())
{
BatchStatement batch = new
BatchStatement(BatchStatement.Type.UNLOGGED);
PreparedStatement preparedWrite = session1.prepare("INSERT INTO " +
KS_TBL + " (k, c, s) VALUES ( ?, ?, ?)");
batch.add(preparedWrite.bind(0, 0, null));
assertTrue(session1.execute(batch).wasApplied());
}
CLUSTER.get(1).nodetool("disablefullquerylog");
ToolRunner.ToolResult negativeRunner =
ToolRunner.invokeClass("org.apache.cassandra.fqltool.FullQueryLogTool",
"dump", temporaryFolder.getRoot().getAbsolutePath());
System.err.println(negativeRunner.getStdout());
}
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]