summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp60
-rw-r--r--ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.cpp2
-rw-r--r--ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.h1
-rw-r--r--ydb/core/protos/feature_flags.proto1
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_external_data_source.cpp7
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_external_table.cpp7
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp7
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp7
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.cpp1
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.h1
10 files changed, 94 insertions, 0 deletions
diff --git a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
index 3651546b391..61290064396 100644
--- a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
+++ b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
@@ -5175,6 +5175,66 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
session.Close().GetValueSync();
}
+ Y_UNIT_TEST(DisableExternalDataSourcesOnServerless) {
+ auto ydb = NWorkload::TYdbSetupSettings()
+ .CreateSampleTenants(true)
+ .EnableExternalDataSourcesOnServerless(false)
+ .Create();
+
+ auto checkDisabled = [](const auto& result, NYdb::EStatus status) {
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), status, result.GetIssues().ToString());
+ UNIT_ASSERT_STRING_CONTAINS(result.GetIssues().ToString(), "External data sources are disabled for serverless domains. Please contact your system administrator to enable it");
+ };
+
+ auto checkNotFound = [](const auto& result, NYdb::EStatus status) {
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), status, result.GetIssues().ToString());
+ UNIT_ASSERT_STRING_CONTAINS(result.GetIssues().ToString(), "Path does not exist");
+ };
+
+ const auto& createSourceSql = R"(
+ CREATE EXTERNAL DATA SOURCE MyExternalDataSource WITH (
+ SOURCE_TYPE="ObjectStorage",
+ LOCATION="my-bucket",
+ AUTH_METHOD="NONE"
+ );)";
+
+ const auto& createTableSql = R"(
+ CREATE EXTERNAL TABLE MyExternalTable (
+ Key Uint64,
+ Value String
+ ) WITH (
+ DATA_SOURCE="MyExternalDataSource",
+ LOCATION="/"
+ );)";
+
+ const auto& dropSourceSql = "DROP EXTERNAL DATA SOURCE MyExternalDataSource;";
+
+ const auto& dropTableSql = "DROP EXTERNAL TABLE MyExternalTable;";
+
+ auto settings = NWorkload::TQueryRunnerSettings().PoolId("");
+
+ // Dedicated, enabled
+ settings.Database(ydb->GetSettings().GetDedicatedTenantName()).NodeIndex(1);
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(createSourceSql, settings));
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(createTableSql, settings));
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(dropTableSql, settings));
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(dropSourceSql, settings));
+
+ // Shared, enabled
+ settings.Database(ydb->GetSettings().GetSharedTenantName()).NodeIndex(2);
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(createSourceSql, settings));
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(createTableSql, settings));
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(dropTableSql, settings));
+ NWorkload::TSampleQueries::CheckSuccess(ydb->ExecuteQuery(dropSourceSql, settings));
+
+ // Serverless, disabled
+ settings.Database(ydb->GetSettings().GetServerlessTenantName()).NodeIndex(2);
+ checkDisabled(ydb->ExecuteQuery(createSourceSql, settings), NYdb::EStatus::GENERIC_ERROR);
+ checkDisabled(ydb->ExecuteQuery(createTableSql, settings), NYdb::EStatus::PRECONDITION_FAILED);
+ checkNotFound(ydb->ExecuteQuery(dropTableSql, settings), NYdb::EStatus::SCHEME_ERROR);
+ checkNotFound(ydb->ExecuteQuery(dropSourceSql, settings), NYdb::EStatus::GENERIC_ERROR);
+ }
+
Y_UNIT_TEST(CreateExternalDataSource) {
NKikimrConfig::TAppConfig appCfg;
appCfg.MutableQueryServiceConfig()->AddHostnamePatterns("my-bucket");
diff --git a/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.cpp b/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.cpp
index 7e06c54a9b0..43dbad70c66 100644
--- a/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.cpp
+++ b/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.cpp
@@ -232,6 +232,8 @@ private:
appConfig.MutableFeatureFlags()->SetEnableResourcePools(Settings_.EnableResourcePools_);
appConfig.MutableFeatureFlags()->SetEnableResourcePoolsOnServerless(Settings_.EnableResourcePoolsOnServerless_);
appConfig.MutableFeatureFlags()->SetEnableMetadataObjectsOnServerless(Settings_.EnableMetadataObjectsOnServerless_);
+ appConfig.MutableFeatureFlags()->SetEnableExternalDataSourcesOnServerless(Settings_.EnableExternalDataSourcesOnServerless_);
+ appConfig.MutableFeatureFlags()->SetEnableExternalDataSources(true);
appConfig.MutableFeatureFlags()->SetEnableResourcePoolsCounters(true);
return appConfig;
diff --git a/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.h b/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.h
index c38e61e45b7..bb0cd7d1793 100644
--- a/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.h
+++ b/ydb/core/kqp/workload_service/ut/common/kqp_workload_service_ut_common.h
@@ -72,6 +72,7 @@ struct TYdbSetupSettings {
FLUENT_SETTING_DEFAULT(bool, EnableResourcePools, true);
FLUENT_SETTING_DEFAULT(bool, EnableResourcePoolsOnServerless, false);
FLUENT_SETTING_DEFAULT(bool, EnableMetadataObjectsOnServerless, true);
+ FLUENT_SETTING_DEFAULT(bool, EnableExternalDataSourcesOnServerless, true);
// Default pool settings
FLUENT_SETTING_DEFAULT(TString, PoolId, "sample_pool_id");
diff --git a/ydb/core/protos/feature_flags.proto b/ydb/core/protos/feature_flags.proto
index 29816cb5186..9570be7581a 100644
--- a/ydb/core/protos/feature_flags.proto
+++ b/ydb/core/protos/feature_flags.proto
@@ -159,4 +159,5 @@ message TFeatureFlags {
optional bool EnableTieringInColumnShard = 140 [default = false];
optional bool EnableMetadataObjectsOnServerless = 141 [default = true];
optional bool EnableOlapCompression = 142 [default = false];
+ optional bool EnableExternalDataSourcesOnServerless = 143 [default = true];
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_data_source.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_data_source.cpp
index c67f26b3cea..1009c5dff47 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_data_source.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_data_source.cpp
@@ -213,6 +213,13 @@ public:
static_cast<ui64>(OperationId.GetTxId()),
static_cast<ui64>(ssId));
+ if (context.SS->IsServerlessDomain(TPath::Init(context.SS->RootPathId(), context.SS))) {
+ if (!context.SS->EnableExternalDataSourcesOnServerless) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "External data sources are disabled for serverless domains. Please contact your system administrator to enable it");
+ return result;
+ }
+ }
+
const TPath parentPath = TPath::Resolve(parentPathStr, context.SS);
RETURN_RESULT_UNLESS(NExternalDataSource::IsParentPathValid(
result, parentPath, Transaction, /* isCreate */ false));
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_table.cpp
index ad563b01c90..54f63ca0db5 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_external_table.cpp
@@ -308,6 +308,13 @@ public:
static_cast<ui64>(OperationId.GetTxId()),
static_cast<ui64>(ssId));
+ if (context.SS->IsServerlessDomain(TPath::Init(context.SS->RootPathId(), context.SS))) {
+ if (!context.SS->EnableExternalDataSourcesOnServerless) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "External data sources are disabled for serverless domains. Please contact your system administrator to enable it");
+ return result;
+ }
+ }
+
const auto parentPath = TPath::Resolve(parentPathStr, context.SS);
RETURN_RESULT_UNLESS(NExternalTable::IsParentPathValid(result, parentPath));
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp
index 6ecbfd3c4b8..2c52d5d486d 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp
@@ -239,6 +239,13 @@ public:
static_cast<ui64>(OperationId.GetTxId()),
static_cast<ui64>(ssId));
+ if (context.SS->IsServerlessDomain(TPath::Init(context.SS->RootPathId(), context.SS))) {
+ if (!context.SS->EnableExternalDataSourcesOnServerless) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "External data sources are disabled for serverless domains. Please contact your system administrator to enable it");
+ return result;
+ }
+ }
+
const TPath parentPath = TPath::Resolve(parentPathStr, context.SS);
RETURN_RESULT_UNLESS(NExternalDataSource::IsParentPathValid(
result, parentPath, Transaction, /* isCreate */ true));
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp
index 1268f15956d..c4e0a5e11a4 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp
@@ -308,6 +308,13 @@ public:
static_cast<ui64>(OperationId.GetTxId()),
static_cast<ui64>(ssId));
+ if (context.SS->IsServerlessDomain(TPath::Init(context.SS->RootPathId(), context.SS))) {
+ if (!context.SS->EnableExternalDataSourcesOnServerless) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "External data sources are disabled for serverless domains. Please contact your system administrator to enable it");
+ return result;
+ }
+ }
+
const auto parentPath = TPath::Resolve(parentPathStr, context.SS);
RETURN_RESULT_UNLESS(NExternalTable::IsParentPathValid(result, parentPath));
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
index e225b866673..7720b0e4007 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
@@ -7038,6 +7038,7 @@ void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TFeatureFlags& featu
EnableTableDatetime64 = featureFlags.GetEnableTableDatetime64();
EnableResourcePoolsOnServerless = featureFlags.GetEnableResourcePoolsOnServerless();
EnableVectorIndex = featureFlags.GetEnableVectorIndex();
+ EnableExternalDataSourcesOnServerless = featureFlags.GetEnableExternalDataSourcesOnServerless();
}
void TSchemeShard::ConfigureStatsBatching(const NKikimrConfig::TSchemeShardConfig& config, const TActorContext& ctx) {
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h
index ea114e605f4..594bd5b99f7 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.h
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.h
@@ -331,6 +331,7 @@ public:
bool EnableTableDatetime64 = false;
bool EnableResourcePoolsOnServerless = false;
bool EnableVectorIndex = false;
+ bool EnableExternalDataSourcesOnServerless = false;
TShardDeleter ShardDeleter;