aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorijon <ijon@yandex-team.com>2022-12-29 18:19:45 +0300
committerijon <ijon@yandex-team.com>2022-12-29 18:19:45 +0300
commit52fd853619c9f751019975f7ce6a4fe2ce906fae (patch)
tree862fb16bf96e8123d00ca20d39d9b26287dc163f
parentf81b72552a40c350730a105225b27125d0dc5118 (diff)
downloadydb-52fd853619c9f751019975f7ce6a4fe2ce906fae.tar.gz
schemeshard: make audit log more concise
schemeshard: make audit log more concise Log audit entry(-es) at the level of the entire operation. Consider individual operation parts (suboperations) as implementation details which should not clutter audit log. (Particularly uninteresting are mkdir suboperations added to some operations internally to create all intermediate-level directories needed to contain target leaf object). Stop logging too much details about an operation.
-rw-r--r--contrib/restricted/boost/test/include/boost/test/impl/cpp_main.ipp136
-rw-r--r--contrib/restricted/boost/test/include/boost/test/impl/test_main.ipp65
-rw-r--r--contrib/restricted/boost/test/include/boost/test/tree/test_case_template.hpp211
-rw-r--r--contrib/restricted/boost/test/include/boost/test/unit_test_suite.hpp409
-rw-r--r--contrib/restricted/boost/test/src/cpp_main.cpp19
-rw-r--r--contrib/restricted/boost/test/src/test_main.cpp15
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation.cpp115
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_part.h30
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.cpp295
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.h28
10 files changed, 170 insertions, 1153 deletions
diff --git a/contrib/restricted/boost/test/include/boost/test/impl/cpp_main.ipp b/contrib/restricted/boost/test/include/boost/test/impl/cpp_main.ipp
deleted file mode 100644
index aaa5cabfc5..0000000000
--- a/contrib/restricted/boost/test/include/boost/test/impl/cpp_main.ipp
+++ /dev/null
@@ -1,136 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2001.
-// (C) Copyright Beman Dawes 1995-2001.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : main function implementation for Program Executon Monitor
-// ***************************************************************************
-
-#ifndef BOOST_TEST_CPP_MAIN_IPP_012205GER
-#define BOOST_TEST_CPP_MAIN_IPP_012205GER
-
-// Boost.Test
-#include <boost/test/execution_monitor.hpp>
-#include <boost/test/detail/config.hpp>
-#include <boost/test/utils/basic_cstring/io.hpp>
-
-// Boost
-#include <boost/cstdlib.hpp> // for exit codes
-#include <boost/config.hpp> // for workarounds
-
-// STL
-#include <iostream>
-#include <cstdlib> // std::getenv
-#include <cstring> // std::strerror
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-#ifdef BOOST_NO_STDC_NAMESPACE
-namespace std { using ::getenv; using ::strerror; }
-#endif
-
-namespace {
-
-struct cpp_main_caller {
- cpp_main_caller( int (*cpp_main_func)( int argc, char* argv[] ), int argc, char** argv )
- : m_cpp_main_func( cpp_main_func )
- , m_argc( argc )
- , m_argv( argv ) {}
-
- int operator()() { return (*m_cpp_main_func)( m_argc, m_argv ); }
-
-private:
- // Data members
- int (*m_cpp_main_func)( int argc, char* argv[] );
- int m_argc;
- char** m_argv;
-};
-
-} // local namespace
-
-// ************************************************************************** //
-// ************** prg_exec_monitor_main ************** //
-// ************************************************************************** //
-
-namespace boost {
-
-int BOOST_TEST_DECL
-prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] )
-{
- int result = 0;
-
- BOOST_TEST_I_TRY {
- boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) );
- ::boost::execution_monitor ex_mon;
-
- ex_mon.p_catch_system_errors.value = p != "no";
-
- result = ex_mon.execute( cpp_main_caller( cpp_main, argc, argv ) );
-
- if( result == 0 )
- result = ::boost::exit_success;
- else if( result != ::boost::exit_success ) {
- std::cout << "\n**** error return code: " << result << std::endl;
- result = ::boost::exit_failure;
- }
- }
- BOOST_TEST_I_CATCH( ::boost::execution_exception, exex ) {
- std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl;
- result = ::boost::exit_exception_failure;
- }
- BOOST_TEST_I_CATCH( ::boost::system_error, ex ) {
- std::cout << "\n**** failed to initialize execution monitor."
- << "\n**** expression at fault: " << ex.p_failed_exp
- << "\n**** error(" << ex.p_errno << "): " << std::strerror( ex.p_errno ) << std::endl;
- result = ::boost::exit_exception_failure;
- }
-
- if( result != ::boost::exit_success ) {
- std::cerr << "******** errors detected; see standard output for details ********" << std::endl;
- }
- else {
- // Some prefer a confirming message when all is well, while others don't
- // like the clutter. Use an environment variable to avoid command
- // line argument modifications; for use in production programs
- // that's a no-no in some organizations.
- ::boost::unit_test::const_string p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) );
- if( p != "no" ) {
- std::cerr << std::flush << "no errors detected" << std::endl;
- }
- }
-
- return result;
-}
-
-} // namespace boost
-
-#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN)
-
-// ************************************************************************** //
-// ************** main function for tests using lib ************** //
-// ************************************************************************** //
-
-int cpp_main( int argc, char* argv[] ); // prototype for user's cpp_main()
-
-int BOOST_TEST_CALL_DECL
-main( int argc, char* argv[] )
-{
- return ::boost::prg_exec_monitor_main( &cpp_main, argc, argv );
-}
-
-//____________________________________________________________________________//
-
-#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_CPP_MAIN_IPP_012205GER
diff --git a/contrib/restricted/boost/test/include/boost/test/impl/test_main.ipp b/contrib/restricted/boost/test/include/boost/test/impl/test_main.ipp
deleted file mode 100644
index 6adc5bb9c2..0000000000
--- a/contrib/restricted/boost/test/include/boost/test/impl/test_main.ipp
+++ /dev/null
@@ -1,65 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2001.
-// (C) Copyright Beman Dawes 1995-2001.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-/// @file
-/// @brief Implements main function for Test Execution Monitor.
-// ***************************************************************************
-
-#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER
-#define BOOST_TEST_TEST_MAIN_IPP_012205GER
-
-// Boost.Test
-#include <boost/test/framework.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test_suite.hpp>
-
-// Boost
-#include <boost/cstdlib.hpp>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-extern int test_main( int argc, char* argv[] ); // prototype for user's test_main()
-
-struct test_main_caller {
- test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {}
-
- void operator()() {
- int test_main_result = test_main( m_argc, m_argv );
-
- // translate a test_main non-success return into a test error
- BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success );
- }
-
-private:
- // Data members
- int m_argc;
- char** m_argv;
-};
-
-// ************************************************************************** //
-// ************** test main ************** //
-// ************************************************************************** //
-
-::boost::unit_test::test_suite*
-init_unit_test_suite( int argc, char* argv[] ) {
- using namespace ::boost::unit_test;
-
- framework::master_test_suite().p_name.value = "Test Program";
-
- framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) );
-
- return 0;
-}
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_TEST_MAIN_IPP_012205GER
diff --git a/contrib/restricted/boost/test/include/boost/test/tree/test_case_template.hpp b/contrib/restricted/boost/test/include/boost/test/tree/test_case_template.hpp
deleted file mode 100644
index e0395c4ce1..0000000000
--- a/contrib/restricted/boost/test/include/boost/test/tree/test_case_template.hpp
+++ /dev/null
@@ -1,211 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2001.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-///@ file
-/// Defines template_test_case_gen
-// ***************************************************************************
-
-#ifndef BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER
-#define BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/detail/global_typedef.hpp>
-#include <boost/test/detail/fwd_decl.hpp>
-#include <boost/test/tree/test_unit.hpp>
-
-#include <boost/test/utils/class_properties.hpp>
-#include <boost/test/tree/observer.hpp>
-#include <boost/test/utils/algorithm.hpp>
-
-
-// Boost
-#include <boost/shared_ptr.hpp>
-#include <boost/mpl/for_each.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/type.hpp>
-#include <boost/type_traits/is_const.hpp>
-#include <boost/type_traits/is_volatile.hpp>
-#include <boost/type_traits/is_lvalue_reference.hpp>
-#include <boost/type_traits/is_rvalue_reference.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/function/function0.hpp>
-
-#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI)
-# include <boost/current_function.hpp>
-#else
-# include <boost/core/demangle.hpp>
-#endif
-
-// STL
-#include <string> // for std::string
-#include <list> // for std::list
-
-#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
- !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
- #include <type_traits>
- #include <boost/mpl/is_sequence.hpp>
-#endif
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-
-//____________________________________________________________________________//
-
-namespace boost {
-namespace unit_test {
-namespace ut_detail {
-
-// ************************************************************************** //
-// ************** test_case_template_invoker ************** //
-// ************************************************************************** //
-
-template<typename TestCaseTemplate,typename TestType>
-class test_case_template_invoker {
-public:
- void operator()() { TestCaseTemplate::run( (boost::type<TestType>*)0 ); }
-};
-
-// ************************************************************************** //
-// ************** generate_test_case_4_type ************** //
-// ************************************************************************** //
-
-template<typename Generator, typename TestCaseTemplate>
-struct generate_test_case_4_type {
- explicit generate_test_case_4_type( const_string tc_name, const_string tc_file, std::size_t tc_line, Generator& G )
- : m_test_case_name( tc_name )
- , m_test_case_file( tc_file )
- , m_test_case_line( tc_line )
- , m_holder( G )
- {}
-
- template<typename TestType>
- void operator()( mpl::identity<TestType> )
- {
- std::string full_name;
- assign_op( full_name, m_test_case_name, 0 );
- full_name += '<';
-#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI)
- full_name += boost::core::demangle(typeid(TestType).name()); // same as execution_monitor.ipp
-#else
- full_name += BOOST_CURRENT_FUNCTION;
-#endif
-
- // replacing ',' by ', ' first, and then removing any double space
- static const std::string to_replace[] = { "class ", "struct ", ",", " ", " <", " >"};
- static const std::string replacement[] = { "", "" , ", ", " ", "<" , ">"};
-
- full_name = unit_test::utils::replace_all_occurrences_of(
- full_name,
- to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]),
- replacement, replacement + sizeof(replacement)/sizeof(replacement[0]));
-
- typedef typename boost::remove_reference<TestType>::type TestTypewoRef;
- if( boost::is_const<TestTypewoRef>::value )
- full_name += "_const";
- if( boost::is_volatile<TestTypewoRef>::value )
- full_name += "_volatile";
- if( boost::is_rvalue_reference<TestType>::value )
- full_name += "_refref";
- else if( boost::is_lvalue_reference<TestType>::value )
- full_name += "_ref";
-
- full_name += '>';
-
- m_holder.m_test_cases.push_back( new test_case( ut_detail::normalize_test_case_name( full_name ),
- m_test_case_file,
- m_test_case_line,
- test_case_template_invoker<TestCaseTemplate,TestType>() ) );
- }
-
-private:
- // Data members
- const_string m_test_case_name;
- const_string m_test_case_file;
- std::size_t m_test_case_line;
- Generator& m_holder;
-};
-
-// ************************************************************************** //
-// ************** test_case_template ************** //
-// ************************************************************************** //
-
-class template_test_case_gen_base : public test_unit_generator {
-public:
- test_unit* next() const BOOST_OVERRIDE
- {
- if( m_test_cases.empty() )
- return 0;
-
- test_unit* res = m_test_cases.front();
- m_test_cases.pop_front();
-
- return res;
- }
-
- // Data members
- mutable std::list<test_unit*> m_test_cases;
-};
-
-template<typename TestCaseTemplate,typename TestTypesList, typename enabler = void>
-class template_test_case_gen : public template_test_case_gen_base {
-public:
- // Constructor
- template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line )
- {
- typedef generate_test_case_4_type<template_test_case_gen<TestCaseTemplate,TestTypesList>,TestCaseTemplate> single_test_gen;
-
- mpl::for_each<TestTypesList,mpl::make_identity<mpl::_> >( single_test_gen( tc_name, tc_file, tc_line, *this ) );
- }
-};
-
-// Describing template test cases with tuples
-#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
- !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && \
- !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
-
-template<typename TestCaseTemplate,
- template <class ...> class C,
- typename... parameter_pack>
-class template_test_case_gen<
- TestCaseTemplate,
- C<parameter_pack...>,
- typename std::enable_if<!boost::mpl::is_sequence<C<parameter_pack...>>::value>::type >
- : public template_test_case_gen_base {
-
- template<typename F>
- void for_each(F &f)
- {
- auto l = { (f(mpl::identity<parameter_pack>()), 0)... };
- (void)l; // silence warning
- }
-
-public:
- // Constructor
- template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line )
- {
- using this_type = template_test_case_gen<
- TestCaseTemplate,
- C<parameter_pack...>,
- typename std::enable_if<!boost::mpl::is_sequence<C<parameter_pack...>>::value>::type>;
- using single_test_gen = generate_test_case_4_type<this_type, TestCaseTemplate>;
-
- single_test_gen op( tc_name, tc_file, tc_line, *this );
-
- this->for_each(op);
- }
-};
-
-#endif /* C++11 variadic, type alias */
-
-} // namespace ut_detail
-} // unit_test
-} // namespace boost
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER
diff --git a/contrib/restricted/boost/test/include/boost/test/unit_test_suite.hpp b/contrib/restricted/boost/test/include/boost/test/unit_test_suite.hpp
deleted file mode 100644
index f74a4c47a5..0000000000
--- a/contrib/restricted/boost/test/include/boost/test/unit_test_suite.hpp
+++ /dev/null
@@ -1,409 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2001.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-/// @file
-/// @brief Defines Unit Test Framework public API
-// ***************************************************************************
-
-#ifndef BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
-#define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/framework.hpp>
-#include <boost/test/tree/auto_registration.hpp>
-#include <boost/test/tree/test_case_template.hpp>
-#include <boost/test/tree/global_fixture.hpp>
-
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-
-#include <boost/test/detail/pp_variadic.hpp>
-
-
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** Non-auto (explicit) test case interface ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_CASE_NAME( test_function, test_name ) \
-boost::unit_test::make_test_case( boost::function<void ()>(test_function), \
- test_name , \
- __FILE__, __LINE__ )
-#define BOOST_TEST_CASE( test_function ) \
-BOOST_TEST_CASE_NAME(test_function, BOOST_TEST_STRINGIZE( test_function) )
-#define BOOST_CLASS_TEST_CASE( test_function, tc_instance ) \
-boost::unit_test::make_test_case( (test_function), \
- BOOST_TEST_STRINGIZE( test_function ), \
- __FILE__, __LINE__, tc_instance )
-
-// ************************************************************************** //
-// ************** BOOST_TEST_SUITE ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_SUITE( testsuite_name ) \
-( new boost::unit_test::test_suite( testsuite_name, __FILE__, __LINE__ ) )
-
-// ************************************************************************** //
-// ************** BOOST_AUTO_TEST_SUITE ************** //
-// ************************************************************************** //
-
-#define BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \
-namespace suite_name { \
-BOOST_AUTO_TU_REGISTRAR( suite_name )( \
- BOOST_STRINGIZE( suite_name ), \
- __FILE__, __LINE__, \
- decorators ); \
-/**/
-
-#define BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \
- BOOST_AUTO_TEST_SUITE_WITH_DECOR( \
- suite_name, \
- boost::unit_test::decorator::collector_t::instance() ) \
-/**/
-
-#if BOOST_PP_VARIADICS
-#define BOOST_AUTO_TEST_SUITE( ... ) \
- BOOST_TEST_INVOKE_IF_N_ARGS( 1, \
- BOOST_AUTO_TEST_SUITE_NO_DECOR, \
- BOOST_AUTO_TEST_SUITE_WITH_DECOR, \
- __VA_ARGS__) \
-/**/
-
-#else /* BOOST_PP_VARIADICS */
-
-#define BOOST_AUTO_TEST_SUITE( suite_name ) \
- BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \
-/**/
-
-
-#endif /* BOOST_PP_VARIADICS */
-
-// ************************************************************************** //
-// ************** BOOST_FIXTURE_TEST_SUITE ************** //
-// ************************************************************************** //
-
-#define BOOST_FIXTURE_TEST_SUITE_WITH_DECOR(suite_name, F, decorators) \
- BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \
-typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \
-/**/
-
-#define BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \
- BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \
-typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \
-/**/
-
-#if BOOST_PP_VARIADICS
-
-#define BOOST_FIXTURE_TEST_SUITE( ... ) \
- BOOST_TEST_INVOKE_IF_N_ARGS( 2, \
- BOOST_FIXTURE_TEST_SUITE_NO_DECOR, \
- BOOST_FIXTURE_TEST_SUITE_WITH_DECOR, \
- __VA_ARGS__) \
-/**/
-
-#else /* BOOST_PP_VARIADICS */
-
-#define BOOST_FIXTURE_TEST_SUITE( suite_name, F ) \
- BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \
-/**/
-
-
-#endif /* BOOST_PP_VARIADICS */
-
-
-// ************************************************************************** //
-// ************** BOOST_AUTO_TEST_SUITE_END ************** //
-// ************************************************************************** //
-
-#define BOOST_AUTO_TEST_SUITE_END() \
-BOOST_AUTO_TU_REGISTRAR( end_suite )( 1 ); \
-} \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES ************** //
-// ************************************************************************** //
-
-/// @deprecated use decorator instead
-#define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \
-BOOST_TEST_DECORATOR( * boost::unit_test::expected_failures( n ) ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_FIXTURE_TEST_CASE ************** //
-// ************************************************************************** //
-
-#define BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, decorators ) \
-struct test_name : public F { void test_method(); }; \
- \
-static void BOOST_AUTO_TC_INVOKER( test_name )() \
-{ \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture ctor"); \
- test_name t; \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture setup"); \
- boost::unit_test::setup_conditional(t); \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" test entry"); \
- t.test_method(); \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture teardown"); \
- boost::unit_test::teardown_conditional(t); \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture dtor"); \
-} \
- \
-struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
- \
-BOOST_AUTO_TU_REGISTRAR( test_name )( \
- boost::unit_test::make_test_case( \
- &BOOST_AUTO_TC_INVOKER( test_name ), \
- #test_name, __FILE__, __LINE__ ), \
- decorators ); \
- \
-void test_name::test_method() \
-/**/
-
-#define BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, F ) \
-BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, \
- boost::unit_test::decorator::collector_t::instance() ) \
-/**/
-
-#if BOOST_PP_VARIADICS
-
-#define BOOST_FIXTURE_TEST_CASE( ... ) \
- BOOST_TEST_INVOKE_IF_N_ARGS( 2, \
- BOOST_FIXTURE_TEST_CASE_NO_DECOR, \
- BOOST_FIXTURE_TEST_CASE_WITH_DECOR, \
- __VA_ARGS__) \
-/**/
-
-#else /* BOOST_PP_VARIADICS */
-
-#define BOOST_FIXTURE_TEST_CASE( test_name, F ) \
- BOOST_FIXTURE_TEST_CASE_NO_DECOR(test_name, F) \
-/**/
-
-
-#endif /* BOOST_PP_VARIADICS */
-
-// ************************************************************************** //
-// ************** BOOST_AUTO_TEST_CASE ************** //
-// ************************************************************************** //
-
-#define BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \
- BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, \
- BOOST_AUTO_TEST_CASE_FIXTURE ) \
-/**/
-
-#define BOOST_AUTO_TEST_CASE_WITH_DECOR( test_name, decorators ) \
- BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, \
- BOOST_AUTO_TEST_CASE_FIXTURE, decorators ) \
-/**/
-
-#if BOOST_PP_VARIADICS
-
-#define BOOST_AUTO_TEST_CASE( ... ) \
- BOOST_TEST_INVOKE_IF_N_ARGS( 1, \
- BOOST_AUTO_TEST_CASE_NO_DECOR, \
- BOOST_AUTO_TEST_CASE_WITH_DECOR, \
- __VA_ARGS__) \
-/**/
-
-#else /* BOOST_PP_VARIADICS */
-
-#define BOOST_AUTO_TEST_CASE( test_name ) \
- BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \
-/**/
-
-
-#endif /* BOOST_PP_VARIADICS */
-
-// ************************************************************************** //
-// ************** BOOST_FIXTURE_TEST_CASE_TEMPLATE ************** //
-// ************************************************************************** //
-
-#define BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, F ) \
-template<typename type_name> \
-struct test_name : public F \
-{ void test_method(); }; \
- \
-struct BOOST_AUTO_TC_INVOKER( test_name ) { \
- template<typename TestType> \
- static void run( boost::type<TestType>* = 0 ) \
- { \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture ctor"); \
- test_name<TestType> t; \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture setup"); \
- boost::unit_test::setup_conditional(t); \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" test entry"); \
- t.test_method(); \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture teardown");\
- boost::unit_test::teardown_conditional(t); \
- BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture dtor"); \
- } \
-}; \
- \
-BOOST_AUTO_TU_REGISTRAR( test_name )( \
- boost::unit_test::ut_detail::template_test_case_gen< \
- BOOST_AUTO_TC_INVOKER( test_name ),TL >( \
- BOOST_STRINGIZE( test_name ), __FILE__, __LINE__ ), \
- boost::unit_test::decorator::collector_t::instance() ); \
- \
-template<typename type_name> \
-void test_name<type_name>::test_method() \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_AUTO_TEST_CASE_TEMPLATE ************** //
-// ************************************************************************** //
-
-#define BOOST_AUTO_TEST_CASE_TEMPLATE( test_name, type_name, TL ) \
-BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, \
- BOOST_AUTO_TEST_CASE_FIXTURE ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_TEST_CASE_TEMPLATE ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
- boost::unit_test::ut_detail::template_test_case_gen<name,typelist>( \
- BOOST_TEST_STRINGIZE( name ), __FILE__, __LINE__ ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_TEST_CASE_TEMPLATE_FUNCTION ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \
-template<typename type_name> \
-void BOOST_JOIN( name, _impl )( boost::type<type_name>* ); \
- \
-struct name { \
- template<typename TestType> \
- static void run( boost::type<TestType>* frwrd = 0 ) \
- { \
- BOOST_JOIN( name, _impl )( frwrd ); \
- } \
-}; \
- \
-template<typename type_name> \
-void BOOST_JOIN( name, _impl )( boost::type<type_name>* ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_GLOBAL_FIXTURE ************** //
-// ************************************************************************** //
-
-#define BOOST_GLOBAL_FIXTURE( F ) \
-static boost::unit_test::ut_detail::global_configuration_impl<F> BOOST_JOIN( gf_, F ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_TEST_GLOBAL_CONFIGURATION ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_GLOBAL_CONFIGURATION( F ) \
-static boost::unit_test::ut_detail::global_configuration_impl<F> BOOST_JOIN( gf_, F ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_TEST_GLOBAL_FIXTURE ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_GLOBAL_FIXTURE( F ) \
-static boost::unit_test::ut_detail::global_fixture_impl<F> BOOST_JOIN( gf_, F ) \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_TEST_DECORATOR ************** //
-// ************************************************************************** //
-
-#define BOOST_TEST_DECORATOR( D ) \
-static boost::unit_test::decorator::collector_t const& \
-BOOST_TEST_APPEND_UNIQUE_ID(decorator_collector) BOOST_ATTRIBUTE_UNUSED = D; \
-/**/
-
-// ************************************************************************** //
-// ************** BOOST_AUTO_TEST_CASE_FIXTURE ************** //
-// ************************************************************************** //
-
-namespace boost { namespace unit_test { namespace ut_detail {
-
-struct nil_t {};
-
-} // namespace ut_detail
-} // unit_test
-} // namespace boost
-
-// Intentionally is in global namespace, so that FIXTURE_TEST_SUITE can reset it in user code.
-typedef ::boost::unit_test::ut_detail::nil_t BOOST_AUTO_TEST_CASE_FIXTURE;
-
-// ************************************************************************** //
-// ************** Auto registration facility helper macros ************** //
-// ************************************************************************** //
-
-// Facility for having a unique name based on __LINE__ and __COUNTER__ (later if available)
-#if defined(__COUNTER__)
- #define BOOST_TEST_INTERNAL_HAS_COUNTER
-#endif
-
-#if defined(BOOST_TEST_INTERNAL_HAS_COUNTER)
- #define BOOST_TEST_APPEND_UNIQUE_ID( name ) \
- BOOST_JOIN( BOOST_JOIN( name, __LINE__ ), __COUNTER__)
- /**/
-#else
- #define BOOST_TEST_APPEND_UNIQUE_ID( name ) \
- BOOST_JOIN( name, __LINE__ )
- /**/
-#endif
-/**/
-
-#define BOOST_AUTO_TU_REGISTRAR( test_name ) \
-static boost::unit_test::ut_detail::auto_test_unit_registrar \
-BOOST_TEST_APPEND_UNIQUE_ID( BOOST_JOIN( test_name, _registrar ) ) BOOST_ATTRIBUTE_UNUSED \
-/**/
-#define BOOST_AUTO_TC_INVOKER( test_name ) BOOST_JOIN( test_name, _invoker )
-#define BOOST_AUTO_TC_UNIQUE_ID( test_name ) BOOST_JOIN( test_name, _id )
-
-// ************************************************************************** //
-// ************** BOOST_TEST_MAIN ************** //
-// ************************************************************************** //
-
-#if defined(BOOST_TEST_MAIN)
-
-// initializing the master test suite name from the user defined macros
-// this function should be seen exactly once.
-#ifdef BOOST_TEST_MODULE
-static const boost::unit_test::framework::impl::master_test_suite_name_setter mtsetter(BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ));
-#endif
-
-#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
-bool init_unit_test() {
-#else
-::boost::unit_test::test_suite*
-init_unit_test_suite( int, char* [] ) {
-#endif
-
-#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
- return true;
-}
-#else
- return 0;
-}
-#endif
-
-#endif
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-
-#endif // BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
-
diff --git a/contrib/restricted/boost/test/src/cpp_main.cpp b/contrib/restricted/boost/test/src/cpp_main.cpp
deleted file mode 100644
index ab92ba5e79..0000000000
--- a/contrib/restricted/boost/test/src/cpp_main.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile$
-//
-// Version : $Revision$
-//
-// Description : forwarding source
-// ***************************************************************************
-
-#define BOOST_TEST_SOURCE
-#include <boost/test/impl/cpp_main.ipp>
-
-// EOF
-
diff --git a/contrib/restricted/boost/test/src/test_main.cpp b/contrib/restricted/boost/test/src/test_main.cpp
deleted file mode 100644
index f7ae352d25..0000000000
--- a/contrib/restricted/boost/test/src/test_main.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2010.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-/// @file
-/// @brief forwarding source
-// ***************************************************************************
-
-#define BOOST_TEST_SOURCE
-#include <boost/test/impl/test_main.ipp>
-
-// EOF
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation.cpp b/ydb/core/tx/schemeshard/schemeshard__operation.cpp
index 85d1ec2616..c8649f0cf5 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation.cpp
@@ -20,6 +20,56 @@ namespace NKikimr::NSchemeShard {
using namespace NTabletFlatExecutor;
+std::tuple<TMaybe<NACLib::TUserToken>, bool> ParseUserToken(const TString& tokenStr) {
+ TMaybe<NACLib::TUserToken> result;
+ bool parseError = false;
+
+ if (!tokenStr.empty()) {
+ NACLibProto::TUserToken tokenPb;
+ if (tokenPb.ParseFromString(tokenStr)) {
+ result = NACLib::TUserToken(tokenPb);
+ } else {
+ parseError = true;
+ }
+ }
+
+ return std::make_tuple(result, parseError);
+}
+
+TString RenderPaths(const TVector<TString>& paths) {
+ auto result = TStringBuilder();
+ result << "[" << JoinStrings(paths.begin(), paths.end(), ", ") << "]";
+ return result;
+}
+
+void AuditLogModifySchemeTransaction(const NKikimrScheme::TEvModifySchemeTransaction& request, const NKikimrScheme::TEvModifySchemeTransactionResult& response, TSchemeShard* SS, const TString& userSID) {
+ // Each TEvModifySchemeTransaction.Transaction is a self sufficient operation and should be logged independently
+ // (even if it was packed into a single TxProxy transaction with some other operations).
+
+ //NOTE: UserSIDNone couldn't be an empty string as "subject" field is a required one,
+ // but AUDIT_PART() skips any part with an empty value
+ static const TString EmptyValue = "{none}";
+
+ for (const auto& operation : request.GetTransaction()) {
+ auto logEntry = MakeAuditLogFragment(operation);
+
+ auto databasePath = TPath::Resolve(operation.GetWorkingDir(), SS);
+ if (!databasePath.IsResolved()) {
+ databasePath.RiseUntilFirstResolvedParent();
+ }
+
+ AUDIT_LOG(
+ AUDIT_PART("txId", std::to_string(request.GetTxId()))
+ AUDIT_PART("subject", (!userSID.empty() ? userSID : EmptyValue))
+ AUDIT_PART("database", (!databasePath.IsEmpty() ? databasePath.GetDomainPathString() : EmptyValue))
+ AUDIT_PART("operation", logEntry.Operation)
+ AUDIT_PART("paths", RenderPaths(logEntry.Paths), !logEntry.Paths.empty())
+ AUDIT_PART("status", NKikimrScheme::EStatus_Name(response.GetStatus()))
+ AUDIT_PART("reason", response.GetReason(), response.HasReason())
+ );
+ }
+}
+
struct TSchemeShard::TTxOperationProposeCancelTx: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
TEvSchemeShard::TEvCancelTx::TPtr Ev;
@@ -71,32 +121,6 @@ NKikimrScheme::TEvModifySchemeTransaction GetRecordForPrint(const NKikimrScheme:
return recordForPrint;
}
-void MakeAuditLog(const TTxId& txId, const THolder<TProposeResponse>& response, TOperationContext& context) {
- auto fragPath = TPath::Resolve(context.AuditLogFragments.front().GetAnyPath(), context.SS);
- if (!fragPath.IsResolved()) {
- fragPath.RiseUntilFirstResolvedParent();
- }
-
- auto operations = TStringBuilder();
- for (auto it = context.AuditLogFragments.begin(); it != context.AuditLogFragments.end(); it++) {
- AUDIT_LOG(
- AUDIT_PART("txId", std::to_string(txId.GetValue()))
- AUDIT_PART("database", fragPath.GetDomainPathString(), !fragPath.IsEmpty())
- AUDIT_PART("subject", context.GetSubject())
- AUDIT_PART("status", NKikimrScheme::EStatus_Name(response->Record.GetStatus()))
- AUDIT_PART("reason", response->Record.GetReason(), response->Record.HasReason())
- AUDIT_PART("operation", it->GetOperation())
- AUDIT_PART("path", it->GetPath())
- AUDIT_PART("src path", it->GetSrcPath())
- AUDIT_PART("dst path", it->GetDstPath())
- AUDIT_PART("set owner", it->GetSetOwner())
- AUDIT_PART("add access", it->GetAddAccess())
- AUDIT_PART("remove access", it->GetRemoveAccess())
- AUDIT_PART("protobuf request", it->GetProtoRequest())
- );
- }
-}
-
THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request, TOperationContext& context) {
THolder<TProposeResponse> response = nullptr;
@@ -116,28 +140,12 @@ THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request
TOperation::TPtr operation = new TOperation(txId);
Operations[txId] = operation; //record is erased at ApplyOnExecute if all parts are done at propose
- if (record.GetUserToken()) {
- NACLibProto::TUserToken tokenPb;
- if (!tokenPb.ParseFromString(record.GetUserToken())) {
- response.Reset(new TProposeResponse(NKikimrScheme::StatusInvalidParameter, ui64(txId), ui64(selfId)));
- response->SetError(NKikimrScheme::StatusInvalidParameter, "Failed to parse user token");
- return std::move(response);
- }
- context.UserToken.Reset(new NACLib::TUserToken(tokenPb));
- }
-
- for (const auto& transaction : record.GetTransaction()) {
- context.AddAuditLogFragment(transaction);
- }
-
for (const auto& transaction : record.GetTransaction()) {
auto quotaResult = operation->ConsumeQuota(transaction, context);
if (quotaResult.Status != NKikimrScheme::StatusSuccess) {
response.Reset(new TProposeResponse(quotaResult.Status, ui64(txId), ui64(selfId)));
response->SetError(quotaResult.Status, quotaResult.Reason);
Operations.erase(txId);
-
- MakeAuditLog(txId, response, context);
return std::move(response);
}
}
@@ -158,8 +166,6 @@ THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request
response.Reset(new TProposeResponse(splitResult.Status, ui64(txId), ui64(selfId)));
response->SetError(splitResult.Status, splitResult.Reason);
Operations.erase(txId);
-
- MakeAuditLog(txId, response, context);
return std::move(response);
}
@@ -167,7 +173,6 @@ THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request
}
const TString owner = record.HasOwner() ? record.GetOwner() : BUILTIN_ACL_ROOT;
- context.ClearAuditLogFragments();
for (const auto& transaction : transactions) {
auto parts = operation->ConstructParts(transaction, context);
@@ -177,8 +182,6 @@ THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request
context.IsAllowedPrivateTables = true;
}
- context.AddAuditLogFragment(transaction);
-
for (auto& part : parts) {
TString errStr;
if (!context.SS->CheckInFlightLimit(part->GetTransaction().GetOperationType(), errStr)) {
@@ -240,13 +243,11 @@ THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request
context.OnComplete.ApplyOnExecute(context.SS, context.GetTxc(), context.Ctx);
Operations.erase(txId);
- MakeAuditLog(txId, response, context);
return std::move(response);
}
}
}
- MakeAuditLog(txId, response, context);
return std::move(response);
}
@@ -256,6 +257,8 @@ struct TSchemeShard::TTxOperationPropose: public NTabletFlatExecutor::TTransacti
TProposeRequest::TPtr Request;
THolder<TProposeResponse> Response = nullptr;
+ TString UserSID;
+
TSideEffects OnComplete;
TTxOperationPropose(TSchemeShard* self, TProposeRequest::TPtr request)
@@ -275,9 +278,19 @@ struct TSchemeShard::TTxOperationPropose: public NTabletFlatExecutor::TTransacti
txc.DB.NoMoreReadsForTx();
+ auto [userToken, tokenParseError] = ParseUserToken(Request->Get()->Record.GetUserToken());
+ if (tokenParseError) {
+ auto txId = Request->Get()->Record.GetTxId();
+ Response = MakeHolder<TProposeResponse>(NKikimrScheme::StatusInvalidParameter, ui64(txId), ui64(selfId), "Failed to parse user token");
+ return true;
+ }
+ if (userToken) {
+ UserSID = userToken->GetUserSID();
+ }
+
TMemoryChanges memChanges;
TStorageChanges dbChanges;
- auto context = TOperationContext{Self, txc, ctx, OnComplete, memChanges, dbChanges};
+ TOperationContext context{Self, txc, ctx, OnComplete, memChanges, dbChanges, std::move(userToken)};
Response = Self->IgniteOperation(*Request->Get(), context);
@@ -298,6 +311,8 @@ struct TSchemeShard::TTxOperationPropose: public NTabletFlatExecutor::TTransacti
<< ", response: " << Response->Record.ShortDebugString()
<< ", at schemeshard: " << Self->TabletID());
+ AuditLogModifySchemeTransaction(record, Response->Record, Self, UserSID);
+
const TActorId sender = Request->Sender;
const ui64 cookie = Request->Cookie;
ctx.Send(sender, Response.Release(), 0, cookie);
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_part.h b/ydb/core/tx/schemeshard/schemeshard__operation_part.h
index 0d3a3c2cd3..121871315d 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_part.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_part.h
@@ -4,7 +4,6 @@
#include "schemeshard_private.h"
#include "schemeshard_tx_infly.h"
#include "schemeshard_types.h"
-#include "schemeshard_audit_log_fragment.h"
#include "schemeshard__operation_side_effects.h"
#include "schemeshard__operation_memory_changes.h"
#include "schemeshard__operation_db_changes.h"
@@ -89,11 +88,9 @@ public:
TMemoryChanges& MemChanges;
TStorageChanges& DbChanges;
- TAutoPtr<NACLib::TUserToken> UserToken = nullptr;
+ TMaybe<NACLib::TUserToken> UserToken;
bool IsAllowedPrivateTables = false;
- TVector<TAuditLogFragment> AuditLogFragments;
-
private:
NTabletFlatExecutor::TTransactionContext& Txc;
bool ProtectDB = false;
@@ -103,29 +100,22 @@ public:
TOperationContext(
TSchemeShard* ss,
NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx,
- TSideEffects& onComplete, TMemoryChanges& memChanges, TStorageChanges& dbChange)
+ TSideEffects& onComplete, TMemoryChanges& memChanges, TStorageChanges& dbChange,
+ TMaybe<NACLib::TUserToken>&& userToken)
: SS(ss)
, Ctx(ctx)
, OnComplete(onComplete)
, MemChanges(memChanges)
, DbChanges(dbChange)
+ , UserToken(userToken)
, Txc(txc)
{}
-
- void AddAuditLogFragment(TAuditLogFragment&& op) {
- AuditLogFragments.push_back(std::move(op));
- }
-
- void ClearAuditLogFragments() {
- AuditLogFragments.clear();
- }
-
- TString GetSubject() const {
- if (UserToken) {
- return UserToken->GetUserSID();
- }
- return "no subject";
- }
+ TOperationContext(
+ TSchemeShard* ss,
+ NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx,
+ TSideEffects& onComplete, TMemoryChanges& memChanges, TStorageChanges& dbChange)
+ : TOperationContext(ss, txc, ctx, onComplete, memChanges, dbChange, Nothing())
+ {}
NTable::TDatabase& GetDB() {
Y_VERIFY_S(ProtectDB == false,
diff --git a/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.cpp b/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.cpp
index 18d6ca8e6a..9b4d522f15 100644
--- a/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.cpp
@@ -6,7 +6,7 @@
#include <util/string/builder.h>
-namespace NKikimr::NSchemeShard {
+namespace {
TString DefineUserOperationName(NKikimrSchemeOp::EOperationType type) {
switch (type) {
@@ -190,388 +190,275 @@ TString DefineUserOperationName(NKikimrSchemeOp::EOperationType type) {
Y_FAIL("switch should cover all operation types");
}
-TAuditLogFragment::TAuditLogFragment(const NKikimrSchemeOp::TModifyScheme& tx)
- : Operation(DefineUserOperationName(tx.GetOperationType()))
- , ProtoRequest(tx.ShortDebugString())
-{
- FillPaths(tx);
- FillACL(tx);
-}
-
-void TAuditLogFragment::FillACL(const NKikimrSchemeOp::TModifyScheme& tx) {
- using namespace NACLib;
-
- bool hasACL = tx.HasModifyACL() && tx.GetModifyACL().HasDiffACL();
- if (hasACL) {
- NACLib::TDiffACL diffACL(tx.GetModifyACL().GetDiffACL());
- for (const auto& diffACE : diffACL.GetDiffACE()) {
- const NACLibProto::TACE& ace = diffACE.GetACE();
- switch (static_cast<EDiffType>(diffACE.GetDiffType())) {
- case EDiffType::Add:
- AddACL.push_back(TACL::ToString(ace));
- break;
- case EDiffType::Remove:
- RmACL.push_back(TACL::ToString(ace));
- break;
- }
- }
- }
-
- bool hasOwner = tx.HasModifyACL() && tx.GetModifyACL().HasNewOwner();
- if (hasOwner) {
- NewOwner = tx.GetModifyACL().GetNewOwner();
- }
-}
+TVector<TString> ExtractChangingPaths(const NKikimrSchemeOp::TModifyScheme& tx) {
+ TVector<TString> result;
-void TAuditLogFragment::FillPaths(const NKikimrSchemeOp::TModifyScheme& tx) {
switch (tx.GetOperationType()) {
case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetMkDir().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetMkDir().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateTable().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateTable().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreatePersQueueGroup().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreatePersQueueGroup().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAllocatePersQueueGroup:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAllocatePersQueueGroup().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAllocatePersQueueGroup().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDeallocatePersQueueGroup:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDeallocatePersQueueGroup().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDeallocatePersQueueGroup().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterTable().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterTable().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterPersQueueGroup().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterPersQueueGroup().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetModifyACL().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetModifyACL().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpRmDir:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetSplitMergeTablePartitions().GetTablePath()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetSplitMergeTablePartitions().GetTablePath()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpBackup:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetBackup().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetBackup().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateRtmrVolume().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateRtmrVolume().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateBlockStoreVolume().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateBlockStoreVolume().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterBlockStoreVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterBlockStoreVolume().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterBlockStoreVolume().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAssignBlockStoreVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAssignBlockStoreVolume().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAssignBlockStoreVolume().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropBlockStoreVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetKesus().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetKesus().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateSolomonVolume().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateSolomonVolume().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropSolomonVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterKesus:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetKesus().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetKesus().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterUserAttributes().GetPathName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterUserAttributes().GetPathName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateIndexedTable().GetTableDescription().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateIndexedTable().GetTableDescription().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateTableIndex().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateTableIndex().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables:
for (const auto& item : tx.GetCreateConsistentCopyTables().GetCopyTableDescriptions()) {
- SrcPaths.push_back(item.GetSrcPath());
- DstPaths.push_back(item.GetDstPath());
+ result.emplace_back(item.GetDstPath());
}
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain:
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomainCreateHive:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropExtSubDomain:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetSubDomain().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOp_DEPRECATED_35:
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetUpgradeSubDomain().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetUpgradeSubDomain().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetUpgradeSubDomain().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetUpgradeSubDomain().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild:
- Path = JoinPath({tx.GetInitiateIndexBuild().GetTable(), tx.GetInitiateIndexBuild().GetIndex().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetInitiateIndexBuild().GetTable(), tx.GetInitiateIndexBuild().GetIndex().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexMainTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetInitiateBuildIndexMainTable().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetInitiateBuildIndexMainTable().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateLock:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetLockConfig().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetLockConfig().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild:
- Path = JoinPath({tx.GetApplyIndexBuild().GetTablePath(), tx.GetApplyIndexBuild().GetIndexName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetApplyIndexBuild().GetTablePath(), tx.GetApplyIndexBuild().GetIndexName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetFinalizeBuildIndexMainTable().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetFinalizeBuildIndexMainTable().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterTableIndex:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterTableIndex().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterTableIndex().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSolomonVolume:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterSolomonVolume().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterSolomonVolume().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropLock:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetLockConfig().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetLockConfig().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexImplTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterTable().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterTable().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexImplTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateTable().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateTable().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDropIndex().GetTableName(), tx.GetDropIndex().GetIndexName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDropIndex().GetTableName(), tx.GetDropIndex().GetIndexName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndexAtMainTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDropIndex().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDropIndex().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild:
- Path = JoinPath({tx.GetCancelIndexBuild().GetTablePath(), tx.GetCancelIndexBuild().GetIndexName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetCancelIndexBuild().GetTablePath(), tx.GetCancelIndexBuild().GetIndexName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateFileStore().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateFileStore().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterFileStore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterFileStore().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterFileStore().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropFileStore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpRestore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetRestore().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetRestore().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateColumnStore().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateColumnStore().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterColumnStore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterColumnStore().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterColumnStore().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropColumnStore:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterColumnTable().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterColumnTable().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterColumnTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterColumnTable().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterColumnTable().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropColumnTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterLogin:
- Path = tx.GetWorkingDir();
+ result.emplace_back(tx.GetWorkingDir());
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateCdcStream().GetTableName(), tx.GetCreateCdcStream().GetStreamDescription().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateCdcStream().GetTableName(), tx.GetCreateCdcStream().GetStreamDescription().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamImpl:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateCdcStream().GetStreamDescription().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateCdcStream().GetStreamDescription().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamAtTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetCreateCdcStream().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetCreateCdcStream().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterCdcStream().GetTableName(), tx.GetAlterCdcStream().GetStreamName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterCdcStream().GetTableName(), tx.GetAlterCdcStream().GetStreamName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterCdcStream().GetStreamName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterCdcStream().GetStreamName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetAlterCdcStream().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetAlterCdcStream().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDropCdcStream().GetTableName(), tx.GetDropCdcStream().GetStreamName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDropCdcStream().GetTableName(), tx.GetDropCdcStream().GetStreamName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamImpl:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamAtTable:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDropCdcStream().GetTableName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDropCdcStream().GetTableName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable:
- SrcPaths.push_back(tx.GetMoveTable().GetSrcPath());
- DstPaths.push_back(tx.GetMoveTable().GetDstPath());
+ result.emplace_back(tx.GetMoveTable().GetSrcPath());
+ result.emplace_back(tx.GetMoveTable().GetDstPath());
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTableIndex:
- SrcPaths.push_back(tx.GetMoveTableIndex().GetSrcPath());
- DstPaths.push_back(tx.GetMoveTableIndex().GetDstPath());
+ result.emplace_back(tx.GetMoveTableIndex().GetSrcPath());
+ result.emplace_back(tx.GetMoveTableIndex().GetDstPath());
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetSequence().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetSequence().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSequence:
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateReplication:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetReplication().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetReplication().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterReplication:
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropReplication:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetDrop().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlobDepot:
- Path = JoinPath({tx.GetWorkingDir(), tx.GetBlobDepot().GetName()});
+ result.emplace_back(NKikimr::JoinPath({tx.GetWorkingDir(), tx.GetBlobDepot().GetName()}));
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterBlobDepot:
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpDropBlobDepot:
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpMoveIndex:
- SrcPaths.push_back(JoinPath({tx.GetMoveIndex().GetTablePath(), tx.GetMoveIndex().GetSrcPath()}));
- DstPaths.push_back(JoinPath({tx.GetMoveIndex().GetTablePath(), tx.GetMoveIndex().GetDstPath()}));
+ result.emplace_back(NKikimr::JoinPath({tx.GetMoveIndex().GetTablePath(), tx.GetMoveIndex().GetSrcPath()}));
+ result.emplace_back(NKikimr::JoinPath({tx.GetMoveIndex().GetTablePath(), tx.GetMoveIndex().GetDstPath()}));
break;
}
-}
-
-TString TAuditLogFragment::GetAnyPath() const {
- if (Path) {
- return *Path;
- } else if (SrcPaths) {
- return SrcPaths.front();
- } else if (DstPaths) {
- return DstPaths.front();
- } else {
- return "";
- }
-}
-
-TString TAuditLogFragment::GetOperation() const {
- return Operation;
-}
-
-TString TAuditLogFragment::GetPath() const {
- if (!Path && SrcPaths && DstPaths) {
- return "";
- }
- return Path.GetOrElse("");
-}
-TString TAuditLogFragment::GetSrcPath() const {
- Y_VERIFY_DEBUG(SrcPaths.size() == DstPaths.size());
- auto minSize = Min(SrcPaths.size(), DstPaths.size());
- if (minSize == 0)
- return "";
-
- auto result = TStringBuilder();
- result << "{";
- for (size_t i = 0; i < minSize; ++i) {
- result << SrcPaths[i];
- if (i < minSize - 1)
- result << ", ";
- }
- result << "}";
return result;
}
-TString TAuditLogFragment::GetDstPath() const {
- Y_VERIFY_DEBUG(SrcPaths.size() == DstPaths.size());
- auto minSize = Min(SrcPaths.size(), DstPaths.size());
- if (minSize == 0)
- return "";
-
- auto result = TStringBuilder();
- result << "{";
- for (size_t i = 0; i < minSize; ++i) {
- result << DstPaths[i];
- if (i < minSize - 1)
- result << ", ";
- }
- result << "}";
- return result;
-}
-
-TString TAuditLogFragment::GetSetOwner() const {
- return NewOwner.GetOrElse("");
-}
-
-TString TAuditLogFragment::GetAddAccess() const {
- if (AddACL.empty())
- return "";
+} // anonymous namespace
- auto result = TStringBuilder();
- result << "{";
- for (size_t i = 0; i < AddACL.size(); ++i) {
- result << AddACL[i];
- if (i < AddACL.size() - 1)
- result << ", ";
- }
- result << "}";
- return result;
-}
-
-TString TAuditLogFragment::GetRemoveAccess() const {
- if (RmACL.empty())
- return "";
+namespace NKikimr::NSchemeShard {
- auto result = TStringBuilder();
- result << "{";
- for (size_t i = 0; i < RmACL.size(); ++i) {
- result << RmACL[i];
- if (i < RmACL.size() - 1)
- result << ", ";
- }
- result << "}";
- return result;
+TAuditLogFragment MakeAuditLogFragment(const NKikimrSchemeOp::TModifyScheme& tx) {
+ return {
+ .Operation = DefineUserOperationName(tx.GetOperationType()),
+ .Paths = ExtractChangingPaths(tx),
+ };
}
-TString TAuditLogFragment::GetProtoRequest() const {
- return ProtoRequest.GetOrElse("");
-}
}
diff --git a/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.h b/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.h
index 16b1832e14..57874086b4 100644
--- a/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.h
+++ b/ydb/core/tx/schemeshard/schemeshard_audit_log_fragment.h
@@ -1,6 +1,5 @@
#pragma once
-#include <util/generic/maybe.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
@@ -11,29 +10,10 @@ namespace NKikimrSchemeOp {
namespace NKikimr::NSchemeShard {
struct TAuditLogFragment {
- const TString Operation;
- TMaybe<TString> Path;
- TVector<TString> SrcPaths;
- TVector<TString> DstPaths;
- TVector<TString> AddACL;
- TVector<TString> RmACL;
- TMaybe<TString> NewOwner;
- TMaybe<TString> ProtoRequest;
-
- TAuditLogFragment(const NKikimrSchemeOp::TModifyScheme& tx);
-
- void FillACL(const NKikimrSchemeOp::TModifyScheme& tx);
- void FillPaths(const NKikimrSchemeOp::TModifyScheme& tx);
-
- TString GetAnyPath() const;
- TString GetOperation() const;
- TString GetPath() const;
- TString GetSrcPath() const;
- TString GetDstPath() const;
- TString GetSetOwner() const;
- TString GetAddAccess() const;
- TString GetRemoveAccess() const;
- TString GetProtoRequest() const;
+ TString Operation;
+ TVector<TString> Paths;
};
+TAuditLogFragment MakeAuditLogFragment(const NKikimrSchemeOp::TModifyScheme& tx);
+
}