diff options
author | sabdenovch <sabdenovch@yandex-team.com> | 2024-03-17 22:28:53 +0300 |
---|---|---|
committer | sabdenovch <sabdenovch@yandex-team.com> | 2024-03-17 22:42:26 +0300 |
commit | b6403cde680cc9e01957e98909b21867891342c6 (patch) | |
tree | e970990ddc74fdb6da42a3e654567a2bd19e7f9a | |
parent | dfe0e4b5acdf479f3e41e710c58218b6baf04f0e (diff) | |
download | ydb-b6403cde680cc9e01957e98909b21867891342c6.tar.gz |
YT-21084, YT-21194: Secondary index modification refactoring
Addressed a concern regarding performance - a hash-map used to be built for every row in transaction which was hardly optimal.
New pipeline allows us to build a resulting table row according to a predetermined mapping, which will be useful for predicates in indices.
The use of a single name table makes the code more clear with less implied invariants.
Also fixed
- a bug with doubling rows in index table and added a test;
- a use-after-free bug with looked up rows.
- sequencing bug when using rpc proxy.
6f3f8915e7d9952193897acffea5cdbdbe1201d7
-rw-r--r-- | yt/yt/client/table_client/row_buffer.cpp | 5 | ||||
-rw-r--r-- | yt/yt/client/table_client/row_buffer.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/yt/yt/client/table_client/row_buffer.cpp b/yt/yt/client/table_client/row_buffer.cpp index dfa72af0a5..dddcbd9ce3 100644 --- a/yt/yt/client/table_client/row_buffer.cpp +++ b/yt/yt/client/table_client/row_buffer.cpp @@ -116,6 +116,7 @@ TMutableUnversionedRow TRowBuffer::CaptureAndPermuteRow( int schemafulColumnCount, const TNameTableToSchemaIdMapping& idMapping, std::vector<bool>* columnPresenceBuffer, + bool preserveIds, std::optional<TUnversionedValue> addend) { int valueCount = schemafulColumnCount; @@ -154,7 +155,9 @@ TMutableUnversionedRow TRowBuffer::CaptureAndPermuteRow( } int pos = mappedId < schemafulColumnCount ? mappedId : valueCount++; capturedRow[pos] = value; - capturedRow[pos].Id = mappedId; + if (!preserveIds) { + capturedRow[pos].Id = mappedId; + } } if (addend) { capturedRow[valueCount++] = *addend; diff --git a/yt/yt/client/table_client/row_buffer.h b/yt/yt/client/table_client/row_buffer.h index 4597fa69c2..4609604673 100644 --- a/yt/yt/client/table_client/row_buffer.h +++ b/yt/yt/client/table_client/row_buffer.h @@ -90,6 +90,7 @@ public: int schemafulColumnCount, const TNameTableToSchemaIdMapping& idMapping, std::vector<bool>* columnPresenceBuffer, + bool preserveIds = false, std::optional<TUnversionedValue> addend = std::nullopt); //! Captures the row applying #idMapping to value ids. |