summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpanesher <[email protected]>2026-04-09 17:21:37 +0300
committerpanesher <[email protected]>2026-04-09 17:56:08 +0300
commitfec857f0627822c86471d6441c1bdcbdab7abc4b (patch)
tree880e4090cff582718a694572b096a12cdc9537a5
parentcc97ca6d92e34ce280d2ae045fa6bfc1b15cbf68 (diff)
[dynamic] fix YT-27866: write, delete, lookup rows with allowMissingKeyColumns
* Changelog entry Type: fix Component: dynamic-tables Write, Delete, Lookup Rows allowed missing keys if allowMissingKeyColumns flag is set commit_hash:4f90a0f906fab5ad43914a34c4737f1f78986a3e
-rw-r--r--yt/yt/client/api/dynamic_table_client.h2
-rw-r--r--yt/yt/client/api/rpc_proxy/client_base.cpp3
-rw-r--r--yt/yt/client/table_client/unversioned_row.cpp5
-rw-r--r--yt/yt/client/table_client/unversioned_row.h9
-rw-r--r--yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto6
5 files changed, 19 insertions, 6 deletions
diff --git a/yt/yt/client/api/dynamic_table_client.h b/yt/yt/client/api/dynamic_table_client.h
index be7746b301b..736c8591529 100644
--- a/yt/yt/client/api/dynamic_table_client.h
+++ b/yt/yt/client/api/dynamic_table_client.h
@@ -22,6 +22,8 @@ struct TLookupRequestOptions
//! Adds |$timestamp:columnName| to result if readMode is latest_timestamp.
NTableClient::TVersionedReadOptions VersionedReadOptions;
std::optional<std::string> ExecutionPool;
+ //! If |true| then treat missing key columns as null.
+ bool AllowMissingKeyColumns = false;
};
struct TLookupRowsOptionsBase
diff --git a/yt/yt/client/api/rpc_proxy/client_base.cpp b/yt/yt/client/api/rpc_proxy/client_base.cpp
index 3807138334e..a7cccce3868 100644
--- a/yt/yt/client/api/rpc_proxy/client_base.cpp
+++ b/yt/yt/client/api/rpc_proxy/client_base.cpp
@@ -928,6 +928,7 @@ TFuture<TUnversionedLookupRowsResult> TClientBase::LookupRows(
req->set_enable_partial_result(options.EnablePartialResult);
req->set_replica_consistency(static_cast<NProto::EReplicaConsistency>(options.ReplicaConsistency));
YT_OPTIONAL_SET_PROTO(req, use_lookup_cache, options.UseLookupCache);
+ req->set_allow_missing_key_columns(options.AllowMissingKeyColumns);
req->SetMultiplexingBand(options.MultiplexingBand);
req->set_multiplexing_band(static_cast<NProto::EMultiplexingBand>(options.MultiplexingBand));
@@ -979,6 +980,7 @@ TFuture<TVersionedLookupRowsResult> TClientBase::VersionedLookupRows(
req->set_enable_partial_result(options.EnablePartialResult);
req->set_replica_consistency(static_cast<NProto::EReplicaConsistency>(options.ReplicaConsistency));
YT_OPTIONAL_SET_PROTO(req, use_lookup_cache, options.UseLookupCache);
+ req->set_allow_missing_key_columns(options.AllowMissingKeyColumns);
req->SetMultiplexingBand(options.MultiplexingBand);
req->set_multiplexing_band(static_cast<NProto::EMultiplexingBand>(options.MultiplexingBand));
@@ -1034,6 +1036,7 @@ TFuture<std::vector<TUnversionedLookupRowsResult>> TClientBase::MultiLookupRows(
protoSubrequest->set_enable_partial_result(subrequestOptions.EnablePartialResult);
YT_OPTIONAL_SET_PROTO(protoSubrequest, use_lookup_cache, subrequestOptions.UseLookupCache);
YT_OPTIONAL_TO_PROTO(protoSubrequest, execution_pool, subrequestOptions.ExecutionPool);
+ protoSubrequest->set_allow_missing_key_columns(subrequestOptions.AllowMissingKeyColumns);
auto rowset = SerializeRowset(
subrequest.NameTable,
diff --git a/yt/yt/client/table_client/unversioned_row.cpp b/yt/yt/client/table_client/unversioned_row.cpp
index 307ba64e66e..343fd5d9d5c 100644
--- a/yt/yt/client/table_client/unversioned_row.cpp
+++ b/yt/yt/client/table_client/unversioned_row.cpp
@@ -1340,9 +1340,10 @@ void ValidateClientKey(
TLegacyKey key,
const TTableSchema& schema,
const TNameTableToSchemaIdMapping& idMapping,
- const TNameTablePtr& nameTable)
+ const TNameTablePtr& nameTable,
+ bool allowMissingKeyColumns)
{
- ValidateClientRow(key, schema, idMapping, nameTable, true);
+ ValidateClientRow(key, schema, idMapping, nameTable, true, allowMissingKeyColumns);
}
void ValidateReadTimestamp(TTimestamp timestamp)
diff --git a/yt/yt/client/table_client/unversioned_row.h b/yt/yt/client/table_client/unversioned_row.h
index 644afde0f60..5156b53540e 100644
--- a/yt/yt/client/table_client/unversioned_row.h
+++ b/yt/yt/client/table_client/unversioned_row.h
@@ -432,18 +432,19 @@ bool ValidateNonKeyColumnsAgainstLock(
/*! The components must pass #ValidateKeyValue check. */
void ValidateClientKey(TLegacyKey key);
-//! Checks that #key is a valid client-side key. Throws on failure.
/*! The key must obey the following properties:
* 1. It cannot be null.
- * 2. It must contain exactly #schema.GetKeyColumnCount() components.
+ * 2. It must contain at most #schema.GetKeyColumnCount() components.
+ * If #allowMissingKeyColumns is false, it must contain exactly that many.
* 3. Value ids must be a permutation of {0, ..., #schema.GetKeyColumnCount() - 1}.
- * 4. Value types must either be null of match those given in schema.
+ * 4. Value types must either be null or match those given in schema.
*/
void ValidateClientKey(
TLegacyKey key,
const TTableSchema& schema,
const TNameTableToSchemaIdMapping& idMapping,
- const TNameTablePtr& nameTable);
+ const TNameTablePtr& nameTable,
+ bool allowMissingKeyColumns = false);
//! Checks if #timestamp is sane and can be used for data.
//! Allows timestamps in range [MinTimestamp, MaxTimestamp] plus some sentinels
diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
index 7cad03f1eee..33f7c955f04 100644
--- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
+++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto
@@ -544,6 +544,8 @@ message TReqLookupRows
optional bool enable_partial_result = 7 [default = false];
optional bool use_lookup_cache = 9 [default = false];
+ optional bool allow_missing_key_columns = 14 [default = false];
+
optional TTabletReadOptions tablet_read_options = 106;
optional EReplicaConsistency replica_consistency = 11;
@@ -590,6 +592,8 @@ message TReqVersionedLookupRows
optional bool enable_partial_result = 7 [default = false];
optional bool use_lookup_cache = 9 [default = false];
+ optional bool allow_missing_key_columns = 12 [default = false];
+
optional TTabletReadOptions tablet_read_options = 106;
optional EReplicaConsistency replica_consistency = 10;
@@ -622,6 +626,8 @@ message TReqMultiLookup
optional bool enable_partial_result = 4 [default = false];
optional bool use_lookup_cache = 5 [default = false];
+ optional bool allow_missing_key_columns = 10 [default = false];
+
required TRowsetDescriptor rowset_descriptor = 6;
required int32 attachment_count = 7;