[
https://issues.apache.org/jira/browse/CASSANDRA-11570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Joshua McKenzie updated CASSANDRA-11570:
----------------------------------------
Assignee: Tyler Hobbs
> Concurrent execution of prepared statement returns invalid JSON as result
> -------------------------------------------------------------------------
>
> Key: CASSANDRA-11570
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11570
> Project: Cassandra
> Issue Type: Bug
> Environment: Cassandra 3.2, C++ or C# driver
> Reporter: Alexander Ryabets
> Assignee: Tyler Hobbs
> Attachments: CassandraPreparedStatementsTest.zip, broken_output.txt,
> test_neptunao.cql, valid_output.txt
>
>
> When I use prepared statement for async execution of multiple statements I
> get JSON with broken data. Keys got totally corrupted when values seems to be
> normal though.
> First I encoutered this issue when I were performing stress testing of our
> project using custom script. We are using DataStax C++ driver and execute
> statements from different fibers.
> Then I was trying to isolate problem and wrote simple C# program which starts
> multiple Tasks in a loop. Each task uses the once created prepared statement
> to read data from the base. As you can see results are totally mess.
> I 've attached archive with console C# project (1 cs file) which just print
> resulting JSON to user.
> Here is the main part of C# code.
> {noformat}
> static void Main(string[] args)
> {
> const int task_count = 300;
> using(var cluster = Cluster.Builder().AddContactPoints(/*contact points
> here*/).Build())
> {
> using(var session = cluster.Connect())
> {
> var prepared = session.Prepare("select json * from test_neptunao.ubuntu
> where id=?");
> var tasks = new Task[task_count];
> for(int i = 0; i < task_count; i++)
> {
> tasks[i] = Query(prepared, session);
> }
> Task.WaitAll(tasks);
> }
> }
> Console.ReadKey();
> }
> private static Task Query(PreparedStatement prepared, ISession session)
> {
> string id = GetIdOfRandomRow();
> var stmt = prepared.Bind(id);
> stmt.SetConsistencyLevel(ConsistencyLevel.One);
> return session.ExecuteAsync(stmt).ContinueWith(tr =>
> {
> foreach(var row in tr.Result)
> {
> var value = row.GetValue<string>(0);
> //some kind of output
> }
> });
> }
> {noformat}
> I also attached cql script with test DB schema.
> {noformat}
> CREATE KEYSPACE IF NOT EXISTS test_neptunao
> WITH replication = {
> 'class' : 'SimpleStrategy',
> 'replication_factor' : 3
> };
> use test_neptunao;
> create table if not exists ubuntu (
> id timeuuid PRIMARY KEY,
> precise_pangolin text,
> trusty_tahr text,
> wily_werewolf text,
> vivid_vervet text,
> saucy_salamander text,
> lucid_lynx text
> );
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)