diff --git a/ReleaseNotes.md b/ReleaseNotes.md index ec1e6be233ef85fac64994e5d5d898b0e74bb99e..3770f57824c7752fd64ca00604614e4f9842d7fc 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -8,16 +8,22 @@ This CTA release requires a backwards compatible database schema upgrade to CTA Please consult the [database upgrade documentation](https://eoscta.docs.cern.ch/catalogue/upgrade/). ### Features +- cta/CTA#823 - Ensure unit tests CANNOT be executed against a production database - cta/CTA#1082 - Review software license text in CTA - cta/CTA#1163 - cta-admin now prefixes the drivename with a '!' if the respective logical library is disabled ### Bug fixes +- cta/CTA#1156 - failed to instanciate the RAO algorithm ### Building and Packaging +- cta/CTA#1153 - Change compiler FLAGS in cmake files +- cta/CTA#1155 - Remove GCC suppresions in DriveGeneric and file/Structures +- cta/CTA#1173 - Remove GCC '-Wno-unused-function' suppresion ### Catalogue Schema -- cta/CTA#1158 - Check all foreign key references have a full index on both sides of the constraint - cta/CTA#1043 - Add verification column to tape table +- cta/CTA#1158 - Check all foreign key references have a full index on both sides of the constraint +- cta/CTA#1166 - Add SCL-RH Repo to CTA CI boot scripts ### Continuous Integration diff --git a/catalogue/CMakeLists.txt b/catalogue/CMakeLists.txt index 9a35eae3d6f4993913004174e463843bf1571fae..dea112cb49c35fecbe9e544d518195779a56711d 100644 --- a/catalogue/CMakeLists.txt +++ b/catalogue/CMakeLists.txt @@ -197,12 +197,19 @@ set_property(TARGET cta-catalogue-schema-create APPEND PROPERTY INSTALL_RPATH ${ install (TARGETS cta-catalogue-schema-create DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-schema-create.1cta DESTINATION /usr/share/man/man1) -add_executable(cta-catalogue-schema-drop +set (DROP_SCHEMA_CMD DropSchemaCmd.cpp DropSchemaCmdLineArgs.cpp - DropSchemaCmdMain.cpp) +) +add_library (ctadropschemacmd SHARED ${DROP_SCHEMA_CMD}) +set_property(TARGET ctadropschemacmd PROPERTY SOVERSION "${CTA_SOVERSION}") +set_property(TARGET ctadropschemacmd PROPERTY VERSION "${CTA_LIBVERSION}") +install (TARGETS ctadropschemacmd DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) +target_link_libraries (ctadropschemacmd ctaschemachecker) + +add_executable(cta-catalogue-schema-drop DropSchemaCmdMain.cpp) -target_link_libraries (cta-catalogue-schema-drop ctacatalogue ctaschemachecker) +target_link_libraries (cta-catalogue-schema-drop ctacatalogue ctadropschemacmd) set_property(TARGET cta-catalogue-schema-drop APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) set_property(TARGET cta-catalogue-schema-drop APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) diff --git a/catalogue/DropSchemaCmd.cpp b/catalogue/DropSchemaCmd.cpp index 4f846061d401533fcc8b0db4be2cf23aa5b5a1e6..afdd9fcd0f8fbe29d23554f091fab551ae212ca5 100644 --- a/catalogue/DropSchemaCmd.cpp +++ b/catalogue/DropSchemaCmd.cpp @@ -65,12 +65,10 @@ int DropSchemaCmd::exceptionThrowingMain(const int argc, char *const *const argv return 0; } - if(isProductionProtectionCheckable(conn,dbLogin.dbType)){ - if(isProductionSet(conn)){ - throw cta::exception::Exception("Cannot drop a production database. If you still wish to proceed then please modify the database manually to remove its production status before trying again."); - } + if (isProductionSet(conn)) { + throw cta::exception::Exception("Cannot drop a production database. If you still wish to proceed then please modify the database manually to remove its production status before trying again."); } - + if(userConfirmsDropOfSchema(dbLogin)) { m_out << "DROPPING the schema of the CTA calalogue database" << std::endl; dropCatalogueSchema(dbLogin.dbType, conn); @@ -187,19 +185,6 @@ bool DropSchemaCmd::isProductionSet(cta::rdbms::Conn & conn){ } } -//------------------------------------------------------------------------------ -// isProductionProtectionCheckable -//------------------------------------------------------------------------------ -bool DropSchemaCmd::isProductionProtectionCheckable(rdbms::Conn& conn, const cta::rdbms::Login::DbType dbType) { - cta::catalogue::SchemaChecker::Builder builder("catalogue",dbType,conn); - auto checker = builder.build(); - SchemaCheckerResult res = checker->checkTableContainsColumns("CTA_CATALOGUE",{"IS_PRODUCTION"}); - if(res.getStatus() == SchemaCheckerResult::Status::FAILED){ - return false; - } - return true; -} - //------------------------------------------------------------------------------ // printUsage //------------------------------------------------------------------------------ diff --git a/catalogue/DropSchemaCmd.hpp b/catalogue/DropSchemaCmd.hpp index 6063f634d394ed4753153ecca7d64fafdd35de92..b4212fea623d4f7f26bb8e8cfb9d3ed94e51c569 100644 --- a/catalogue/DropSchemaCmd.hpp +++ b/catalogue/DropSchemaCmd.hpp @@ -45,6 +45,12 @@ public: */ ~DropSchemaCmd() noexcept; + /** + * Checks if the IS_PRODUCTION bit is set on the CTA_CATALOGUE table + * @return true if the IS_PRODUCTION bit is set, false otherwise + */ + static bool isProductionSet(rdbms::Conn & conn); + private: /** @@ -94,15 +100,9 @@ private: * @param conn The database connection. */ void dropDatabaseSequences(rdbms::Conn &conn); - - /** - * Checks if the IS_PRODUCTION bit is set on the CTA_CATALOGUE table - * @return true if the IS_PRODUCTION bit is set, false otherwise - */ - bool isProductionSet(rdbms::Conn & conn); - + /** - * Checks if we can check the IS_PRODUCTION bit. This allows the backward-compatibility of + * Checks if we can check the IS_PRODUCTION bit. This allows the backward-compatibility of * this tool if we use it against a schema that does not have the IS_PRODUCTION bit. * @param conn the connection to the Catalogue database * @param dbType the type of the Catalogue database diff --git a/cta.spec.in b/cta.spec.in index 9efbb1cb2ff1a858f0f3e485158d1376caf44cfc..aa9a68882055762a134cdd1bc3ab7953db0265b9 100644 --- a/cta.spec.in +++ b/cta.spec.in @@ -46,7 +46,7 @@ BuildRequires: xrootd-client-devel >= %{xrootdVersion} BuildRequires: xrootd-devel >= %{xrootdVersion} BuildRequires: xrootd-server-devel >= %{xrootdVersion} BuildRequires: xrootd-private-devel >= %{xrootdVersion} -BuildRequires: librados-devel = %{radosVersion}, libradosstriper-devel = %{radosVersion}, +BuildRequires: librados-devel = %{radosVersion}, libradosstriper-devel = %{radosVersion}, BuildRequires: protobuf3-compiler >= 3.3.1 protobuf3-devel >= 3.3.1 BuildRequires: gmock-devel >= 1.5.0 gtest-devel >= 1.5.0 BuildRequires: sqlite-devel >= 3.6 @@ -222,6 +222,7 @@ Shared libraries required to access the CTA catalogue %files -n cta-lib-catalogue %defattr(0755,root,root,-) %{_libdir}/libctacatalogue.so* +%{_libdir}/libctadropschemacmd.so* %{_libdir}/libctardbms.so* %{_libdir}/libctardbmswrapper.so* %{_libdir}/libctaschemachecker.so* @@ -569,7 +570,7 @@ This package contains .repo files, gpg keys and yum-versionlock configuration fo - cta-admin: All short options with more than one character now require two dashes - cta/CTA#1013 reportType uninitialized - cta/CTA#1044 Fix segmentation fault due to uninitialized optional value and remove diskSpaceReservations from `cta-admin dr ls` -* Thu Sep 30 2021 jorge.camarero (at) cern.ch - 4.3-1 +* Thu Sep 30 2021 jorge.camarero (at) cern.ch - 4.3-1 - cta/CTA#976 Add logical part of Drive Status using Catalogue - cta/CTA#988 Add diskSpaceReservations map in cta-admin --json dr ls output. - cta/CTA#983 Add cta-versionlock helper script to cta-release package, Update cta repo file to use the new public repo @@ -737,7 +738,7 @@ This package contains .repo files, gpg keys and yum-versionlock configuration fo - fix for xrdfs query prepare on_tape logic - more tests on the tape drive (device path must exist, no name duplication in objectstore) * Sat Mar 14 2020 julien.leduc (at) cern.ch - 2.0-1 -- Schema version 2.0: DISK_FILE_PATH is now resolved on eos instance using grpc and VIRTUAL_ORGANIZATION has its own table +- Schema version 2.0: DISK_FILE_PATH is now resolved on eos instance using grpc and VIRTUAL_ORGANIZATION has its own table - eos 4.6.7-1 - xrootd 4.11.2-1 * Fri Feb 21 2020 julien.leduc (at) cern.ch - 1.2-0 @@ -753,4 +754,3 @@ This package contains .repo files, gpg keys and yum-versionlock configuration fo - CTA Frontend logs which FST sent the archive request - New configuration file for gRPC namespace endpoints so CTA can query EOS namespace - Archive requests sent to hard-coded fail_on_closew_test storage class will always fail with an error - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d8cfe49c0a094c8a44de7f45777caea822549e4e..b714fb1299d2310a3a061499f5fc207e72b3d6cb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -60,6 +60,7 @@ add_executable(cta-rdbmsUnitTests ${GMOCK_SRC}) target_link_libraries(cta-rdbmsUnitTests + ctadropschemacmd ctadbconfigcatalogueunittests ctadbconfigconnunittests ctadbconfigstmtunittests diff --git a/tests/rdbmsUnitTests.cpp b/tests/rdbmsUnitTests.cpp index ce2244e8841aed481ab3d5f5b1a083440fefc487..a40ef3841f8f0da6aab58a061b475b18719575d9 100644 --- a/tests/rdbmsUnitTests.cpp +++ b/tests/rdbmsUnitTests.cpp @@ -16,11 +16,13 @@ */ #include "catalogue/CatalogueFactoryFactory.hpp" +#include "catalogue/DropSchemaCmd.hpp" #ifdef STDOUT_LOGGING #include "common/log/StdoutLogger.hpp" #else #include "common/log/DummyLogger.hpp" #endif +#include "rdbms/ConnPool.hpp" #include "rdbms/Login.hpp" #include "tests/GlobalCatalogueFactoryForUnitTests.hpp" #include "tests/RdbmsUnitTestsCmdLineArgs.hpp" @@ -79,6 +81,11 @@ int main(int argc, char** argv) { const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 1; const uint64_t maxTriesToConnect = 1; + cta::rdbms::ConnPool connPool(login, nbConns); + cta::rdbms::Conn conn = connPool.getConn(); + if (cta::catalogue::DropSchemaCmd::isProductionSet(conn)) { + throw cta::exception::Exception("Cannot use a production database for testing."); + } auto catalogueFactory = cta::catalogue::CatalogueFactoryFactory::create(dummyLogger, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect); g_catalogueFactoryForUnitTests = catalogueFactory.get();