How to remove a large number of lines in Cassandra (and avoid potential tombstone problems)?

To simplify the simplification of the data model, we have the following tables:

CREATE TABLE storage (
    id timeuuid,
    foo blob,
    bar blob,
    baz blob,
    data blob,
    PRIMARY KEY ((id))
);

CREATE TABLE storage_idx_by_foo (
    foo blob,
    id timeuuid,
    PRIMARY KEY ((foo), id)
);

CREATE TABLE storage_idx_by_bar (
    bar blob,
    id timeuuid,
    PRIMARY KEY ((bar), id)
);

CREATE TABLE storage_idx_by_baz (
    baz blob,
    id timeuuid,
    PRIMARY KEY ((baz), id)
);

The first table can contain hundreds of millions of records, and we use index tables to easily find data based on some requested parameters.

The problem arises when we have to clear data based on foo, bar or baz. We must delete the entry from the storage table and all index tables. So, suppose we delete, for example. foo , follow these steps:

  • Find the identifier based on the corresponding index table (in this case storage_idx_by_foo)
  • Get panel and baz and delete entry from storage table
  • ( bar/baz id)

№3 - - - ( ), Cassandra , , .

:

  • ,
  • ????

? , Cassandra , , " Cassandra ". , -, (, , ).

2, .

+4
1

", "!!

? , , . . , (, ..).

, foo, bar baz, , , . , , , , - foo ( baz). , , . , , , . foo bar baz , . . bucketing. , , , " foo x " " foo x / ..". .

, , node . , :

CREATE TABLE storage (
    some_bucket text,
    id timeuuid,
    foo blob,
    bar blob,
    baz blob,
    data blob,
    PRIMARY KEY (somebucket, id)
);

:

CREATE TABLE storage (
    bucket text,
    foo blob,
    bar blob,
    baz blob,
    data blob,
    PRIMARY KEY (bucket)
);

cassandra foo, bar baz. . , , , , , -. Cassandra 3.0 , , ​​ , , + , .

... . . . LSM db , - cassandra () . , . , , nodetool :

http://www.datastax.com/documentation/cassandra/2.1/cassandra/tools/toolsDisableAutoCompaction.html

, :

http://www.datastax.com/documentation/cassandra/2.1/cassandra/tools/toolsCompact.html

.

, , "", , , , .

, .

+1

Source: https://habr.com/ru/post/1569252/


All Articles