diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-07-13 14:41:31 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-08-17 13:42:50 +0000 |
commit | 54693fc154c0fabae6ac82607765a22057977bbb (patch) | |
tree | 4522fe00d0f72311a1c5b99909ffcce7956fbd88 /persistence | |
parent | dddd2b3708358da2a855cbbef456c94c985cf08e (diff) |
Add support for two-phase document garbage collection
If enabled, garbage collection is performed in two phases (metadata
gathering and deletion) instead of just a single phase. Two-phase GC
allows for ensuring the same set of documents is deleted across all
nodes and explicitly takes write locks on the distributor to prevent
concurrent feed ops to GC'd documents from potentially creating
inconsistencies.
Two-phase GC is only used _iff_ all replica content nodes support
the feature _and_ it's enabled in config. An additional field has
been added to the feature negotiation functionality to communicate
support from content nodes to distributors.
Diffstat (limited to 'persistence')
-rw-r--r-- | persistence/src/vespa/persistence/spi/id_and_timestamp.cpp | 20 | ||||
-rw-r--r-- | persistence/src/vespa/persistence/spi/id_and_timestamp.h | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp b/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp index fba45990744..03eaf7c9e6e 100644 --- a/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp +++ b/persistence/src/vespa/persistence/spi/id_and_timestamp.cpp @@ -1,5 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "id_and_timestamp.h" +#include <vespa/vespalib/stllike/asciistream.h> namespace storage::spi { @@ -14,4 +15,23 @@ IdAndTimestamp& IdAndTimestamp::operator=(const IdAndTimestamp&) = default; IdAndTimestamp::IdAndTimestamp(IdAndTimestamp&&) noexcept = default; IdAndTimestamp& IdAndTimestamp::operator=(IdAndTimestamp&&) noexcept = default; +void IdAndTimestamp::print(vespalib::asciistream& os) const { + os << id.toString() << " at time " << timestamp.getValue(); +} + +vespalib::string IdAndTimestamp::to_string() const { + vespalib::asciistream os; + print(os); + return os.str(); +} + +vespalib::asciistream& operator<<(vespalib::asciistream& os, const IdAndTimestamp& id_ts) { + id_ts.print(os); + return os; +} +std::ostream& operator<<(std::ostream& os, const IdAndTimestamp& id_ts) { + os << id_ts.to_string(); + return os; +} + } diff --git a/persistence/src/vespa/persistence/spi/id_and_timestamp.h b/persistence/src/vespa/persistence/spi/id_and_timestamp.h index d8cdba3d063..a45cbfcf5eb 100644 --- a/persistence/src/vespa/persistence/spi/id_and_timestamp.h +++ b/persistence/src/vespa/persistence/spi/id_and_timestamp.h @@ -3,6 +3,10 @@ #include "types.h" #include <vespa/document/base/documentid.h> +#include <vespa/vespalib/stllike/string.h> +#include <iosfwd> + +namespace vespalib { class asciistream; } namespace storage::spi { @@ -27,6 +31,9 @@ struct IdAndTimestamp { return ((id == rhs.id) && (timestamp == rhs.timestamp)); } + void print(vespalib::asciistream&) const; + vespalib::string to_string() const; + struct hash { size_t operator()(const IdAndTimestamp& id_ts) const noexcept { const size_t h = document::GlobalId::hash()(id_ts.id.getGlobalId()); @@ -35,4 +42,7 @@ struct IdAndTimestamp { }; }; +vespalib::asciistream& operator<<(vespalib::asciistream&, const IdAndTimestamp&); +std::ostream& operator<<(std::ostream&, const IdAndTimestamp&); + } |