scylla-tools-java
scylla-tools-java copied to clipboard
sstableloader returns exit code 0 even if writes failed
It prints errors on stderr, but still will returns a success. May be a problem when this is run through some automation.
Relevant code in BulkLoader.java:
semaphore.acquire();
try {
ResultSetFuture future = session.executeAsync(s);
Futures.addCallback(future, new FutureCallback<ResultSet>() {
@Override
public void onSuccess(ResultSet result) {
semaphore.release();
}
@Override
public void onFailure(Throwable t) {
semaphore.release();
System.err.println(t);
}
}, MoreExecutors.directExecutor());
} finally {
}
@Orenef11 reported the same bug while writing a test for #220 and #230. Although syntax errors are reported during the sstableloader run (because of a bug that caused invalid CQL to be generated), at the end of the run sstableloader seemingly reports success, shows a count of partitions supposedly loaded, and returns exit code 0 - while it actually didn't manage to write anything.
The Scylla version is 2021-02-15T01:57:05Z (4.5)
The example of output returned from the command (the result code is 0) are :
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
...
...
...
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
com.datastax.driver.core.exceptions.SyntaxError: line 1:49 : missing elements...
100% done. 0 statements sent (in 0 batches, 0 failed).
2000 statements generated.
4000 cql rows processed in 2000 partitions.
0 cql rows and 0 partitions deleted.
0 local and 0 remote counter shards where skipped.