mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 00:50:35 +00:00
cql: fix lists::setter to use a tombstone
Properly squash existing value
This commit is contained in:
@@ -328,16 +328,12 @@ public:
|
||||
}
|
||||
|
||||
virtual void execute(mutation& m, const exploded_clustering_prefix& prefix, const update_parameters& params) override {
|
||||
tombstone ts;
|
||||
if (column.type->is_multi_cell()) {
|
||||
// delete + append
|
||||
// FIXME:
|
||||
warn(unimplemented::cause::COLLECTIONS);
|
||||
#if 0
|
||||
CellName name = cf.getComparator().create(prefix, column);
|
||||
cf.addAtom(params.makeTombstoneForOverwrite(name.slice()));
|
||||
#endif
|
||||
ts = params.make_tombstone_just_before();
|
||||
}
|
||||
do_append(_t, m, prefix, column, params);
|
||||
do_append(_t, m, prefix, column, params, ts);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -418,7 +414,8 @@ public:
|
||||
mutation& m,
|
||||
const exploded_clustering_prefix& prefix,
|
||||
const column_definition& column,
|
||||
const update_parameters& params) {
|
||||
const update_parameters& params,
|
||||
tombstone ts = {}) {
|
||||
auto&& value = t->bind(params._options);
|
||||
auto&& list_value = dynamic_pointer_cast<lists::value>(value);
|
||||
auto&& ltype = dynamic_pointer_cast<list_type_impl>(column.type);
|
||||
@@ -431,6 +428,7 @@ public:
|
||||
|
||||
auto&& to_add = list_value->_elements;
|
||||
collection_type_impl::mutation appended;
|
||||
appended.tomb = ts;
|
||||
appended.cells.reserve(to_add.size());
|
||||
for (auto&& e : to_add) {
|
||||
auto uuid1 = utils::UUID_gen::get_time_UUID_bytes();
|
||||
|
||||
@@ -501,11 +501,8 @@ SEASTAR_TEST_CASE(test_list_insert_update) {
|
||||
}).then([state, db] {
|
||||
return state->execute_cql("update cf set list1 = [ 1002, 1003 ] where p1 = 'key1';").discard_result();
|
||||
}).then([state, db] {
|
||||
#if 0
|
||||
// test fails due to lack of collection tombstones (append instead of replace)
|
||||
return require_column_has_value(*db, ks_name, table_name, {sstring("key1")}, {},
|
||||
"list1", list_type_impl::native_type({boost::any(1002), boost::any(1003)}));
|
||||
#endif
|
||||
}).then([db] {
|
||||
return db->stop();
|
||||
}).then_wrapped([db] (future<> f) mutable {
|
||||
|
||||
Reference in New Issue
Block a user