diff --git a/Makefile b/Makefile index ce93c576adde..3476b5f5cf71 100644 --- a/Makefile +++ b/Makefile @@ -1202,7 +1202,7 @@ UI_JS_OSS := pkg/ui/src/js/protos.js UI_TS_OSS := pkg/ui/src/js/protos.d.ts UI_PROTOS_OSS := $(UI_JS_OSS) $(UI_TS_OSS) -CPP_PROTOS := $(filter %/roachpb/metadata.proto %/roachpb/data.proto %/roachpb/internal.proto %/roachpb/errors.proto %/roachpb/api.proto %util/tracing/recorded_span.proto %/engine/enginepb/mvcc.proto %/engine/enginepb/mvcc3.proto %/engine/enginepb/file_registry.proto %/engine/enginepb/rocksdb.proto %/hlc/legacy_timestamp.proto %/hlc/timestamp.proto %/log/log.proto %/unresolved_addr.proto,$(GO_PROTOS)) +CPP_PROTOS := $(filter %/roachpb/api.proto %/roachpb/metadata.proto %/roachpb/data.proto %/roachpb/internal.proto %/roachpb/errors.proto %util/tracing/recorded_span.proto %/concurrency/lock/locking.proto %/engine/enginepb/mvcc.proto %/engine/enginepb/mvcc3.proto %/engine/enginepb/file_registry.proto %/engine/enginepb/rocksdb.proto %/hlc/legacy_timestamp.proto %/hlc/timestamp.proto %/log/log.proto %/unresolved_addr.proto,$(GO_PROTOS)) CPP_HEADERS := $(subst ./pkg,$(CPP_PROTO_ROOT),$(CPP_PROTOS:%.proto=%.pb.h)) CPP_SOURCES := $(subst ./pkg,$(CPP_PROTO_ROOT),$(CPP_PROTOS:%.proto=%.pb.cc)) diff --git a/c-deps/libroach/CMakeLists.txt b/c-deps/libroach/CMakeLists.txt index 818ffd36f961..cdb23b9abded 100644 --- a/c-deps/libroach/CMakeLists.txt +++ b/c-deps/libroach/CMakeLists.txt @@ -44,10 +44,12 @@ add_library(roach sst_dump.cc table_props.cc utils.cc + protos/roachpb/api.pb.cc protos/roachpb/data.pb.cc protos/roachpb/errors.pb.cc protos/roachpb/internal.pb.cc protos/roachpb/metadata.pb.cc + protos/storage/concurrency/lock/locking.pb.cc protos/storage/engine/enginepb/mvcc.pb.cc protos/storage/engine/enginepb/mvcc3.pb.cc protos/storage/engine/enginepb/file_registry.pb.cc @@ -55,9 +57,8 @@ add_library(roach protos/util/hlc/legacy_timestamp.pb.cc protos/util/hlc/timestamp.pb.cc protos/util/log/log.pb.cc - protos/util/unresolved_addr.pb.cc - protos/roachpb/api.pb.cc protos/util/tracing/recorded_span.pb.cc + protos/util/unresolved_addr.pb.cc rocksdbutils/env_encryption.cc ) target_include_directories(roach diff --git a/c-deps/libroach/protos/roachpb/data.pb.cc b/c-deps/libroach/protos/roachpb/data.pb.cc index a7508c937e39..44c54fec7add 100644 --- a/c-deps/libroach/protos/roachpb/data.pb.cc +++ b/c-deps/libroach/protos/roachpb/data.pb.cc @@ -114,6 +114,11 @@ class IntentDefaultTypeInternal { ::google::protobuf::internal::ExplicitlyConstructed _instance; } _Intent_default_instance_; +class LockUpdateDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; +} _LockUpdate_default_instance_; class SequencedWriteDefaultTypeInternal { public: ::google::protobuf::internal::ExplicitlyConstructed @@ -362,8 +367,24 @@ static void InitDefaultsIntent() { ::cockroach::roachpb::Intent::InitAsDefaultInstance(); } -::google::protobuf::internal::SCCInfo<3> scc_info_Intent = - {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsIntent}, { +::google::protobuf::internal::SCCInfo<2> scc_info_Intent = + {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsIntent}, { + &protobuf_roachpb_2fdata_2eproto::scc_info_Span.base, + &protobuf_storage_2fengine_2fenginepb_2fmvcc3_2eproto::scc_info_TxnMeta.base,}}; + +static void InitDefaultsLockUpdate() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::cockroach::roachpb::_LockUpdate_default_instance_; + new (ptr) ::cockroach::roachpb::LockUpdate(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::cockroach::roachpb::LockUpdate::InitAsDefaultInstance(); +} + +::google::protobuf::internal::SCCInfo<3> scc_info_LockUpdate = + {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsLockUpdate}, { &protobuf_roachpb_2fdata_2eproto::scc_info_Span.base, &protobuf_storage_2fengine_2fenginepb_2fmvcc3_2eproto::scc_info_TxnMeta.base, &protobuf_storage_2fengine_2fenginepb_2fmvcc3_2eproto::scc_info_IgnoredSeqNumRange.base,}}; @@ -460,6 +481,7 @@ void InitDefaults() { ::google::protobuf::internal::InitSCC(&scc_info_Transaction.base); ::google::protobuf::internal::InitSCC(&scc_info_TransactionRecord.base); ::google::protobuf::internal::InitSCC(&scc_info_Intent.base); + ::google::protobuf::internal::InitSCC(&scc_info_LockUpdate.base); ::google::protobuf::internal::InitSCC(&scc_info_SequencedWrite.base); ::google::protobuf::internal::InitSCC(&scc_info_Lease.base); ::google::protobuf::internal::InitSCC(&scc_info_AbortSpanEntry.base); @@ -4477,14 +4499,9 @@ void Intent::clear_txn() { } txn_ = NULL; } -void Intent::clear_ignored_seqnums() { - ignored_seqnums_.Clear(); -} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Intent::kSpanFieldNumber; const int Intent::kTxnFieldNumber; -const int Intent::kStatusFieldNumber; -const int Intent::kIgnoredSeqnumsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 Intent::Intent() @@ -4496,8 +4513,7 @@ Intent::Intent() } Intent::Intent(const Intent& from) : ::google::protobuf::MessageLite(), - _internal_metadata_(NULL), - ignored_seqnums_(from.ignored_seqnums_) { + _internal_metadata_(NULL) { _internal_metadata_.MergeFrom(from._internal_metadata_); if (from.has_span()) { span_ = new ::cockroach::roachpb::Span(*from.span_); @@ -4509,14 +4525,13 @@ Intent::Intent(const Intent& from) } else { txn_ = NULL; } - status_ = from.status_; // @@protoc_insertion_point(copy_constructor:cockroach.roachpb.Intent) } void Intent::SharedCtor() { ::memset(&span_, 0, static_cast( - reinterpret_cast(&status_) - - reinterpret_cast(&span_)) + sizeof(status_)); + reinterpret_cast(&txn_) - + reinterpret_cast(&span_)) + sizeof(txn_)); } Intent::~Intent() { @@ -4544,7 +4559,6 @@ void Intent::Clear() { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - ignored_seqnums_.Clear(); if (GetArenaNoVirtual() == NULL && span_ != NULL) { delete span_; } @@ -4553,7 +4567,6 @@ void Intent::Clear() { delete txn_; } txn_ = NULL; - status_ = 0; _internal_metadata_.Clear(); } @@ -4595,6 +4608,254 @@ bool Intent::MergePartialFromCodedStream( break; } + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField( + input, tag, &unknown_fields_stream)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:cockroach.roachpb.Intent) + return true; +failure: + // @@protoc_insertion_point(parse_failure:cockroach.roachpb.Intent) + return false; +#undef DO_ +} + +void Intent::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:cockroach.roachpb.Intent) + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (this->has_span()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->_internal_span(), output); + } + + if (this->has_txn()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->_internal_txn(), output); + } + + output->WriteRaw((::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).data(), + static_cast((::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).size())); + // @@protoc_insertion_point(serialize_end:cockroach.roachpb.Intent) +} + +size_t Intent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:cockroach.roachpb.Intent) + size_t total_size = 0; + + total_size += (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).size(); + + if (this->has_span()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize( + *span_); + } + + if (this->has_txn()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSize( + *txn_); + } + + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void Intent::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void Intent::MergeFrom(const Intent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:cockroach.roachpb.Intent) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.has_span()) { + mutable_span()->::cockroach::roachpb::Span::MergeFrom(from.span()); + } + if (from.has_txn()) { + mutable_txn()->::cockroach::storage::engine::enginepb::TxnMeta::MergeFrom(from.txn()); + } +} + +void Intent::CopyFrom(const Intent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:cockroach.roachpb.Intent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Intent::IsInitialized() const { + return true; +} + +void Intent::Swap(Intent* other) { + if (other == this) return; + InternalSwap(other); +} +void Intent::InternalSwap(Intent* other) { + using std::swap; + swap(span_, other->span_); + swap(txn_, other->txn_); + _internal_metadata_.Swap(&other->_internal_metadata_); +} + +::std::string Intent::GetTypeName() const { + return "cockroach.roachpb.Intent"; +} + + +// =================================================================== + +void LockUpdate::InitAsDefaultInstance() { + ::cockroach::roachpb::_LockUpdate_default_instance_._instance.get_mutable()->span_ = const_cast< ::cockroach::roachpb::Span*>( + ::cockroach::roachpb::Span::internal_default_instance()); + ::cockroach::roachpb::_LockUpdate_default_instance_._instance.get_mutable()->txn_ = const_cast< ::cockroach::storage::engine::enginepb::TxnMeta*>( + ::cockroach::storage::engine::enginepb::TxnMeta::internal_default_instance()); +} +void LockUpdate::clear_txn() { + if (GetArenaNoVirtual() == NULL && txn_ != NULL) { + delete txn_; + } + txn_ = NULL; +} +void LockUpdate::clear_ignored_seqnums() { + ignored_seqnums_.Clear(); +} +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int LockUpdate::kSpanFieldNumber; +const int LockUpdate::kTxnFieldNumber; +const int LockUpdate::kStatusFieldNumber; +const int LockUpdate::kIgnoredSeqnumsFieldNumber; +const int LockUpdate::kDurabilityFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +LockUpdate::LockUpdate() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + ::google::protobuf::internal::InitSCC( + &protobuf_roachpb_2fdata_2eproto::scc_info_LockUpdate.base); + SharedCtor(); + // @@protoc_insertion_point(constructor:cockroach.roachpb.LockUpdate) +} +LockUpdate::LockUpdate(const LockUpdate& from) + : ::google::protobuf::MessageLite(), + _internal_metadata_(NULL), + ignored_seqnums_(from.ignored_seqnums_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from.has_span()) { + span_ = new ::cockroach::roachpb::Span(*from.span_); + } else { + span_ = NULL; + } + if (from.has_txn()) { + txn_ = new ::cockroach::storage::engine::enginepb::TxnMeta(*from.txn_); + } else { + txn_ = NULL; + } + ::memcpy(&status_, &from.status_, + static_cast(reinterpret_cast(&durability_) - + reinterpret_cast(&status_)) + sizeof(durability_)); + // @@protoc_insertion_point(copy_constructor:cockroach.roachpb.LockUpdate) +} + +void LockUpdate::SharedCtor() { + ::memset(&span_, 0, static_cast( + reinterpret_cast(&durability_) - + reinterpret_cast(&span_)) + sizeof(durability_)); +} + +LockUpdate::~LockUpdate() { + // @@protoc_insertion_point(destructor:cockroach.roachpb.LockUpdate) + SharedDtor(); +} + +void LockUpdate::SharedDtor() { + if (this != internal_default_instance()) delete span_; + if (this != internal_default_instance()) delete txn_; +} + +void LockUpdate::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const LockUpdate& LockUpdate::default_instance() { + ::google::protobuf::internal::InitSCC(&protobuf_roachpb_2fdata_2eproto::scc_info_LockUpdate.base); + return *internal_default_instance(); +} + + +void LockUpdate::Clear() { +// @@protoc_insertion_point(message_clear_start:cockroach.roachpb.LockUpdate) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ignored_seqnums_.Clear(); + if (GetArenaNoVirtual() == NULL && span_ != NULL) { + delete span_; + } + span_ = NULL; + if (GetArenaNoVirtual() == NULL && txn_ != NULL) { + delete txn_; + } + txn_ = NULL; + ::memset(&status_, 0, static_cast( + reinterpret_cast(&durability_) - + reinterpret_cast(&status_)) + sizeof(durability_)); + _internal_metadata_.Clear(); +} + +bool LockUpdate::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::internal::LiteUnknownFieldSetter unknown_fields_setter( + &_internal_metadata_); + ::google::protobuf::io::StringOutputStream unknown_fields_output( + unknown_fields_setter.buffer()); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_output, false); + // @@protoc_insertion_point(parse_start:cockroach.roachpb.LockUpdate) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + case 1: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, mutable_span())); + } else { + goto handle_unusual; + } + break; + } + + case 2: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( + input, mutable_txn())); + } else { + goto handle_unusual; + } + break; + } + // .cockroach.roachpb.TransactionStatus status = 3; case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == @@ -4621,6 +4882,21 @@ bool Intent::MergePartialFromCodedStream( break; } + // .cockroach.storage.concurrency.lock.Durability durability = 5; + case 5: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + set_durability(static_cast< ::cockroach::storage::concurrency::lock::Durability >(value)); + } else { + goto handle_unusual; + } + break; + } + default: { handle_unusual: if (tag == 0) { @@ -4633,17 +4909,17 @@ bool Intent::MergePartialFromCodedStream( } } success: - // @@protoc_insertion_point(parse_success:cockroach.roachpb.Intent) + // @@protoc_insertion_point(parse_success:cockroach.roachpb.LockUpdate) return true; failure: - // @@protoc_insertion_point(parse_failure:cockroach.roachpb.Intent) + // @@protoc_insertion_point(parse_failure:cockroach.roachpb.LockUpdate) return false; #undef DO_ } -void Intent::SerializeWithCachedSizes( +void LockUpdate::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:cockroach.roachpb.Intent) + // @@protoc_insertion_point(serialize_start:cockroach.roachpb.LockUpdate) ::google::protobuf::uint32 cached_has_bits = 0; (void) cached_has_bits; @@ -4671,13 +4947,19 @@ void Intent::SerializeWithCachedSizes( output); } + // .cockroach.storage.concurrency.lock.Durability durability = 5; + if (this->durability() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 5, this->durability(), output); + } + output->WriteRaw((::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).data(), static_cast((::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).size())); - // @@protoc_insertion_point(serialize_end:cockroach.roachpb.Intent) + // @@protoc_insertion_point(serialize_end:cockroach.roachpb.LockUpdate) } -size_t Intent::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:cockroach.roachpb.Intent) +size_t LockUpdate::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:cockroach.roachpb.LockUpdate) size_t total_size = 0; total_size += (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).size(); @@ -4710,18 +4992,24 @@ size_t Intent::ByteSizeLong() const { ::google::protobuf::internal::WireFormatLite::EnumSize(this->status()); } + // .cockroach.storage.concurrency.lock.Durability durability = 5; + if (this->durability() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->durability()); + } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } -void Intent::CheckTypeAndMergeFrom( +void LockUpdate::CheckTypeAndMergeFrom( const ::google::protobuf::MessageLite& from) { - MergeFrom(*::google::protobuf::down_cast(&from)); + MergeFrom(*::google::protobuf::down_cast(&from)); } -void Intent::MergeFrom(const Intent& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:cockroach.roachpb.Intent) +void LockUpdate::MergeFrom(const LockUpdate& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:cockroach.roachpb.LockUpdate) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::google::protobuf::uint32 cached_has_bits = 0; @@ -4737,34 +5025,38 @@ void Intent::MergeFrom(const Intent& from) { if (from.status() != 0) { set_status(from.status()); } + if (from.durability() != 0) { + set_durability(from.durability()); + } } -void Intent::CopyFrom(const Intent& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:cockroach.roachpb.Intent) +void LockUpdate::CopyFrom(const LockUpdate& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:cockroach.roachpb.LockUpdate) if (&from == this) return; Clear(); MergeFrom(from); } -bool Intent::IsInitialized() const { +bool LockUpdate::IsInitialized() const { return true; } -void Intent::Swap(Intent* other) { +void LockUpdate::Swap(LockUpdate* other) { if (other == this) return; InternalSwap(other); } -void Intent::InternalSwap(Intent* other) { +void LockUpdate::InternalSwap(LockUpdate* other) { using std::swap; CastToBase(&ignored_seqnums_)->InternalSwap(CastToBase(&other->ignored_seqnums_)); swap(span_, other->span_); swap(txn_, other->txn_); swap(status_, other->status_); + swap(durability_, other->durability_); _internal_metadata_.Swap(&other->_internal_metadata_); } -::std::string Intent::GetTypeName() const { - return "cockroach.roachpb.Intent"; +::std::string LockUpdate::GetTypeName() const { + return "cockroach.roachpb.LockUpdate"; } @@ -6334,6 +6626,9 @@ template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::cockroach::roachpb::TransactionR template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::cockroach::roachpb::Intent* Arena::CreateMaybeMessage< ::cockroach::roachpb::Intent >(Arena* arena) { return Arena::CreateInternal< ::cockroach::roachpb::Intent >(arena); } +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::cockroach::roachpb::LockUpdate* Arena::CreateMaybeMessage< ::cockroach::roachpb::LockUpdate >(Arena* arena) { + return Arena::CreateInternal< ::cockroach::roachpb::LockUpdate >(arena); +} template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::cockroach::roachpb::SequencedWrite* Arena::CreateMaybeMessage< ::cockroach::roachpb::SequencedWrite >(Arena* arena) { return Arena::CreateInternal< ::cockroach::roachpb::SequencedWrite >(arena); } diff --git a/c-deps/libroach/protos/roachpb/data.pb.h b/c-deps/libroach/protos/roachpb/data.pb.h index 020e625ce091..9292f161185c 100644 --- a/c-deps/libroach/protos/roachpb/data.pb.h +++ b/c-deps/libroach/protos/roachpb/data.pb.h @@ -31,6 +31,7 @@ #include // IWYU pragma: export #include #include "roachpb/metadata.pb.h" +#include "storage/concurrency/lock/locking.pb.h" #include "storage/engine/enginepb/mvcc.pb.h" #include "storage/engine/enginepb/mvcc3.pb.h" #include "util/hlc/timestamp.pb.h" @@ -42,7 +43,7 @@ namespace protobuf_roachpb_2fdata_2eproto { struct TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[19]; + static const ::google::protobuf::internal::ParseTable schema[20]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; static const ::google::protobuf::uint32 offsets[]; @@ -74,6 +75,9 @@ extern LeafTxnInputStateDefaultTypeInternal _LeafTxnInputState_default_instance_ class Lease; class LeaseDefaultTypeInternal; extern LeaseDefaultTypeInternal _Lease_default_instance_; +class LockUpdate; +class LockUpdateDefaultTypeInternal; +extern LockUpdateDefaultTypeInternal _LockUpdate_default_instance_; class MergeTrigger; class MergeTriggerDefaultTypeInternal; extern MergeTriggerDefaultTypeInternal _MergeTrigger_default_instance_; @@ -119,6 +123,7 @@ template<> ::cockroach::roachpb::KeyValue* Arena::CreateMaybeMessage<::cockroach template<> ::cockroach::roachpb::LeafTxnFinalState* Arena::CreateMaybeMessage<::cockroach::roachpb::LeafTxnFinalState>(Arena*); template<> ::cockroach::roachpb::LeafTxnInputState* Arena::CreateMaybeMessage<::cockroach::roachpb::LeafTxnInputState>(Arena*); template<> ::cockroach::roachpb::Lease* Arena::CreateMaybeMessage<::cockroach::roachpb::Lease>(Arena*); +template<> ::cockroach::roachpb::LockUpdate* Arena::CreateMaybeMessage<::cockroach::roachpb::LockUpdate>(Arena*); template<> ::cockroach::roachpb::MergeTrigger* Arena::CreateMaybeMessage<::cockroach::roachpb::MergeTrigger>(Arena*); template<> ::cockroach::roachpb::ModifiedSpanTrigger* Arena::CreateMaybeMessage<::cockroach::roachpb::ModifiedSpanTrigger>(Arena*); template<> ::cockroach::roachpb::ObservedTimestamp* Arena::CreateMaybeMessage<::cockroach::roachpb::ObservedTimestamp>(Arena*); @@ -2069,6 +2074,124 @@ class Intent : public ::google::protobuf::MessageLite /* @@protoc_insertion_poin // accessors ------------------------------------------------------- + bool has_span() const; + void clear_span(); + static const int kSpanFieldNumber = 1; + private: + const ::cockroach::roachpb::Span& _internal_span() const; + public: + const ::cockroach::roachpb::Span& span() const; + ::cockroach::roachpb::Span* release_span(); + ::cockroach::roachpb::Span* mutable_span(); + void set_allocated_span(::cockroach::roachpb::Span* span); + + bool has_txn() const; + void clear_txn(); + static const int kTxnFieldNumber = 2; + private: + const ::cockroach::storage::engine::enginepb::TxnMeta& _internal_txn() const; + public: + const ::cockroach::storage::engine::enginepb::TxnMeta& txn() const; + ::cockroach::storage::engine::enginepb::TxnMeta* release_txn(); + ::cockroach::storage::engine::enginepb::TxnMeta* mutable_txn(); + void set_allocated_txn(::cockroach::storage::engine::enginepb::TxnMeta* txn); + + // @@protoc_insertion_point(class_scope:cockroach.roachpb.Intent) + private: + + ::google::protobuf::internal::InternalMetadataWithArenaLite _internal_metadata_; + ::cockroach::roachpb::Span* span_; + ::cockroach::storage::engine::enginepb::TxnMeta* txn_; + mutable ::google::protobuf::internal::CachedSize _cached_size_; + friend struct ::protobuf_roachpb_2fdata_2eproto::TableStruct; +}; +// ------------------------------------------------------------------- + +class LockUpdate : public ::google::protobuf::MessageLite /* @@protoc_insertion_point(class_definition:cockroach.roachpb.LockUpdate) */ { + public: + LockUpdate(); + virtual ~LockUpdate(); + + LockUpdate(const LockUpdate& from); + + inline LockUpdate& operator=(const LockUpdate& from) { + CopyFrom(from); + return *this; + } + #if LANG_CXX11 + LockUpdate(LockUpdate&& from) noexcept + : LockUpdate() { + *this = ::std::move(from); + } + + inline LockUpdate& operator=(LockUpdate&& from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + #endif + static const LockUpdate& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const LockUpdate* internal_default_instance() { + return reinterpret_cast( + &_LockUpdate_default_instance_); + } + static constexpr int kIndexInFileMessages = + 14; + + void Swap(LockUpdate* other); + friend void swap(LockUpdate& a, LockUpdate& b) { + a.Swap(&b); + } + + // implements Message ---------------------------------------------- + + inline LockUpdate* New() const final { + return CreateMaybeMessage(NULL); + } + + LockUpdate* New(::google::protobuf::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from) + final; + void CopyFrom(const LockUpdate& from); + void MergeFrom(const LockUpdate& from); + void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) final; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const final; + void DiscardUnknownFields(); + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(LockUpdate* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return NULL; + } + inline void* MaybeArenaPtr() const { + return NULL; + } + public: + + ::std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + int ignored_seqnums_size() const; void clear_ignored_seqnums(); static const int kIgnoredSeqnumsFieldNumber = 4; @@ -2108,7 +2231,13 @@ class Intent : public ::google::protobuf::MessageLite /* @@protoc_insertion_poin ::cockroach::roachpb::TransactionStatus status() const; void set_status(::cockroach::roachpb::TransactionStatus value); - // @@protoc_insertion_point(class_scope:cockroach.roachpb.Intent) + // .cockroach.storage.concurrency.lock.Durability durability = 5; + void clear_durability(); + static const int kDurabilityFieldNumber = 5; + ::cockroach::storage::concurrency::lock::Durability durability() const; + void set_durability(::cockroach::storage::concurrency::lock::Durability value); + + // @@protoc_insertion_point(class_scope:cockroach.roachpb.LockUpdate) private: ::google::protobuf::internal::InternalMetadataWithArenaLite _internal_metadata_; @@ -2116,6 +2245,7 @@ class Intent : public ::google::protobuf::MessageLite /* @@protoc_insertion_poin ::cockroach::roachpb::Span* span_; ::cockroach::storage::engine::enginepb::TxnMeta* txn_; int status_; + int durability_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::protobuf_roachpb_2fdata_2eproto::TableStruct; }; @@ -2155,7 +2285,7 @@ class SequencedWrite : public ::google::protobuf::MessageLite /* @@protoc_insert &_SequencedWrite_default_instance_); } static constexpr int kIndexInFileMessages = - 14; + 15; void Swap(SequencedWrite* other); friend void swap(SequencedWrite& a, SequencedWrite& b) { @@ -2269,7 +2399,7 @@ class Lease : public ::google::protobuf::MessageLite /* @@protoc_insertion_point &_Lease_default_instance_); } static constexpr int kIndexInFileMessages = - 15; + 16; void Swap(Lease* other); friend void swap(Lease& a, Lease& b) { @@ -2436,7 +2566,7 @@ class AbortSpanEntry : public ::google::protobuf::MessageLite /* @@protoc_insert &_AbortSpanEntry_default_instance_); } static constexpr int kIndexInFileMessages = - 16; + 17; void Swap(AbortSpanEntry* other); friend void swap(AbortSpanEntry& a, AbortSpanEntry& b) { @@ -2562,7 +2692,7 @@ class LeafTxnInputState : public ::google::protobuf::MessageLite /* @@protoc_ins &_LeafTxnInputState_default_instance_); } static constexpr int kIndexInFileMessages = - 17; + 18; void Swap(LeafTxnInputState* other); friend void swap(LeafTxnInputState& a, LeafTxnInputState& b) { @@ -2700,7 +2830,7 @@ class LeafTxnFinalState : public ::google::protobuf::MessageLite /* @@protoc_ins &_LeafTxnFinalState_default_instance_); } static constexpr int kIndexInFileMessages = - 18; + 19; void Swap(LeafTxnFinalState* other); friend void swap(LeafTxnFinalState& a, LeafTxnFinalState& b) { @@ -4908,46 +5038,164 @@ inline void Intent::set_allocated_txn(::cockroach::storage::engine::enginepb::Tx // @@protoc_insertion_point(field_set_allocated:cockroach.roachpb.Intent.txn) } +// ------------------------------------------------------------------- + +// LockUpdate + +inline bool LockUpdate::has_span() const { + return this != internal_default_instance() && span_ != NULL; +} +inline void LockUpdate::clear_span() { + if (GetArenaNoVirtual() == NULL && span_ != NULL) { + delete span_; + } + span_ = NULL; +} +inline const ::cockroach::roachpb::Span& LockUpdate::_internal_span() const { + return *span_; +} +inline const ::cockroach::roachpb::Span& LockUpdate::span() const { + const ::cockroach::roachpb::Span* p = span_; + // @@protoc_insertion_point(field_get:cockroach.roachpb.LockUpdate.span) + return p != NULL ? *p : *reinterpret_cast( + &::cockroach::roachpb::_Span_default_instance_); +} +inline ::cockroach::roachpb::Span* LockUpdate::release_span() { + // @@protoc_insertion_point(field_release:cockroach.roachpb.LockUpdate.span) + + ::cockroach::roachpb::Span* temp = span_; + span_ = NULL; + return temp; +} +inline ::cockroach::roachpb::Span* LockUpdate::mutable_span() { + + if (span_ == NULL) { + auto* p = CreateMaybeMessage<::cockroach::roachpb::Span>(GetArenaNoVirtual()); + span_ = p; + } + // @@protoc_insertion_point(field_mutable:cockroach.roachpb.LockUpdate.span) + return span_; +} +inline void LockUpdate::set_allocated_span(::cockroach::roachpb::Span* span) { + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete span_; + } + if (span) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + span = ::google::protobuf::internal::GetOwnedMessage( + message_arena, span, submessage_arena); + } + + } else { + + } + span_ = span; + // @@protoc_insertion_point(field_set_allocated:cockroach.roachpb.LockUpdate.span) +} + +inline bool LockUpdate::has_txn() const { + return this != internal_default_instance() && txn_ != NULL; +} +inline const ::cockroach::storage::engine::enginepb::TxnMeta& LockUpdate::_internal_txn() const { + return *txn_; +} +inline const ::cockroach::storage::engine::enginepb::TxnMeta& LockUpdate::txn() const { + const ::cockroach::storage::engine::enginepb::TxnMeta* p = txn_; + // @@protoc_insertion_point(field_get:cockroach.roachpb.LockUpdate.txn) + return p != NULL ? *p : *reinterpret_cast( + &::cockroach::storage::engine::enginepb::_TxnMeta_default_instance_); +} +inline ::cockroach::storage::engine::enginepb::TxnMeta* LockUpdate::release_txn() { + // @@protoc_insertion_point(field_release:cockroach.roachpb.LockUpdate.txn) + + ::cockroach::storage::engine::enginepb::TxnMeta* temp = txn_; + txn_ = NULL; + return temp; +} +inline ::cockroach::storage::engine::enginepb::TxnMeta* LockUpdate::mutable_txn() { + + if (txn_ == NULL) { + auto* p = CreateMaybeMessage<::cockroach::storage::engine::enginepb::TxnMeta>(GetArenaNoVirtual()); + txn_ = p; + } + // @@protoc_insertion_point(field_mutable:cockroach.roachpb.LockUpdate.txn) + return txn_; +} +inline void LockUpdate::set_allocated_txn(::cockroach::storage::engine::enginepb::TxnMeta* txn) { + ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == NULL) { + delete reinterpret_cast< ::google::protobuf::MessageLite*>(txn_); + } + if (txn) { + ::google::protobuf::Arena* submessage_arena = NULL; + if (message_arena != submessage_arena) { + txn = ::google::protobuf::internal::GetOwnedMessage( + message_arena, txn, submessage_arena); + } + + } else { + + } + txn_ = txn; + // @@protoc_insertion_point(field_set_allocated:cockroach.roachpb.LockUpdate.txn) +} + // .cockroach.roachpb.TransactionStatus status = 3; -inline void Intent::clear_status() { +inline void LockUpdate::clear_status() { status_ = 0; } -inline ::cockroach::roachpb::TransactionStatus Intent::status() const { - // @@protoc_insertion_point(field_get:cockroach.roachpb.Intent.status) +inline ::cockroach::roachpb::TransactionStatus LockUpdate::status() const { + // @@protoc_insertion_point(field_get:cockroach.roachpb.LockUpdate.status) return static_cast< ::cockroach::roachpb::TransactionStatus >(status_); } -inline void Intent::set_status(::cockroach::roachpb::TransactionStatus value) { +inline void LockUpdate::set_status(::cockroach::roachpb::TransactionStatus value) { status_ = value; - // @@protoc_insertion_point(field_set:cockroach.roachpb.Intent.status) + // @@protoc_insertion_point(field_set:cockroach.roachpb.LockUpdate.status) } -inline int Intent::ignored_seqnums_size() const { +inline int LockUpdate::ignored_seqnums_size() const { return ignored_seqnums_.size(); } -inline ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange* Intent::mutable_ignored_seqnums(int index) { - // @@protoc_insertion_point(field_mutable:cockroach.roachpb.Intent.ignored_seqnums) +inline ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange* LockUpdate::mutable_ignored_seqnums(int index) { + // @@protoc_insertion_point(field_mutable:cockroach.roachpb.LockUpdate.ignored_seqnums) return ignored_seqnums_.Mutable(index); } inline ::google::protobuf::RepeatedPtrField< ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange >* -Intent::mutable_ignored_seqnums() { - // @@protoc_insertion_point(field_mutable_list:cockroach.roachpb.Intent.ignored_seqnums) +LockUpdate::mutable_ignored_seqnums() { + // @@protoc_insertion_point(field_mutable_list:cockroach.roachpb.LockUpdate.ignored_seqnums) return &ignored_seqnums_; } -inline const ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange& Intent::ignored_seqnums(int index) const { - // @@protoc_insertion_point(field_get:cockroach.roachpb.Intent.ignored_seqnums) +inline const ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange& LockUpdate::ignored_seqnums(int index) const { + // @@protoc_insertion_point(field_get:cockroach.roachpb.LockUpdate.ignored_seqnums) return ignored_seqnums_.Get(index); } -inline ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange* Intent::add_ignored_seqnums() { - // @@protoc_insertion_point(field_add:cockroach.roachpb.Intent.ignored_seqnums) +inline ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange* LockUpdate::add_ignored_seqnums() { + // @@protoc_insertion_point(field_add:cockroach.roachpb.LockUpdate.ignored_seqnums) return ignored_seqnums_.Add(); } inline const ::google::protobuf::RepeatedPtrField< ::cockroach::storage::engine::enginepb::IgnoredSeqNumRange >& -Intent::ignored_seqnums() const { - // @@protoc_insertion_point(field_list:cockroach.roachpb.Intent.ignored_seqnums) +LockUpdate::ignored_seqnums() const { + // @@protoc_insertion_point(field_list:cockroach.roachpb.LockUpdate.ignored_seqnums) return ignored_seqnums_; } +// .cockroach.storage.concurrency.lock.Durability durability = 5; +inline void LockUpdate::clear_durability() { + durability_ = 0; +} +inline ::cockroach::storage::concurrency::lock::Durability LockUpdate::durability() const { + // @@protoc_insertion_point(field_get:cockroach.roachpb.LockUpdate.durability) + return static_cast< ::cockroach::storage::concurrency::lock::Durability >(durability_); +} +inline void LockUpdate::set_durability(::cockroach::storage::concurrency::lock::Durability value) { + + durability_ = value; + // @@protoc_insertion_point(field_set:cockroach.roachpb.LockUpdate.durability) +} + // ------------------------------------------------------------------- // SequencedWrite @@ -5679,6 +5927,8 @@ inline void LeafTxnFinalState::set_refresh_invalid(bool value) { // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/c-deps/libroach/protos/roachpb/errors.pb.cc b/c-deps/libroach/protos/roachpb/errors.pb.cc index 27668fb8333f..1580b7bfc59c 100644 --- a/c-deps/libroach/protos/roachpb/errors.pb.cc +++ b/c-deps/libroach/protos/roachpb/errors.pb.cc @@ -19,8 +19,8 @@ namespace protobuf_roachpb_2fdata_2eproto { extern PROTOBUF_INTERNAL_EXPORT_protobuf_roachpb_2fdata_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_ObservedTimestamp; extern PROTOBUF_INTERNAL_EXPORT_protobuf_roachpb_2fdata_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_Value; +extern PROTOBUF_INTERNAL_EXPORT_protobuf_roachpb_2fdata_2eproto ::google::protobuf::internal::SCCInfo<2> scc_info_Intent; extern PROTOBUF_INTERNAL_EXPORT_protobuf_roachpb_2fdata_2eproto ::google::protobuf::internal::SCCInfo<2> scc_info_Lease; -extern PROTOBUF_INTERNAL_EXPORT_protobuf_roachpb_2fdata_2eproto ::google::protobuf::internal::SCCInfo<3> scc_info_Intent; extern PROTOBUF_INTERNAL_EXPORT_protobuf_roachpb_2fdata_2eproto ::google::protobuf::internal::SCCInfo<6> scc_info_Transaction; } // namespace protobuf_roachpb_2fdata_2eproto namespace protobuf_roachpb_2ferrors_2eproto { diff --git a/c-deps/libroach/protos/storage/concurrency/lock/locking.pb.cc b/c-deps/libroach/protos/storage/concurrency/lock/locking.pb.cc new file mode 100644 index 000000000000..133f5c29278b --- /dev/null +++ b/c-deps/libroach/protos/storage/concurrency/lock/locking.pb.cc @@ -0,0 +1,68 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: storage/concurrency/lock/locking.proto + +#include "storage/concurrency/lock/locking.pb.h" + +#include + +#include +#include +#include +#include +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif +// @@protoc_insertion_point(includes) + +namespace cockroach { +namespace storage { +namespace concurrency { +namespace lock { +} // namespace lock +} // namespace concurrency +} // namespace storage +} // namespace cockroach +namespace protobuf_storage_2fconcurrency_2flock_2flocking_2eproto { +void InitDefaults() { +} + +} // namespace protobuf_storage_2fconcurrency_2flock_2flocking_2eproto +namespace cockroach { +namespace storage { +namespace concurrency { +namespace lock { +bool Strength_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +bool Durability_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace lock +} // namespace concurrency +} // namespace storage +} // namespace cockroach +namespace google { +namespace protobuf { +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/c-deps/libroach/protos/storage/concurrency/lock/locking.pb.h b/c-deps/libroach/protos/storage/concurrency/lock/locking.pb.h new file mode 100644 index 000000000000..a6ac1de96799 --- /dev/null +++ b/c-deps/libroach/protos/storage/concurrency/lock/locking.pb.h @@ -0,0 +1,117 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: storage/concurrency/lock/locking.proto + +#ifndef PROTOBUF_INCLUDED_storage_2fconcurrency_2flock_2flocking_2eproto +#define PROTOBUF_INCLUDED_storage_2fconcurrency_2flock_2flocking_2eproto + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 3006000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#define PROTOBUF_INTERNAL_EXPORT_protobuf_storage_2fconcurrency_2flock_2flocking_2eproto + +namespace protobuf_storage_2fconcurrency_2flock_2flocking_2eproto { +// Internal implementation detail -- do not use these members. +struct TableStruct { + static const ::google::protobuf::internal::ParseTableField entries[]; + static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable schema[1]; + static const ::google::protobuf::internal::FieldMetadata field_metadata[]; + static const ::google::protobuf::internal::SerializationTable serialization_table[]; + static const ::google::protobuf::uint32 offsets[]; +}; +} // namespace protobuf_storage_2fconcurrency_2flock_2flocking_2eproto +namespace cockroach { +namespace storage { +namespace concurrency { +namespace lock { +} // namespace lock +} // namespace concurrency +} // namespace storage +} // namespace cockroach +namespace cockroach { +namespace storage { +namespace concurrency { +namespace lock { + +enum Strength { + None = 0, + Shared = 1, + Upgrade = 2, + Exclusive = 3, + Strength_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, + Strength_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max +}; +bool Strength_IsValid(int value); +const Strength Strength_MIN = None; +const Strength Strength_MAX = Exclusive; +const int Strength_ARRAYSIZE = Strength_MAX + 1; + +enum Durability { + Replicated = 0, + Unreplicated = 1, + Durability_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, + Durability_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max +}; +bool Durability_IsValid(int value); +const Durability Durability_MIN = Replicated; +const Durability Durability_MAX = Unreplicated; +const int Durability_ARRAYSIZE = Durability_MAX + 1; + +// =================================================================== + + +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) + +} // namespace lock +} // namespace concurrency +} // namespace storage +} // namespace cockroach + +namespace google { +namespace protobuf { + +template <> struct is_proto_enum< ::cockroach::storage::concurrency::lock::Strength> : ::std::true_type {}; +template <> struct is_proto_enum< ::cockroach::storage::concurrency::lock::Durability> : ::std::true_type {}; + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_INCLUDED_storage_2fconcurrency_2flock_2flocking_2eproto diff --git a/pkg/cli/debug.go b/pkg/cli/debug.go index 32d3e59cfb6e..d95437107b4c 100644 --- a/pkg/cli/debug.go +++ b/pkg/cli/debug.go @@ -38,6 +38,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/server/status/statuspb" "github.com/cockroachdb/cockroach/pkg/sql/execinfrapb" "github.com/cockroachdb/cockroach/pkg/storage" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/gc" @@ -567,7 +568,7 @@ func runDebugGCCmd(cmd *cobra.Command, args []string) error { now, thresh, policy, gc.NoopGCer{}, func(_ context.Context, _ []roachpb.Intent) error { return nil }, - func(_ context.Context, _ *roachpb.Transaction, _ []roachpb.Intent) error { return nil }, + func(_ context.Context, _ *roachpb.Transaction, _ []roachpb.LockUpdate) error { return nil }, ) if err != nil { return err @@ -1131,8 +1132,13 @@ func removeDeadReplicas( if err := engine.MVCCDelete(ctx, batch, &ms, txnKey, hlc.Timestamp{}, nil); err != nil { return nil, err } - intent.Status = roachpb.ABORTED - if _, err := engine.MVCCResolveWriteIntent(ctx, batch, &ms, intent); err != nil { + update := roachpb.LockUpdate{ + Span: intent.Span, + Txn: intent.Txn, + Status: roachpb.ABORTED, + Durability: lock.Replicated, + } + if _, err := engine.MVCCResolveWriteIntent(ctx, batch, &ms, update); err != nil { return nil, err } // With the intent resolved, we can try again. diff --git a/pkg/roachpb/api.go b/pkg/roachpb/api.go index 71a5d5f61f35..4103e6e5dae4 100644 --- a/pkg/roachpb/api.go +++ b/pkg/roachpb/api.go @@ -15,6 +15,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/pkg/errors" ) @@ -1272,23 +1273,26 @@ func (acrr *AdminChangeReplicasRequest) Changes() []ReplicationChange { return sl } -// AsIntent creates an intent corresponding to the given resolve intent request. -func (rir *ResolveIntentRequest) AsIntent() Intent { - return Intent{ +// AsLockUpdate creates a lock update message corresponding to the given resolve +// intent request. +func (rir *ResolveIntentRequest) AsLockUpdate() LockUpdate { + return LockUpdate{ Span: rir.Span(), Txn: rir.IntentTxn, Status: rir.Status, IgnoredSeqNums: rir.IgnoredSeqNums, + Durability: lock.Replicated, } } -// AsIntent creates an intent corresponding to the given resolve +// AsLockUpdate creates a lock update message corresponding to the given resolve // intent range request. -func (rirr *ResolveIntentRangeRequest) AsIntent() Intent { - return Intent{ +func (rirr *ResolveIntentRangeRequest) AsLockUpdate() LockUpdate { + return LockUpdate{ Span: rirr.Span(), Txn: rirr.IntentTxn, Status: rirr.Status, IgnoredSeqNums: rirr.IgnoredSeqNums, + Durability: lock.Replicated, } } diff --git a/pkg/roachpb/data.go b/pkg/roachpb/data.go index e2badfd1f05c..cd95f0ab7751 100644 --- a/pkg/roachpb/data.go +++ b/pkg/roachpb/data.go @@ -27,6 +27,7 @@ import ( "time" "github.com/cockroachdb/apd" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/util" "github.com/cockroachdb/cockroach/pkg/util/bitarray" @@ -1782,17 +1783,51 @@ func (l *Lease) Equal(that interface{}) bool { return true } -// AsIntents takes a slice of spans and returns it as a slice of intents for -// the given transaction. -func AsIntents(spans []Span, txn *Transaction) []Intent { +// MakePendingIntent makes an intent in the pending state with the +// given span and txn. This is suitable for use when constructing +// WriteIntentError. +func MakePendingIntent(txn *enginepb.TxnMeta, span Span) Intent { + return Intent{ + Span: span, + Txn: *txn, + } +} + +// AsPendingIntents takes a slice of spans and returns it as a slice of intents +// for the given transaction. +func AsPendingIntents(txn *enginepb.TxnMeta, spans []Span) []Intent { ret := make([]Intent, len(spans)) for i := range spans { - ret[i] = Intent{Span: spans[i]} - ret[i].SetTxn(txn) + ret[i] = MakePendingIntent(txn, spans[i]) + } + return ret +} + +// MakeLockUpdate makes a lock update from the given span and txn. +func MakeLockUpdate(txn *Transaction, span Span, dur lock.Durability) LockUpdate { + update := LockUpdate{Span: span} + update.SetTxn(txn) + update.Durability = dur + return update +} + +// AsLockUpdates takes a slice of spans and returns it as a slice of lock updates +// for the given transaction. +func AsLockUpdates(txn *Transaction, spans []Span, dur lock.Durability) []LockUpdate { + ret := make([]LockUpdate, len(spans)) + for i := range spans { + ret[i] = MakeLockUpdate(txn, spans[i], dur) } return ret } +// SetTxn updates the transaction details in the lock update. +func (u *LockUpdate) SetTxn(txn *Transaction) { + u.Txn = txn.TxnMeta + u.Status = txn.Status + u.IgnoredSeqNums = txn.IgnoredSeqNums +} + // EqualValue compares for equality. func (s Span) EqualValue(o Span) bool { return s.Key.Equal(o.Key) && s.EndKey.Equal(o.EndKey) @@ -2129,28 +2164,3 @@ func init() { enginepb.FormatBytesAsKey = func(k []byte) string { return Key(k).String() } enginepb.FormatBytesAsValue = func(v []byte) string { return Value{RawBytes: v}.PrettyPrint() } } - -// MakeIntent makes an intent from the given span and txn. -func MakeIntent(txn *Transaction, span Span) Intent { - intent := Intent{Span: span} - intent.SetTxn(txn) - return intent -} - -// MakePendingIntent makes an intent in the pending state with the -// given span and txn. This is suitable for use when constructing -// WriteIntentError. -func MakePendingIntent(txn *enginepb.TxnMeta, span Span) Intent { - return Intent{ - Span: span, - Txn: *txn, - Status: PENDING, - } -} - -// SetTxn updates the transaction details in the intent. -func (i *Intent) SetTxn(txn *Transaction) { - i.Txn = txn.TxnMeta - i.Status = txn.Status - i.IgnoredSeqNums = txn.IgnoredSeqNums -} diff --git a/pkg/roachpb/data.pb.go b/pkg/roachpb/data.pb.go index 18d4b5515f0d..a84021b73175 100644 --- a/pkg/roachpb/data.pb.go +++ b/pkg/roachpb/data.pb.go @@ -6,6 +6,7 @@ package roachpb import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" +import lock "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" import enginepb "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" import hlc "github.com/cockroachdb/cockroach/pkg/util/hlc" @@ -90,7 +91,7 @@ func (x ValueType) String() string { return proto.EnumName(ValueType_name, int32(x)) } func (ValueType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{0} + return fileDescriptor_data_1dce4c12350bd2e1, []int{0} } // ReplicaChangeType is a parameter of ChangeReplicasTrigger. @@ -114,7 +115,7 @@ func (x ReplicaChangeType) String() string { return proto.EnumName(ReplicaChangeType_name, int32(x)) } func (ReplicaChangeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{1} + return fileDescriptor_data_1dce4c12350bd2e1, []int{1} } // TransactionStatus specifies possible states for a transaction. @@ -166,7 +167,7 @@ func (x TransactionStatus) String() string { return proto.EnumName(TransactionStatus_name, int32(x)) } func (TransactionStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{2} + return fileDescriptor_data_1dce4c12350bd2e1, []int{2} } // Span is a key range with an inclusive start Key and an exclusive end Key. @@ -183,7 +184,7 @@ type Span struct { func (m *Span) Reset() { *m = Span{} } func (*Span) ProtoMessage() {} func (*Span) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{0} + return fileDescriptor_data_1dce4c12350bd2e1, []int{0} } func (m *Span) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,7 +236,7 @@ func (m *Value) Reset() { *m = Value{} } func (m *Value) String() string { return proto.CompactTextString(m) } func (*Value) ProtoMessage() {} func (*Value) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{1} + return fileDescriptor_data_1dce4c12350bd2e1, []int{1} } func (m *Value) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -271,7 +272,7 @@ func (m *KeyValue) Reset() { *m = KeyValue{} } func (m *KeyValue) String() string { return proto.CompactTextString(m) } func (*KeyValue) ProtoMessage() {} func (*KeyValue) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{2} + return fileDescriptor_data_1dce4c12350bd2e1, []int{2} } func (m *KeyValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -309,7 +310,7 @@ func (m *StoreIdent) Reset() { *m = StoreIdent{} } func (m *StoreIdent) String() string { return proto.CompactTextString(m) } func (*StoreIdent) ProtoMessage() {} func (*StoreIdent) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{3} + return fileDescriptor_data_1dce4c12350bd2e1, []int{3} } func (m *StoreIdent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -349,7 +350,7 @@ func (m *SplitTrigger) Reset() { *m = SplitTrigger{} } func (m *SplitTrigger) String() string { return proto.CompactTextString(m) } func (*SplitTrigger) ProtoMessage() {} func (*SplitTrigger) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{4} + return fileDescriptor_data_1dce4c12350bd2e1, []int{4} } func (m *SplitTrigger) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -397,7 +398,7 @@ func (m *MergeTrigger) Reset() { *m = MergeTrigger{} } func (m *MergeTrigger) String() string { return proto.CompactTextString(m) } func (*MergeTrigger) ProtoMessage() {} func (*MergeTrigger) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{5} + return fileDescriptor_data_1dce4c12350bd2e1, []int{5} } func (m *MergeTrigger) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -467,7 +468,7 @@ type ChangeReplicasTrigger struct { func (m *ChangeReplicasTrigger) Reset() { *m = ChangeReplicasTrigger{} } func (*ChangeReplicasTrigger) ProtoMessage() {} func (*ChangeReplicasTrigger) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{6} + return fileDescriptor_data_1dce4c12350bd2e1, []int{6} } func (m *ChangeReplicasTrigger) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -509,7 +510,7 @@ func (m *ModifiedSpanTrigger) Reset() { *m = ModifiedSpanTrigger{} } func (m *ModifiedSpanTrigger) String() string { return proto.CompactTextString(m) } func (*ModifiedSpanTrigger) ProtoMessage() {} func (*ModifiedSpanTrigger) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{7} + return fileDescriptor_data_1dce4c12350bd2e1, []int{7} } func (m *ModifiedSpanTrigger) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -555,7 +556,7 @@ func (m *StickyBitTrigger) Reset() { *m = StickyBitTrigger{} } func (m *StickyBitTrigger) String() string { return proto.CompactTextString(m) } func (*StickyBitTrigger) ProtoMessage() {} func (*StickyBitTrigger) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{8} + return fileDescriptor_data_1dce4c12350bd2e1, []int{8} } func (m *StickyBitTrigger) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -594,7 +595,7 @@ func (m *InternalCommitTrigger) Reset() { *m = InternalCommitTrigger{} } func (m *InternalCommitTrigger) String() string { return proto.CompactTextString(m) } func (*InternalCommitTrigger) ProtoMessage() {} func (*InternalCommitTrigger) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{9} + return fileDescriptor_data_1dce4c12350bd2e1, []int{9} } func (m *InternalCommitTrigger) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -663,7 +664,7 @@ func (m *ObservedTimestamp) Reset() { *m = ObservedTimestamp{} } func (m *ObservedTimestamp) String() string { return proto.CompactTextString(m) } func (*ObservedTimestamp) ProtoMessage() {} func (*ObservedTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{10} + return fileDescriptor_data_1dce4c12350bd2e1, []int{10} } func (m *ObservedTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -898,7 +899,7 @@ type Transaction struct { func (m *Transaction) Reset() { *m = Transaction{} } func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{11} + return fileDescriptor_data_1dce4c12350bd2e1, []int{11} } func (m *Transaction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -949,7 +950,7 @@ func (m *TransactionRecord) Reset() { *m = TransactionRecord{} } func (m *TransactionRecord) String() string { return proto.CompactTextString(m) } func (*TransactionRecord) ProtoMessage() {} func (*TransactionRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{12} + return fileDescriptor_data_1dce4c12350bd2e1, []int{12} } func (m *TransactionRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -974,30 +975,26 @@ func (m *TransactionRecord) XXX_DiscardUnknown() { var xxx_messageInfo_TransactionRecord proto.InternalMessageInfo -// A Intent is a Span together with a Transaction metadata and its status. +// A Intent is a Span together with a Transaction metadata. Intents messages +// are used to reference persistent on-disk write intents. They are used on +// the return path of e.g. scans, to report the existence of a write intent +// on a key. // -// Intents are used for two separate purposes: -// - on the return path of e.g. scans, to report the existence of a -// write intent on a key; -// - as input argument to intent resolution, to pass the current txn status, -// timestamps and ignored seqnum ranges to the resolution algorithm. -// Only in the latter case are the TxnMeta, status and ignored seqnum -// ranges guaranteed to be consistent with the latest txn's state. -// -// Note: avoid constructing Intent directly; consider using -// MakeIntent() or MakeErrorIntent() instead. +// Note: avoid constructing Intent directly; consider using MakePendingIntent() +// instead. type Intent struct { - Span `protobuf:"bytes,1,opt,name=span,proto3,embedded=span" json:"span"` - Txn enginepb.TxnMeta `protobuf:"bytes,2,opt,name=txn,proto3" json:"txn"` - Status TransactionStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cockroach.roachpb.TransactionStatus" json:"status,omitempty"` - IgnoredSeqNums []enginepb.IgnoredSeqNumRange `protobuf:"bytes,4,rep,name=ignored_seqnums,json=ignoredSeqnums,proto3" json:"ignored_seqnums"` + // NB: now that LockUpdate is split away from this message type, this span + // field always contains a single-key. We could migrate it, but doing so + // doesn't seem worth it. + Span `protobuf:"bytes,1,opt,name=span,proto3,embedded=span" json:"span"` + Txn enginepb.TxnMeta `protobuf:"bytes,2,opt,name=txn,proto3" json:"txn"` } func (m *Intent) Reset() { *m = Intent{} } func (m *Intent) String() string { return proto.CompactTextString(m) } func (*Intent) ProtoMessage() {} func (*Intent) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{13} + return fileDescriptor_data_1dce4c12350bd2e1, []int{13} } func (m *Intent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1022,6 +1019,48 @@ func (m *Intent) XXX_DiscardUnknown() { var xxx_messageInfo_Intent proto.InternalMessageInfo +// A LockUpdate is a Span together with Transaction state. LockUpdate messages +// are used to update all locks held by the transaction within the span to the +// transaction's authoritative state. As such, the message is used as input +// argument to intent resolution, to pass the current txn status, timestamps and +// ignored seqnum ranges to the resolution algorithm. +type LockUpdate struct { + Span `protobuf:"bytes,1,opt,name=span,proto3,embedded=span" json:"span"` + Txn enginepb.TxnMeta `protobuf:"bytes,2,opt,name=txn,proto3" json:"txn"` + Status TransactionStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cockroach.roachpb.TransactionStatus" json:"status,omitempty"` + IgnoredSeqNums []enginepb.IgnoredSeqNumRange `protobuf:"bytes,4,rep,name=ignored_seqnums,json=ignoredSeqnums,proto3" json:"ignored_seqnums"` + Durability lock.Durability `protobuf:"varint,5,opt,name=durability,proto3,enum=cockroach.storage.concurrency.lock.Durability" json:"durability,omitempty"` +} + +func (m *LockUpdate) Reset() { *m = LockUpdate{} } +func (m *LockUpdate) String() string { return proto.CompactTextString(m) } +func (*LockUpdate) ProtoMessage() {} +func (*LockUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_data_1dce4c12350bd2e1, []int{14} +} +func (m *LockUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LockUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *LockUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_LockUpdate.Merge(dst, src) +} +func (m *LockUpdate) XXX_Size() int { + return m.Size() +} +func (m *LockUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_LockUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_LockUpdate proto.InternalMessageInfo + // A SequencedWrite is a point write to a key with a certain sequence number. type SequencedWrite struct { // The key that the write was made at. @@ -1034,7 +1073,7 @@ func (m *SequencedWrite) Reset() { *m = SequencedWrite{} } func (m *SequencedWrite) String() string { return proto.CompactTextString(m) } func (*SequencedWrite) ProtoMessage() {} func (*SequencedWrite) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{14} + return fileDescriptor_data_1dce4c12350bd2e1, []int{15} } func (m *SequencedWrite) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1098,7 +1137,7 @@ type Lease struct { func (m *Lease) Reset() { *m = Lease{} } func (*Lease) ProtoMessage() {} func (*Lease) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{15} + return fileDescriptor_data_1dce4c12350bd2e1, []int{16} } func (m *Lease) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1143,7 +1182,7 @@ func (m *AbortSpanEntry) Reset() { *m = AbortSpanEntry{} } func (m *AbortSpanEntry) String() string { return proto.CompactTextString(m) } func (*AbortSpanEntry) ProtoMessage() {} func (*AbortSpanEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{16} + return fileDescriptor_data_1dce4c12350bd2e1, []int{17} } func (m *AbortSpanEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1200,7 +1239,7 @@ func (m *LeafTxnInputState) Reset() { *m = LeafTxnInputState{} } func (m *LeafTxnInputState) String() string { return proto.CompactTextString(m) } func (*LeafTxnInputState) ProtoMessage() {} func (*LeafTxnInputState) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{17} + return fileDescriptor_data_1dce4c12350bd2e1, []int{18} } func (m *LeafTxnInputState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1253,7 +1292,7 @@ func (m *LeafTxnFinalState) Reset() { *m = LeafTxnFinalState{} } func (m *LeafTxnFinalState) String() string { return proto.CompactTextString(m) } func (*LeafTxnFinalState) ProtoMessage() {} func (*LeafTxnFinalState) Descriptor() ([]byte, []int) { - return fileDescriptor_data_1a440e049c0365d8, []int{18} + return fileDescriptor_data_1dce4c12350bd2e1, []int{19} } func (m *LeafTxnFinalState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1293,6 +1332,7 @@ func init() { proto.RegisterType((*Transaction)(nil), "cockroach.roachpb.Transaction") proto.RegisterType((*TransactionRecord)(nil), "cockroach.roachpb.TransactionRecord") proto.RegisterType((*Intent)(nil), "cockroach.roachpb.Intent") + proto.RegisterType((*LockUpdate)(nil), "cockroach.roachpb.LockUpdate") proto.RegisterType((*SequencedWrite)(nil), "cockroach.roachpb.SequencedWrite") proto.RegisterType((*Lease)(nil), "cockroach.roachpb.Lease") proto.RegisterType((*AbortSpanEntry)(nil), "cockroach.roachpb.AbortSpanEntry") @@ -1746,6 +1786,33 @@ func (this *Intent) Equal(that interface{}) bool { if !this.Txn.Equal(&that1.Txn) { return false } + return true +} +func (this *LockUpdate) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*LockUpdate) + if !ok { + that2, ok := that.(LockUpdate) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Span.Equal(&that1.Span) { + return false + } + if !this.Txn.Equal(&that1.Txn) { + return false + } if this.Status != that1.Status { return false } @@ -1757,6 +1824,9 @@ func (this *Intent) Equal(that interface{}) bool { return false } } + if this.Durability != that1.Durability { + return false + } return true } func (this *SequencedWrite) Equal(that interface{}) bool { @@ -2528,6 +2598,40 @@ func (m *Intent) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n28 + return i, nil +} + +func (m *LockUpdate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LockUpdate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintData(dAtA, i, uint64(m.Span.Size())) + n29, err := m.Span.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + dAtA[i] = 0x12 + i++ + i = encodeVarintData(dAtA, i, uint64(m.Txn.Size())) + n30, err := m.Txn.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n30 if m.Status != 0 { dAtA[i] = 0x18 i++ @@ -2545,6 +2649,11 @@ func (m *Intent) MarshalTo(dAtA []byte) (int, error) { i += n } } + if m.Durability != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintData(dAtA, i, uint64(m.Durability)) + } return i, nil } @@ -2595,48 +2704,48 @@ func (m *Lease) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintData(dAtA, i, uint64(m.Start.Size())) - n29, err := m.Start.MarshalTo(dAtA[i:]) + n31, err := m.Start.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n29 + i += n31 if m.Expiration != nil { dAtA[i] = 0x12 i++ i = encodeVarintData(dAtA, i, uint64(m.Expiration.Size())) - n30, err := m.Expiration.MarshalTo(dAtA[i:]) + n32, err := m.Expiration.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n30 + i += n32 } dAtA[i] = 0x1a i++ i = encodeVarintData(dAtA, i, uint64(m.Replica.Size())) - n31, err := m.Replica.MarshalTo(dAtA[i:]) + n33, err := m.Replica.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n31 + i += n33 if m.DeprecatedStartStasis != nil { dAtA[i] = 0x22 i++ i = encodeVarintData(dAtA, i, uint64(m.DeprecatedStartStasis.Size())) - n32, err := m.DeprecatedStartStasis.MarshalTo(dAtA[i:]) + n34, err := m.DeprecatedStartStasis.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n32 + i += n34 } if m.ProposedTS != nil { dAtA[i] = 0x2a i++ i = encodeVarintData(dAtA, i, uint64(m.ProposedTS.Size())) - n33, err := m.ProposedTS.MarshalTo(dAtA[i:]) + n35, err := m.ProposedTS.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n33 + i += n35 } if m.Epoch != 0 { dAtA[i] = 0x30 @@ -2675,11 +2784,11 @@ func (m *AbortSpanEntry) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintData(dAtA, i, uint64(m.Timestamp.Size())) - n34, err := m.Timestamp.MarshalTo(dAtA[i:]) + n36, err := m.Timestamp.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n34 + i += n36 if m.Priority != 0 { dAtA[i] = 0x18 i++ @@ -2706,11 +2815,11 @@ func (m *LeafTxnInputState) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintData(dAtA, i, uint64(m.Txn.Size())) - n35, err := m.Txn.MarshalTo(dAtA[i:]) + n37, err := m.Txn.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n35 + i += n37 if m.RefreshInvalid { dAtA[i] = 0x38 i++ @@ -2769,11 +2878,11 @@ func (m *LeafTxnFinalState) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintData(dAtA, i, uint64(m.Txn.Size())) - n36, err := m.Txn.MarshalTo(dAtA[i:]) + n38, err := m.Txn.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n36 + i += n38 if m.DeprecatedCommandCount != 0 { dAtA[i] = 0x18 i++ @@ -3360,6 +3469,19 @@ func (m *TransactionRecord) Size() (n int) { } func (m *Intent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Span.Size() + n += 1 + l + sovData(uint64(l)) + l = m.Txn.Size() + n += 1 + l + sovData(uint64(l)) + return n +} + +func (m *LockUpdate) Size() (n int) { if m == nil { return 0 } @@ -3378,6 +3500,9 @@ func (m *Intent) Size() (n int) { n += 1 + l + sovData(uint64(l)) } } + if m.Durability != 0 { + n += 1 + sovData(uint64(m.Durability)) + } return n } @@ -5644,6 +5769,116 @@ func (m *Intent) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Intent: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Span", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowData + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthData + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Span.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Txn", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowData + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthData + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Txn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipData(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthData + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LockUpdate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowData + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LockUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LockUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Span", wireType) @@ -5754,6 +5989,25 @@ func (m *Intent) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Durability", wireType) + } + m.Durability = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowData + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Durability |= (lock.Durability(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipData(dAtA[iNdEx:]) @@ -6677,148 +6931,152 @@ var ( ErrIntOverflowData = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("roachpb/data.proto", fileDescriptor_data_1a440e049c0365d8) } - -var fileDescriptor_data_1a440e049c0365d8 = []byte{ - // 2234 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0x4d, 0x8c, 0x1b, 0x49, - 0x15, 0x9e, 0x76, 0xb7, 0xed, 0xf6, 0xb3, 0xc7, 0xd3, 0x53, 0xc9, 0x24, 0x4e, 0x56, 0xd8, 0xc1, - 0x8b, 0x20, 0x44, 0xbb, 0x1e, 0x91, 0xec, 0xae, 0x20, 0x42, 0x08, 0xff, 0x25, 0x69, 0x67, 0xec, - 0xc9, 0xb6, 0x3d, 0x59, 0x25, 0xcb, 0xaa, 0x69, 0x77, 0xd7, 0x78, 0x9a, 0xb8, 0xbb, 0x9d, 0xee, - 0xf6, 0x64, 0xcc, 0x99, 0xc3, 0x8a, 0x0b, 0x7b, 0x44, 0x9c, 0x22, 0x71, 0xe3, 0xc2, 0x95, 0x13, - 0x1c, 0x90, 0x50, 0x8e, 0x39, 0xc1, 0x8a, 0x83, 0x05, 0xce, 0x85, 0x33, 0xc7, 0x48, 0x48, 0xa8, - 0xaa, 0xfa, 0x2f, 0x19, 0x67, 0xe4, 0x61, 0x22, 0xb4, 0xda, 0xcb, 0xb8, 0xeb, 0xd5, 0x7b, 0xdf, - 0xab, 0x7a, 0xef, 0xd5, 0x7b, 0xaf, 0x6a, 0x00, 0xb9, 0x8e, 0xa6, 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 0x95, 0x39, 0x4f, 0x29, 0x9a, 0xd1, 0x98, 0x28, 0x39, - 0x76, 0xf5, 0xe2, 0x25, 0xa1, 0x23, 0x88, 0x39, 0x09, 0x3a, 0x82, 0xb8, 0x2e, 0x15, 0x3b, 0x82, - 0x58, 0x94, 0x36, 0xaa, 0x7f, 0x11, 0x60, 0x33, 0x71, 0x94, 0x14, 0xac, 0x3b, 0xae, 0xf1, 0x16, - 0x8f, 0xf7, 0x57, 0xe7, 0x28, 0x9f, 0x3d, 0x84, 0xbf, 0x46, 0xc1, 0x21, 0x26, 0x02, 0x23, 0x25, - 0xf1, 0x51, 0x78, 0x64, 0xa4, 0x6c, 0x47, 0x10, 0xb3, 0x92, 0xd8, 0x11, 0x44, 0x51, 0xca, 0x45, - 0x01, 0x03, 0x52, 0xbe, 0x23, 0x88, 0x05, 0x69, 0x3d, 0x19, 0x3c, 0x1d, 0x41, 0xdc, 0x90, 0xa4, - 0x8e, 0x20, 0x4a, 0xd2, 0x66, 0xf5, 0x4f, 0x29, 0xc8, 0xc8, 0xd4, 0x58, 0xe8, 0x43, 0x10, 0xa2, - 0x56, 0xea, 0x04, 0x0b, 0x27, 0x42, 0x85, 0xb0, 0xa3, 0x06, 0xf0, 0xfe, 0x51, 0xd8, 0x52, 0x9d, - 0x26, 0xe6, 0x98, 0x69, 0x89, 0x70, 0x22, 0xdc, 0xf8, 0xff, 0x21, 0xdc, 0x96, 0x78, 0x43, 0xf8, - 0x7f, 0x78, 0x83, 0xb5, 0x6d, 0xbf, 0xe1, 0xa0, 0xf8, 0x6a, 0xd0, 0x9c, 0xf4, 0x52, 0xa1, 0x83, - 0xe8, 0x05, 0xcc, 0xc1, 0xe5, 0xff, 0xf6, 0xcb, 0x79, 0xa5, 0xb9, 0xd2, 0xf3, 0xc2, 0x1b, 0x9e, - 0x8b, 0x88, 0x41, 0xfb, 0xf8, 0xb1, 0x12, 0x01, 0x27, 0x1a, 0x80, 0xff, 0xf0, 0x90, 0xde, 0xc1, - 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, 0xbe, 0xd2, 0xa5, 0xb2, 0xb2, 0x4d, 0x76, 0x70, 0xaf, 0xdd, 0x6b, 0xc9, 0xbd, - 0xdb, 0xd2, 0x1a, 0x19, 0xf4, 0x07, 0xf5, 0xdb, 0x64, 0xc0, 0xa3, 0x75, 0xc8, 0x35, 0x77, 0xbb, - 0x5d, 0x79, 0x30, 0x68, 0xb7, 0x24, 0x8e, 0xcc, 0xd5, 0x1b, 0xbb, 0x0a, 0x19, 0xa4, 0x18, 0x60, - 0xe3, 0xbb, 0xcf, 0xfe, 0x59, 0x5e, 0x7b, 0xb6, 0x28, 0x73, 0xcf, 0x17, 0x65, 0xee, 0xcb, 0x45, - 0x99, 0xfb, 0xc7, 0xa2, 0xcc, 0x7d, 0xf1, 0xa2, 0xbc, 0xf6, 0xfc, 0x45, 0x79, 0xed, 0xcb, 0x17, - 0xe5, 0xb5, 0x87, 0xd9, 0xc0, 0xb7, 0xc3, 0x0c, 0xfd, 0x7f, 0xc8, 0x8d, 0xff, 0x06, 0x00, 0x00, - 0xff, 0xff, 0x7a, 0x18, 0xe7, 0x5a, 0xc9, 0x19, 0x00, 0x00, +func init() { proto.RegisterFile("roachpb/data.proto", fileDescriptor_data_1dce4c12350bd2e1) } + +var fileDescriptor_data_1dce4c12350bd2e1 = []byte{ + // 2300 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0x4f, 0x8c, 0xdb, 0x58, + 0x19, 0x1f, 0x8f, 0x9d, 0xc4, 0xf9, 0x92, 0xc9, 0x78, 0x5e, 0x3b, 0x6d, 0xb6, 0x2b, 0x92, 0x92, + 0x45, 0x4b, 0xa9, 0x76, 0x33, 0x62, 0xba, 0xbb, 0x82, 0x0a, 0x21, 0xf2, 0xaf, 0xad, 0xd3, 0x49, + 0xa6, 0xeb, 0x64, 0xba, 0x6a, 0x97, 0x95, 0x71, 0xec, 0x37, 0x19, 0x33, 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, 0xea, 0xae, 0xbd, 0x15, 0x63, 0x1b, 0x83, + 0xf9, 0xf3, 0xd6, 0xe8, 0x70, 0xb8, 0x45, 0x5d, 0x35, 0x1e, 0x9b, 0x46, 0x75, 0x6f, 0x4f, 0x6e, + 0xce, 0xa6, 0xe5, 0x6c, 0x83, 0x01, 0xca, 0x4d, 0x25, 0x1b, 0x62, 0xcb, 0x06, 0x7a, 0x1f, 0x32, + 0x8e, 0x6b, 0x60, 0xa2, 0x85, 0xec, 0x37, 0x55, 0xbf, 0x38, 0x9b, 0x96, 0xd3, 0x5d, 0xd7, 0xc0, + 0x72, 0xf3, 0x45, 0xfc, 0xa4, 0xa4, 0x09, 0x93, 0x6c, 0xa0, 0x6f, 0x83, 0x48, 0x02, 0x85, 0xf2, + 0xf3, 0x94, 0xff, 0xd2, 0x6c, 0x5a, 0xce, 0xb0, 0x9d, 0x13, 0x81, 0xe8, 0x51, 0xc9, 0xf8, 0xec, + 0x34, 0x95, 0xdf, 0x72, 0x90, 0xef, 0x8d, 0x2c, 0x33, 0xe8, 0x7b, 0xe6, 0x70, 0x88, 0x3d, 0xd4, + 0x82, 0xac, 0x85, 0xf7, 0x03, 0xd5, 0xc0, 0xbe, 0x4e, 0x8f, 0x96, 0xdb, 0xae, 0x2c, 0x30, 0x92, + 0xa2, 0x39, 0x43, 0xdc, 0xc4, 0xbe, 0xee, 0x99, 0xa3, 0xc0, 0xf5, 0x42, 0x73, 0x89, 0x44, 0x94, + 0x50, 0xd1, 0x6d, 0x00, 0xcf, 0x1c, 0x1e, 0x84, 0x38, 0xab, 0x67, 0xc4, 0xc9, 0x52, 0x59, 0x42, + 0x66, 0xde, 0x6d, 0x0b, 0x22, 0x2f, 0x09, 0x95, 0xd9, 0x2a, 0xe4, 0x3b, 0xd8, 0x1b, 0xe2, 0xaf, + 0xe8, 0x66, 0x91, 0x03, 0x12, 0x03, 0x22, 0x79, 0xa9, 0xfa, 0x81, 0x16, 0xf8, 0x34, 0x71, 0x72, + 0xd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 0x6b, 0xdb, 0x73, + 0x1d, 0x4d, 0x58, 0xf3, 0x49, 0x35, 0x57, 0x03, 0x46, 0x08, 0xd5, 0x94, 0x17, 0xee, 0x7f, 0x5e, + 0xf5, 0x95, 0xbc, 0x9f, 0xec, 0x01, 0x4d, 0x58, 0xb3, 0x49, 0x99, 0x8d, 0x51, 0x56, 0x5f, 0x8b, + 0x92, 0x2c, 0xc7, 0x4a, 0xde, 0x4e, 0x16, 0xe7, 0x1f, 0xc1, 0xe5, 0xb0, 0x46, 0x44, 0xee, 0x8f, + 0xf1, 0x78, 0x8a, 0x77, 0x6d, 0x01, 0xde, 0xc2, 0xca, 0xa3, 0x6c, 0xea, 0xaf, 0x29, 0x48, 0x9b, + 0x76, 0xe8, 0x77, 0xea, 0xad, 0x18, 0x9f, 0xd5, 0xdc, 0x77, 0x17, 0xed, 0xf7, 0x64, 0x9c, 0x28, + 0x17, 0xec, 0x05, 0xc1, 0xf3, 0x31, 0xa0, 0xb9, 0xb7, 0x62, 0x60, 0x96, 0x70, 0xef, 0x2c, 0x32, + 0xe7, 0x2b, 0xee, 0x56, 0x24, 0xff, 0x15, 0xca, 0x4d, 0xf1, 0xf3, 0x70, 0x4e, 0xaa, 0xfc, 0x82, + 0x83, 0x8d, 0xdd, 0x81, 0x8f, 0xbd, 0x23, 0x6c, 0xc4, 0xde, 0x4e, 0x76, 0x7b, 0x6e, 0x89, 0x6e, + 0xff, 0x06, 0x46, 0x27, 0x31, 0x9a, 0xdc, 0x2a, 0x7f, 0xce, 0x40, 0xae, 0xef, 0x69, 0x8e, 0xaf, + 0xe9, 0x81, 0xe9, 0x3a, 0xe8, 0x0e, 0x08, 0x64, 0x9e, 0x0d, 0xe3, 0xe7, 0xfa, 0x12, 0xdd, 0xab, + 0x7f, 0xec, 0x74, 0x70, 0xa0, 0xd5, 0x45, 0xa2, 0xe4, 0xd9, 0xb4, 0xcc, 0x29, 0x14, 0x01, 0x21, + 0x10, 0x1c, 0xcd, 0x66, 0x03, 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xc4, 0x3d, 0x9b, 0x95, 0xb8, + 0x2f, 0x67, 0x25, 0xee, 0x6f, 0xb3, 0x12, 0xf7, 0xc5, 0xf3, 0xd2, 0xca, 0xb3, 0xe7, 0xa5, 0x95, + 0x2f, 0x9f, 0x97, 0x56, 0x1e, 0x66, 0x42, 0xdf, 0x0e, 0xd2, 0xf4, 0xff, 0x3d, 0x37, 0xfe, 0x1d, + 0x00, 0x00, 0xff, 0xff, 0x95, 0x94, 0x17, 0x77, 0xd1, 0x1a, 0x00, 0x00, } diff --git a/pkg/roachpb/data.proto b/pkg/roachpb/data.proto index 40a3d39e18e2..8b95ba59bcce 100644 --- a/pkg/roachpb/data.proto +++ b/pkg/roachpb/data.proto @@ -13,6 +13,7 @@ package cockroach.roachpb; option go_package = "roachpb"; import "roachpb/metadata.proto"; +import "storage/concurrency/lock/locking.proto"; import "storage/engine/enginepb/mvcc.proto"; import "storage/engine/enginepb/mvcc3.proto"; import "util/hlc/timestamp.proto"; @@ -539,25 +540,36 @@ message TransactionRecord { reserved 2, 3, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16; } -// A Intent is a Span together with a Transaction metadata and its status. +// A Intent is a Span together with a Transaction metadata. Intents messages +// are used to reference persistent on-disk write intents. They are used on +// the return path of e.g. scans, to report the existence of a write intent +// on a key. // -// Intents are used for two separate purposes: -// - on the return path of e.g. scans, to report the existence of a -// write intent on a key; -// - as input argument to intent resolution, to pass the current txn status, -// timestamps and ignored seqnum ranges to the resolution algorithm. -// Only in the latter case are the TxnMeta, status and ignored seqnum -// ranges guaranteed to be consistent with the latest txn's state. -// -// Note: avoid constructing Intent directly; consider using -// MakeIntent() or MakeErrorIntent() instead. +// Note: avoid constructing Intent directly; consider using MakePendingIntent() +// instead. message Intent { option (gogoproto.equal) = true; + // NB: now that LockUpdate is split away from this message type, this span + // field always contains a single-key. We could migrate it, but doing so + // doesn't seem worth it. + Span span = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + storage.engine.enginepb.TxnMeta txn = 2 [(gogoproto.nullable) = false]; +} + +// A LockUpdate is a Span together with Transaction state. LockUpdate messages +// are used to update all locks held by the transaction within the span to the +// transaction's authoritative state. As such, the message is used as input +// argument to intent resolution, to pass the current txn status, timestamps and +// ignored seqnum ranges to the resolution algorithm. +message LockUpdate { + option (gogoproto.equal) = true; + Span span = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; storage.engine.enginepb.TxnMeta txn = 2 [(gogoproto.nullable) = false]; TransactionStatus status = 3; repeated storage.engine.enginepb.IgnoredSeqNumRange ignored_seqnums = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "IgnoredSeqNums"]; + storage.concurrency.lock.Durability durability = 5; } // A SequencedWrite is a point write to a key with a certain sequence number. diff --git a/pkg/roachpb/data_test.go b/pkg/roachpb/data_test.go index 5351e822d280..895de3ceca6e 100644 --- a/pkg/roachpb/data_test.go +++ b/pkg/roachpb/data_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/cockroachdb/apd" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/testutils/zerofields" "github.com/cockroachdb/cockroach/pkg/util" @@ -1895,9 +1896,9 @@ func TestChangeReplicasTrigger_ConfChange(t *testing.T) { } } -// TestAsIntents verifies that AsIntents propagates all the important +// TestAsLockUpdates verifies that AsLockUpdates propagates all the important // fields from a txn to each intent. -func TestAsIntents(t *testing.T) { +func TestAsLockUpdates(t *testing.T) { defer leaktest.AfterTest(t)() ts := hlc.Timestamp{WallTime: 1} @@ -1906,10 +1907,12 @@ func TestAsIntents(t *testing.T) { txn.Status = COMMITTED txn.IgnoredSeqNums = []enginepb.IgnoredSeqNumRange{{Start: 0, End: 0}} + dur := lock.Unreplicated spans := []Span{{Key: Key("a"), EndKey: Key("b")}} - for _, intent := range AsIntents(spans, &txn) { - require.Equal(t, intent.Status, txn.Status) - require.Equal(t, intent.IgnoredSeqNums, txn.IgnoredSeqNums) - require.Equal(t, intent.Txn, txn.TxnMeta) + for _, intent := range AsLockUpdates(&txn, spans, dur) { + require.Equal(t, txn.Status, intent.Status) + require.Equal(t, txn.IgnoredSeqNums, intent.IgnoredSeqNums) + require.Equal(t, txn.TxnMeta, intent.Txn) + require.Equal(t, dur, intent.Durability) } } diff --git a/pkg/storage/batch_spanset_test.go b/pkg/storage/batch_spanset_test.go index 0d6d4c25f500..8974bdaa21d2 100644 --- a/pkg/storage/batch_spanset_test.go +++ b/pkg/storage/batch_spanset_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/spanset" @@ -544,10 +545,11 @@ func TestSpanSetMVCCResolveWriteIntentRangeUsingIter(t *testing.T) { batch := spanset.NewBatch(eng.NewBatch(), &ss) defer batch.Close() - intent := roachpb.Intent{ - Span: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("b\x00")}, - Txn: enginepb.TxnMeta{}, // unused - Status: roachpb.PENDING, + intent := roachpb.LockUpdate{ + Span: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("b\x00")}, + Txn: enginepb.TxnMeta{}, // unused + Status: roachpb.PENDING, + Durability: lock.Replicated, } iterAndBuf := engine.GetIterAndBuf(batch, engine.IterOptions{UpperBound: intent.Span.EndKey}) diff --git a/pkg/storage/batcheval/cmd_end_transaction.go b/pkg/storage/batcheval/cmd_end_transaction.go index 78d84358d845..e208d72765f4 100644 --- a/pkg/storage/batcheval/cmd_end_transaction.go +++ b/pkg/storage/batcheval/cmd_end_transaction.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/storage/abortspan" "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/rditer" @@ -481,7 +482,7 @@ func resolveLocalIntents( externalIntents = append(externalIntents, span) return nil } - intent := roachpb.MakeIntent(txn, span) + intent := roachpb.MakeLockUpdate(txn, span, lock.Replicated) if len(span.EndKey) == 0 { // For single-key intents, do a KeyAddress-aware check of // whether it's contained in our Range. diff --git a/pkg/storage/batcheval/cmd_refresh_range_test.go b/pkg/storage/batcheval/cmd_refresh_range_test.go index f1957275264e..637654458069 100644 --- a/pkg/storage/batcheval/cmd_refresh_range_test.go +++ b/pkg/storage/batcheval/cmd_refresh_range_test.go @@ -16,6 +16,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/util/hlc" @@ -83,7 +84,7 @@ func TestRefreshRangeTimeBoundIterator(t *testing.T) { // (committed). The sstable also has a second write at a different (older) // timestamp, because if it were empty other than the deletion tombstone, it // would not have any timestamp bounds and would be selected for every read. - intent := roachpb.MakeIntent(txn, roachpb.Span{Key: k}) + intent := roachpb.MakeLockUpdate(txn, roachpb.Span{Key: k}, lock.Replicated) intent.Status = roachpb.COMMITTED if _, err := engine.MVCCResolveWriteIntent(ctx, db, nil, intent); err != nil { t.Fatal(err) diff --git a/pkg/storage/batcheval/cmd_resolve_intent.go b/pkg/storage/batcheval/cmd_resolve_intent.go index 184b7604147b..bf8160cc7e1c 100644 --- a/pkg/storage/batcheval/cmd_resolve_intent.go +++ b/pkg/storage/batcheval/cmd_resolve_intent.go @@ -81,8 +81,8 @@ func ResolveIntent( return result.Result{}, ErrTransactionUnsupported } - intent := args.AsIntent() - ok, err := engine.MVCCResolveWriteIntent(ctx, readWriter, ms, intent) + update := args.AsLockUpdate() + ok, err := engine.MVCCResolveWriteIntent(ctx, readWriter, ms, update) if err != nil { return result.Result{}, err } diff --git a/pkg/storage/batcheval/cmd_resolve_intent_range.go b/pkg/storage/batcheval/cmd_resolve_intent_range.go index e4175053c7aa..fa69674907fa 100644 --- a/pkg/storage/batcheval/cmd_resolve_intent_range.go +++ b/pkg/storage/batcheval/cmd_resolve_intent_range.go @@ -42,13 +42,13 @@ func ResolveIntentRange( return result.Result{}, ErrTransactionUnsupported } - intent := args.AsIntent() + update := args.AsLockUpdate() iterAndBuf := engine.GetIterAndBuf(readWriter, engine.IterOptions{UpperBound: args.EndKey}) defer iterAndBuf.Cleanup() numKeys, resumeSpan, err := engine.MVCCResolveWriteIntentRangeUsingIter( - ctx, readWriter, iterAndBuf, ms, intent, cArgs.MaxKeys, + ctx, readWriter, iterAndBuf, ms, update, cArgs.MaxKeys, ) if err != nil { return result.Result{}, err diff --git a/pkg/storage/concurrency/concurrency_control.go b/pkg/storage/concurrency/concurrency_control.go index 669d84bb01a9..cf4771318178 100644 --- a/pkg/storage/concurrency/concurrency_control.go +++ b/pkg/storage/concurrency/concurrency_control.go @@ -229,11 +229,11 @@ type ContentionHandler interface { type LockManager interface { // OnLockAcquired informs the concurrency manager that a transaction has // acquired a new lock or re-acquired an existing lock that it already held. - OnLockAcquired(context.Context, *roachpb.Intent) + OnLockAcquired(context.Context, *roachpb.LockUpdate) // OnLockUpdated informs the concurrency manager that a transaction has // updated or released a lock or range of locks that it previously held. - OnLockUpdated(context.Context, *roachpb.Intent) + OnLockUpdated(context.Context, *roachpb.LockUpdate) } // TransactionManager is concerned with tracking transactions that have their @@ -505,7 +505,7 @@ type lockTable interface { // contained in IgnoredSeqNums are dropped. // - the remaining locks are changed to timestamp equal to // txn.WriteTimestamp. - UpdateLocks(*roachpb.Intent) error + UpdateLocks(*roachpb.LockUpdate) error // Clear removes all locks and lock wait-queues from the lockTable. Clear() diff --git a/pkg/storage/concurrency/concurrency_manager.go b/pkg/storage/concurrency/concurrency_manager.go index 8bfa012a1555..33254358b6ba 100644 --- a/pkg/storage/concurrency/concurrency_manager.go +++ b/pkg/storage/concurrency/concurrency_manager.go @@ -284,17 +284,15 @@ func (m *managerImpl) HandleTransactionPushError( } // OnLockAcquired implements the LockManager interface. -func (m *managerImpl) OnLockAcquired(ctx context.Context, in *roachpb.Intent) { - // TODO(nvanbenschoten): rename roachpb.Intent and add a lock.Durability - // field to it. - if err := m.lt.AcquireLock(&in.Txn, in.Key, lock.Exclusive, lock.Unreplicated); err != nil { +func (m *managerImpl) OnLockAcquired(ctx context.Context, up *roachpb.LockUpdate) { + if err := m.lt.AcquireLock(&up.Txn, up.Key, lock.Exclusive, up.Durability); err != nil { log.Fatal(ctx, errors.HandleAsAssertionFailure(err)) } } // OnLockUpdated implements the LockManager interface. -func (m *managerImpl) OnLockUpdated(ctx context.Context, in *roachpb.Intent) { - if err := m.lt.UpdateLocks(in); err != nil { +func (m *managerImpl) OnLockUpdated(ctx context.Context, up *roachpb.LockUpdate) { + if err := m.lt.UpdateLocks(up); err != nil { log.Fatal(ctx, errors.HandleAsAssertionFailure(err)) } } diff --git a/pkg/storage/concurrency/concurrency_manager_test.go b/pkg/storage/concurrency/concurrency_manager_test.go index 73e5d6d102b3..f606bfe67c62 100644 --- a/pkg/storage/concurrency/concurrency_manager_test.go +++ b/pkg/storage/concurrency/concurrency_manager_test.go @@ -27,6 +27,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/internal/client" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/storage/batcheval" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/intentresolver" "github.com/cockroachdb/cockroach/pkg/storage/spanset" @@ -249,10 +250,9 @@ func TestConcurrencyManagerBasic(t *testing.T) { mon.runSync("acquire lock", func(ctx context.Context) { log.Eventf(ctx, "%s @ %s", txnName, key) - m.OnLockAcquired(ctx, &roachpb.Intent{ - Span: roachpb.Span{Key: roachpb.Key(key)}, - Txn: txn.TxnMeta, - }) + span := roachpb.Span{Key: roachpb.Key(key)} + up := roachpb.MakeLockUpdate(txn, span, lock.Unreplicated) + m.OnLockAcquired(ctx, &up) }) return mon.waitAndCollect(t) @@ -407,7 +407,7 @@ func (c *cluster) PushTransaction( // ResolveIntent implements the IntentResolver interface. func (c *cluster) ResolveIntent( - ctx context.Context, intent roachpb.Intent, _ intentresolver.ResolveOptions, + ctx context.Context, intent roachpb.LockUpdate, _ intentresolver.ResolveOptions, ) *Error { log.Eventf(ctx, "resolving intent %s for txn %s with %s status", intent.Key, intent.Txn.ID, intent.Status) c.m.OnLockUpdated(ctx, &intent) diff --git a/pkg/storage/concurrency/lock_table.go b/pkg/storage/concurrency/lock_table.go index c70fc476de96..826580802624 100644 --- a/pkg/storage/concurrency/lock_table.go +++ b/pkg/storage/concurrency/lock_table.go @@ -49,6 +49,7 @@ type waitingState struct { // request is waiting for. txn *enginepb.TxnMeta // always non-nil ts hlc.Timestamp // the timestamp of the transaction that is causing the wait + dur lock.Durability // the durability of the lock that is causing the wait key roachpb.Key // the key of the lock that is causing the wait held bool // is the lock currently held? access spanset.SpanAccess // currently only SpanReadWrite @@ -577,7 +578,7 @@ func (l *lockState) tryBreakReservation(seqNum uint64) bool { // waitForDistinguished states. // REQUIRES: l.mu is locked. func (l *lockState) informActiveWaiters() { - waitForTxn, waitForTs := l.getLockerInfo() + waitForTxn, waitForTs, waitForDur := l.getLockerInfo() var checkForWaitSelf bool findDistinguished := l.distinguishedWaiter == nil if waitForTxn == nil { @@ -593,6 +594,7 @@ func (l *lockState) informActiveWaiters() { stateKind: waitFor, txn: waitForTxn, ts: waitForTs, + dur: waitForDur, key: l.key, held: l.holder.locked, access: spanset.SpanReadWrite, @@ -691,9 +693,9 @@ func (l *lockState) isLockedBy(id uuid.UUID) bool { // Returns information about the current lock holder if the lock is held, else // returns nil. // REQUIRES: l.mu is locked. -func (l *lockState) getLockerInfo() (*enginepb.TxnMeta, hlc.Timestamp) { +func (l *lockState) getLockerInfo() (*enginepb.TxnMeta, hlc.Timestamp, lock.Durability) { if !l.holder.locked { - return nil, hlc.Timestamp{} + return nil, hlc.Timestamp{}, 0 } // If the lock is held as both replicated and unreplicated we want to @@ -710,7 +712,7 @@ func (l *lockState) getLockerInfo() (*enginepb.TxnMeta, hlc.Timestamp) { l.holder.holder[lock.Unreplicated].ts.Less(l.holder.holder[lock.Replicated].ts)) { index = lock.Unreplicated } - return l.holder.holder[index].txn, l.holder.holder[index].ts + return l.holder.holder[index].txn, l.holder.holder[index].ts, index } // Decides whether the request g with access sa should actively wait at this @@ -732,7 +734,7 @@ func (l *lockState) tryActiveWait(g *lockTableGuardImpl, sa spanset.SpanAccess, } // Lock is not empty. - waitForTxn, waitForTs := l.getLockerInfo() + waitForTxn, waitForTs, waitForDur := l.getLockerInfo() if waitForTxn != nil && g.isTxn(waitForTxn) { // Already locked by this txn. return false @@ -865,6 +867,7 @@ func (l *lockState) tryActiveWait(g *lockTableGuardImpl, sa spanset.SpanAccess, stateKind: stateType, txn: waitForTxn, ts: waitForTs, + dur: waitForDur, key: l.key, held: l.holder.locked, access: spanset.SpanReadWrite, @@ -888,7 +891,7 @@ func (l *lockState) acquireLock( defer l.mu.Unlock() if l.holder.locked { // Already held. - beforeTxn, beforeTs := l.getLockerInfo() + beforeTxn, beforeTs, _ := l.getLockerInfo() if txn.ID != beforeTxn.ID { return errors.Errorf("caller violated contract") } @@ -913,7 +916,7 @@ func (l *lockState) acquireLock( } l.holder.holder[durability].txn = txn l.holder.holder[durability].ts = ts - _, afterTs := l.getLockerInfo() + _, afterTs, _ := l.getLockerInfo() if afterTs.Less(beforeTs) { return errors.Errorf("caller violated contract") } else if beforeTs.Less(afterTs) { @@ -1089,13 +1092,14 @@ func (l *lockState) tryClearLock(force bool) bool { l.holder.holder[lock.Unreplicated] = lockHolderInfo{} var waitState waitingState if replicatedHeld && !force { - holderTxn, holderTs := l.getLockerInfo() + holderTxn, holderTs, holderDur := l.getLockerInfo() // Note that none of the current waiters can be requests // from holderTxn. waitState = waitingState{ stateKind: waitElsewhere, txn: holderTxn, ts: holderTs, + dur: holderDur, key: l.key, held: true, access: spanset.SpanReadWrite, @@ -1182,13 +1186,13 @@ func removeIgnored( // transaction, else the lock is updated. Returns whether the lockState can be // garbage collected. // Acquires l.mu. -func (l *lockState) tryUpdateLock(intent *roachpb.Intent) (gc bool, err error) { +func (l *lockState) tryUpdateLock(up *roachpb.LockUpdate) (gc bool, err error) { l.mu.Lock() defer l.mu.Unlock() - if !l.isLockedBy(intent.Txn.ID) { + if !l.isLockedBy(up.Txn.ID) { return false, nil } - if intent.Status.IsFinalized() { + if up.Status.IsFinalized() { l.holder.locked = false for i := range l.holder.holder { l.holder.holder[i] = lockHolderInfo{} @@ -1197,9 +1201,9 @@ func (l *lockState) tryUpdateLock(intent *roachpb.Intent) (gc bool, err error) { return gc, nil } - ts := intent.Txn.WriteTimestamp - txn := &intent.Txn - _, beforeTs := l.getLockerInfo() + ts := up.Txn.WriteTimestamp + txn := &up.Txn + _, beforeTs, _ := l.getLockerInfo() isLocked := false for i := range l.holder.holder { holderTxn := l.holder.holder[i].txn @@ -1212,7 +1216,7 @@ func (l *lockState) tryUpdateLock(intent *roachpb.Intent) (gc bool, err error) { continue } // Held in same epoch. - l.holder.holder[i].seqs = removeIgnored(l.holder.holder[i].seqs, intent.IgnoredSeqNums) + l.holder.holder[i].seqs = removeIgnored(l.holder.holder[i].seqs, up.IgnoredSeqNums) if len(l.holder.holder[i].seqs) == 0 { l.holder.holder[i].txn = nil continue @@ -1597,8 +1601,8 @@ func (t *lockTableImpl) tryGCLocks(tree *treeMu, locks []*lockState) { } // UpdateLocks implements the lockTable interface. -func (t *lockTableImpl) UpdateLocks(intent *roachpb.Intent) error { - span := intent.Span +func (t *lockTableImpl) UpdateLocks(up *roachpb.LockUpdate) error { + span := up.Span ss := spanset.SpanGlobal if keys.IsLocal(span.Key) { ss = spanset.SpanLocal @@ -1608,7 +1612,7 @@ func (t *lockTableImpl) UpdateLocks(intent *roachpb.Intent) error { var locksToGC []*lockState changeFunc := func(i btree.Item) bool { l := i.(*lockState) - gc, err2 := l.tryUpdateLock(intent) + gc, err2 := l.tryUpdateLock(up) if err2 != nil { err = err2 return false @@ -1747,7 +1751,7 @@ func (t *lockTableImpl) String() string { fmt.Fprintln(&buf, "empty") return } - txn, ts := l.getLockerInfo() + txn, ts, _ := l.getLockerInfo() if txn == nil { fmt.Fprintf(&buf, " res: req: %d, %s\n", l.reservation.seqNum, waitingOnStr(l.reservation.txn, l.reservation.ts)) diff --git a/pkg/storage/concurrency/lock_table_test.go b/pkg/storage/concurrency/lock_table_test.go index 571410462bc9..82cb9e902006 100644 --- a/pkg/storage/concurrency/lock_table_test.go +++ b/pkg/storage/concurrency/lock_table_test.go @@ -237,7 +237,7 @@ func TestLockTableBasic(t *testing.T) { d.ScanArgs(t, "span", &s) span := getSpan(t, d, s) // TODO(sbhola): also test ABORTED. - intent := &roachpb.Intent{Span: span, Txn: *txnMeta, Status: roachpb.COMMITTED} + intent := &roachpb.LockUpdate{Span: span, Txn: *txnMeta, Status: roachpb.COMMITTED} if err := lt.UpdateLocks(intent); err != nil { return err.Error() } @@ -261,7 +261,7 @@ func TestLockTableBasic(t *testing.T) { d.ScanArgs(t, "span", &s) span := getSpan(t, d, s) // TODO(sbhola): also test STAGING. - intent := &roachpb.Intent{Span: span, Txn: *txnMeta, Status: roachpb.PENDING} + intent := &roachpb.LockUpdate{Span: span, Txn: *txnMeta, Status: roachpb.PENDING} if err := lt.UpdateLocks(intent); err != nil { return err.Error() } @@ -283,7 +283,7 @@ func TestLockTableBasic(t *testing.T) { d.Fatalf(t, "unknown txn %s", txnName) } span := roachpb.Span{Key: roachpb.Key(key)} - intent := &roachpb.Intent{Span: span, Txn: *txnMeta, Status: roachpb.PENDING} + intent := &roachpb.Intent{Span: span, Txn: *txnMeta} if err := lt.AddDiscoveredLock(intent, g); err != nil { return err.Error() } @@ -378,7 +378,7 @@ type workItem struct { locksToAcquire []roachpb.Key // Update locks. - intents []roachpb.Intent + intents []roachpb.LockUpdate } func (w *workItem) getRequestTxnID() uuid.UUID { @@ -505,7 +505,7 @@ type transactionState struct { func makeWorkItemFinishTxn(tstate *transactionState) workItem { wItem := workItem{} for i := range tstate.acquiredLocks { - wItem.intents = append(wItem.intents, roachpb.Intent{ + wItem.intents = append(wItem.intents, roachpb.LockUpdate{ Span: roachpb.Span{Key: tstate.acquiredLocks[i]}, Txn: *tstate.txn, Status: roachpb.COMMITTED, @@ -970,7 +970,7 @@ func doBenchWork(item *benchWorkItem, env benchEnv, doneCh chan<- error) { return } for _, k := range item.locksToAcquire { - intent := roachpb.Intent{ + intent := roachpb.LockUpdate{ Span: roachpb.Span{Key: k}, Txn: item.Request.Txn.TxnMeta, Status: roachpb.COMMITTED, diff --git a/pkg/storage/concurrency/lock_table_waiter.go b/pkg/storage/concurrency/lock_table_waiter.go index b0dc92eba291..5417ebd2c8d3 100644 --- a/pkg/storage/concurrency/lock_table_waiter.go +++ b/pkg/storage/concurrency/lock_table_waiter.go @@ -54,7 +54,7 @@ type IntentResolver interface { ) (roachpb.Transaction, *Error) // ResolveIntent resolves the provided intent according to the options. - ResolveIntent(context.Context, roachpb.Intent, intentresolver.ResolveOptions) *Error + ResolveIntent(context.Context, roachpb.LockUpdate, intentresolver.ResolveOptions) *Error } // WaitOn implements the lockTableWaiter interface. @@ -227,10 +227,9 @@ func (w *lockTableWaiterImpl) pushTxn(ctx context.Context, req Request, ws waiti // // To do better here, we need per-intent information on whether we need to // poison. - resolveIntent := roachpb.Intent{Span: roachpb.Span{Key: ws.key}} - resolveIntent.SetTxn(&pusheeTxn) + resolve := roachpb.MakeLockUpdate(&pusheeTxn, roachpb.Span{Key: ws.key}, ws.dur) opts := intentresolver.ResolveOptions{Wait: false, Poison: true} - return w.ir.ResolveIntent(ctx, resolveIntent, opts) + return w.ir.ResolveIntent(ctx, resolve, opts) } func hasMinPriority(txn *enginepb.TxnMeta) bool { diff --git a/pkg/storage/concurrency/lock_table_waiter_test.go b/pkg/storage/concurrency/lock_table_waiter_test.go index cc1724cea292..18110c701be5 100644 --- a/pkg/storage/concurrency/lock_table_waiter_test.go +++ b/pkg/storage/concurrency/lock_table_waiter_test.go @@ -28,7 +28,7 @@ import ( type mockIntentResolver struct { pushTxn func(context.Context, *enginepb.TxnMeta, roachpb.Header, roachpb.PushTxnType) (roachpb.Transaction, *Error) - resolveIntent func(context.Context, roachpb.Intent) *Error + resolveIntent func(context.Context, roachpb.LockUpdate) *Error } func (m *mockIntentResolver) PushTransaction( @@ -38,7 +38,7 @@ func (m *mockIntentResolver) PushTransaction( } func (m *mockIntentResolver) ResolveIntent( - ctx context.Context, intent roachpb.Intent, _ intentresolver.ResolveOptions, + ctx context.Context, intent roachpb.LockUpdate, _ intentresolver.ResolveOptions, ) *Error { return m.resolveIntent(ctx, intent) } @@ -304,7 +304,7 @@ func testWaitPush(t *testing.T, k stateKind, makeReq func() Request, expPushTS h // we know the holder is ABORTED. Otherwide, immediately // tell the request to stop waiting. if lockHeld { - ir.resolveIntent = func(_ context.Context, intent roachpb.Intent) *Error { + ir.resolveIntent = func(_ context.Context, intent roachpb.LockUpdate) *Error { require.Equal(t, keyA, intent.Key) require.Equal(t, pusheeTxn.ID, intent.Txn.ID) require.Equal(t, roachpb.ABORTED, intent.Status) @@ -371,7 +371,7 @@ func TestLockTableWaiterIntentResolverError(t *testing.T) { ) (roachpb.Transaction, *Error) { return roachpb.Transaction{}, nil } - ir.resolveIntent = func(_ context.Context, intent roachpb.Intent) *Error { + ir.resolveIntent = func(_ context.Context, intent roachpb.LockUpdate) *Error { return err2 } err = w.WaitOn(ctx, req, g) diff --git a/pkg/storage/engine/bench_test.go b/pkg/storage/engine/bench_test.go index 1527fe3ac25f..db7b754757ae 100644 --- a/pkg/storage/engine/bench_test.go +++ b/pkg/storage/engine/bench_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/encoding" @@ -137,10 +138,11 @@ func setupMVCCData( key := keys[idx] txnMeta := txn.TxnMeta txnMeta.WriteTimestamp = hlc.Timestamp{WallTime: int64(counts[idx]) * 5} - if _, err := MVCCResolveWriteIntent(ctx, batch, nil /* ms */, roachpb.Intent{ - Span: roachpb.Span{Key: key}, - Status: roachpb.COMMITTED, - Txn: txnMeta, + if _, err := MVCCResolveWriteIntent(ctx, batch, nil /* ms */, roachpb.LockUpdate{ + Span: roachpb.Span{Key: key}, + Status: roachpb.COMMITTED, + Txn: txnMeta, + Durability: lock.Replicated, }); err != nil { b.Fatal(err) } diff --git a/pkg/storage/engine/metamorphic/operands.go b/pkg/storage/engine/metamorphic/operands.go index 6746efdcb2e7..2bc5ceee1f43 100644 --- a/pkg/storage/engine/metamorphic/operands.go +++ b/pkg/storage/engine/metamorphic/operands.go @@ -17,6 +17,7 @@ import ( "strconv" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/util/hlc" @@ -232,7 +233,7 @@ func (t *txnManager) open() *roachpb.Transaction { func (t *txnManager) close(op operand) { txn := op.(*roachpb.Transaction) for _, span := range txn.IntentSpans { - intent := roachpb.MakeIntent(txn, span) + intent := roachpb.MakeLockUpdate(txn, span, lock.Replicated) intent.Status = roachpb.COMMITTED _, err := engine.MVCCResolveWriteIntent(context.TODO(), t.testRunner.engine, nil, intent) if err != nil { diff --git a/pkg/storage/engine/mvcc.go b/pkg/storage/engine/mvcc.go index 94e952d4cd99..b1c63e0a0333 100644 --- a/pkg/storage/engine/mvcc.go +++ b/pkg/storage/engine/mvcc.go @@ -2631,7 +2631,7 @@ func MVCCIterate( // Doesn't look like this code here caught that. Shouldn't resolve intents // when they're not at the timestamp the Txn mandates them to be. func MVCCResolveWriteIntent( - ctx context.Context, rw ReadWriter, ms *enginepb.MVCCStats, intent roachpb.Intent, + ctx context.Context, rw ReadWriter, ms *enginepb.MVCCStats, intent roachpb.LockUpdate, ) (bool, error) { iterAndBuf := GetBufUsingIter(rw.NewIterator(IterOptions{Prefix: true})) ok, err := MVCCResolveWriteIntentUsingIter(ctx, rw, iterAndBuf, ms, intent) @@ -2647,7 +2647,7 @@ func MVCCResolveWriteIntentUsingIter( rw ReadWriter, iterAndBuf IterAndBuf, ms *enginepb.MVCCStats, - intent roachpb.Intent, + intent roachpb.LockUpdate, ) (bool, error) { if len(intent.Key) == 0 { return false, emptyKeyError() @@ -2688,7 +2688,7 @@ func mvccResolveWriteIntent( rw ReadWriter, iter Iterator, ms *enginepb.MVCCStats, - intent roachpb.Intent, + intent roachpb.LockUpdate, buf *putBuffer, forRange bool, ) (bool, error) { @@ -3083,9 +3083,9 @@ func (b IterAndBuf) Cleanup() { // txns. Returns the number of intents resolved and a resume span if // the max keys limit was exceeded. func MVCCResolveWriteIntentRange( - ctx context.Context, rw ReadWriter, ms *enginepb.MVCCStats, intent roachpb.Intent, max int64, + ctx context.Context, rw ReadWriter, ms *enginepb.MVCCStats, intent roachpb.LockUpdate, max int64, ) (int64, *roachpb.Span, error) { - iterAndBuf := GetIterAndBuf(rw, IterOptions{UpperBound: intent.Span.EndKey}) + iterAndBuf := GetIterAndBuf(rw, IterOptions{UpperBound: intent.EndKey}) defer iterAndBuf.Cleanup() return MVCCResolveWriteIntentRangeUsingIter(ctx, rw, iterAndBuf, ms, intent, max) } @@ -3100,7 +3100,7 @@ func MVCCResolveWriteIntentRangeUsingIter( rw ReadWriter, iterAndBuf IterAndBuf, ms *enginepb.MVCCStats, - intent roachpb.Intent, + intent roachpb.LockUpdate, max int64, ) (int64, *roachpb.Span, error) { encKey := MakeMVCCMetadataKey(intent.Key) diff --git a/pkg/storage/engine/mvcc_history_test.go b/pkg/storage/engine/mvcc_history_test.go index 7e771cd9340a..147ce87ab93f 100644 --- a/pkg/storage/engine/mvcc_history_test.go +++ b/pkg/storage/engine/mvcc_history_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/leaktest" @@ -503,7 +504,7 @@ func cmdResolveIntent(e *evalCtx) error { func (e *evalCtx) resolveIntent( rw ReadWriter, key roachpb.Key, txn *roachpb.Transaction, resolveStatus roachpb.TransactionStatus, ) error { - intent := roachpb.MakeIntent(txn, roachpb.Span{Key: key}) + intent := roachpb.MakeLockUpdate(txn, roachpb.Span{Key: key}, lock.Replicated) intent.Status = resolveStatus _, err := MVCCResolveWriteIntent(e.ctx, rw, nil, intent) return err @@ -606,7 +607,7 @@ func cmdGet(e *evalCtx) error { // ascertain no result is populated in the intent when an error // occurs. if intent != nil { - fmt.Fprintf(e.results.buf, "get: %v -> intent {%s} %s\n", key, intent.Txn, intent.Status) + fmt.Fprintf(e.results.buf, "get: %v -> intent {%s}\n", key, intent.Txn) } if val != nil { fmt.Fprintf(e.results.buf, "get: %v -> %v @%v\n", key, val.PrettyPrint(), val.Timestamp) @@ -713,7 +714,7 @@ func cmdScan(e *evalCtx) error { // ascertain no result is populated in the intents when an error // occurs. for _, intent := range res.Intents { - fmt.Fprintf(e.results.buf, "scan: %v -> intent {%s} %s\n", key, intent.Txn, intent.Status) + fmt.Fprintf(e.results.buf, "scan: %v -> intent {%s}\n", key, intent.Txn) } for _, val := range res.KVs { fmt.Fprintf(e.results.buf, "scan: %v -> %v @%v\n", val.Key, val.Value.PrettyPrint(), val.Value.Timestamp) diff --git a/pkg/storage/engine/mvcc_incremental_iterator_test.go b/pkg/storage/engine/mvcc_incremental_iterator_test.go index 1d049fcf5cba..74b320447f8c 100644 --- a/pkg/storage/engine/mvcc_incremental_iterator_test.go +++ b/pkg/storage/engine/mvcc_incremental_iterator_test.go @@ -17,6 +17,7 @@ import ( "testing" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/hlc" @@ -206,12 +207,12 @@ func TestMVCCIncrementalIterator(t *testing.T) { t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4, tsMax, kvs())) t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4.Next(), tsMax, kvs())) - intent1 := roachpb.MakeIntent(&txn1, roachpb.Span{Key: testKey1}) + intent1 := roachpb.MakeLockUpdate(&txn1, roachpb.Span{Key: testKey1}, lock.Replicated) intent1.Status = roachpb.COMMITTED if _, err := MVCCResolveWriteIntent(ctx, e, nil, intent1); err != nil { t.Fatal(err) } - intent2 := roachpb.MakeIntent(&txn2, roachpb.Span{Key: testKey2}) + intent2 := roachpb.MakeLockUpdate(&txn2, roachpb.Span{Key: testKey2}, lock.Replicated) intent2.Status = roachpb.ABORTED if _, err := MVCCResolveWriteIntent(ctx, e, nil, intent2); err != nil { t.Fatal(err) @@ -296,12 +297,12 @@ func TestMVCCIncrementalIterator(t *testing.T) { t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4, tsMax, kvs())) t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4.Next(), tsMax, kvs())) - intent1 := roachpb.MakeIntent(&txn1, roachpb.Span{Key: testKey1}) + intent1 := roachpb.MakeLockUpdate(&txn1, roachpb.Span{Key: testKey1}, lock.Replicated) intent1.Status = roachpb.COMMITTED if _, err := MVCCResolveWriteIntent(ctx, e, nil, intent1); err != nil { t.Fatal(err) } - intent2 := roachpb.MakeIntent(&txn2, roachpb.Span{Key: testKey2}) + intent2 := roachpb.MakeLockUpdate(&txn2, roachpb.Span{Key: testKey2}, lock.Replicated) intent2.Status = roachpb.ABORTED if _, err := MVCCResolveWriteIntent(ctx, e, nil, intent2); err != nil { t.Fatal(err) diff --git a/pkg/storage/engine/mvcc_logical_ops_test.go b/pkg/storage/engine/mvcc_logical_ops_test.go index 21a27bfb4dfb..fa94d1786bc1 100644 --- a/pkg/storage/engine/mvcc_logical_ops_test.go +++ b/pkg/storage/engine/mvcc_logical_ops_test.go @@ -18,6 +18,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/leaktest" @@ -76,16 +77,16 @@ func TestMVCCOpLogWriter(t *testing.T) { txn1CommitTS := *txn1Commit txn1CommitTS.WriteTimestamp = hlc.Timestamp{Logical: 4} if _, _, err := MVCCResolveWriteIntentRange(ctx, ol, nil, - roachpb.MakeIntent( + roachpb.MakeLockUpdate( &txn1CommitTS, - roachpb.Span{Key: testKey1, EndKey: testKey2.Next()}), + roachpb.Span{Key: testKey1, EndKey: testKey2.Next()}, lock.Replicated), math.MaxInt64); err != nil { t.Fatal(err) } if _, _, err := MVCCResolveWriteIntentRange(ctx, ol, nil, - roachpb.MakeIntent( + roachpb.MakeLockUpdate( &txn1CommitTS, - roachpb.Span{Key: localKey, EndKey: localKey.Next()}), + roachpb.Span{Key: localKey, EndKey: localKey.Next()}, lock.Replicated), math.MaxInt64); err != nil { t.Fatal(err) } @@ -98,14 +99,14 @@ func TestMVCCOpLogWriter(t *testing.T) { txn2Pushed := *txn2 txn2Pushed.WriteTimestamp = hlc.Timestamp{Logical: 6} if _, err := MVCCResolveWriteIntent(ctx, ol, nil, - roachpb.MakeIntent(&txn2Pushed, roachpb.Span{Key: testKey3}), + roachpb.MakeLockUpdate(&txn2Pushed, roachpb.Span{Key: testKey3}, lock.Replicated), ); err != nil { t.Fatal(err) } txn2Abort := txn2Pushed txn2Abort.Status = roachpb.ABORTED if _, err := MVCCResolveWriteIntent(ctx, ol, nil, - roachpb.MakeIntent(&txn2Abort, roachpb.Span{Key: testKey3}), + roachpb.MakeLockUpdate(&txn2Abort, roachpb.Span{Key: testKey3}, lock.Replicated), ); err != nil { t.Fatal(err) } diff --git a/pkg/storage/engine/mvcc_stats_test.go b/pkg/storage/engine/mvcc_stats_test.go index d045fcddb448..87718f7bb263 100644 --- a/pkg/storage/engine/mvcc_stats_test.go +++ b/pkg/storage/engine/mvcc_stats_test.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/hlc" @@ -113,7 +114,7 @@ func TestMVCCStatsDeleteCommitMovesTimestamp(t *testing.T) { txn.Status = roachpb.COMMITTED txn.WriteTimestamp.Forward(ts4) if _, err := MVCCResolveWriteIntent(ctx, engine, aggMS, - roachpb.MakeIntent(txn, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -193,7 +194,7 @@ func TestMVCCStatsPutCommitMovesTimestamp(t *testing.T) { txn.Status = roachpb.COMMITTED txn.WriteTimestamp.Forward(ts4) if _, err := MVCCResolveWriteIntent(ctx, engine, aggMS, - roachpb.MakeIntent(txn, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -271,7 +272,7 @@ func TestMVCCStatsPutPushMovesTimestamp(t *testing.T) { ts4 := hlc.Timestamp{WallTime: 4 * 1e9} txn.WriteTimestamp.Forward(ts4) if _, err := MVCCResolveWriteIntent(ctx, engine, aggMS, - roachpb.MakeIntent(txn, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -606,7 +607,7 @@ func TestMVCCStatsDelDelCommitMovesTimestamp(t *testing.T) { txnCommit.Status = roachpb.COMMITTED txnCommit.WriteTimestamp.Forward(ts3) if _, err := MVCCResolveWriteIntent(ctx, engine, &aggMS, - roachpb.MakeIntent(txnCommit, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txnCommit, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -635,7 +636,7 @@ func TestMVCCStatsDelDelCommitMovesTimestamp(t *testing.T) { txnAbort.Status = roachpb.ABORTED txnAbort.WriteTimestamp.Forward(ts3) if _, err := MVCCResolveWriteIntent(ctx, engine, &aggMS, - roachpb.MakeIntent(txnAbort, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txnAbort, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -765,7 +766,7 @@ func TestMVCCStatsPutDelPutMovesTimestamp(t *testing.T) { txnAbort := txn.Clone() txnAbort.Status = roachpb.ABORTED // doesn't change m2ValSize, fortunately if _, err := MVCCResolveWriteIntent(ctx, engine, &aggMS, - roachpb.MakeIntent(txnAbort, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txnAbort, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -1236,7 +1237,7 @@ func TestMVCCStatsTxnSysPutAbort(t *testing.T) { // Now abort the intent. txn.Status = roachpb.ABORTED if _, err := MVCCResolveWriteIntent(ctx, engine, aggMS, - roachpb.MakeIntent(txn, roachpb.Span{Key: key}), + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: key}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -1339,14 +1340,14 @@ type state struct { key roachpb.Key } -func (s *state) intent(status roachpb.TransactionStatus) roachpb.Intent { - intent := roachpb.MakeIntent(s.Txn, roachpb.Span{Key: s.key}) +func (s *state) intent(status roachpb.TransactionStatus) roachpb.LockUpdate { + intent := roachpb.MakeLockUpdate(s.Txn, roachpb.Span{Key: s.key}, lock.Replicated) intent.Status = status return intent } -func (s *state) intentRange(status roachpb.TransactionStatus) roachpb.Intent { - intent := roachpb.MakeIntent(s.Txn, roachpb.Span{Key: roachpb.KeyMin, EndKey: roachpb.KeyMax}) +func (s *state) intentRange(status roachpb.TransactionStatus) roachpb.LockUpdate { + intent := roachpb.MakeLockUpdate(s.Txn, roachpb.Span{Key: roachpb.KeyMin, EndKey: roachpb.KeyMax}, lock.Replicated) intent.Status = status return intent } diff --git a/pkg/storage/engine/mvcc_test.go b/pkg/storage/engine/mvcc_test.go index 5bad412e7c54..0fbd4b85244c 100644 --- a/pkg/storage/engine/mvcc_test.go +++ b/pkg/storage/engine/mvcc_test.go @@ -25,6 +25,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/testutils/zerofields" @@ -2800,7 +2801,7 @@ func TestMVCCInitPutWithTxn(t *testing.T) { txnCommit.Status = roachpb.COMMITTED txnCommit.WriteTimestamp = clock.Now().Add(1, 0) if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(&txnCommit, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(&txnCommit, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -3115,7 +3116,7 @@ func TestMVCCResolveTxn(t *testing.T) { // Resolve will write with txn1's timestamp which is 0,1. if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1Commit, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn1Commit, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -3157,7 +3158,7 @@ func TestMVCCResolveNewerIntent(t *testing.T) { // Resolve will succeed but should remove the intent. if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1Commit, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn1Commit, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -3194,7 +3195,7 @@ func TestMVCCResolveIntentTxnTimestampMismatch(t *testing.T) { // the intent sits at tsEarly. The bug was looking at the former // instead of the latter (and so we could also tickle it with // smaller timestamps in Txn). - intent := roachpb.MakeIntent(txn, roachpb.Span{Key: testKey1}) + intent := roachpb.MakeLockUpdate(txn, roachpb.Span{Key: testKey1}, lock.Replicated) intent.Status = roachpb.PENDING // A bug (see #7654) caused intents to just stay where they were instead @@ -3417,7 +3418,7 @@ func TestMVCCAbortTxn(t *testing.T) { txn1AbortWithTS.WriteTimestamp = hlc.Timestamp{Logical: 1} if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1AbortWithTS, roachpb.Span{Key: testKey1}), + roachpb.MakeLockUpdate(txn1AbortWithTS, roachpb.Span{Key: testKey1}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -3462,7 +3463,7 @@ func TestMVCCAbortTxnWithPreviousVersion(t *testing.T) { txn1AbortWithTS.WriteTimestamp = hlc.Timestamp{WallTime: 2} if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1AbortWithTS, roachpb.Span{Key: testKey1}), + roachpb.MakeLockUpdate(txn1AbortWithTS, roachpb.Span{Key: testKey1}, lock.Replicated), ); err != nil { t.Fatal(err) } @@ -3530,7 +3531,7 @@ func TestMVCCWriteWithDiffTimestampsAndEpochs(t *testing.T) { txne2Commit.Status = roachpb.COMMITTED txne2Commit.WriteTimestamp = hlc.Timestamp{WallTime: 1} if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(&txne2Commit, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(&txne2Commit, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -3860,7 +3861,7 @@ func TestMVCCGetWithPushedTimestamp(t *testing.T) { // Resolve the intent, pushing its timestamp forward. txn := makeTxn(*txn1, hlc.Timestamp{WallTime: 1}) if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } // Attempt to read using naive txn's previous timestamp. @@ -3892,7 +3893,7 @@ func TestMVCCResolveWithDiffEpochs(t *testing.T) { t.Fatal(err) } num, _, err := MVCCResolveWriteIntentRange(ctx, engine, nil, - roachpb.MakeIntent(txn1e2Commit, roachpb.Span{Key: testKey1, EndKey: testKey2.Next()}), 2) + roachpb.MakeLockUpdate(txn1e2Commit, roachpb.Span{Key: testKey1, EndKey: testKey2.Next()}, lock.Replicated), 2) if err != nil { t.Fatal(err) } @@ -3948,7 +3949,7 @@ func TestMVCCResolveWithUpdatedTimestamp(t *testing.T) { // intent when making it permanent. txn := makeTxn(*txn1Commit, hlc.Timestamp{WallTime: 1}) if _, err = MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -3999,7 +4000,7 @@ func TestMVCCResolveWithPushedTimestamp(t *testing.T) { // This represents a straightforward push (i.e. from a read/write conflict). txn := makeTxn(*txn1, hlc.Timestamp{WallTime: 1}) if _, err = MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -4037,7 +4038,7 @@ func TestMVCCResolveTxnNoOps(t *testing.T) { // Resolve a non existent key; noop. if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1Commit, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn1Commit, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -4046,7 +4047,7 @@ func TestMVCCResolveTxnNoOps(t *testing.T) { t.Fatal(err) } if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn2Commit, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn2Commit, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } @@ -4058,7 +4059,7 @@ func TestMVCCResolveTxnNoOps(t *testing.T) { txn1CommitWithTS := txn2Commit.Clone() txn1CommitWithTS.WriteTimestamp = hlc.Timestamp{WallTime: 1} if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1CommitWithTS, roachpb.Span{Key: testKey2})); err != nil { + roachpb.MakeLockUpdate(txn1CommitWithTS, roachpb.Span{Key: testKey2}, lock.Replicated)); err != nil { t.Fatal(err) } }) @@ -4088,7 +4089,7 @@ func TestMVCCResolveTxnRange(t *testing.T) { } num, resumeSpan, err := MVCCResolveWriteIntentRange(ctx, engine, nil, - roachpb.MakeIntent(txn1Commit, roachpb.Span{Key: testKey1, EndKey: testKey4.Next()}), + roachpb.MakeLockUpdate(txn1Commit, roachpb.Span{Key: testKey1, EndKey: testKey4.Next()}, lock.Replicated), math.MaxInt64) if err != nil { t.Fatal(err) @@ -4172,7 +4173,7 @@ func TestMVCCResolveTxnRangeResume(t *testing.T) { // Resolve up to 5 intents. num, resumeSpan, err := MVCCResolveWriteIntentRange(ctx, engine, nil, - roachpb.MakeIntent(txn1Commit, roachpb.Span{Key: roachpb.Key("00"), EndKey: roachpb.Key("30")}), + roachpb.MakeLockUpdate(txn1Commit, roachpb.Span{Key: roachpb.Key("00"), EndKey: roachpb.Key("30")}, lock.Replicated), 5) if err != nil { t.Fatal(err) @@ -4929,7 +4930,7 @@ func TestResolveIntentWithLowerEpoch(t *testing.T) { } // Resolve the intent with a low epoch. if _, err := MVCCResolveWriteIntent(ctx, engine, nil, - roachpb.MakeIntent(txn1, roachpb.Span{Key: testKey1})); err != nil { + roachpb.MakeLockUpdate(txn1, roachpb.Span{Key: testKey1}, lock.Replicated)); err != nil { t.Fatal(err) } diff --git a/pkg/storage/engine/testdata/mvcc_histories/update_existing_key_diff_txn b/pkg/storage/engine/testdata/mvcc_histories/update_existing_key_diff_txn index b0d4b5eb29a5..3d54be2bb6be 100644 --- a/pkg/storage/engine/testdata/mvcc_histories/update_existing_key_diff_txn +++ b/pkg/storage/engine/testdata/mvcc_histories/update_existing_key_diff_txn @@ -21,5 +21,5 @@ run ok with t=B get k=a inconsistent ---- -get: "a" -> intent {id=00000000 key=/Min pri=0.00000000 epo=0 ts=0.000000033,0 min=0,0 seq=0} PENDING +get: "a" -> intent {id=00000000 key=/Min pri=0.00000000 epo=0 ts=0.000000033,0 min=0,0 seq=0} get: "a" -> diff --git a/pkg/storage/gc/gc.go b/pkg/storage/gc/gc.go index 1e118aa5d314..2646167933d9 100644 --- a/pkg/storage/gc/gc.go +++ b/pkg/storage/gc/gc.go @@ -25,6 +25,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/storage/abortspan" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/storagebase" @@ -134,7 +135,7 @@ type CleanupIntentsFunc func(context.Context, []roachpb.Intent) error // transaction record, pushing the transaction first if it is // PENDING. Once all intents are resolved successfully, removes the // transaction record. -type CleanupTxnIntentsAsyncFunc func(context.Context, *roachpb.Transaction, []roachpb.Intent) error +type CleanupTxnIntentsAsyncFunc func(context.Context, *roachpb.Transaction, []roachpb.LockUpdate) error // Run runs garbage collection for the specified descriptor on the // provided Engine (which is not mutated). It uses the provided gcFn @@ -199,7 +200,7 @@ func Run( // Push transactions (if pending) and resolve intents. var intents []roachpb.Intent for txnID, txn := range txnMap { - intents = append(intents, roachpb.AsIntents(intentSpanMap[txnID], txn)...) + intents = append(intents, roachpb.AsPendingIntents(&txn.TxnMeta, intentSpanMap[txnID])...) } info.ResolveTotal += len(intents) log.Eventf(ctx, "cleanup of %d intents", len(intents)) @@ -406,7 +407,7 @@ func processLocalKeyRange( // If the transaction needs to be pushed or there are intents to // resolve, invoke the cleanup function. if !txn.Status.IsFinalized() || len(txn.IntentSpans) > 0 { - return cleanupTxnIntentsAsyncFn(ctx, txn, roachpb.AsIntents(txn.IntentSpans, txn)) + return cleanupTxnIntentsAsyncFn(ctx, txn, roachpb.AsLockUpdates(txn, txn.IntentSpans, lock.Replicated)) } gcKeys = append(gcKeys, roachpb.GCRequest_GCKey{Key: key}) // zero timestamp return nil diff --git a/pkg/storage/gc/gc_old_test.go b/pkg/storage/gc/gc_old_test.go index 036bcb1c88fc..c06898dbca4c 100644 --- a/pkg/storage/gc/gc_old_test.go +++ b/pkg/storage/gc/gc_old_test.go @@ -237,7 +237,7 @@ func runGCOld( // Push transactions (if pending) and resolve intents. var intents []roachpb.Intent for txnID, txn := range txnMap { - intents = append(intents, roachpb.AsIntents(intentSpanMap[txnID], txn)...) + intents = append(intents, roachpb.AsPendingIntents(&txn.TxnMeta, intentSpanMap[txnID])...) } info.ResolveTotal += len(intents) log.Eventf(ctx, "cleanup of %d intents", len(intents)) diff --git a/pkg/storage/gc/gc_random_test.go b/pkg/storage/gc/gc_random_test.go index 9b4291bd7fde..7519fca910b1 100644 --- a/pkg/storage/gc/gc_random_test.go +++ b/pkg/storage/gc/gc_random_test.go @@ -136,7 +136,7 @@ func BenchmarkRun(b *testing.B) { func(ctx context.Context, intents []roachpb.Intent) error { return nil }, - func(ctx context.Context, txn *roachpb.Transaction, intents []roachpb.Intent) error { + func(ctx context.Context, txn *roachpb.Transaction, intents []roachpb.LockUpdate) error { return nil }) } @@ -206,7 +206,7 @@ func (f *fakeGCer) GC(ctx context.Context, keys []roachpb.GCRequest_GCKey) error } func (f *fakeGCer) resolveIntentsAsync( - _ context.Context, txn *roachpb.Transaction, intents []roachpb.Intent, + _ context.Context, txn *roachpb.Transaction, intents []roachpb.LockUpdate, ) error { f.txnIntents = append(f.txnIntents, txnIntents{txn: txn, intents: intents}) return nil @@ -244,5 +244,5 @@ func intentLess(a, b *roachpb.Intent) bool { type txnIntents struct { txn *roachpb.Transaction - intents []roachpb.Intent + intents []roachpb.LockUpdate } diff --git a/pkg/storage/gc_queue.go b/pkg/storage/gc_queue.go index 2b516ba704f6..00aac943c3bc 100644 --- a/pkg/storage/gc_queue.go +++ b/pkg/storage/gc_queue.go @@ -426,7 +426,7 @@ func (gcq *gcQueue) process(ctx context.Context, repl *Replica, sysCfg *config.S } return err }, - func(ctx context.Context, txn *roachpb.Transaction, intents []roachpb.Intent) error { + func(ctx context.Context, txn *roachpb.Transaction, intents []roachpb.LockUpdate) error { err := repl.store.intentResolver. CleanupTxnIntentsOnGCAsync(ctx, repl.RangeID, txn, intents, gcTimestamp, func(pushed, succeeded bool) { diff --git a/pkg/storage/gc_queue_test.go b/pkg/storage/gc_queue_test.go index d4b825f0d0e3..eb768168bcfd 100644 --- a/pkg/storage/gc_queue_test.go +++ b/pkg/storage/gc_queue_test.go @@ -516,7 +516,7 @@ func TestGCQueueProcess(t *testing.T) { func(ctx context.Context, intents []roachpb.Intent) error { return nil }, - func(ctx context.Context, txn *roachpb.Transaction, intents []roachpb.Intent) error { + func(ctx context.Context, txn *roachpb.Transaction, intents []roachpb.LockUpdate) error { return nil }) }() diff --git a/pkg/storage/intentresolver/intent_resolver.go b/pkg/storage/intentresolver/intent_resolver.go index 2af81a136cbe..93ea016af515 100644 --- a/pkg/storage/intentresolver/intent_resolver.go +++ b/pkg/storage/intentresolver/intent_resolver.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/kv/kvbase" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/storagebase" "github.com/cockroachdb/cockroach/pkg/storage/txnwait" @@ -331,18 +332,11 @@ func (ir *IntentResolver) maybePushIntents( h roachpb.Header, pushType roachpb.PushTxnType, skipIfInFlight bool, -) ([]roachpb.Intent, *roachpb.Error) { +) ([]roachpb.LockUpdate, *roachpb.Error) { // Attempt to push the transaction(s) which created the conflicting intent(s). pushTxns := make(map[uuid.UUID]*enginepb.TxnMeta) for i := range intents { intent := &intents[i] - if intent.Status != roachpb.PENDING { - // The current intent does not need conflict resolution - // because the transaction is already finalized. - // This shouldn't happen as all intents created are in - // the PENDING status. - return nil, roachpb.NewErrorf("unexpected %s intent: %+v", intent.Status, intent) - } pushTxns[intent.Txn.ID] = &intent.Txn } @@ -363,8 +357,8 @@ func updateIntentTxnStatus( pushedTxns map[uuid.UUID]roachpb.Transaction, intents []roachpb.Intent, skipIfInFlight bool, - results []roachpb.Intent, -) []roachpb.Intent { + results []roachpb.LockUpdate, +) []roachpb.LockUpdate { for _, intent := range intents { pushee, ok := pushedTxns[intent.Txn.ID] if !ok { @@ -375,8 +369,8 @@ func updateIntentTxnStatus( // It must have been skipped. continue } - intent.SetTxn(&pushee) - results = append(results, intent) + up := roachpb.MakeLockUpdate(&pushee, intent.Span, lock.Replicated) + results = append(results, up) } return results } @@ -559,6 +553,7 @@ func (ir *IntentResolver) CleanupIntents( resolved := 0 const skipIfInFlight = true pushTxns := make(map[uuid.UUID]*enginepb.TxnMeta) + var resolveIntents []roachpb.LockUpdate for unpushed := intents; len(unpushed) > 0; { for k := range pushTxns { // clear the pushTxns map delete(pushTxns, k) @@ -579,8 +574,8 @@ func (ir *IntentResolver) CleanupIntents( if pErr != nil { return 0, errors.Wrapf(pErr.GoError(), "failed to push during intent resolution") } - resolveIntents := updateIntentTxnStatus(ctx, pushedTxns, unpushed[:i], - skipIfInFlight, unpushed[:0]) + resolveIntents = updateIntentTxnStatus(ctx, pushedTxns, unpushed[:i], + skipIfInFlight, resolveIntents[:0]) // resolveIntents with poison=true because we're resolving // intents outside of the context of an EndTxn. // @@ -627,7 +622,7 @@ func (ir *IntentResolver) CleanupTxnIntentsAsync( return } defer release() - intents := roachpb.AsIntents(et.Txn.IntentSpans, et.Txn) + intents := roachpb.AsLockUpdates(et.Txn, et.Txn.IntentSpans, lock.Replicated) if err := ir.cleanupFinishedTxnIntents(ctx, rangeID, et.Txn, intents, now, et.Poison, nil); err != nil { if ir.every.ShouldLog() { log.Warningf(ctx, "failed to cleanup transaction intents: %v", err) @@ -672,7 +667,7 @@ func (ir *IntentResolver) CleanupTxnIntentsOnGCAsync( ctx context.Context, rangeID roachpb.RangeID, txn *roachpb.Transaction, - intents []roachpb.Intent, + intents []roachpb.LockUpdate, now hlc.Timestamp, onComplete func(pushed, succeeded bool), ) error { @@ -807,7 +802,7 @@ func (ir *IntentResolver) cleanupFinishedTxnIntents( ctx context.Context, rangeID roachpb.RangeID, txn *roachpb.Transaction, - intents []roachpb.Intent, + intents []roachpb.LockUpdate, now hlc.Timestamp, poison bool, onComplete func(error), @@ -882,14 +877,14 @@ func (ir *IntentResolver) lookupRangeID(ctx context.Context, key roachpb.Key) ro // ResolveIntent synchronously resolves an intent according to opts. func (ir *IntentResolver) ResolveIntent( - ctx context.Context, intent roachpb.Intent, opts ResolveOptions, + ctx context.Context, intent roachpb.LockUpdate, opts ResolveOptions, ) *roachpb.Error { - return ir.ResolveIntents(ctx, []roachpb.Intent{intent}, opts) + return ir.ResolveIntents(ctx, []roachpb.LockUpdate{intent}, opts) } // ResolveIntents synchronously resolves intents according to opts. func (ir *IntentResolver) ResolveIntents( - ctx context.Context, intents []roachpb.Intent, opts ResolveOptions, + ctx context.Context, intents []roachpb.LockUpdate, opts ResolveOptions, ) *roachpb.Error { if len(intents) == 0 { return nil diff --git a/pkg/storage/intentresolver/intent_resolver_test.go b/pkg/storage/intentresolver/intent_resolver_test.go index 2d214a81e6ee..42655273d750 100644 --- a/pkg/storage/intentresolver/intent_resolver_test.go +++ b/pkg/storage/intentresolver/intent_resolver_test.go @@ -23,6 +23,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/internal/client" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/storagebase" "github.com/cockroachdb/cockroach/pkg/testutils" @@ -37,45 +38,6 @@ import ( "github.com/stretchr/testify/assert" ) -// TestPushTransactionsWithNonPendingIntent verifies that maybePushIntents -// returns an error when a non-pending intent is passed. -func TestPushTransactionsWithNonPendingIntent(t *testing.T) { - defer leaktest.AfterTest(t)() - clock := hlc.NewClock(hlc.UnixNano, time.Nanosecond) - db := client.NewDB(log.AmbientContext{ - Tracer: tracing.NewTracer(), - }, client.NonTransactionalFactoryFunc(func(context.Context, roachpb.BatchRequest) ( - *roachpb.BatchResponse, *roachpb.Error) { - return nil, nil - }), clock) - stopper := stop.NewStopper() - defer stopper.Stop(context.Background()) - ir := New(Config{ - Stopper: stopper, - DB: db, - Clock: clock, - }) - - testCases := [][]roachpb.Intent{ - {{Span: roachpb.Span{Key: roachpb.Key("a")}, Status: roachpb.PENDING}, - {Span: roachpb.Span{Key: roachpb.Key("b")}, Status: roachpb.STAGING}}, - {{Span: roachpb.Span{Key: roachpb.Key("a")}, Status: roachpb.PENDING}, - {Span: roachpb.Span{Key: roachpb.Key("b")}, Status: roachpb.ABORTED}}, - {{Span: roachpb.Span{Key: roachpb.Key("a")}, Status: roachpb.PENDING}, - {Span: roachpb.Span{Key: roachpb.Key("b")}, Status: roachpb.COMMITTED}}, - } - for _, intents := range testCases { - if _, pErr := ir.maybePushIntents( - context.Background(), intents, roachpb.Header{}, roachpb.PUSH_TOUCH, true, - ); !testutils.IsPError(pErr, "unexpected (STAGING|ABORTED|COMMITTED) intent") { - t.Errorf("expected error on non-pending intent, but got %s", pErr) - } - if cnt := len(ir.mu.inFlightPushes); cnt != 0 { - t.Errorf("expected no inflight pushes refcount map entries, found %d", cnt) - } - } -} - // TestCleanupTxnIntentsOnGCAsync exercises the code which is used to // asynchronously clean up transaction intents and then transaction records. // This method is invoked from the storage GC queue. @@ -93,7 +55,7 @@ func TestCleanupTxnIntentsOnGCAsync(t *testing.T) { } type testCase struct { txn *roachpb.Transaction - intents []roachpb.Intent + intents []roachpb.LockUpdate sendFuncs *sendFuncs expectPushed bool expectSucceed bool @@ -147,9 +109,9 @@ func TestCleanupTxnIntentsOnGCAsync(t *testing.T) { // has been pushed but that the garbage collection was not successful. { txn: txn1, - intents: []roachpb.Intent{ - roachpb.MakeIntent(txn1, roachpb.Span{Key: key}), - roachpb.MakeIntent(txn1, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}), + intents: []roachpb.LockUpdate{ + roachpb.MakeLockUpdate(txn1, roachpb.Span{Key: key}, lock.Replicated), + roachpb.MakeLockUpdate(txn1, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}, lock.Replicated), }, sendFuncs: newSendFuncs(t, singlePushTxnSendFunc(t), @@ -167,10 +129,10 @@ func TestCleanupTxnIntentsOnGCAsync(t *testing.T) { // that the txn has both been pushed and successfully resolved. { txn: txn1, - intents: []roachpb.Intent{ - roachpb.MakeIntent(txn1, roachpb.Span{Key: key}), - roachpb.MakeIntent(txn1, roachpb.Span{Key: roachpb.Key("aa")}), - roachpb.MakeIntent(txn1, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}), + intents: []roachpb.LockUpdate{ + roachpb.MakeLockUpdate(txn1, roachpb.Span{Key: key}, lock.Replicated), + roachpb.MakeLockUpdate(txn1, roachpb.Span{Key: roachpb.Key("aa")}, lock.Replicated), + roachpb.MakeLockUpdate(txn1, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}, lock.Replicated), }, sendFuncs: func() *sendFuncs { s := newSendFuncs(t) @@ -206,9 +168,9 @@ func TestCleanupTxnIntentsOnGCAsync(t *testing.T) { // has been pushed but that the garbage collection was not successful. { txn: txn3, - intents: []roachpb.Intent{ - roachpb.MakeIntent(txn3, roachpb.Span{Key: key}), - roachpb.MakeIntent(txn3, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}), + intents: []roachpb.LockUpdate{ + roachpb.MakeLockUpdate(txn3, roachpb.Span{Key: key}, lock.Replicated), + roachpb.MakeLockUpdate(txn3, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}, lock.Replicated), }, sendFuncs: newSendFuncs(t, singlePushTxnSendFunc(t), @@ -226,10 +188,10 @@ func TestCleanupTxnIntentsOnGCAsync(t *testing.T) { // that the txn has both been pushed and successfully resolved. { txn: txn3, - intents: []roachpb.Intent{ - roachpb.MakeIntent(txn3, roachpb.Span{Key: key}), - roachpb.MakeIntent(txn3, roachpb.Span{Key: roachpb.Key("aa")}), - roachpb.MakeIntent(txn3, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}), + intents: []roachpb.LockUpdate{ + roachpb.MakeLockUpdate(txn3, roachpb.Span{Key: key}, lock.Replicated), + roachpb.MakeLockUpdate(txn3, roachpb.Span{Key: roachpb.Key("aa")}, lock.Replicated), + roachpb.MakeLockUpdate(txn3, roachpb.Span{Key: key, EndKey: roachpb.Key("b")}, lock.Replicated), }, sendFuncs: func() *sendFuncs { s := newSendFuncs(t) @@ -248,7 +210,7 @@ func TestCleanupTxnIntentsOnGCAsync(t *testing.T) { // is no push but that the gc has occurred successfully. { txn: txn4, - intents: []roachpb.Intent{}, + intents: []roachpb.LockUpdate{}, sendFuncs: newSendFuncs(t, gcSendFunc(t)), expectSucceed: true, }, @@ -574,7 +536,7 @@ func TestCleanupIntentsAsyncThrottled(t *testing.T) { } wg.Wait() testIntents := []roachpb.Intent{ - roachpb.MakeIntent(txn, roachpb.Span{Key: roachpb.Key("a")}), + roachpb.MakePendingIntent(&txn.TxnMeta, roachpb.Span{Key: roachpb.Key("a")}), } // Running with allowSyncProcessing = false should result in an error and no // requests being sent. @@ -599,7 +561,7 @@ func TestCleanupIntentsAsync(t *testing.T) { clock := hlc.NewClock(hlc.UnixNano, time.Nanosecond) txn := newTransaction("txn", roachpb.Key("a"), 1, clock) testIntents := []roachpb.Intent{ - roachpb.MakeIntent(txn, roachpb.Span{Key: roachpb.Key("a")}), + roachpb.MakePendingIntent(&txn.TxnMeta, roachpb.Span{Key: roachpb.Key("a")}), } cases := []testCase{ { @@ -991,7 +953,7 @@ func TestCleanupIntents(t *testing.T) { // Set txn.ID to a very small value so it's sorted deterministically first. txn.ID = uuid.UUID{15: 0x01} testIntents := []roachpb.Intent{ - roachpb.MakeIntent(txn, roachpb.Span{Key: roachpb.Key("a")}), + roachpb.MakePendingIntent(&txn.TxnMeta, roachpb.Span{Key: roachpb.Key("a")}), } type testCase struct { intents []roachpb.Intent @@ -1075,7 +1037,7 @@ func makeTxnIntents(t *testing.T, clock *hlc.Clock, numIntents int) []roachpb.In for i := 0; i < numIntents; i++ { txn := newTransaction("test", roachpb.Key("a"), 1, clock) ret = append(ret, - roachpb.MakeIntent(txn, roachpb.Span{Key: txn.Key})) + roachpb.MakePendingIntent(&txn.TxnMeta, roachpb.Span{Key: txn.Key})) } return ret } diff --git a/pkg/storage/replica_test.go b/pkg/storage/replica_test.go index 0a7cad6e215e..1262bf1edb3b 100644 --- a/pkg/storage/replica_test.go +++ b/pkg/storage/replica_test.go @@ -40,6 +40,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/storage/apply" "github.com/cockroachdb/cockroach/pkg/storage/batcheval" "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result" + "github.com/cockroachdb/cockroach/pkg/storage/concurrency/lock" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/engine/enginepb" "github.com/cockroachdb/cockroach/pkg/storage/intentresolver" @@ -4284,8 +4285,8 @@ func TestEndTxnRollbackAbortedTransaction(t *testing.T) { } if pErr := tc.store.intentResolver.ResolveIntents(context.TODO(), - []roachpb.Intent{ - roachpb.MakeIntent(&txnRecord, roachpb.Span{Key: key}), + []roachpb.LockUpdate{ + roachpb.MakeLockUpdate(&txnRecord, roachpb.Span{Key: key}, lock.Replicated), }, intentresolver.ResolveOptions{Wait: true, Poison: true}); pErr != nil { t.Fatal(pErr) } @@ -4981,8 +4982,8 @@ func TestReplicaResolveIntentNoWait(t *testing.T) { txn := newTransaction("name", key, 1, tc.Clock()) txn.Status = roachpb.COMMITTED if pErr := tc.store.intentResolver.ResolveIntents(context.Background(), - []roachpb.Intent{ - roachpb.MakeIntent(txn, roachpb.Span{Key: key}), + []roachpb.LockUpdate{ + roachpb.MakeLockUpdate(txn, roachpb.Span{Key: key}, lock.Replicated), }, intentresolver.ResolveOptions{Wait: false, Poison: true /* irrelevant */}, ); pErr != nil {