mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 12:06:44 +00:00
This will allow expressing lack of information about certain ranges of
rows (including the static row), which will be used in cache to
determine if information in cache is complete or not.
Continuity is represented internally using flags on row entries. The
key range between two consecutive entries is continuous iff
rows_entry::continuous() is true for the later entry. The range
starting after the last entry is assumed to be continuous. The range
corresponding to the key of the entry is continuous iff
rows_entry::dummy() is false.
[tgrabiec:
- based on the following commits:
4a5bf75 - Piotr Jastrzebski : mutation_partition: introduce dummy rows_entry
773070e - Piotr Jastrzebski : mutation_partition: add continuity flag to rows_entry
- documented that partition tombstone is always complete
- require specifying the partition tombstone when creating an incomplete entry
- replaced rows_entry(dummy_tag, ...) constructor with more general
rows_entry(position_in_partition, ...)
- documented continuity semantics on mutation_partition
- fixed _static_row_cached being lost by mutation_partition copy constructors
- fixed conversion to streamed_mutation to ignore dummy entries
- fixed mutation_partition serializer to drop dummy entries
- documented semantics of continuity on mutation_partition level
- dropped assumptions that dummy entries can be only at the last position
- changed equality to ignore continuity completely, rather than
partially (it was not ignoring dummy entries, but ignoring
continuity flag)
- added printout of continuity information in mutation_partition
- fixed handling of empty entries in apply_reversibly() with regards
to continuity; we no longer can remove empty entries before
merging, since that may affect continuity of the right-hand
mutation. Added _erased flag.
- fixed mutation_partition::clustered_row() with dummy==true to not ignore the key
- fixed partition_builder to not ignore continuity
- renamed dummy_tag_t to dummy_tag. _t suffix is reserved.
- standardized all APIs on is_dummy and is_continuous bool_class:es
- replaced add_dummy_entry() with ensure_last_dummy() with safer semantics
- dropped unused remove_dummy_entry()
- simplified and inlined cache_entry::add_dummy_entry()
- fixed mutation_partition(incomplete_tag) constructor to mark all row ranges as discontinuous
]
79 lines
2.7 KiB
C++
79 lines
2.7 KiB
C++
/*
|
|
* Copyright (C) 2015 ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* This file is part of Scylla.
|
|
*
|
|
* Scylla is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Scylla is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "atomic_cell.hh"
|
|
#include "tombstone.hh"
|
|
#include "range_tombstone.hh"
|
|
#include "keys.hh"
|
|
|
|
class row_marker;
|
|
class row_tombstone;
|
|
|
|
// When used on an entry, marks the range between this entry and the previous
|
|
// one as continuous or discontinuous, excluding the keys of both entries.
|
|
// This information doesn't apply to continuity of the entries themselves,
|
|
// that is specified by is_dummy flag.
|
|
// See class doc of mutation_partition.
|
|
using is_continuous = bool_class<class continuous_tag>;
|
|
|
|
// Dummy entry is an entry which is incomplete.
|
|
// Typically used for marking bounds of continuity range.
|
|
// See class doc of mutation_partition.
|
|
class dummy_tag {};
|
|
using is_dummy = bool_class<dummy_tag>;
|
|
|
|
// Guarantees:
|
|
//
|
|
// - any tombstones which affect cell's liveness are visited before that cell
|
|
//
|
|
// - rows are visited in ascending order with respect to their keys
|
|
//
|
|
// - row header (accept_row) is visited before that row's cells
|
|
//
|
|
// - row tombstones are visited in ascending order with respect to their key prefixes
|
|
//
|
|
// - cells in given row are visited in ascending order with respect to their column IDs
|
|
//
|
|
// - static row is visited before any clustered row
|
|
//
|
|
// - for each column in a row only one variant of accept_(static|row)_cell() is called, appropriate
|
|
// for column's kind (atomic or collection).
|
|
//
|
|
class mutation_partition_visitor {
|
|
public:
|
|
virtual void accept_partition_tombstone(tombstone) = 0;
|
|
|
|
virtual void accept_static_cell(column_id, atomic_cell_view) = 0;
|
|
|
|
virtual void accept_static_cell(column_id, collection_mutation_view) = 0;
|
|
|
|
virtual void accept_row_tombstone(const range_tombstone&) = 0;
|
|
|
|
virtual void accept_row(position_in_partition_view key, const row_tombstone& deleted_at, const row_marker& rm,
|
|
is_dummy = is_dummy::no, is_continuous = is_continuous::yes) = 0;
|
|
|
|
virtual void accept_row_cell(column_id id, atomic_cell_view) = 0;
|
|
|
|
virtual void accept_row_cell(column_id id, collection_mutation_view) = 0;
|
|
};
|