k8ssandra / management-api-for-apache-cassandra

RESTful / Secure Management Sidecar for Apache Cassandra
Apache License 2.0
70 stars 51 forks source link

Compaction throws NullPointerException but returns 202 Accepted #437

Closed emerkle826 closed 5 months ago

emerkle826 commented 7 months ago

In the context of cass-operator, it seems that invoking the /api/v1/ops/tables/compact endpoint returns a 202 Accepted, but cass-operator logs show that the task failed due to a NullPointerException:

"error": "task failed: java.lang.NullPointerException"

burmanm commented 5 months ago
ERROR [epollEventLoopGroup-5-3] 2024-02-06 12:44:25,846 NodeOpsProvider.java:97 - Task 8a0b3e1b-fd2a-4514-ae76-07ccd8214a7e execution failed
java.util.concurrent.CompletionException: java.lang.NullPointerException
        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1739)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException: null
        at com.datastax.mgmtapi.NodeOpsProvider.lambda$forceKeyspaceCompaction$6(NodeOpsProvider.java:396)
        at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
        ... 3 common frames omitted
burmanm commented 5 months ago

It's because the compactRequest.tables is used if no tokenRange is set, but tables is used if tokenRange is set. The latter is correct, compactRequest.tables can be null, tables can't.