aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgaltsev <galtsev@yandex-team.com>2024-09-03 22:26:49 +0300
committergaltsev <galtsev@yandex-team.com>2024-09-03 22:37:32 +0300
commit3a9ef6c61609dabfb6739723e216cd8783dc0894 (patch)
tree8b2ec4fcc7d069d821eea9c3b4cabb04e440a703
parent2671d03e5d1dc47268068c494d79f6f6250f7d22 (diff)
downloadydb-3a9ef6c61609dabfb6739723e216cd8783dc0894.tar.gz
YT-21993: Migrate chunk pools to Phoenix v2
8d0355171e82ebe60cfffe386600260f849e47b8
-rw-r--r--yt/yt/client/chunk_client/chunk_replica-inl.h5
-rw-r--r--yt/yt/client/chunk_client/chunk_replica.cpp6
-rw-r--r--yt/yt/client/chunk_client/chunk_replica.h9
-rw-r--r--yt/yt/client/chunk_client/private.h6
-rw-r--r--yt/yt/client/table_client/serialize.cpp2
-rw-r--r--yt/yt/client/table_client/serialize.h9
-rw-r--r--yt/yt/client/table_client/unversioned_row.h1
-rw-r--r--yt/yt/core/logging/logger_owner.cpp22
-rw-r--r--yt/yt/core/logging/logger_owner.h12
-rw-r--r--yt/yt/core/misc/id_generator.cpp6
-rw-r--r--yt/yt/core/misc/id_generator.h3
11 files changed, 55 insertions, 26 deletions
diff --git a/yt/yt/client/chunk_client/chunk_replica-inl.h b/yt/yt/client/chunk_client/chunk_replica-inl.h
index 3e302bf95c..aa301e5e86 100644
--- a/yt/yt/client/chunk_client/chunk_replica-inl.h
+++ b/yt/yt/client/chunk_client/chunk_replica-inl.h
@@ -140,6 +140,11 @@ Y_FORCE_INLINE int TChunkReplica::GetReplicaIndex() const
return (Value_ & 0x1f000000) >> 24;
}
+Y_FORCE_INLINE void TChunkReplica::RegisterMetadata(auto&& registrar)
+{
+ registrar.template Field<1, &TThis::Value_>("value")();
+}
+
Y_FORCE_INLINE void ToProto(ui32* value, TChunkReplica replica)
{
*value = replica.Value_;
diff --git a/yt/yt/client/chunk_client/chunk_replica.cpp b/yt/yt/client/chunk_client/chunk_replica.cpp
index 4fe3c8335d..a3b034c886 100644
--- a/yt/yt/client/chunk_client/chunk_replica.cpp
+++ b/yt/yt/client/chunk_client/chunk_replica.cpp
@@ -8,6 +8,8 @@
#include <yt/yt/core/misc/protobuf_helpers.h>
+#include <yt/yt/core/phoenix/type_def.h>
+
#include <yt/yt_proto/yt/client/chunk_client/proto/confirm_chunk_replica_info.pb.h>
namespace NYT::NChunkClient {
@@ -17,6 +19,10 @@ using namespace NObjectClient;
////////////////////////////////////////////////////////////////////////////////
+PHOENIX_DEFINE_TYPE(TChunkReplica);
+
+////////////////////////////////////////////////////////////////////////////////
+
void TChunkIdWithIndex::Save(TStreamSaveContext& context) const
{
using NYT::Save;
diff --git a/yt/yt/client/chunk_client/chunk_replica.h b/yt/yt/client/chunk_client/chunk_replica.h
index bc61c40be3..3e8f8a1dea 100644
--- a/yt/yt/client/chunk_client/chunk_replica.h
+++ b/yt/yt/client/chunk_client/chunk_replica.h
@@ -6,6 +6,9 @@
#include <yt/yt/client/node_tracker_client/public.h>
+#include <yt/yt/core/phoenix/context.h>
+#include <yt/yt/core/phoenix/type_decl.h>
+
namespace NYT::NChunkClient {
////////////////////////////////////////////////////////////////////////////////
@@ -121,6 +124,12 @@ private:
friend void ToProto(ui32* value, TChunkReplica replica);
friend void FromProto(TChunkReplica* replica, ui32 value);
+
+ using TLoadContext = NPhoenix2::TLoadContext;
+ using TSaveContext = NPhoenix2::TSaveContext;
+ using TPersistenceContext = NPhoenix2::TPersistenceContext;
+
+ PHOENIX_DECLARE_TYPE(TChunkReplica, 0x004d1b8a);
};
void FormatValue(TStringBuilderBase* builder, TChunkReplica replica, TStringBuf spec);
diff --git a/yt/yt/client/chunk_client/private.h b/yt/yt/client/chunk_client/private.h
index 94046385ff..05e8ffecb3 100644
--- a/yt/yt/client/chunk_client/private.h
+++ b/yt/yt/client/chunk_client/private.h
@@ -2,10 +2,16 @@
#include "public.h"
+#include <yt/yt/client/table_client/public.h>
+
#include <yt/yt/core/logging/log.h>
namespace NYT::NChunkClient {
+using NTableClient::TLoadContext;
+using NTableClient::TSaveContext;
+using NTableClient::TPersistenceContext;
+
////////////////////////////////////////////////////////////////////////////////
YT_DEFINE_GLOBAL(const NLogging::TLogger, ChunkClientLogger, "ChunkClient");
diff --git a/yt/yt/client/table_client/serialize.cpp b/yt/yt/client/table_client/serialize.cpp
index 5f9ca0d24d..12315f8928 100644
--- a/yt/yt/client/table_client/serialize.cpp
+++ b/yt/yt/client/table_client/serialize.cpp
@@ -7,7 +7,7 @@ namespace NYT::NTableClient {
TLoadContext::TLoadContext(
IZeroCopyInput* input,
TRowBufferPtr rowBuffer)
- : NPhoenix::TLoadContext(input)
+ : NPhoenix2::TLoadContext(input)
, RowBuffer_(std::move(rowBuffer))
{ }
diff --git a/yt/yt/client/table_client/serialize.h b/yt/yt/client/table_client/serialize.h
index de4a59364d..bcb83bcf75 100644
--- a/yt/yt/client/table_client/serialize.h
+++ b/yt/yt/client/table_client/serialize.h
@@ -3,23 +3,24 @@
#include "public.h"
#include <yt/yt/core/misc/property.h>
-#include <yt/yt/core/misc/phoenix.h>
+
+#include <yt/yt/core/phoenix/context.h>
namespace NYT::NTableClient {
////////////////////////////////////////////////////////////////////////////////
class TSaveContext
- : public NPhoenix::TSaveContext
+ : public NPhoenix2::TSaveContext
{
public:
- using NPhoenix::TSaveContext::TSaveContext;
+ using NPhoenix2::TSaveContext::TSaveContext;
};
////////////////////////////////////////////////////////////////////////////////
class TLoadContext
- : public NPhoenix::TLoadContext
+ : public NPhoenix2::TLoadContext
{
public:
DEFINE_BYVAL_RO_PROPERTY(TRowBufferPtr, RowBuffer);
diff --git a/yt/yt/client/table_client/unversioned_row.h b/yt/yt/client/table_client/unversioned_row.h
index 5b8b63e9e3..18ba6cb813 100644
--- a/yt/yt/client/table_client/unversioned_row.h
+++ b/yt/yt/client/table_client/unversioned_row.h
@@ -2,6 +2,7 @@
#include "public.h"
#include "row_base.h"
+#include "serialize.h"
#include "unversioned_value.h"
#include <yt/yt/core/logging/log.h>
diff --git a/yt/yt/core/logging/logger_owner.cpp b/yt/yt/core/logging/logger_owner.cpp
index ee5abca554..09beec6c24 100644
--- a/yt/yt/core/logging/logger_owner.cpp
+++ b/yt/yt/core/logging/logger_owner.cpp
@@ -1,31 +1,17 @@
#include "logger_owner.h"
-#include <yt/yt/core/misc/serialize.h>
+#include <yt/yt/core/phoenix/type_def.h>
namespace NYT::NLogging {
////////////////////////////////////////////////////////////////////////////////
-void TLoggerOwner::Save(TStreamSaveContext& context) const
+void TLoggerOwner::RegisterMetadata(auto&& registrar)
{
- using NYT::Save;
-
- Save(context, Logger);
-}
-
-void TLoggerOwner::Load(TStreamLoadContext& context)
-{
- using NYT::Load;
-
- Load(context, Logger);
+ registrar.template Field<1, &TThis::Logger>("logger")();
}
-void TLoggerOwner::Persist(const TStreamPersistenceContext& context)
-{
- using NYT::Persist;
-
- Persist(context, Logger);
-}
+PHOENIX_DEFINE_TYPE(TLoggerOwner);
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/logging/logger_owner.h b/yt/yt/core/logging/logger_owner.h
index c4815eaa06..68d7d7583b 100644
--- a/yt/yt/core/logging/logger_owner.h
+++ b/yt/yt/core/logging/logger_owner.h
@@ -2,8 +2,16 @@
#include "serializable_logger.h"
+#include <yt/yt/core/phoenix/context.h>
+#include <yt/yt/core/phoenix/type_decl.h>
+#include <yt/yt/core/phoenix/type_def.h>
+
namespace NYT::NLogging {
+using NPhoenix2::TLoadContext;
+using NPhoenix2::TSaveContext;
+using NPhoenix2::TPersistenceContext;
+
////////////////////////////////////////////////////////////////////////////////
//! Typically serves as a virtual base for classes that need a member logger.
@@ -14,9 +22,7 @@ protected:
TLoggerOwner() = default;
- void Save(TStreamSaveContext& context) const;
- void Load(TStreamLoadContext& context);
- void Persist(const TStreamPersistenceContext& context);
+ PHOENIX_DECLARE_TYPE(TLoggerOwner, 0x9feb0be1);
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/misc/id_generator.cpp b/yt/yt/core/misc/id_generator.cpp
index 30d4133af3..38075ddb80 100644
--- a/yt/yt/core/misc/id_generator.cpp
+++ b/yt/yt/core/misc/id_generator.cpp
@@ -5,6 +5,12 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
+TIdGenerator& TIdGenerator::operator=(const TIdGenerator& other)
+{
+ Current_.store(other.Current_.load());
+ return *this;
+}
+
ui64 TIdGenerator::Next()
{
return Current_++;
diff --git a/yt/yt/core/misc/id_generator.h b/yt/yt/core/misc/id_generator.h
index dd1d5d9a95..8fc1eff48b 100644
--- a/yt/yt/core/misc/id_generator.h
+++ b/yt/yt/core/misc/id_generator.h
@@ -10,6 +10,9 @@ namespace NYT {
class TIdGenerator
{
public:
+ //! For persistence only.
+ TIdGenerator& operator=(const TIdGenerator& other);
+
ui64 Next();
void Reset();