aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.com>2022-11-08 08:21:11 +0300
committerivanmorozov <ivanmorozov@yandex-team.com>2022-11-08 08:21:11 +0300
commit73886eee782d33048e3e1e7878d1ab69882662c5 (patch)
tree644684c2a80cafa02a2b45636d285914d5317326
parent4279a48238a1a4105a3d77a50f245591649245a7 (diff)
downloadydb-73886eee782d33048e3e1e7878d1ab69882662c5.tar.gz
modify permissions
fix win build correct test
-rw-r--r--ydb/core/grpc_services/rpc_modify_permissions.cpp5
-rw-r--r--ydb/core/tx/tiering/CMakeLists.txt1
-rw-r--r--ydb/core/tx/tiering/cleaner_task.cpp4
-rw-r--r--ydb/core/tx/tiering/external_data.cpp9
-rw-r--r--ydb/core/tx/tiering/path_cleaner.cpp2
-rw-r--r--ydb/core/tx/tiering/path_cleaner.h2
-rw-r--r--ydb/core/tx/tiering/tier_cleaner.cpp3
-rw-r--r--ydb/core/tx/tiering/tier_cleaner.h2
-rw-r--r--ydb/core/tx/tiering/ut/CMakeLists.darwin.txt54
-rw-r--r--ydb/core/tx/tiering/ut/CMakeLists.linux-aarch64.txt56
-rw-r--r--ydb/core/tx/tiering/ut/CMakeLists.linux.txt58
-rw-r--r--ydb/core/tx/tiering/ut/CMakeLists.txt15
-rw-r--r--ydb/core/tx/tiering/ut/ut_tiers.cpp3
-rw-r--r--ydb/services/metadata/request/common.h7
-rw-r--r--ydb/services/metadata/request/request_actor.h2
15 files changed, 220 insertions, 3 deletions
diff --git a/ydb/core/grpc_services/rpc_modify_permissions.cpp b/ydb/core/grpc_services/rpc_modify_permissions.cpp
index d9b01887d2c..1ceb9560718 100644
--- a/ydb/core/grpc_services/rpc_modify_permissions.cpp
+++ b/ydb/core/grpc_services/rpc_modify_permissions.cpp
@@ -100,5 +100,10 @@ void DoModifyPermissionsRequest(std::unique_ptr<IRequestOpCtx> p, const IFacilit
TActivationContext::AsActorContext().Register(new TModifyPermissionsRPC(p.release()));
}
+template<>
+IActor* TEvModifyPermissionsRequest::CreateRpcActor(NKikimr::NGRpcService::IRequestOpCtx* msg) {
+ return new TModifyPermissionsRPC(msg);
+}
+
} // namespace NKikimr
} // namespace NGRpcService
diff --git a/ydb/core/tx/tiering/CMakeLists.txt b/ydb/core/tx/tiering/CMakeLists.txt
index 2a598bd407c..f6662658a37 100644
--- a/ydb/core/tx/tiering/CMakeLists.txt
+++ b/ydb/core/tx/tiering/CMakeLists.txt
@@ -6,6 +6,7 @@
# original buildsystem will not be accepted.
+add_subdirectory(ut)
add_library(core-tx-tiering)
target_link_libraries(core-tx-tiering PUBLIC
diff --git a/ydb/core/tx/tiering/cleaner_task.cpp b/ydb/core/tx/tiering/cleaner_task.cpp
index 1872a955349..a1ab4b20424 100644
--- a/ydb/core/tx/tiering/cleaner_task.cpp
+++ b/ydb/core/tx/tiering/cleaner_task.cpp
@@ -19,7 +19,11 @@ bool TTaskCleanerActivity::DoDeserializeFromProto(const NKikimrSchemeOp::TTaskCl
void TTaskCleanerActivity::DoExecute(NBackgroundTasks::ITaskExecutorController::TPtr controller,
const NBackgroundTasks::TTaskStateContainer& /*state*/)
{
+#ifndef KIKIMR_DISABLE_S3_OPS
TActivationContext::AsActorContext().Register(new TPathCleaner(PathId, controller));
+#else
+ controller->TaskFinished();
+#endif
}
}
diff --git a/ydb/core/tx/tiering/external_data.cpp b/ydb/core/tx/tiering/external_data.cpp
index eab129ed7b1..8c508dde913 100644
--- a/ydb/core/tx/tiering/external_data.cpp
+++ b/ydb/core/tx/tiering/external_data.cpp
@@ -147,6 +147,15 @@ TVector<NMetadataProvider::ITableModifier::TPtr> TSnapshotConstructor::DoGetTabl
}
result.emplace_back(new NMetadataProvider::TGenericTableModifier<NInternal::NRequest::TDialogCreateTable>(request));
}
+ for (auto&& t: Tables) {
+ Ydb::Scheme::ModifyPermissionsRequest request;
+ request.set_path(t);
+ request.set_clear_permissions(true);
+ auto* permission = request.add_actions();
+ permission->mutable_grant()->add_permission_names("ydb.tables.modify");
+ permission->mutable_grant()->add_permission_names("ydb.tables.read");
+ result.emplace_back(new NMetadataProvider::TGenericTableModifier<NInternal::NRequest::TDialogModifyPermissions>(request));
+ }
return result;
}
diff --git a/ydb/core/tx/tiering/path_cleaner.cpp b/ydb/core/tx/tiering/path_cleaner.cpp
index 5e6d54ad488..df2a360be83 100644
--- a/ydb/core/tx/tiering/path_cleaner.cpp
+++ b/ydb/core/tx/tiering/path_cleaner.cpp
@@ -1,4 +1,5 @@
#include "path_cleaner.h"
+#ifndef KIKIMR_DISABLE_S3_OPS
#include "external_data.h"
#include <ydb/services/metadata/service.h>
@@ -53,3 +54,4 @@ TPathCleaner::TPathCleaner(const ui64 pathId, NBackgroundTasks::ITaskExecutorCon
}
}
+#endif
diff --git a/ydb/core/tx/tiering/path_cleaner.h b/ydb/core/tx/tiering/path_cleaner.h
index 44963a3e986..d938fcb76bb 100644
--- a/ydb/core/tx/tiering/path_cleaner.h
+++ b/ydb/core/tx/tiering/path_cleaner.h
@@ -1,4 +1,5 @@
#pragma once
+#ifndef KIKIMR_DISABLE_S3_OPS
#include "common.h"
#include "tier_cleaner.h"
@@ -42,3 +43,4 @@ public:
void Bootstrap();
};
}
+#endif
diff --git a/ydb/core/tx/tiering/tier_cleaner.cpp b/ydb/core/tx/tiering/tier_cleaner.cpp
index e7b8f94d850..2d42f7d28fa 100644
--- a/ydb/core/tx/tiering/tier_cleaner.cpp
+++ b/ydb/core/tx/tiering/tier_cleaner.cpp
@@ -1,4 +1,5 @@
#include "tier_cleaner.h"
+#ifndef KIKIMR_DISABLE_S3_OPS
namespace NKikimr::NColumnShard::NTiers {
@@ -42,7 +43,6 @@ void TTierCleaner::Bootstrap() {
auto request = Aws::S3::Model::ListObjectsRequest()
.WithPrefix("S3-" + ::ToString(PathId));
-
Send(SelfId(), new NWrappers::TEvExternalStorage::TEvListObjectsRequest(request));
}
@@ -56,3 +56,4 @@ TTierCleaner::TTierCleaner(const TString& tierName, const TActorId& ownerId,
Y_VERIFY(Storage);
}
}
+#endif
diff --git a/ydb/core/tx/tiering/tier_cleaner.h b/ydb/core/tx/tiering/tier_cleaner.h
index 9c8d421ad08..2743edb7dac 100644
--- a/ydb/core/tx/tiering/tier_cleaner.h
+++ b/ydb/core/tx/tiering/tier_cleaner.h
@@ -1,4 +1,5 @@
#pragma once
+#ifndef KIKIMR_DISABLE_S3_OPS
#include "common.h"
#include <ydb/core/wrappers/abstract.h>
@@ -59,3 +60,4 @@ public:
void Bootstrap();
};
}
+#endif
diff --git a/ydb/core/tx/tiering/ut/CMakeLists.darwin.txt b/ydb/core/tx/tiering/ut/CMakeLists.darwin.txt
new file mode 100644
index 00000000000..d89539e28fc
--- /dev/null
+++ b/ydb/core/tx/tiering/ut/CMakeLists.darwin.txt
@@ -0,0 +1,54 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_executable(ydb-core-tx-tiering-ut)
+target_compile_options(ydb-core-tx-tiering-ut PRIVATE
+ -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_include_directories(ydb-core-tx-tiering-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/tiering
+)
+target_link_libraries(ydb-core-tx-tiering-ut PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ library-cpp-cpuid_check
+ cpp-testing-unittest_main
+ core-tx-tiering
+ library-cpp-getopt
+ cpp-regex-pcre
+ library-cpp-svnversion
+ core-testlib-default
+ ydb-services-metadata
+ ydb-core-tx
+ core-tx-columnshard
+ public-lib-yson_value
+)
+target_link_options(ydb-core-tx-tiering-ut PRIVATE
+ -Wl,-no_deduplicate
+ -Wl,-sdk_version,10.15
+ -fPIC
+ -fPIC
+ -framework
+ CoreFoundation
+)
+target_sources(ydb-core-tx-tiering-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/tiering/ut/ut_tiers.cpp
+)
+add_test(
+ NAME
+ ydb-core-tx-tiering-ut
+ COMMAND
+ ydb-core-tx-tiering-ut
+ --print-before-suite
+ --print-before-test
+ --fork-tests
+ --print-times
+ --show-fails
+)
+vcs_info(ydb-core-tx-tiering-ut)
diff --git a/ydb/core/tx/tiering/ut/CMakeLists.linux-aarch64.txt b/ydb/core/tx/tiering/ut/CMakeLists.linux-aarch64.txt
new file mode 100644
index 00000000000..65ef4d9585e
--- /dev/null
+++ b/ydb/core/tx/tiering/ut/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,56 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_executable(ydb-core-tx-tiering-ut)
+target_compile_options(ydb-core-tx-tiering-ut PRIVATE
+ -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_include_directories(ydb-core-tx-tiering-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/tiering
+)
+target_link_libraries(ydb-core-tx-tiering-ut PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ library-cpp-lfalloc
+ cpp-testing-unittest_main
+ core-tx-tiering
+ library-cpp-getopt
+ cpp-regex-pcre
+ library-cpp-svnversion
+ core-testlib-default
+ ydb-services-metadata
+ ydb-core-tx
+ core-tx-columnshard
+ public-lib-yson_value
+)
+target_link_options(ydb-core-tx-tiering-ut PRIVATE
+ -ldl
+ -lrt
+ -Wl,--no-as-needed
+ -fPIC
+ -fPIC
+ -lpthread
+ -lrt
+ -ldl
+)
+target_sources(ydb-core-tx-tiering-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/tiering/ut/ut_tiers.cpp
+)
+add_test(
+ NAME
+ ydb-core-tx-tiering-ut
+ COMMAND
+ ydb-core-tx-tiering-ut
+ --print-before-suite
+ --print-before-test
+ --fork-tests
+ --print-times
+ --show-fails
+)
+vcs_info(ydb-core-tx-tiering-ut)
diff --git a/ydb/core/tx/tiering/ut/CMakeLists.linux.txt b/ydb/core/tx/tiering/ut/CMakeLists.linux.txt
new file mode 100644
index 00000000000..35e3c60c10c
--- /dev/null
+++ b/ydb/core/tx/tiering/ut/CMakeLists.linux.txt
@@ -0,0 +1,58 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_executable(ydb-core-tx-tiering-ut)
+target_compile_options(ydb-core-tx-tiering-ut PRIVATE
+ -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_include_directories(ydb-core-tx-tiering-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/tiering
+)
+target_link_libraries(ydb-core-tx-tiering-ut PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ cpp-malloc-tcmalloc
+ libs-tcmalloc-no_percpu_cache
+ library-cpp-cpuid_check
+ cpp-testing-unittest_main
+ core-tx-tiering
+ library-cpp-getopt
+ cpp-regex-pcre
+ library-cpp-svnversion
+ core-testlib-default
+ ydb-services-metadata
+ ydb-core-tx
+ core-tx-columnshard
+ public-lib-yson_value
+)
+target_link_options(ydb-core-tx-tiering-ut PRIVATE
+ -ldl
+ -lrt
+ -Wl,--no-as-needed
+ -fPIC
+ -fPIC
+ -lpthread
+ -lrt
+ -ldl
+)
+target_sources(ydb-core-tx-tiering-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/tiering/ut/ut_tiers.cpp
+)
+add_test(
+ NAME
+ ydb-core-tx-tiering-ut
+ COMMAND
+ ydb-core-tx-tiering-ut
+ --print-before-suite
+ --print-before-test
+ --fork-tests
+ --print-times
+ --show-fails
+)
+vcs_info(ydb-core-tx-tiering-ut)
diff --git a/ydb/core/tx/tiering/ut/CMakeLists.txt b/ydb/core/tx/tiering/ut/CMakeLists.txt
new file mode 100644
index 00000000000..3e0811fb22e
--- /dev/null
+++ b/ydb/core/tx/tiering/ut/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (APPLE)
+ include(CMakeLists.darwin.txt)
+elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID)
+ include(CMakeLists.linux.txt)
+endif()
diff --git a/ydb/core/tx/tiering/ut/ut_tiers.cpp b/ydb/core/tx/tiering/ut/ut_tiers.cpp
index 3b1caea1d88..d8183fa43a6 100644
--- a/ydb/core/tx/tiering/ut/ut_tiers.cpp
+++ b/ydb/core/tx/tiering/ut/ut_tiers.cpp
@@ -136,8 +136,7 @@ Y_UNIT_TEST_SUITE(ColumnShardTiers) {
runtime.SetObserverFunc(pred);
for (const TInstant start = Now(); !IsFound() && Now() - start < TDuration::Seconds(10); ) {
- runtime.DispatchEvents(TDispatchOptions(), TDuration::Seconds(1));
- runtime.UpdateCurrentTime(Now());
+ runtime.SimulateSleep(TDuration::Seconds(1));
}
runtime.SetObserverFunc(TTestActorRuntime::DefaultObserverFunc);
Y_VERIFY(IsFound());
diff --git a/ydb/services/metadata/request/common.h b/ydb/services/metadata/request/common.h
index 9fb0a8b5f2b..a249ce84c41 100644
--- a/ydb/services/metadata/request/common.h
+++ b/ydb/services/metadata/request/common.h
@@ -18,12 +18,19 @@ enum EEvents {
EvSelectRequest,
EvSelectInternalResponse,
EvSelectResponse,
+
EvYQLRequest,
EvYQLInternalResponse,
EvGeneralYQLResponse,
+
EvCreateSessionRequest,
EvCreateSessionInternalResponse,
EvCreateSessionResponse,
+
+ EvModifyPermissionsRequest,
+ EvModifyPermissionsInternalResponse,
+ EvModifyPermissionsResponse,
+
EvRequestFinished,
EvRequestFailed,
EvRequestStart,
diff --git a/ydb/services/metadata/request/request_actor.h b/ydb/services/metadata/request/request_actor.h
index a6cc0a51641..2da9ea8aa93 100644
--- a/ydb/services/metadata/request/request_actor.h
+++ b/ydb/services/metadata/request/request_actor.h
@@ -22,6 +22,8 @@ public:
using TDialogCreateTable = TDialogPolicyImpl<Ydb::Table::CreateTableRequest, Ydb::Table::CreateTableResponse,
EEvents::EvCreateTableRequest, EEvents::EvCreateTableInternalResponse, EEvents::EvCreateTableResponse>;
+using TDialogModifyPermissions = TDialogPolicyImpl<Ydb::Scheme::ModifyPermissionsRequest, Ydb::Scheme::ModifyPermissionsResponse,
+ EEvents::EvModifyPermissionsRequest, EEvents::EvModifyPermissionsInternalResponse, EEvents::EvModifyPermissionsResponse>;
using TDialogSelect = TDialogPolicyImpl<Ydb::Table::ExecuteDataQueryRequest, Ydb::Table::ExecuteDataQueryResponse,
EEvents::EvSelectRequest, EEvents::EvSelectInternalResponse, EEvents::EvSelectResponse>;
using TDialogCreateSession = TDialogPolicyImpl<Ydb::Table::CreateSessionRequest, Ydb::Table::CreateSessionResponse,