diff options
author | h0pless <[email protected]> | 2023-09-29 16:15:00 +0300 |
---|---|---|
committer | h0pless <[email protected]> | 2023-09-29 16:34:35 +0300 |
commit | a5b613e8dcdbc73008cfe9c827920d7eeab1163d (patch) | |
tree | e2db497978bc58e4592147a62286c237501bb62f | |
parent | cc28e03be1ce27e4e65a4ce9469227a0010ee582 (diff) |
Introduce cypress transaction service
Creating new service - Cypress Transaction service.
It's purpose is to unify master transaction API. This is going to be handy when transactions will become replicated to sequoia through cypress proxy.
Alongside this new service 4 new transaction types were introduced. Adding new types is needed for clients to distinguish which service is responsible for any given request.
-rw-r--r-- | yt/yt/client/object_client/helpers.cpp | 17 | ||||
-rw-r--r-- | yt/yt/client/object_client/helpers.h | 8 | ||||
-rw-r--r-- | yt/yt/client/object_client/public.h | 2 | ||||
-rw-r--r-- | yt/yt/client/transaction_client/helpers.cpp | 11 | ||||
-rw-r--r-- | yt/yt/client/transaction_client/helpers.h | 7 |
5 files changed, 38 insertions, 7 deletions
diff --git a/yt/yt/client/object_client/helpers.cpp b/yt/yt/client/object_client/helpers.cpp index fc7614687b8..0104eff9a20 100644 --- a/yt/yt/client/object_client/helpers.cpp +++ b/yt/yt/client/object_client/helpers.cpp @@ -117,6 +117,7 @@ bool IsUserType(EObjectType type) { return type == EObjectType::Transaction || + type == EObjectType::SystemTransaction || type == EObjectType::Chunk || type == EObjectType::JournalChunk || type == EObjectType::ErasureChunk || @@ -234,6 +235,22 @@ bool IsMediumType(EObjectType type) type == EObjectType::S3Medium; } +bool IsCypressTransactionType(EObjectType type) +{ + return + type == EObjectType::Transaction || + type == EObjectType::NestedTransaction || + type == EObjectType::UploadTransaction || + type == EObjectType::UploadNestedTransaction; +} + +bool IsSystemTransactionType(EObjectType type) +{ + return + type == EObjectType::SystemTransaction || + type == EObjectType::SystemNestedTransaction; +} + bool HasSchema(EObjectType type) { if (type == EObjectType::Master) { diff --git a/yt/yt/client/object_client/helpers.h b/yt/yt/client/object_client/helpers.h index 4f7280e4a8c..3c57fa58e7b 100644 --- a/yt/yt/client/object_client/helpers.h +++ b/yt/yt/client/object_client/helpers.h @@ -63,9 +63,15 @@ bool IsChaosTableReplicaType(EObjectType type); //! Checks if the given type is a collocation. bool IsCollocationType(EObjectType type); -//! Checks if the given type is a medium; +//! Checks if the given type is a medium. bool IsMediumType(EObjectType type); +//! Checks if the given type is a cypress (i.e. master, simple) transaction. +bool IsCypressTransactionType(EObjectType type); + +//! Checks if the given type is a system transaction. +bool IsSystemTransactionType(EObjectType type); + //! Extracts the type component from #id. EObjectType TypeFromId(TObjectId id); diff --git a/yt/yt/client/object_client/public.h b/yt/yt/client/object_client/public.h index 05dc869b112..7863a6e6e03 100644 --- a/yt/yt/client/object_client/public.h +++ b/yt/yt/client/object_client/public.h @@ -100,6 +100,8 @@ DEFINE_ENUM(EObjectType, ((ExternalizedNestedTransaction) ( 6)) ((UploadTransaction) ( 7)) ((UploadNestedTransaction) ( 8)) + ((SystemTransaction) ( 9)) + ((SystemNestedTransaction) ( 10)) ((TransactionMap) (407)) ((TopmostTransactionMap) (418)) ((LockMap) (422)) diff --git a/yt/yt/client/transaction_client/helpers.cpp b/yt/yt/client/transaction_client/helpers.cpp index 03506509913..f4f32f95114 100644 --- a/yt/yt/client/transaction_client/helpers.cpp +++ b/yt/yt/client/transaction_client/helpers.cpp @@ -15,10 +15,13 @@ bool IsMasterTransactionId(TTransactionId id) { auto type = TypeFromId(id); // NB: Externalized transactions are for internal use only. - return type == NObjectClient::EObjectType::Transaction || - type == NObjectClient::EObjectType::NestedTransaction || + return + type == EObjectType::Transaction || + type == EObjectType::NestedTransaction || type == EObjectType::UploadTransaction || - type == EObjectType::UploadNestedTransaction; + type == EObjectType::UploadNestedTransaction || + type == EObjectType::SystemTransaction || + type == EObjectType::SystemNestedTransaction; } void ValidateTabletTransactionId(TTransactionId id) @@ -79,7 +82,7 @@ TTimestamp TimestampFromUnixTime(ui64 time) return time << TimestampCounterWidth; } -TTimestamp EmbedCellTagIntoTimestamp(TTimestamp timestamp, NObjectClient::TCellTag cellTag) +TTimestamp EmbedCellTagIntoTimestamp(TTimestamp timestamp, TCellTag cellTag) { static_assert(sizeof(TCellTag) == 2, "Invalid TCellTag size"); diff --git a/yt/yt/client/transaction_client/helpers.h b/yt/yt/client/transaction_client/helpers.h index f2ccbee4275..419e2b36ead 100644 --- a/yt/yt/client/transaction_client/helpers.h +++ b/yt/yt/client/transaction_client/helpers.h @@ -21,7 +21,9 @@ struct TReadTimestampRange //! Checks if #id represents a valid transaction accepted by masters: //! the type of #id must be either -//! #EObjectType::Transaction or #EObjectType::NestedTransaction. +//! #EObjectType::Transaction, #EObjectType::NestedTransaction, +//! #EObjectType::UploadTransaction, #EObjectType::UploadNestedTransaction. +//! #EObjectType::SytemTransaction or #EObjectType::SystemNestedTransaction. bool IsMasterTransactionId(TTransactionId id); //! Checks if #id represents a valid transaction accepted by tablets: @@ -33,7 +35,8 @@ void ValidateTabletTransactionId(TTransactionId id); //! Checks if #id represents a valid transaction accepted by masters: //! the type of #id must be one of //! #EObjectType::Transaction, #EObjectType::NestedTransaction, -//! #EObjectType::UploadTransaction, or #EObjectType::UploadNestedTransaction. +//! #EObjectType::UploadTransaction, #EObjectType::UploadNestedTransaction. +//! #EObjectType::SytemTransaction or #EObjectType::SystemNestedTransaction. void ValidateMasterTransactionId(TTransactionId id); //! Returns a range of instants containing a given timestamp. |