Hi,
I have used NoSQLBench a bit and it is a great tool. Now, I am trying to use the binding function CharBufImage(), but I must be doing something wrong.
The idea is to insert lines containing long texts in a Cassandra table (I'm using DSE version 6.8.6). A doc size of 20 is being used here, but the tests will require 100K+ characters/doc. I've already used function AlphaNumericString(int: length) to generate the docs, and it works, but since there's no need for a different doc for each line at this point, CharBufImage() seemed a lighter option, and that would be very helpful.
Here is the test schema:
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE test.docs ( id uuid, doc text, PRIMARY KEY (id) );
Here is the yaml file (I'm using NoSQLBench 4.15.51):
# test-charbuf.yaml # description: Test CharBufImage usage. scenarios: default: run driver=cql hosts=srv cycles=1..10 test: run driver=stdout cycles=1..10 bindings: doc: CharBufImage("a-z",20) -> java.nio.CharBuffer blocks: - name: block_1 tags: phase: insert params: cl: ONE statements: - cmd1: | insert into test.docs (id, doc) values ( uuid(), '{doc}' );
I run the two scenarios this way:
/opt/nb/nb test-charbuf test /opt/nb/nb test-charbuf
With the test scenario, which uses driver stdout, the output is as expected.
ze@local:~/tst$ /opt/nb/nb test-charbuf test insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' ); insert into test.docs (id, doc) values ( uuid(), 'xqaoxvdxybvcumaiddqu' );
However, with the default scenario, which uses the CQL driver, I get the following (the host address has been masked off).
ze@local:~/tst$ /opt/nb/nb test-charbuf [scenarios:001] INFO com.datastax.driver.core - DataStax Java Driver 1.9.0 for DataStax Enterprise (DSE) and Apache Cassandra® [scenarios:001] INFO com.datastax.driver.core.GuavaCompatibility - Detected Guava >= 19 in the classpath, using modern compatibility layer [scenarios:001] INFO com.datastax.driver.core.ClockFactory - Using native clock to generate timestamps. [scenarios:001] INFO com.datastax.driver.core.utils.UUIDs - PID obtained through native call to getpid(): 43453 [scenarios:001] INFO com.datastax.driver.core.NettyUtil - Found Netty's native epoll transport in the classpath, using it [scenarios:001] INFO com.datastax.driver.core.policies.DCAwareRoundRobinPolicy - Using data-center name 'dc1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor) [scenarios:001] INFO com.datastax.driver.core.Cluster - New Cassandra host srv/xxxxxxxxxxxxxxx:9042 added 6092 ERROR [testcharbuf_default_001:001] CoreMotor Error in core motor loop:java.lang.RuntimeException: Binding error:BindingsTemplate:'doc'=>"CharBufImage("a-z",20) -> java.nio.CharBuffer"=>[xqaoxvdxybvcumaiddqu](HeapCharBufferR) java.lang.RuntimeException: Binding error:BindingsTemplate:'doc'=>"CharBufImage("a-z",20) -> java.nio.CharBuffer"=>[xqaoxvdxybvcumaiddqu](HeapCharBufferR) at io.nosqlbench.virtdata.core.bindings.ContextualArrayBindings.bind(ContextualArrayBindings.java:41) at io.nosqlbench.activitytype.cql.statements.core.ReadyCQLStatement.bind(ReadyCQLStatement.java:51) at io.nosqlbench.activitytype.cql.core.CqlAction.runPhase(CqlAction.java:106) at io.nosqlbench.activitytype.cql.core.CqlAction.runCycle(CqlAction.java:85) at io.nosqlbench.engine.api.activityimpl.motor.CoreMotor.run(CoreMotor.java:405) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.base/java.util.Arrays$ArrayList.get(Unknown Source) at io.nosqlbench.activitytype.cql.statements.binders.UnsettableValuesBinder.bindValues(UnsettableValuesBinder.java:49) at io.nosqlbench.activitytype.cql.statements.binders.UnsettableValuesBinder.bindValues(UnsettableValuesBinder.java:12) at io.nosqlbench.virtdata.core.bindings.ContextualArrayBindings.bind(ContextualArrayBindings.java:39) ... 7 more 6104 WARN [scenarios:001] SCENARIO Error in scenario, shutting down. 6153 ERROR [main] ERRORHANDLER Error from driver or included library: java.lang.RuntimeException: javax.script.ScriptException: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 java.util.concurrent.ExecutionException: java.lang.RuntimeException: javax.script.ScriptException: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 at java.base/java.util.concurrent.FutureTask.report(Unknown Source) at java.base/java.util.concurrent.FutureTask.get(Unknown Source) at io.nosqlbench.engine.core.script.ScenariosExecutor.getAsyncResultStatus(ScenariosExecutor.java:150) at io.nosqlbench.engine.core.script.ScenariosExecutor.awaitAllResults(ScenariosExecutor.java:115) at io.nosqlbench.engine.core.script.ScenariosExecutor.awaitAllResults(ScenariosExecutor.java:73) at io.nosqlbench.engine.cli.NBCLI.run(NBCLI.java:405) at io.nosqlbench.engine.cli.NBCLI.main(NBCLI.java:69) Caused by: java.lang.RuntimeException: javax.script.ScriptException: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 at io.nosqlbench.engine.core.script.Scenario.runScenario(Scenario.java:307) at io.nosqlbench.engine.core.script.Scenario.call(Scenario.java:362) at io.nosqlbench.engine.core.script.Scenario.call(Scenario.java:56) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: javax.script.ScriptException: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 at io.nosqlbench.engine.core.lifecycle.ActivityExecutor.notifyException(ActivityExecutor.java:526) at io.nosqlbench.engine.core.lifecycle.ActivityExceptionHandler.uncaughtException(ActivityExceptionHandler.java:30) at java.base/java.lang.Thread.dispatchUncaughtException(Unknown Source) Caused by: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 ... 3 more Caused by: java.lang.RuntimeException: Binding error:BindingsTemplate:'doc'=>"CharBufImage("a-z",20) -> java.nio.CharBuffer"=>[xqaoxvdxybvcumaiddqu](HeapCharBufferR) at io.nosqlbench.virtdata.core.bindings.ContextualArrayBindings.bind(ContextualArrayBindings.java:41) at io.nosqlbench.activitytype.cql.statements.core.ReadyCQLStatement.bind(ReadyCQLStatement.java:51) at io.nosqlbench.activitytype.cql.core.CqlAction.runPhase(CqlAction.java:106) at io.nosqlbench.activitytype.cql.core.CqlAction.runCycle(CqlAction.java:85) at io.nosqlbench.engine.api.activityimpl.motor.CoreMotor.run(CoreMotor.java:405) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.base/java.util.Arrays$ArrayList.get(Unknown Source) at io.nosqlbench.activitytype.cql.statements.binders.UnsettableValuesBinder.bindValues(UnsettableValuesBinder.java:49) at io.nosqlbench.activitytype.cql.statements.binders.UnsettableValuesBinder.bindValues(UnsettableValuesBinder.java:12) at io.nosqlbench.virtdata.core.bindings.ContextualArrayBindings.bind(ContextualArrayBindings.java:39) ... 7 more 6155 ERROR [main] ERRORHANDLER cause (see stack trace for details):javax.script.ScriptException: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 java.lang.RuntimeException: javax.script.ScriptException: java.lang.RuntimeException: Error in activity thread testcharbuf_default_001:001 6156 WARN [Thread-1] SCENARIO Scenario was interrupted by process exit, shutting down