diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d44f3e4e..172201d44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,7 @@ BuildInfo_Create(${build_info_PATH} # Add installcheck targets add_subdirectory(tests) +add_subdirectory(upgrade_test) # NOTE: keep install part at the end of file, to overwrite previous binary install(PROGRAMS "cmake/install_gpdb_component" DESTINATION ".") @@ -160,7 +161,9 @@ install(FILES ${build_info_PATH} DESTINATION ".") file(GLOB sql_files RELATIVE ${DISKQUOTA_DDL_DIR} "${DISKQUOTA_DDL_DIR}/diskquota--2.*.sql") list(FILTER sql_files EXCLUDE REGEX ".*--.*--.*") list(FILTER sql_files EXCLUDE REGEX ".*diskquota--${DISKQUOTA_MAJOR_VERSION}.${DISKQUOTA_MINOR_VERSION}.*") -foreach(so IN LISTS sql_files) - string(REGEX REPLACE "^diskquota--([0-9]+)\.([0-9]+).sql$" "diskquota-\\1.\\2.so" so ${so}) - install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${DISKQUOTA_BINARY_NAME}.so \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/postgresql/${so}\")") -endforeach() +if(NOT DEFINED DISKQUOTA_LAST_RELEASE_PATH) + foreach(so IN LISTS sql_files) + string(REGEX REPLACE "^diskquota--([0-9]+)\.([0-9]+).sql$" "diskquota-\\1.\\2.so" so ${so}) + install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${DISKQUOTA_BINARY_NAME}.so \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/postgresql/${so}\")") + endforeach() +endif() diff --git a/arenadata/README.md b/arenadata/README.md index fff0b9868..d890992ca 100644 --- a/arenadata/README.md +++ b/arenadata/README.md @@ -5,18 +5,33 @@ How to build Docker image: (["readme.md"](https://github.com/arenadata/gpdb/blob 1. Download the cmake-3.20 install script from ([source](https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh)). -2. Build diskquota in the Docker container. -Change and to the appropriate paths on your local machine. +2. Prepare diskquota-.tar.gz which must contains all . versions of diskquota. For each versions you need to use last tag (see `git tag`). Name of this archive must be `diskquota-.tar.gz`, where is tag for the latest version of diskquota in this archive. All `*.so` files must be at `lib/postgresql` path: + +``` +evgeniy@evgeniy-pc:~/gpdb/diskquota_bin$ tar -tvf diskquota-2.2.1_arenadata3.tar.gz +drwxrwxr-x evgeniy/evgeniy 0 2023-10-05 14:40 lib/ +drwxrwxr-x evgeniy/evgeniy 0 2023-10-05 14:41 lib/postgresql/ +-rwxr-xr-x evgeniy/evgeniy 281632 2023-10-03 13:55 lib/postgresql/diskquota.so +-rwxr-xr-x evgeniy/evgeniy 550080 2023-10-03 13:53 lib/postgresql/diskquota-2.0.so +-rwxr-xr-x evgeniy/evgeniy 619824 2023-10-03 13:51 lib/postgresql/diskquota-2.1.so +-rwxr-xr-x evgeniy/evgeniy 755664 2023-10-04 10:11 lib/postgresql/diskquota-2.2.so +``` + +This archive is needed for run upgrade tests for diskquota. This tests may be disabled (see ([commit](https://github.com/arenadata/diskquota/commit/50ed2e4e1883ec8ec4e7086b750cb28cdc5a2dc0)). + +3. Build diskquota in the Docker container. +Change and to the appropriate paths on your local machine. is the same as at step 2. If upgrade test is disabled, line with is not needed. ``` docker run --rm -it -e DISKQUOTA_OS=rhel7 \ -v /tmp/diskquota_artifacts:/home/gpadmin/diskquota_artifacts \ -v :/home/gpadmin/diskquota_src \ -v :/home/gpadmin/bin_cmake/cmake-3.20.0-linux-x86_64.sh \ + -v :/home/gpadmin/last_released_diskquota_bin/diskquota-.tar.gz \ hub.adsw.io/library/gpdb6_regress:latest diskquota_src/concourse/scripts/entry.sh build ``` -3. Run tests. +4. Run tests. Change and to the appropriate paths on your local machine. ``` diff --git a/concourse/scripts/build_diskquota.sh b/concourse/scripts/build_diskquota.sh index 10b66e341..7b2ee30b6 100755 --- a/concourse/scripts/build_diskquota.sh +++ b/concourse/scripts/build_diskquota.sh @@ -11,7 +11,10 @@ function pkg() { export CXX="$(which g++)" pushd /home/gpadmin/diskquota_artifacts + local last_release_path + last_release_path=$(readlink -eq /home/gpadmin/last_released_diskquota_bin/diskquota-*.tar.gz) cmake /home/gpadmin/diskquota_src \ + -DDISKQUOTA_LAST_RELEASE_PATH="${last_release_path}" \ -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" cmake --build . --target create_artifact popd diff --git a/concourse/scripts/test_diskquota.sh b/concourse/scripts/test_diskquota.sh index 245196ffc..85b2bce15 100755 --- a/concourse/scripts/test_diskquota.sh +++ b/concourse/scripts/test_diskquota.sh @@ -38,6 +38,8 @@ function _main() { activate_standby time cmake --build . --target installcheck fi + # Run upgrade test (with standby master) + time cmake --build . --target upgradecheck popd } diff --git a/upgrade_test/CMakeLists.txt b/upgrade_test/CMakeLists.txt index 1e3a25628..6be68af64 100644 --- a/upgrade_test/CMakeLists.txt +++ b/upgrade_test/CMakeLists.txt @@ -32,17 +32,17 @@ regresstarget_add( exec_program( git ${CMAKE_SOURCE_DIR} ARGS - tag | sort --version-sort -r | head -n 1 + describe --abbrev=0 --tags OUTPUT_VARIABLE latest_tag ) # check whether DDL file (*.sql) is modified -file(GLOB ddl_files ${CMAKE_SOURCE_DIR}/*.sql) +file(GLOB ddl_files ${CMAKE_SOURCE_DIR}/control/ddl/*.sql) foreach(ddl IN LISTS ddl_files) cmake_path(GET ddl FILENAME ddl) exec_program( git ${CMAKE_SOURCE_DIR} ARGS - diff ${latest_tag} --exit-code ${ddl} + diff ${latest_tag} --exit-code control/ddl/${ddl} OUTPUT_VARIABLE NULL RETURN_VALUE "${ddl}_modified")