String inserts with the same primary key replace previous entries in Cassandra

Created a table in Cassandra, where the primary key is based on two columns (groupname, type). When I try to insert more than one line where the group name and type are the same, then in this situation it does not save more than one line, then writes where the groupname and type are the same .. then the last record replaces previous similar records. Why does Cassandra replace in this way instead of writing each line im inserting?

Record 1

cqlsh:resto> insert into restmaster (rest_id,type,rname,groupname,address,city,country)values(blobAsUuid(timeuuidAsBlob(now())),'SportsBar','SportsDen','VK Group','Majestic','Bangalore','India');

Write 2

insert into restmaster (rest_id,type,rname,groupname,address,city,country)values(blobAsUuid(timeuuidAsBlob(now())),'SportsBar','Sports Spot','VK Group','Bandra','Mumbai','India');

Write 3

cqlsh:resto> insert into restmaster (rest_id,type,rname,groupname,address,city,country)values(blobAsUuid(timeuuidAsBlob(now())),'SportsBar','Cricket Heaven ','VK Group','Connaught Place','New Delhi','India');

Result Im expecting (check lines 4,5,6)

 groupname      | type       | rname
----------------+------------+-----------------
           none |      Udipi |  Gayatri Bhavan
           none |     dinein |    Blue Diamond
       VK Group |  FoodCourt |        FoodLion
       VK Group |  SportsBar |      Sports Den
       VK Group |  SportsBar |     Sports Spot
       VK Group |  SportsBar |  Cricket Heaven
  Viceroy Group | Vegetarian |  Palace Heights
 Mainland Group |    Chinese |  MainLand China
      JSP Group |  FoodCourt |        Nautanki
          Ohris |  FoodCourt |           Ohris

But this is the actual result (record 3 replaced the previous 2 inserts [lines 4,5])

 cqlsh:resto> select groupname,type,rname From restmaster;

 groupname      | type       | rname
----------------+------------+-----------------
           none |      Udipi |  Gayatri Bhavan
           none |     dinein |    Blue Diamond
       VK Group |  FoodCourt |        FoodLion
       VK Group |  SportsBar | Cricket Heaven 
  Viceroy Group | Vegetarian |  Palace Heights
 Mainland Group |    Chinese |  MainLand China
      JSP Group |  FoodCourt |        Nautanki
          Ohris |  FoodCourt |           Ohris


cqlsh:resto> describe table restmaster;

CREATE TABLE restmaster (
  groupname text,
  type text,
  address text,
  city text,
  country text,
  rest_id uuid,
  rname text,
  PRIMARY KEY ((groupname), type)
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  index_interval=128 AND
  read_repair_chance=0.000000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  default_time_to_live=0 AND
  speculative_retry='99.0PERCENTILE' AND
  memtable_flush_period_in_ms=0 AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};
+4
source share
1

Cassandra /, . , , .

: http://www.datastax.com/documentation/cql/3.1/cql/cql_intro_c.html

:

Primary Key ((groupname),type,rname)

, . , , - " ?" Cassandra . , , : " , , , , "

,

 SELECT * FROM restmaster WHERE groupname = 'Lettuce Entertain You' ;
 SELECT * FROM restmaster WHERE groupname = 'Lettuce Entertain You' and type = 'Formal'  ;
 SELECT * FROM restmaster WHERE groupname = 'Lettuce Entertain You' and type = 'Formal' 
    and rname > 'C' and rname < 'Y' ;

, , , , , .

+5

All Articles