You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by yuan yao <sm...@gmail.com> on 2016/10/25 08:07:06 UTC

Delete and insert rows in one batch

Dear all,

In my project, because it's a legacy system, I have to run below CQL
statements in one batch:

BEGIN BATCH

delete from "Volume" where key='urn:storageos:Volume:
abf3614c-cd26-40b4-8543-e2d84e2fae70:vdc1' and
column1='thinVolumePreAllocationSize'
and column2='' and column3='';

insert into "Volume" (key, column1, column2, column3, column4, value)
values ('urn:storageos:Volume:abf3614c-cd26-40b4-8543-e2d84e2fae70:vdc1',
'thinVolumePreAllocationSize-temp', '', '', now(), intasblob(1));

APPLY BATCH;

After run this batch, old data has been deleted, but new data NOT inserted
into DB.

Below is table schema:

CREATE TABLE "Volume" (

  key text,

  column1 text,

  column2 text,

  column3 text,

  column4 timeuuid,

  value blob,

  PRIMARY KEY (key, column1, column2, column3, column4)

) WITH COMPACT STORAGE AND

  bloom_filter_fp_chance=0.010000 AND

  caching='{"keys":"ALL", "rows_per_partition":"NONE"}' AND

  comment='' AND

  dclocal_read_repair_chance=0.100000 AND

  gc_grace_seconds=432000 AND

  read_repair_chance=0.000000 AND

  default_time_to_live=0 AND

  speculative_retry='NONE' AND

  memtable_flush_period_in_ms=0 AND

  compaction={'class': 'SizeTieredCompactionStrategy'} AND

  compression={'sstable_compression': 'LZ4Compressor'};


Cassandra version is 2.1.11


Do you know why insert statement doesn't work in this case?



Thanks.

Yuan.