Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to run upgrade test #21

Open
wants to merge 6 commits into
base: gpdb
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ".")
Expand All @@ -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()
21 changes: 18 additions & 3 deletions arenadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine.
2. Prepare diskquota-<LAST_DISKQUOTA_TAG>.tar.gz which must contains all <MAJOR>.<MINOR> versions of diskquota. For each versions you need to use last tag (see `git tag`). Name of this archive must be `diskquota-<LAST_DISKQUOTA_TAG>.tar.gz`, where <LAST_DISKQUOTA_TAG> 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 <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine. <LAST_DISKQUOTA_TAG> is the same as at step 2. If upgrade test is disabled, line with <PATH_TO_ARCHIVE_WITH_OLD_VERSIONS> is not needed.

```
docker run --rm -it -e DISKQUOTA_OS=rhel7 \
-v /tmp/diskquota_artifacts:/home/gpadmin/diskquota_artifacts \
-v <PATH_TO_DISKQUOTA_SRC>:/home/gpadmin/diskquota_src \
-v <PATH_TO_CMAKE_INSTALL_SCRIPT>:/home/gpadmin/bin_cmake/cmake-3.20.0-linux-x86_64.sh \
-v <PATH_TO_ARCHIVE_WITH_OLD_VERSIONS>:/home/gpadmin/last_released_diskquota_bin/diskquota-<LAST_DISKQUOTA_TAG>.tar.gz \
hub.adsw.io/library/gpdb6_regress:latest diskquota_src/concourse/scripts/entry.sh build
```

3. Run tests.
4. Run tests.
Change <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine.

```
Expand Down
3 changes: 3 additions & 0 deletions concourse/scripts/build_diskquota.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions concourse/scripts/test_diskquota.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions upgrade_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down