diff options
author | spuchin <spuchin@ydb.tech> | 2022-11-24 02:25:43 +0300 |
---|---|---|
committer | spuchin <spuchin@ydb.tech> | 2022-11-24 02:25:43 +0300 |
commit | e4710c84e536fdba401aa86f902925ad66ac896c (patch) | |
tree | caed0fd771ca2454643c00ac311cc7ede57dbf3a | |
parent | 05955aab8cc674ca7e279119352f8f98d95b0c73 (diff) | |
download | ydb-e4710c84e536fdba401aa86f902925ad66ac896c.tar.gz |
Remove legacy Kikimr settings. ()
19 files changed, 42 insertions, 337 deletions
diff --git a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp index 2be1f8cb4d5..a126e199ac2 100644 --- a/ydb/core/kqp/compile_service/kqp_compile_actor.cpp +++ b/ydb/core/kqp/compile_service/kqp_compile_actor.cpp @@ -310,7 +310,6 @@ private: }; void ApplyServiceConfig(TKikimrConfiguration& kqpConfig, const TTableServiceConfig& serviceConfig) { - kqpConfig._KqpAllowUnsafeCommit = serviceConfig.GetAllowUnsafeCommit(); if (serviceConfig.HasSqlVersion()) { kqpConfig._KqpYqlSyntaxVersion = serviceConfig.GetSqlVersion(); } diff --git a/ydb/core/kqp/host/kqp_host.cpp b/ydb/core/kqp/host/kqp_host.cpp index 6865597f335..4b5239913af 100644 --- a/ydb/core/kqp/host/kqp_host.cpp +++ b/ydb/core/kqp/host/kqp_host.cpp @@ -391,7 +391,6 @@ public: YQL_ENSURE(QueryCtx->PrepareOnly); YQL_ENSURE(!ExecuteCtx->Settings.CommitTx); YQL_ENSURE(!ExecuteCtx->Settings.RollbackTx); - YQL_ENSURE(!ExecuteCtx->Settings.IsolationLevel); if (QueryCtx->Type == EKikimrQueryType::Scan) { AsyncResult = KqpRunner->PrepareScanQuery(Cluster, input.Get(), ctx, ExecuteCtx->Settings); diff --git a/ydb/core/kqp/kqp_default_settings.txt b/ydb/core/kqp/kqp_default_settings.txt index b3f67b48d9c..48aa4cc4f9d 100644 --- a/ydb/core/kqp/kqp_default_settings.txt +++ b/ydb/core/kqp/kqp_default_settings.txt @@ -14,16 +14,6 @@ DefaultSettings { } DefaultSettings { - Name: "_KqpQueryTimeoutSec" - Value: "600" -} - -DefaultSettings { - Name: "_KqpRollbackInvalidatedTx" - Value: "true" -} - -DefaultSettings { Name: "_KqpSessionIdleTimeoutSec" Value: "600" } @@ -60,7 +50,7 @@ DefaultSettings { DefaultSettings { Name: "_KqpAllowUnsafeCommit" - Value: "true" + Value: "false" } DefaultSettings { @@ -69,51 +59,11 @@ DefaultSettings { } DefaultSettings { - Name: "_CommitReadsLimit" - Value: "10" -} - -DefaultSettings { - Name: "_RestrictModifyPermissions" - Value: "false" -} - -DefaultSettings { Name: "_ResultRowsLimit" Value: "1000" } DefaultSettings { - Name: "_AllowReverseRange" - Value: "true" -} - -DefaultSettings { - Name: "CommitSafety" - Value: "Safe" -} - -DefaultSettings { - Name: "IsolationLevel" - Value: "Serializable" -} - -DefaultSettings { - Name: "Profile" - Value: "false" -} - -DefaultSettings { - Name: "UnwrapReadTableValues" - Value: "false" -} - -DefaultSettings { - Name: "StrictDml" - Value: "true" -} - -DefaultSettings { Name: "OptDisableJoinReverseTableLookup" Value: "true" } diff --git a/ydb/core/kqp/opt/kqp_opt_kql.cpp b/ydb/core/kqp/opt/kqp_opt_kql.cpp index 0fed2b1100b..b8b0e1c5e76 100644 --- a/ydb/core/kqp/opt/kqp_opt_kql.cpp +++ b/ydb/core/kqp/opt/kqp_opt_kql.cpp @@ -11,45 +11,6 @@ using namespace NYql::NNodes; namespace { -TExprBase UnwrapReadTableValues(TExprBase input, const TKikimrTableDescription& tableDesc, - const TCoAtomList columns, TExprContext& ctx) -{ - TCoArgument itemArg = Build<TCoArgument>(ctx, input.Pos()) - .Name("item") - .Done(); - - TVector<TExprBase> structItems; - for (auto atom : columns) { - auto columnType = tableDesc.GetColumnType(TString(atom.Value())); - YQL_ENSURE(columnType); - - auto item = Build<TCoNameValueTuple>(ctx, input.Pos()) - .Name(atom) - .Value<TCoCoalesce>() - .Predicate<TCoMember>() - .Struct(itemArg) - .Name(atom) - .Build() - .Value<TCoDefault>() - .Type(ExpandType(atom.Pos(), *columnType->Cast<TOptionalExprType>()->GetItemType(), ctx)) - .Build() - .Build() - .Done(); - - structItems.push_back(item); - } - - return Build<TCoMap>(ctx, input.Pos()) - .Input(input) - .Lambda() - .Args({itemArg}) - .Body<TCoAsStruct>() - .Add(structItems) - .Build() - .Build() - .Done(); -} - // Replace absent input columns to NULL to perform REPLACE via UPSERT std::pair<TExprBase, TCoAtomList> CreateRowsToReplace(const TExprBase& input, const TCoAtomList& inputColumns, const TKikimrTableDescription& tableDesc, @@ -190,22 +151,16 @@ TExprBase BuildReadTable(const TCoAtomList& columns, TPositionHandle pos, const TExprBase BuildReadTable(const TKiReadTable& read, const TKikimrTableDescription& tableData, bool withSystemColumns, TExprContext& ctx, const TIntrusivePtr<TKqpOptimizeContext>& kqpCtx) { - bool unwrapValues = HasSetting(read.Settings().Ref(), "unwrap_values"); - const auto& columns = read.GetSelectColumns(ctx, tableData, withSystemColumns); auto readNode = BuildReadTable(columns, read.Pos(), tableData, ctx, kqpCtx); - return unwrapValues - ? UnwrapReadTableValues(readNode, tableData, columns, ctx) - : readNode; + return readNode; } TExprBase BuildReadTableIndex(const TKiReadTable& read, const TKikimrTableDescription& tableData, const TString& indexName, bool withSystemColumns, TExprContext& ctx) { - bool unwrapValues = HasSetting(read.Settings().Ref(), "unwrap_values"); - auto kqlReadTable = Build<TKqlReadTableIndex>(ctx, read.Pos()) .Table(BuildTableMeta(tableData, read.Pos(), ctx)) .Range() @@ -220,9 +175,7 @@ TExprBase BuildReadTableIndex(const TKiReadTable& read, const TKikimrTableDescri .Index().Build(indexName) .Done(); - return unwrapValues - ? UnwrapReadTableValues(kqlReadTable, tableData, kqlReadTable.Columns(), ctx) - : kqlReadTable; + return kqlReadTable; } TExprBase BuildUpsertTable(const TKiWriteTable& write, const TCoAtomList& inputColumns, diff --git a/ydb/core/kqp/opt/logical/kqp_opt_log_ranges.cpp b/ydb/core/kqp/opt/logical/kqp_opt_log_ranges.cpp index 5d62ee43596..ec9857f5806 100644 --- a/ydb/core/kqp/opt/logical/kqp_opt_log_ranges.cpp +++ b/ydb/core/kqp/opt/logical/kqp_opt_log_ranges.cpp @@ -207,8 +207,7 @@ TExprBase KqpPushPredicateToReadTable(TExprBase node, TExprContext& ctx, const T auto row = flatmap.Lambda().Args().Arg(0); auto predicate = TExprBase(flatmap.Lambda().Body().Ref().ChildPtr(0)); TTableLookup lookup = ExtractTableLookup(row, predicate, tableDesc.Metadata->KeyColumnNames, - &KqpTableLookupGetValue, &KqpTableLookupCanCompare, &KqpTableLookupCompare, ctx, - kqpCtx.Config->HasAllowNullCompareInIndex()); + &KqpTableLookupGetValue, &KqpTableLookupCanCompare, &KqpTableLookupCompare, ctx, false); if (lookup.IsFullScan()) { return node; diff --git a/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp b/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp index 150e2c6a492..a963a8bdcb5 100644 --- a/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp +++ b/ydb/core/kqp/opt/logical/kqp_opt_log_ranges_predext.cpp @@ -23,6 +23,8 @@ TMaybeNode<TExprBase> TryBuildTrivialReadTable(TCoFlatMap& flatmap, TKqlReadTabl const TKqpMatchReadResult& readMatch, const TKikimrTableDescription& tableDesc, TExprContext& ctx, const TKqpOptimizeContext& kqpCtx) { + Y_UNUSED(kqpCtx); + switch (tableDesc.Metadata->Kind) { case EKikimrTableKind::Datashard: case EKikimrTableKind::SysView: @@ -35,8 +37,7 @@ TMaybeNode<TExprBase> TryBuildTrivialReadTable(TCoFlatMap& flatmap, TKqlReadTabl auto row = flatmap.Lambda().Args().Arg(0); auto predicate = TExprBase(flatmap.Lambda().Body().Ref().ChildPtr(0)); TTableLookup lookup = ExtractTableLookup(row, predicate, tableDesc.Metadata->KeyColumnNames, - &KqpTableLookupGetValue, &KqpTableLookupCanCompare, &KqpTableLookupCompare, ctx, - kqpCtx.Config->HasAllowNullCompareInIndex()); + &KqpTableLookupGetValue, &KqpTableLookupCanCompare, &KqpTableLookupCompare, ctx, false); if (lookup.IsFullScan()) { return {}; diff --git a/ydb/core/kqp/provider/yql_kikimr_datasource.cpp b/ydb/core/kqp/provider/yql_kikimr_datasource.cpp index ec5b2949e2a..c1dd2b0df80 100644 --- a/ydb/core/kqp/provider/yql_kikimr_datasource.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_datasource.cpp @@ -482,22 +482,6 @@ public: if (auto maybeRead = TMaybeNode<TKiReadTable>(newRead)) { auto read = maybeRead.Cast(); - - if (SessionCtx->Config().HasUnwrapReadTableValues()) { - newRead = Build<TKiReadTable>(ctx, read.Pos()) - .World(read.World()) - .DataSource(read.DataSource()) - .TableKey(read.TableKey()) - .Select(read.Select()) - .Settings() - .Add(read.Settings()) - .Add() - .Name().Build("unwrap_values") - .Build() - .Build() - .Done() - .Ptr(); - } } auto retChildren = node->ChildrenList(); diff --git a/ydb/core/kqp/provider/yql_kikimr_exec.cpp b/ydb/core/kqp/provider/yql_kikimr_exec.cpp index 2f45b602279..05d797862bf 100644 --- a/ydb/core/kqp/provider/yql_kikimr_exec.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_exec.cpp @@ -1227,8 +1227,6 @@ private: } else { auto config = SessionCtx->Config().Snapshot(); - auto isolationLevel = config->IsolationLevel.Get(cluster); - IKikimrQueryExecutor::TExecuteSettings settings; settings.CommitTx = true; if (mode) { @@ -1242,20 +1240,12 @@ private: } } - settings.IsolationLevel = isolationLevel; - settings.StrictDml = config->StrictDml.Get(cluster).GetRef(); - const auto& scanQuery = config->ScanQuery.Get(cluster); if (scanQuery) { settings.UseScanQuery = scanQuery.GetRef(); } settings.StatsMode = SessionCtx->Query().StatsMode; - auto profile = config->Profile.Get(cluster); - if (profile && *profile) { - // Do not disable profiling if it was enabled at request level - settings.StatsMode = EKikimrStatsMode::Full; - } asyncResult = runFunc(settings); @@ -1327,7 +1317,6 @@ private: bool ApplyTableOperations(const TString& cluster, const TVector<NKqpProto::TKqpTableOp>& tableOps, NKikimrKqp::EIsolationLevel isolationLevel, TExprContext& ctx) { - bool strictDml = SessionCtx->Config().StrictDml.Get(cluster).GetRef(); bool enableImmediateEffects = SessionCtx->Config().FeatureFlags.GetEnableKqpImmediateEffects(); auto queryType = SessionCtx->Query().Type; TVector<NKqpProto::TKqpTableInfo> tableInfo; @@ -1342,11 +1331,11 @@ private: if (!SessionCtx->HasTx()) { TKikimrTransactionContextBase emptyCtx; - return emptyCtx.ApplyTableOperations(tableOps, tableInfo, isolationLevel, strictDml, enableImmediateEffects, + return emptyCtx.ApplyTableOperations(tableOps, tableInfo, isolationLevel, enableImmediateEffects, queryType, ctx); } - return SessionCtx->Tx().ApplyTableOperations(tableOps, tableInfo, isolationLevel, strictDml, + return SessionCtx->Tx().ApplyTableOperations(tableOps, tableInfo, isolationLevel, enableImmediateEffects, queryType, ctx); } @@ -1374,34 +1363,6 @@ private: } // namespace -NKikimrKqp::EIsolationLevel GetIsolationLevel(const TMaybe<TString>& isolationLevel) { - YQL_ENSURE(isolationLevel); - auto levelStr = *isolationLevel; - - if (levelStr == "ReadStale") { - return NKikimrKqp::ISOLATION_LEVEL_READ_STALE; - } else if (levelStr == "ReadUncommitted") { - return NKikimrKqp::ISOLATION_LEVEL_READ_UNCOMMITTED; - } else if (levelStr == "ReadCommitted") { - return NKikimrKqp::ISOLATION_LEVEL_READ_COMMITTED; - } else if (levelStr == "Serializable") { - return NKikimrKqp::ISOLATION_LEVEL_SERIALIZABLE; - } - - YQL_ENSURE(false, "Unsupported isolation level: " << levelStr); -} - -TMaybe<TString> GetIsolationLevel(const NKikimrKqp::EIsolationLevel& isolationLevel) { - switch (isolationLevel) { - case NKikimrKqp::ISOLATION_LEVEL_READ_STALE: return "ReadStale"; - case NKikimrKqp::ISOLATION_LEVEL_READ_UNCOMMITTED: return "ReadUncommitted"; - case NKikimrKqp::ISOLATION_LEVEL_READ_COMMITTED: return "ReadCommitted"; - case NKikimrKqp::ISOLATION_LEVEL_SERIALIZABLE: return "Serializable"; - default: - return TMaybe<TString>(); - } -} - TAutoPtr<IGraphTransformer> CreateKiSourceCallableExecutionTransformer( TIntrusivePtr<IKikimrGateway> gateway, TIntrusivePtr<TKikimrSessionContext> sessionCtx) diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.cpp b/ydb/core/kqp/provider/yql_kikimr_provider.cpp index 2359c4aeb21..951ee022724 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_provider.cpp @@ -560,23 +560,16 @@ bool ValidateTableHasIndex(TKikimrTableMetadataPtr metadata, TExprContext& ctx, return true; } -bool AddDmlIssue(const TIssue& issue, bool strictDml, TExprContext& ctx) { - if (strictDml) { - TIssue newIssue; - newIssue.SetCode(issue.GetCode(), ESeverity::TSeverityIds_ESeverityId_S_ERROR); - newIssue.SetMessage("Detected violation of logical DML constraints. YDB transactions don't see their own" - " changes, make sure you perform all table reads before any modifications."); +bool AddDmlIssue(const TIssue& issue, TExprContext& ctx) { + TIssue newIssue; + newIssue.SetCode(issue.GetCode(), ESeverity::TSeverityIds_ESeverityId_S_ERROR); + newIssue.SetMessage("Detected violation of logical DML constraints. YDB transactions don't see their own" + " changes, make sure you perform all table reads before any modifications."); - newIssue.AddSubIssue(new TIssue(issue)); + newIssue.AddSubIssue(new TIssue(issue)); - ctx.AddError(newIssue); - return false; - } else { - if (!ctx.AddWarning(issue)) { - return false; - } - return true; - } + ctx.AddError(newIssue); + return false; } TKiDataQueryBlockSettings TKiDataQueryBlockSettings::Parse(const NNodes::TKiDataQueryBlock& node) { diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.h b/ydb/core/kqp/provider/yql_kikimr_provider.h index 149eea729b8..e2c112d4aa0 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.h +++ b/ydb/core/kqp/provider/yql_kikimr_provider.h @@ -42,8 +42,6 @@ public: TKikimrQueryDeadlines Deadlines; TKikimrQueryLimits Limits; bool RawResults = false; // TODO: deprecate - TMaybe<TString> IsolationLevel; // TODO: deprecate - TMaybe<bool> StrictDml; // TODO: deprecate TMaybe<bool> UseScanQuery; EKikimrStatsMode StatsMode = EKikimrStatsMode::None; TMaybe<bool> DocumentApiRestricted; @@ -274,7 +272,7 @@ const TYdbOperations& KikimrModifyOps(); const TYdbOperations& KikimrReadOps(); const TYdbOperations& KikimrRequireUnmodifiedOps(); -bool AddDmlIssue(const TIssue& issue, bool strictDml, TExprContext& ctx); +bool AddDmlIssue(const TIssue& issue, TExprContext& ctx); class TKikimrTransactionContextBase : public TThrRefBase { public: @@ -318,7 +316,7 @@ public: template<class IterableKqpTableOps, class IterableKqpTableInfos> bool ApplyTableOperations(const IterableKqpTableOps& operations, - const IterableKqpTableInfos& tableInfos, NKikimrKqp::EIsolationLevel isolationLevel, bool strictDml, + const IterableKqpTableInfos& tableInfos, NKikimrKqp::EIsolationLevel isolationLevel, bool enableImmediateEffects, EKikimrQueryType queryType, TExprContext& ctx) { if (IsClosed()) { @@ -408,7 +406,7 @@ public: if (KikimrReadOps() & newOp) { TString message = TStringBuilder() << "Data modifications previously made to table '" << table << "' in current transaction won't be seen by operation: '" << newOp << "'"; - if (!AddDmlIssue(YqlIssue(pos, TIssuesIds::KIKIMR_READ_MODIFIED_TABLE, message), strictDml, ctx)) { + if (!AddDmlIssue(YqlIssue(pos, TIssuesIds::KIKIMR_READ_MODIFIED_TABLE, message), ctx)) { return false; } } @@ -433,7 +431,7 @@ public: if (currentDelete && newUpdate && !enableImmediateEffects) { TString message = TStringBuilder() << "Operation '" << newOp << "' may lead to unexpected results when applied to table with deleted rows: " << table; - if (!AddDmlIssue(YqlIssue(pos, TIssuesIds::KIKIMR_UPDATE_TABLE_WITH_DELETES, message), strictDml, ctx)) { + if (!AddDmlIssue(YqlIssue(pos, TIssuesIds::KIKIMR_UPDATE_TABLE_WITH_DELETES, message), ctx)) { return false; } } diff --git a/ydb/core/kqp/provider/yql_kikimr_provider_impl.h b/ydb/core/kqp/provider/yql_kikimr_provider_impl.h index a622698a7c6..3e0e2e60262 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider_impl.h +++ b/ydb/core/kqp/provider/yql_kikimr_provider_impl.h @@ -209,9 +209,6 @@ NNodes::TCoAtomList BuildColumnsList(const TKikimrTableDescription& table, TPosi const TTypeAnnotationNode* GetReadTableRowType(TExprContext& ctx, const TKikimrTablesData& tablesData, const TString& cluster, const TString& table, NNodes::TCoAtomList select, bool withSystemColumns = false); -NKikimrKqp::EIsolationLevel GetIsolationLevel(const TMaybe<TString>& isolationLevel); -TMaybe<TString> GetIsolationLevel(const NKikimrKqp::EIsolationLevel& isolationLevel); - TYdbOperation GetTableOp(const NNodes::TKiWriteTable& write); TVector<NKqpProto::TKqpTableOp> TableOperationsToProto(const NNodes::TCoNameValueTupleList& operations, TExprContext& ctx); diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.cpp b/ydb/core/kqp/provider/yql_kikimr_settings.cpp index be21318b382..4247f14555c 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_settings.cpp @@ -27,11 +27,9 @@ static inline bool GetFlagValue(const TMaybe<bool>& flag) { TKikimrConfiguration::TKikimrConfiguration() { /* KQP */ - REGISTER_SETTING(*this, _KqpQueryTimeoutSec); REGISTER_SETTING(*this, _KqpSessionIdleTimeoutSec); REGISTER_SETTING(*this, _KqpMaxActiveTxPerSession); REGISTER_SETTING(*this, _KqpTxIdleTimeoutSec); - REGISTER_SETTING(*this, _KqpRollbackInvalidatedTx); REGISTER_SETTING(*this, _KqpExprNodesAllocationLimit); REGISTER_SETTING(*this, _KqpExprStringsAllocationLimit); REGISTER_SETTING(*this, _KqpTablePathPrefix); @@ -48,13 +46,8 @@ TKikimrConfiguration::TKikimrConfiguration() { /* Compile time */ REGISTER_SETTING(*this, _CommitPerShardKeysSizeLimitBytes); - REGISTER_SETTING(*this, _CommitReadsLimit); REGISTER_SETTING(*this, _DefaultCluster); REGISTER_SETTING(*this, _ResultRowsLimit); - REGISTER_SETTING(*this, _AllowReverseRange); - REGISTER_SETTING(*this, CommitSafety).Enum({"Full", "Safe", "Moderate"}); - REGISTER_SETTING(*this, UnwrapReadTableValues); - REGISTER_SETTING(*this, AllowNullCompareInIndex); REGISTER_SETTING(*this, EnableSystemColumns); REGISTER_SETTING(*this, EnableLlvm); @@ -68,30 +61,13 @@ TKikimrConfiguration::TKikimrConfiguration() { REGISTER_SETTING(*this, OptEnablePredicateExtract); /* Runtime */ - REGISTER_SETTING(*this, _RestrictModifyPermissions); - REGISTER_SETTING(*this, _UseLocalProvider); - REGISTER_SETTING(*this, IsolationLevel).Enum({"ReadStale", "ReadUncommitted", "ReadCommitted", "Serializable"}); - REGISTER_SETTING(*this, Profile); - REGISTER_SETTING(*this, StrictDml); REGISTER_SETTING(*this, ScanQuery); } -bool TKikimrSettings::HasAllowNullCompareInIndex() const { - return GetFlagValue(AllowNullCompareInIndex.Get()); -} - -bool TKikimrSettings::HasUnwrapReadTableValues() const { - return GetFlagValue(UnwrapReadTableValues.Get()); -} - bool TKikimrSettings::HasAllowKqpUnsafeCommit() const { return GetFlagValue(_KqpAllowUnsafeCommit.Get()); } -bool TKikimrSettings::AllowReverseRange() const { - return GetFlagValue(_AllowReverseRange.Get()); -} - bool TKikimrSettings::HasDefaultCluster() const { return _DefaultCluster.Get() && !_DefaultCluster.Get().GetRef().empty(); } diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.h b/ydb/core/kqp/provider/yql_kikimr_settings.h index 1436c766c4a..b92b04677a5 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.h +++ b/ydb/core/kqp/provider/yql_kikimr_settings.h @@ -16,11 +16,9 @@ struct TKikimrSettings { using TConstPtr = std::shared_ptr<const TKikimrSettings>; /* KQP */ - NCommon::TConfSetting<ui32, false> _KqpQueryTimeoutSec; NCommon::TConfSetting<ui32, false> _KqpSessionIdleTimeoutSec; NCommon::TConfSetting<ui32, false> _KqpMaxActiveTxPerSession; NCommon::TConfSetting<ui32, false> _KqpTxIdleTimeoutSec; - NCommon::TConfSetting<bool, false> _KqpRollbackInvalidatedTx; NCommon::TConfSetting<ui64, false> _KqpExprNodesAllocationLimit; NCommon::TConfSetting<ui64, false> _KqpExprStringsAllocationLimit; NCommon::TConfSetting<TString, false> _KqpTablePathPrefix; @@ -39,14 +37,9 @@ struct TKikimrSettings { NCommon::TConfSetting<bool, false> KqpPushOlapProcess; /* Compile time */ - NCommon::TConfSetting<bool, false> _AllowReverseRange; NCommon::TConfSetting<ui64, false> _CommitPerShardKeysSizeLimitBytes; - NCommon::TConfSetting<ui32, false> _CommitReadsLimit; NCommon::TConfSetting<TString, false> _DefaultCluster; NCommon::TConfSetting<ui32, false> _ResultRowsLimit; - NCommon::TConfSetting<TString, false> CommitSafety; - NCommon::TConfSetting<bool, false> UnwrapReadTableValues; - NCommon::TConfSetting<bool, false> AllowNullCompareInIndex; NCommon::TConfSetting<bool, false> EnableSystemColumns; NCommon::TConfSetting<bool, false> EnableLlvm; @@ -61,17 +54,9 @@ struct TKikimrSettings { NCommon::TConfSetting<bool, false> OptEnablePredicateExtract; /* Runtime */ - NCommon::TConfSetting<bool, true> _UseLocalProvider; - NCommon::TConfSetting<bool, true> _RestrictModifyPermissions; - NCommon::TConfSetting<TString, true> IsolationLevel; - NCommon::TConfSetting<bool, true> Profile; - NCommon::TConfSetting<bool, true> StrictDml; NCommon::TConfSetting<bool, true> ScanQuery; /* Accessors */ - bool HasAllowNullCompareInIndex() const; - bool HasUnwrapReadTableValues() const; - bool AllowReverseRange() const; bool HasDefaultCluster() const; bool HasAllowKqpUnsafeCommit() const; bool SystemColumnsEnabled() const; diff --git a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp index c2007692981..21b6786447e 100644 --- a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp @@ -142,19 +142,6 @@ private: return TStatus::Error; } - if (HasSetting(readTable.Settings().Ref(), "unwrap_values")) { - TVector<const TItemExprType*> unwrappedItems; - for (auto* item : selectType->Cast<TStructExprType>()->GetItems()) { - auto unwrappedType = item->GetItemType()->Cast<TOptionalExprType>()->GetItemType(); - auto newItemType = ctx.MakeType<TItemExprType>(item->GetName(), unwrappedType); - YQL_ENSURE(newItemType->Validate(node.Pos(), ctx)); - unwrappedItems.push_back(newItemType); - } - auto newStructType = ctx.MakeType<TStructExprType>(unwrappedItems); - YQL_ENSURE(newStructType->Validate(node.Pos(), ctx)); - selectType = newStructType; - } - auto listSelectType = ctx.MakeType<TListExprType>(selectType); TTypeAnnotationNode::TListType children; @@ -422,10 +409,6 @@ private: return status; } - if (!EnsureModifyPermissions(table->Metadata->Cluster, table->Metadata->Name, node.Pos(), ctx)) { - return TStatus::Error; - } - node.Ptr()->SetTypeAnn(node.World().Ref().GetTypeAnn()); return TStatus::Ok; } @@ -506,10 +489,6 @@ private: return status; } - if (!EnsureModifyPermissions(table->Metadata->Cluster, table->Metadata->Name, node.Pos(), ctx)) { - return TStatus::Error; - } - node.Ptr()->SetTypeAnn(node.World().Ref().GetTypeAnn()); return TStatus::Ok; } @@ -538,10 +517,6 @@ private: return IGraphTransformer::TStatus::Error; } - if (!EnsureModifyPermissions(table->Metadata->Cluster, table->Metadata->Name, node.Pos(), ctx)) { - return TStatus::Error; - } - node.Ptr()->SetTypeAnn(node.World().Ref().GetTypeAnn()); return TStatus::Ok; } @@ -843,9 +818,6 @@ private: return TStatus::Error; } - if (!EnsureModifyPermissions(cluster, table, create.Pos(), ctx)) { - return TStatus::Error; - } auto& tableDesc = SessionCtx->Tables().GetTable(cluster, table); if (meta->TableType == ETableType::Table && tableDesc.DoesExist() && !tableDesc.Metadata->IsSameTable(*meta)) { ctx.AddError(TIssue(ctx.GetPosition(create.Pos()), TStringBuilder() @@ -869,10 +841,6 @@ private: } if (table->GetTableType() == ETableType::Table) { - if (!EnsureModifyPermissions(table->Metadata->Cluster, table->Metadata->Name, node.Pos(), ctx)) { - return TStatus::Error; - } - if (!CheckDocApiModifiation(*table->Metadata, node.Pos(), ctx)) { return TStatus::Error; } @@ -892,10 +860,6 @@ private: return TStatus::Error; } - if (!EnsureModifyPermissions(table->Metadata->Cluster, table->Metadata->Name, node.Pos(), ctx)) { - return TStatus::Error; - } - if (!CheckDocApiModifiation(*table->Metadata, node.Pos(), ctx)) { return TStatus::Error; } @@ -1314,25 +1278,6 @@ private: return TStatus::Error; } - bool EnsureModifyPermissions(const TString& cluster, const TString& table, TPositionHandle pos, TExprContext& ctx) { - bool restrictPermissions = SessionCtx->Config()._RestrictModifyPermissions.Get(cluster).GetRef(); - if (!restrictPermissions) { - return true; - } - - TString tmpDir = "/Root/Tmp/"; - TString homeDir = "/Root/Home/" + SessionCtx->GetUserName() + "/"; - - auto tablePath = Gateway->CanonizePath(table); - if (!tablePath.StartsWith(tmpDir) && !tablePath.StartsWith(homeDir)) { - ctx.AddError(TIssue(ctx.GetPosition(pos), TStringBuilder() - << "User " << SessionCtx->GetUserName() << " doesn't have permissions to modify table: " << table)); - return false; - } - - return true; - } - bool CheckDocApiModifiation(const TKikimrTableMetadata& meta, TPositionHandle pos, TExprContext& ctx) { if (!SessionCtx->Query().DocumentApiRestricted) { return true; diff --git a/ydb/core/kqp/session_actor/kqp_session_actor.cpp b/ydb/core/kqp/session_actor/kqp_session_actor.cpp index 0cb4190dabc..08a9a23dafc 100644 --- a/ydb/core/kqp/session_actor/kqp_session_actor.cpp +++ b/ydb/core/kqp/session_actor/kqp_session_actor.cpp @@ -772,11 +772,10 @@ public: std::pair<bool, TIssues> ApplyTableOperations(TKqpTransactionContext* txCtx, const NKqpProto::TKqpPhyQuery& query) { auto isolationLevel = *txCtx->EffectiveIsolationLevel; - bool strictDml = Config->StrictDml.Get(Settings.Cluster).GetOrElse(false); bool enableImmediateEffects = Config->FeatureFlags.GetEnableKqpImmediateEffects(); TExprContext ctx; - bool success = txCtx->ApplyTableOperations(query.GetTableOps(), query.GetTableInfos(), isolationLevel, strictDml, + bool success = txCtx->ApplyTableOperations(query.GetTableOps(), query.GetTableInfos(), isolationLevel, enableImmediateEffects, EKikimrQueryType::Dml, ctx); return {success, ctx.IssueManager.GetIssues()}; } diff --git a/ydb/core/kqp/ut/kqp_inplace_update_ut.cpp b/ydb/core/kqp/ut/kqp_inplace_update_ut.cpp index 39eae8229ff..3a1bde48682 100644 --- a/ydb/core/kqp/ut/kqp_inplace_update_ut.cpp +++ b/ydb/core/kqp/ut/kqp_inplace_update_ut.cpp @@ -36,8 +36,13 @@ void PrepareTable(TSession& session) { void Test(bool enableInplaceUpdate, const TString& query, TParams&& params, const TString& expectedResult, std::function<void(const Ydb::TableStats::QueryStats&)>&& check) { - TKikimrRunner kikimr; - auto session = kikimr.GetTableClient().CreateSession().GetValueSync().GetSession(); + auto setting = NKikimrKqp::TKqpSetting(); + setting.SetName("_KqpAllowUnsafeCommit"); + setting.SetValue("true"); + + TKikimrRunner kikimr({setting}); + auto db = kikimr.GetTableClient(); + auto session = db.CreateSession().GetValueSync().GetSession(); PrepareTable(session); @@ -353,7 +358,11 @@ Y_UNIT_TEST_TWIN(BigRow, EnableInplaceUpdate) { keysLimitSetting.SetName("_CommitPerShardKeysSizeLimitBytes"); keysLimitSetting.SetValue("100"); - TKikimrRunner kikimr({keysLimitSetting}); + auto unsafeCommitSetting = NKikimrKqp::TKqpSetting(); + unsafeCommitSetting.SetName("_KqpAllowUnsafeCommit"); + unsafeCommitSetting.SetValue("true"); + + TKikimrRunner kikimr({keysLimitSetting, unsafeCommitSetting}); auto db = kikimr.GetTableClient(); auto session = db.CreateSession().GetValueSync().GetSession(); diff --git a/ydb/core/kqp/ut/kqp_pragma_ut.cpp b/ydb/core/kqp/ut/kqp_pragma_ut.cpp index 65b8bc10a03..8cd9b54a685 100644 --- a/ydb/core/kqp/ut/kqp_pragma_ut.cpp +++ b/ydb/core/kqp/ut/kqp_pragma_ut.cpp @@ -9,34 +9,6 @@ using namespace NYdb; using namespace NYdb::NTable; Y_UNIT_TEST_SUITE(KqpPragma) { - Y_UNIT_TEST(Static) { - TKikimrRunner kikimr; - auto db = kikimr.GetTableClient(); - auto session = db.CreateSession().GetValueSync().GetSession(); - - auto result = session.ExecuteDataQuery(R"( - PRAGMA ydb.UnwrapReadTableValues = "true"; - SELECT * FROM `/Root/KeyValue` WHERE Key = 1; - )", TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync(); - UNIT_ASSERT(result.IsSuccess()); - - CompareYson(R"([[1u;"One"]])", FormatResultSetYson(result.GetResultSet(0))); - } - - Y_UNIT_TEST(Runtime) { - TKikimrRunner kikimr; - auto db = kikimr.GetTableClient(); - auto session = db.CreateSession().GetValueSync().GetSession(); - - auto result = session.ExecuteDataQuery(Q_(R"( - PRAGMA kikimr.IsolationLevel = "ReadCommitted"; - SELECT * FROM `/Root/KeyValue` WHERE Key = 1; - )"), TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync(); - - UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), NYdb::EStatus::GENERIC_ERROR); - UNIT_ASSERT(HasIssue(result.GetIssues(), NYql::TIssuesIds::KIKIMR_PRAGMA_NOT_SUPPORTED)); - } - Y_UNIT_TEST(Auth) { TKikimrRunner kikimr; auto db = kikimr.GetTableClient(); @@ -57,17 +29,18 @@ Y_UNIT_TEST_SUITE(KqpPragma) { auto session = db.CreateSession().GetValueSync().GetSession(); auto result = session.ExecuteDataQuery(R"( - PRAGMA kikimr.UnwrapReadTableValues = "true"; - SELECT * FROM `/Root/KeyValue` WHERE Key = 1; + PRAGMA kikimr.EnableSystemColumns = "true"; + + SELECT COUNT(_yql_partition_id) FROM `/Root/KeyValue` WHERE Key = 1; )", TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync(); UNIT_ASSERT(result.IsSuccess()); - CompareYson(R"([[1u;"One"]])", FormatResultSetYson(result.GetResultSet(0))); + CompareYson(R"([[1u]])", FormatResultSetYson(result.GetResultSet(0))); result = session.ExecuteDataQuery(R"( - SELECT * FROM `/Root/KeyValue` WHERE Key = 1; + SELECT COUNT(_yql_partition_id) FROM `/Root/KeyValue` WHERE Key = 1; )", TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync(); - UNIT_ASSERT(result.IsSuccess()); - CompareYson(R"([[[1u];["One"]]])", FormatResultSetYson(result.GetResultSet(0))); + UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), NYdb::EStatus::GENERIC_ERROR); + UNIT_ASSERT(HasIssue(result.GetIssues(), NYql::TIssuesIds::CORE_TYPE_ANN)); } Y_UNIT_TEST(OrderedColumns) { diff --git a/ydb/core/kqp/ut/kqp_yql_ut.cpp b/ydb/core/kqp/ut/kqp_yql_ut.cpp index 9f819ba58c9..8264f24fecf 100644 --- a/ydb/core/kqp/ut/kqp_yql_ut.cpp +++ b/ydb/core/kqp/ut/kqp_yql_ut.cpp @@ -268,22 +268,6 @@ Y_UNIT_TEST_SUITE(KqpYql) { UNIT_ASSERT(HasIssue(result.GetIssues(), NYql::TIssuesIds::KIKIMR_READ_MODIFIED_TABLE)); } - Y_UNIT_TEST(UnwrapReadTableValues) { - auto kikimr = DefaultKikimrRunner(); - TScriptingClient client(kikimr.GetDriver()); - - auto result = client.ExecuteYqlScript(R"( - --!syntax_v1 - PRAGMA kikimr.UnwrapReadTableValues = "true"; - SELECT LENGTH(Name) == 4 AND Amount > 1000 FROM `/Root/Test`; - )").GetValueSync(); - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - - CompareYson(R"([ - [%true];[%false];[%true] - ])", FormatResultSetYson(result.GetResultSet(0))); - } - Y_UNIT_TEST(CreateUseTable) { auto kikimr = DefaultKikimrRunner(); TScriptingClient client(kikimr.GetDriver()); diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto index 17a6a8d0f41..ea7ae5ac215 100644 --- a/ydb/core/protos/config.proto +++ b/ydb/core/protos/config.proto @@ -1183,7 +1183,7 @@ message TTableServiceConfig { optional uint32 CompileRequestQueueSize = 8 [default = 1000]; optional bool UseSchemeCacheMetadata = 9 [default = true]; optional bool UseSessionBusyStatus = 10 [default = true]; - optional bool AllowUnsafeCommit = 11 [default = true]; + reserved 11; // (deprecated) AllowUnsafeCommit optional uint32 CompileTimeoutMs = 12 [default = 60000]; optional TResourceManager ResourceManager = 13; optional TQueryLimits QueryLimits = 14; |