From fde0c2da0757941e8394b6046d4402b040f0d5ad Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin Date: Sun, 15 Feb 2026 14:35:59 +0100 Subject: [PATCH 1/7] ci: pin govulncheck to the latest it has issues with checkout fixed in current master --- .github/workflows/golvulncheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golvulncheck.yml b/.github/workflows/golvulncheck.yml index 363ee2f62..9cf7c3ba5 100644 --- a/.github/workflows/golvulncheck.yml +++ b/.github/workflows/golvulncheck.yml @@ -31,4 +31,4 @@ jobs: run: | go get -v -t -d ./... - id: govulncheck - uses: golang/govulncheck-action@v1 + uses: golang/govulncheck-action@5accf6f1b739690f60277e881531d59debe04a22 From a77709587a7616bb8562985d70b5540e6a4cf8eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:01:29 +0000 Subject: [PATCH 2/7] Initial plan From 97cb83b7d9f4ba9892e4a21edfb85d02483ebf59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:04:00 +0000 Subject: [PATCH 3/7] Initial plan for replacing cbrotli with pure Go brotli Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com> --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 91238a6ef..c6c5f4980 100644 --- a/go.mod +++ b/go.mod @@ -72,6 +72,7 @@ require ( require ( github.com/alibabacloud-go/debug v1.0.1 // indirect + github.com/andybalholm/brotli v1.2.0 // indirect github.com/containerd/errdefs v1.0.0 // indirect github.com/containerd/errdefs/pkg v0.3.0 // indirect github.com/containerd/log v0.1.0 // indirect diff --git a/go.sum b/go.sum index e7716b459..00a1833b1 100644 --- a/go.sum +++ b/go.sum @@ -79,6 +79,8 @@ github.com/aliyun/alibabacloud-oss-go-sdk-v2 v1.2.3 h1:LyeTJauAchnWdre3sAyterGrz github.com/aliyun/alibabacloud-oss-go-sdk-v2 v1.2.3/go.mod h1:FTzydeQVmR24FI0D6XWUOMKckjXehM/jgMn1xC+DA9M= github.com/aliyun/credentials-go v1.4.5 h1:O76WYKgdy1oQYYiJkERjlA2dxGuvLRrzuO2ScrtGWSk= github.com/aliyun/credentials-go v1.4.5/go.mod h1:Jm6d+xIgwJVLVWT561vy67ZRP4lPTQxMbEYRuT2Ti1U= +github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= +github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= From 5f6a6430024b46ad35ea98f3439f8cf19ed402a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:11:11 +0000 Subject: [PATCH 4/7] Replace CGO cbrotli with pure Go andybalholm/brotli implementation Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com> --- CMakeLists-brotli.txt | 377 -------------------- Makefile | 44 +-- go.mod | 3 +- go.sum | 4 +- internal/compression/brotli/compressor.go | 5 +- internal/compression/brotli/decompressor.go | 4 +- internal/compression/brotli_enabled.go | 4 +- link_brotli.sh | 27 -- 8 files changed, 24 insertions(+), 444 deletions(-) delete mode 100644 CMakeLists-brotli.txt delete mode 100755 link_brotli.sh diff --git a/CMakeLists-brotli.txt b/CMakeLists-brotli.txt deleted file mode 100644 index 0537f21b8..000000000 --- a/CMakeLists-brotli.txt +++ /dev/null @@ -1,377 +0,0 @@ -# Available CMake versions: -# - Ubuntu 20.04 LTS : 3.16.3 -# - Solaris 11.4 SRU 15 : 3.15 -cmake_minimum_required(VERSION 3.15) - -# Since this project's version is loaded from other files, this policy -# will help suppress the warning generated by cmake. -# This policy is set because we can't provide "VERSION" in "project" command. -# Use `cmake --help-policy CMP0048` for more information. -cmake_policy(SET CMP0048 NEW) -project(brotli C) - -option(BUILD_SHARED_LIBS "Build shared libraries" ON) -set(BROTLI_BUILD_TOOLS ON CACHE BOOL "Build/install CLI tools") - -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to Release as none was specified.") - set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE) -else() - message(STATUS "Build type is '${CMAKE_BUILD_TYPE}'") -endif() - -include(CheckCSourceCompiles) -check_c_source_compiles( - "#if defined(__EMSCRIPTEN__) - int main() {return 0;} - #endif" - BROTLI_EMSCRIPTEN -) -if (BROTLI_EMSCRIPTEN) - message("-- Compiler is EMSCRIPTEN") -else() - message("-- Compiler is not EMSCRIPTEN") -endif() - -# If Brotli is being bundled in another project, we don't want to -# install anything. However, we want to let people override this, so -# we'll use the BROTLI_BUNDLED_MODE variable to let them do that; just -# set it to OFF in your project before you add_subdirectory(brotli). -get_directory_property(BROTLI_PARENT_DIRECTORY PARENT_DIRECTORY) -if(NOT DEFINED BROTLI_BUNDLED_MODE) - # Bundled mode hasn't been set one way or the other, set the default - # depending on whether or not we are the top-level project. - if(BROTLI_PARENT_DIRECTORY) - set(BROTLI_BUNDLED_MODE ON) - else() - set(BROTLI_BUNDLED_MODE OFF) - endif() -endif() -mark_as_advanced(BROTLI_BUNDLED_MODE) - -include(GNUInstallDirs) - -# Reads macro from .h file; it is expected to be a single-line define. -function(read_macro PATH MACRO OUTPUT) - file(STRINGS ${PATH} _line REGEX "^#define +${MACRO} +(.+)$") - string(REGEX REPLACE "^#define +${MACRO} +(.+)$" "\\1" _val "${_line}") - set(${OUTPUT} ${_val} PARENT_SCOPE) -endfunction(read_macro) - -# Version information -read_macro("c/common/version.h" "BROTLI_VERSION_MAJOR" BROTLI_VERSION_MAJOR) -read_macro("c/common/version.h" "BROTLI_VERSION_MINOR" BROTLI_VERSION_MINOR) -read_macro("c/common/version.h" "BROTLI_VERSION_PATCH" BROTLI_VERSION_PATCH) -set(BROTLI_VERSION "${BROTLI_VERSION_MAJOR}.${BROTLI_VERSION_MINOR}.${BROTLI_VERSION_PATCH}") -mark_as_advanced(BROTLI_VERSION BROTLI_VERSION_MAJOR BROTLI_VERSION_MINOR BROTLI_VERSION_PATCH) - -# ABI Version information -read_macro("c/common/version.h" "BROTLI_ABI_CURRENT" BROTLI_ABI_CURRENT) -read_macro("c/common/version.h" "BROTLI_ABI_REVISION" BROTLI_ABI_REVISION) -read_macro("c/common/version.h" "BROTLI_ABI_AGE" BROTLI_ABI_AGE) -math(EXPR BROTLI_ABI_COMPATIBILITY "${BROTLI_ABI_CURRENT} - ${BROTLI_ABI_AGE}") -mark_as_advanced(BROTLI_ABI_CURRENT BROTLI_ABI_REVISION BROTLI_ABI_AGE BROTLI_ABI_COMPATIBILITY) - -if (ENABLE_SANITIZER) - set(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS} -fsanitize=${ENABLE_SANITIZER}") - set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${ENABLE_SANITIZER}") -endif () - -include(CheckLibraryExists) -set(LIBM_LIBRARY) -CHECK_LIBRARY_EXISTS(m log2 "" HAVE_LIB_M) -if(HAVE_LIB_M) - set(LIBM_LIBRARY "m") -endif() - -set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/c/include") -mark_as_advanced(BROTLI_INCLUDE_DIRS) - -set(BROTLI_LIBRARIES_CORE brotlienc brotlidec brotlicommon) -set(BROTLI_LIBRARIES ${BROTLI_LIBRARIES_CORE} ${LIBM_LIBRARY}) -mark_as_advanced(BROTLI_LIBRARIES) - -set(BROTLI_LIBRARIES_CORE_STATIC brotlienc-static brotlidec-static brotlicommon-static) -set(BROTLI_LIBRARIES_STATIC ${BROTLI_LIBRARIES_CORE_STATIC} ${LIBM_LIBRARY}) -mark_as_advanced(BROTLI_LIBRARIES_STATIC) - -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - add_definitions(-DOS_LINUX) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - add_definitions(-DOS_FREEBSD) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - add_definitions(-DOS_MACOSX) - set(CMAKE_MACOS_RPATH TRUE) - set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}") -endif() - -if(BROTLI_EMSCRIPTEN) - set(BUILD_SHARED_LIBS OFF) -endif() - -file(GLOB_RECURSE BROTLI_COMMON_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c/common/*.c) -add_library(brotlicommon ${BROTLI_COMMON_SOURCES}) - -file(GLOB_RECURSE BROTLI_DEC_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c/dec/*.c) -add_library(brotlidec ${BROTLI_DEC_SOURCES}) - -file(GLOB_RECURSE BROTLI_ENC_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} c/enc/*.c) -add_library(brotlienc ${BROTLI_ENC_SOURCES}) - -set(BROTLI_STATIC_LIBS brotlicommon-static brotlidec-static brotlienc-static) -add_library(brotlicommon-static STATIC ${BROTLI_COMMON_SOURCES}) -add_library(brotlidec-static STATIC ${BROTLI_DEC_SOURCES}) -add_library(brotlienc-static STATIC ${BROTLI_ENC_SOURCES}) - -# Older CMake versions does not understand INCLUDE_DIRECTORIES property. -include_directories(${BROTLI_INCLUDE_DIRS}) - -if(BUILD_SHARED_LIBS) - foreach(lib ${BROTLI_LIBRARIES_CORE}) - target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" ) - string(TOUPPER "${lib}" LIB) - set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION") - endforeach() -endif() - -foreach(lib ${BROTLI_LIBRARIES_CORE}) - target_link_libraries(${lib} ${LIBM_LIBRARY}) - set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS}) - set_target_properties(${lib} PROPERTIES - VERSION "${BROTLI_ABI_COMPATIBILITY}.${BROTLI_ABI_AGE}.${BROTLI_ABI_REVISION}" - SOVERSION "${BROTLI_ABI_COMPATIBILITY}") - if(NOT BROTLI_EMSCRIPTEN) - set_target_properties(${lib} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) - endif() - set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$") -endforeach() - -if(NOT BROTLI_EMSCRIPTEN) - target_link_libraries(brotlidec brotlicommon) - target_link_libraries(brotlienc brotlicommon) -endif() - -target_link_libraries(brotlidec-static brotlicommon-static) -target_link_libraries(brotlienc-static brotlicommon-static) - -# For projects stuck on older versions of CMake, this will set the -# BROTLI_INCLUDE_DIRS and BROTLI_LIBRARIES variables so they still -# have a relatively easy way to use Brotli: -# -# include_directories(${BROTLI_INCLUDE_DIRS}) -# target_link_libraries(foo ${BROTLI_LIBRARIES}) -if(BROTLI_PARENT_DIRECTORY) - set(BROTLI_INCLUDE_DIRS "${BROTLI_INCLUDE_DIRS}" PARENT_SCOPE) - set(BROTLI_LIBRARIES "${BROTLI_LIBRARIES}" PARENT_SCOPE) -endif() - -# Build the brotli executable -if(BROTLI_BUILD_TOOLS) - add_executable(brotli c/tools/brotli.c) - target_link_libraries(brotli ${BROTLI_LIBRARIES}) -endif() - -# Installation -if(NOT BROTLI_BUNDLED_MODE) - if (BROTLI_BUILD_TOOLS) - install( - TARGETS brotli - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ) - endif() - - install( - TARGETS ${BROTLI_LIBRARIES_CORE} - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ) - - install( - TARGETS ${BROTLI_LIBRARIES_CORE_STATIC} - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ) - - install( - DIRECTORY ${BROTLI_INCLUDE_DIRS}/brotli - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - ) -endif() # BROTLI_BUNDLED_MODE - -# Tests - -# Integration tests, those depend on `brotli` binary -if(NOT BROTLI_DISABLE_TESTS AND BROTLI_BUILD_TOOLS) - # If we're targeting Windows but not running on Windows, we need Wine - # to run the tests... - if(WIN32 AND NOT CMAKE_HOST_WIN32) - find_program(BROTLI_WRAPPER NAMES wine) - - if(NOT BROTLI_WRAPPER) - message(STATUS "wine not found, disabling tests") - set(BROTLI_DISABLE_TESTS TRUE) - endif() - endif() - # If our compiler is a cross-compiler that we know about (arm/aarch64), - # then we need to use qemu to execute the tests. - if ("${CMAKE_C_COMPILER}" MATCHES "^.*/arm-linux-gnueabihf-.*$") - message(STATUS "Detected arm-linux-gnueabihf cross-compilation") - set(BROTLI_WRAPPER "qemu-arm") - set(BROTLI_WRAPPER_LD_PREFIX "/usr/arm-linux-gnueabihf") - endif() - - if ("${CMAKE_C_COMPILER}" MATCHES "^.*/arm-linux-gnueabi-.*$") - message(STATUS "Detected arm-linux-gnueabi cross-compilation") - set(BROTLI_WRAPPER "qemu-arm") - set(BROTLI_WRAPPER_LD_PREFIX "/usr/arm-linux-gnueabi") - endif() - - if ("${CMAKE_C_COMPILER}" MATCHES "^.*/aarch64-linux-gnu-.*$") - message(STATUS "Detected aarch64-linux-gnu cross-compilation") - set(BROTLI_WRAPPER "qemu-aarch64") - set(BROTLI_WRAPPER_LD_PREFIX "/usr/aarch64-linux-gnu") - endif() - - include(CTest) - enable_testing() - - set(ROUNDTRIP_INPUTS - tests/testdata/alice29.txt - tests/testdata/asyoulik.txt - tests/testdata/lcet10.txt - tests/testdata/plrabn12.txt - c/enc/encode.c - c/common/dictionary.h - c/dec/decode.c) - - foreach(INPUT ${ROUNDTRIP_INPUTS}) - get_filename_component(OUTPUT_NAME "${INPUT}" NAME) - - set(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}") - set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}") - - if (EXISTS "${INPUT_FILE}") - foreach(quality 1 6 9 11) - add_test(NAME "${BROTLI_TEST_PREFIX}roundtrip/${INPUT}/${quality}" - COMMAND "${CMAKE_COMMAND}" - -DBROTLI_WRAPPER=${BROTLI_WRAPPER} - -DBROTLI_WRAPPER_LD_PREFIX=${BROTLI_WRAPPER_LD_PREFIX} - -DBROTLI_CLI=$ - -DQUALITY=${quality} - -DINPUT=${INPUT_FILE} - -DOUTPUT=${OUTPUT_FILE}.${quality} - -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/run-roundtrip-test.cmake) - endforeach() - else() - message(NOTICE "Test file ${INPUT} does not exist; OK on tarball builds; consider running scripts/download_testdata.sh before configuring.") - endif() - endforeach() - - file(GLOB_RECURSE - COMPATIBILITY_INPUTS - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - tests/testdata/*.compressed*) - - foreach(INPUT ${COMPATIBILITY_INPUTS}) - add_test(NAME "${BROTLI_TEST_PREFIX}compatibility/${INPUT}" - COMMAND "${CMAKE_COMMAND}" - -DBROTLI_WRAPPER=${BROTLI_WRAPPER} - -DBROTLI_WRAPPER_LD_PREFIX=${BROTLI_WRAPPER_LD_PREFIX} - -DBROTLI_CLI=$ - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/${INPUT} - -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/run-compatibility-test.cmake) - endforeach() -endif() # BROTLI_DISABLE_TESTS - -# Generate a pkg-config files - -function(generate_pkg_config_path outvar path) - string(LENGTH "${path}" path_length) - - set(path_args ${ARGV}) - list(REMOVE_AT path_args 0 1) - list(LENGTH path_args path_args_remaining) - - set("${outvar}" "${path}") - - while(path_args_remaining GREATER 1) - list(GET path_args 0 name) - list(GET path_args 1 value) - - get_filename_component(value_full "${value}" ABSOLUTE) - string(LENGTH "${value}" value_length) - - if(path_length EQUAL value_length AND path STREQUAL value) - set("${outvar}" "\${${name}}") - break() - elseif(path_length GREATER value_length) - # We might be in a subdirectory of the value, but we have to be - # careful about a prefix matching but not being a subdirectory - # (for example, /usr/lib64 is not a subdirectory of /usr/lib). - # We'll do this by making sure the next character is a directory - # separator. - string(SUBSTRING "${path}" ${value_length} 1 sep) - if(sep STREQUAL "/") - string(SUBSTRING "${path}" 0 ${value_length} s) - if(s STREQUAL value) - string(SUBSTRING "${path}" "${value_length}" -1 suffix) - set("${outvar}" "\${${name}}${suffix}") - break() - endif() - endif() - endif() - - list(REMOVE_AT path_args 0 1) - list(LENGTH path_args path_args_remaining) - endwhile() - - set("${outvar}" "${${outvar}}" PARENT_SCOPE) -endfunction(generate_pkg_config_path) - -function(transform_pc_file INPUT_FILE OUTPUT_FILE VERSION) - file(READ ${INPUT_FILE} TEXT) - - set(PREFIX "${CMAKE_INSTALL_PREFIX}") - string(REGEX REPLACE "@prefix@" "${PREFIX}" TEXT ${TEXT}) - string(REGEX REPLACE "@exec_prefix@" "${PREFIX}" TEXT ${TEXT}) - - generate_pkg_config_path(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}" prefix "${PREFIX}") - string(REGEX REPLACE "@libdir@" "${LIBDIR}" TEXT ${TEXT}) - - generate_pkg_config_path(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}" prefix "${PREFIX}") - string(REGEX REPLACE "@includedir@" "${INCLUDEDIR}" TEXT ${TEXT}) - - string(REGEX REPLACE "@PACKAGE_VERSION@" "${VERSION}" TEXT ${TEXT}) - - file(WRITE ${OUTPUT_FILE} ${TEXT}) -endfunction() - -transform_pc_file("scripts/libbrotlicommon.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libbrotlicommon.pc" "${BROTLI_VERSION}") - -transform_pc_file("scripts/libbrotlidec.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libbrotlidec.pc" "${BROTLI_VERSION}") - -transform_pc_file("scripts/libbrotlienc.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libbrotlienc.pc" "${BROTLI_VERSION}") - -if(NOT BROTLI_BUNDLED_MODE) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libbrotlicommon.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libbrotlidec.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libbrotlienc.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") -endif() # BROTLI_BUNDLED_MODE - -if (BROTLI_BUILD_TOOLS) - install(FILES "docs/brotli.1" - DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1") -endif() - -install(FILES docs/constants.h.3 docs/decode.h.3 docs/encode.h.3 docs/types.h.3 - DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man3") - -if (ENABLE_COVERAGE STREQUAL "yes") - setup_target_for_coverage(coverage test coverage) -endif() diff --git a/Makefile b/Makefile index c9599e4c8..63748a726 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,9 @@ endif .PHONY: unittest fmt lint clean install_tools -test: deps unittest pg_build mysql_build redis_build mongo_build gp_build cloudberry_build unlink_brotli pg_integration_test mysql_integration_test redis_integration_test fdb_integration_test gp_integration_test cloudberry_integration_test etcd_integration_test +test: deps unittest pg_build mysql_build redis_build mongo_build gp_build cloudberry_build pg_integration_test mysql_integration_test redis_integration_test fdb_integration_test gp_integration_test cloudberry_integration_test etcd_integration_test -pg_test: deps pg_build unlink_brotli pg_integration_test +pg_test: deps pg_build pg_integration_test pg_build: $(CMD_FILES) $(PKG_FILES) (cd $(MAIN_PG_PATH) && go build -mod vendor -tags "$(BUILD_TAGS)" -o wal-g -gcflags "$(BUILD_GCFLAGS)" -ldflags "-s -w -X github.com/wal-g/wal-g/cmd/pg.buildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd/pg.gitRevision=$(GIT_REVISION) -X github.com/wal-g/wal-g/cmd/pg.walgVersion=$(WALG_VERSION)") @@ -130,8 +130,8 @@ pg_clean: pg_install: pg_build mv $(MAIN_PG_PATH)/wal-g $(GOBIN)/wal-g -mysql_base: deps mysql_build unlink_brotli -mysql_test: deps mysql_build unlink_brotli mysql_integration_test +mysql_base: deps mysql_build +mysql_test: deps mysql_build mysql_integration_test mysql_build: $(CMD_FILES) $(PKG_FILES) (cd $(MAIN_MYSQL_PATH) && go build -mod vendor -tags "$(BUILD_TAGS)" -o wal-g -gcflags "$(BUILD_GCFLAGS)" -ldflags "-s -w -X github.com/wal-g/wal-g/cmd/mysql.buildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd/mysql.gitRevision=$(GIT_REVISION) -X github.com/wal-g/wal-g/cmd/mysql.walgVersion=$(WALG_VERSION)") @@ -149,12 +149,11 @@ load_docker_common: docker load -i ${CACHE_FILE_GOLANG};\ fi -mysql_integration_test: deps mysql_build unlink_brotli load_docker_common - ./link_brotli.sh +mysql_integration_test: deps mysql_build load_docker_common docker compose build mysql && docker compose build $(MYSQL_TEST) docker compose up --force-recreate --exit-code-from $(MYSQL_TEST) $(MYSQL_TEST) -mysql8_integration_test: go_deps unlink_brotli load_docker_common +mysql8_integration_test: go_deps load_docker_common docker compose build mysql8 && docker compose build $(MYSQL8_TEST) docker compose up --force-recreate --exit-code-from $(MYSQL8_TEST) $(MYSQL8_TEST) @@ -165,14 +164,13 @@ mysql_clean: mysql_install: mysql_build mv $(MAIN_MYSQL_PATH)/wal-g $(GOBIN)/wal-g -mariadb_test: deps mysql_build unlink_brotli mariadb_integration_test +mariadb_test: deps mysql_build mariadb_integration_test -mariadb_integration_test: unlink_brotli load_docker_common - ./link_brotli.sh +mariadb_integration_test: load_docker_common docker compose build mariadb && docker compose build mariadb_tests docker compose up --force-recreate --exit-code-from mariadb_tests mariadb_tests -mongo_test: deps mongo_build unlink_brotli +mongo_test: deps mongo_build mongo_build: $(CMD_FILES) $(PKG_FILES) (cd $(MAIN_MONGO_PATH) && go build $(BUILD_ARGS) -mod vendor -tags "$(BUILD_TAGS)" -o wal-g -gcflags "$(BUILD_GCFLAGS)" -ldflags "-s -w -X github.com/wal-g/wal-g/cmd/mongo.buildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd/mongo.gitRevision=$(GIT_REVISION) -X github.com/wal-g/wal-g/cmd/mongo.walgVersion=$(WALG_VERSION)") @@ -212,7 +210,7 @@ fdb_integration_test: load_docker_common docker compose build fdb_tests docker compose up --force-recreate --renew-anon-volumes --exit-code-from fdb_tests fdb_tests -redis_test: deps redis_build unlink_brotli redis_integration_test +redis_test: deps redis_build redis_integration_test redis_build: $(CMD_FILES) $(PKG_FILES) (cd $(MAIN_REDIS_PATH) && go build -mod vendor -tags "$(BUILD_TAGS)" -o wal-g -gcflags "$(BUILD_GCFLAGS)" -ldflags "-s -w -X github.com/wal-g/wal-g/cmd/redis.buildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd/redis.gitRevision=$(GIT_REVISION) -X github.com/wal-g/wal-g/cmd/redis.walgVersion=$(WALG_VERSION)") @@ -237,7 +235,7 @@ clean_redis_features: set -e cd tests_func/ && REDIS_VERSION=$(REDIS_VERSION) go test -v -count=1 -timeout 5m --tf.test=false --tf.debug=false --tf.clean=true --tf.stop=true --tf.database=redis -etcd_test: deps etcd_build unlink_brotli etcd_integration_test +etcd_test: deps etcd_build etcd_integration_test etcd_build: $(CMD_FILES) $(PKG_FILES) (cd $(MAIN_ETCD_PATH) && go build -mod vendor -tags "$(BUILD_TAGS)" -o wal-g -gcflags "$(BUILD_GCFLAGS)" -ldflags "-s -w -X github.com/wal-g/wal-g/cmd/etcd.buildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd/etcd.gitRevision=$(GIT_REVISION) -X github.com/wal-g/wal-g/cmd/etcd.walgVersion=$(WALG_VERSION)") @@ -265,7 +263,7 @@ gp_clean: gp_install: gp_build mv $(MAIN_GP_PATH)/wal-g $(GOBIN)/wal-g -gp_test: deps gp_build unlink_brotli gp_integration_test +gp_test: deps gp_build gp_integration_test gp_integration_test: load_docker_common docker compose build gp @@ -278,14 +276,14 @@ cloudberry_clean: gp_clean cloudberry_install: gp_install -cloudberry_test: deps cloudberry_build unlink_brotli cloudberry_integration_test +cloudberry_test: deps cloudberry_build cloudberry_integration_test cloudberry_integration_test: load_docker_common docker compose build cloudberry docker compose build cloudberry_tests docker compose up s3 cloudberry_tests --force-recreate --exit-code-from cloudberry_tests -st_test: deps pg_build unlink_brotli st_integration_test +st_test: deps pg_build st_integration_test st_integration_test: load_docker_common docker compose build st_tests @@ -328,33 +326,23 @@ deps: go_deps link_external_deps go_deps: git submodule update --init - cp CMakeLists-brotli.txt submodules/brotli/CMakeLists.txt go mod vendor ifdef USE_LZO sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' vendor/github.com/cyberdelia/lzo/lzo.go endif -link_external_deps: link_brotli link_libsodium +link_external_deps: link_libsodium -unlink_external_deps: unlink_brotli unlink_libsodium +unlink_external_deps: unlink_libsodium install: @echo "Nothing to be done. Use pg_install/mysql_install/mongo_install/fdb_install/gp_install/etcd_install... instead." -link_brotli: - @if [ -n "${USE_BROTLI}" ]; then ./link_brotli.sh; fi - @if [ -z "${USE_BROTLI}" ]; then echo "info: USE_BROTLI is not set, skipping 'link_brotli' task"; fi - link_libsodium: @if [ ! -z "${USE_LIBSODIUM}" ]; then\ ./link_libsodium.sh;\ fi -unlink_brotli: - rm -rf vendor/github.com/google/brotli/* - if [ -n "${USE_BROTLI}" ] ; then mv tmp/brotli/* vendor/github.com/google/brotli/; fi - rm -rf tmp/brotli - unlink_libsodium: rm -rf tmp/libsodium diff --git a/go.mod b/go.mod index c6c5f4980..a8a568105 100644 --- a/go.mod +++ b/go.mod @@ -54,8 +54,8 @@ require ( github.com/ProtonMail/go-crypto v1.3.0 github.com/aliyun/alibabacloud-oss-go-sdk-v2 v1.2.3 github.com/aliyun/credentials-go v1.4.5 + github.com/andybalholm/brotli v1.2.0 github.com/cactus/go-statsd-client/v5 v5.0.0 - github.com/google/brotli/go/cbrotli v0.0.0-20220110100810-f4153a09f87c github.com/klauspost/compress v1.18.2 github.com/mongodb/mongo-tools v0.0.0-20240724183527-6d4f001be3fc github.com/ncw/directio v1.0.5 @@ -72,7 +72,6 @@ require ( require ( github.com/alibabacloud-go/debug v1.0.1 // indirect - github.com/andybalholm/brotli v1.2.0 // indirect github.com/containerd/errdefs v1.0.0 // indirect github.com/containerd/errdefs/pkg v0.3.0 // indirect github.com/containerd/log v0.1.0 // indirect diff --git a/go.sum b/go.sum index 00a1833b1..c069a10e3 100644 --- a/go.sum +++ b/go.sum @@ -266,8 +266,6 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/brotli/go/cbrotli v0.0.0-20220110100810-f4153a09f87c h1:r47YgJ24CPvKxwxxHYPuE+FX1GgNtV93E7uaknKW0HU= -github.com/google/brotli/go/cbrotli v0.0.0-20220110100810-f4153a09f87c/go.mod h1:nOPhAkwVliJdNTkj3gXpljmWhjc4wCaVqbMJcPKWP4s= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -675,6 +673,8 @@ github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3k github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= +github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yandex-cloud/go-genproto v0.0.0-20230918115514-93a99045c9de h1:BZxUcHNdLoxwiFWQoTY5pmOmdGiHdjmpsITBCSBCYw8= github.com/yandex-cloud/go-genproto v0.0.0-20230918115514-93a99045c9de/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE= github.com/yandex-cloud/go-sdk v0.0.0-20230918120620-9e95f0816d79 h1:LhStDM3zogjx+lUW3O90jakeLnRwSCsaPfRkPFMdpnA= diff --git a/internal/compression/brotli/compressor.go b/internal/compression/brotli/compressor.go index 1e6930e95..93899e97f 100644 --- a/internal/compression/brotli/compressor.go +++ b/internal/compression/brotli/compressor.go @@ -6,9 +6,8 @@ package brotli import ( "io" + "github.com/andybalholm/brotli" "github.com/wal-g/wal-g/internal/ioextensions" - - "github.com/google/brotli/go/cbrotli" ) const ( @@ -19,7 +18,7 @@ const ( type Compressor struct{} func (compressor Compressor) NewWriter(writer io.Writer) ioextensions.WriteFlushCloser { - return cbrotli.NewWriter(writer, cbrotli.WriterOptions{Quality: 3}) + return brotli.NewWriterLevel(writer, 3) } func (compressor Compressor) FileExtension() string { diff --git a/internal/compression/brotli/decompressor.go b/internal/compression/brotli/decompressor.go index 246255c1d..fd50d5a96 100644 --- a/internal/compression/brotli/decompressor.go +++ b/internal/compression/brotli/decompressor.go @@ -6,14 +6,14 @@ package brotli import ( "io" - "github.com/google/brotli/go/cbrotli" + "github.com/andybalholm/brotli" "github.com/wal-g/wal-g/internal/compression/computils" ) type Decompressor struct{} func (decompressor Decompressor) Decompress(src io.Reader) (io.ReadCloser, error) { - return cbrotli.NewReader(computils.NewUntilEOFReader(src)), nil + return io.NopCloser(brotli.NewReader(computils.NewUntilEOFReader(src))), nil } func (decompressor Decompressor) FileExtension() string { diff --git a/internal/compression/brotli_enabled.go b/internal/compression/brotli_enabled.go index 22a29e0f1..3803c5be4 100644 --- a/internal/compression/brotli_enabled.go +++ b/internal/compression/brotli_enabled.go @@ -1,7 +1,5 @@ -//go:build brotli && !windows && !(darwin && arm64) +//go:build brotli // +build brotli -// +build !windows -// +build !darwin !arm64 package compression diff --git a/link_brotli.sh b/link_brotli.sh deleted file mode 100755 index 096ce1305..000000000 --- a/link_brotli.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -set -e - -test -d tmp/brotli || mkdir -p tmp/brotli - -cp -rf vendor/github.com/google/brotli/* tmp/brotli/ -cp -rf submodules/brotli/* vendor/github.com/google/brotli/ - -readonly CWD=$PWD - -cd vendor/github.com/google/brotli/go/cbrotli - -readonly LIB_DIR=../../dist # dist will contain binaries and it is in the google/brotli/.gitignore - -# patch cgo.go to force usage of static libraries for linking -sed -i -e "s|#cgo LDFLAGS: -lbrotlicommon|#cgo CFLAGS: -I../../c/include|" cgo.go -sed -i -e "s|\(#cgo LDFLAGS:\) \(-lbrotli.*\)|\1 -L$LIB_DIR \2-static -lbrotlicommon-static|" cgo.go -sed -i -e "/ -lm$/ n; /brotlienc/ s|$| -lm|" cgo.go - -mkdir -p ${LIB_DIR} - -cd ${LIB_DIR} -cmake .. -make - -cd ${CWD} \ No newline at end of file From 5daeae63458981fc6b812320a542e94d667837f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:03:55 +0000 Subject: [PATCH 5/7] Fix: Remove non-existent brotli CGo file from Dockerfile sed command Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com> --- docker/pg_tests/Dockerfile_prefix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/pg_tests/Dockerfile_prefix b/docker/pg_tests/Dockerfile_prefix index bd66039a4..05c61ed48 100644 --- a/docker/pg_tests/Dockerfile_prefix +++ b/docker/pg_tests/Dockerfile_prefix @@ -15,9 +15,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' \ +RUN sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' \ vendor/github.com/cyberdelia/lzo/lzo.go RUN --mount=type=cache,target=/gocache cd main/pg && GOCACHE=/gocache \ go build -mod vendor -race -o wal-g -tags "brotli lzo" -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" From 465c985047a752d51d5371cacf94b7c707c5cb9b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 20:56:02 +0000 Subject: [PATCH 6/7] Fix: Remove obsolete brotli CGo sed patches from all Dockerfiles Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com> --- docker/etcd_tests/Dockerfile | 6 ++---- docker/fdb_tests/Dockerfile | 4 +--- docker/mysql_tests/Dockerfile | 4 +--- docker/mysql_tests/Dockerfile_base | 4 +--- docker/mysql_tests/Dockerfile_copy | 4 +--- docker/mysql_tests/Dockerfile_delete | 4 +--- docker/orioledb/Dockerfile | 4 +--- docker/redis_tests/Dockerfile | 4 +--- docker/st_tests/Dockerfile | 4 +--- 9 files changed, 10 insertions(+), 28 deletions(-) diff --git a/docker/etcd_tests/Dockerfile b/docker/etcd_tests/Dockerfile index 96396f2a3..94c52c2a7 100644 --- a/docker/etcd_tests/Dockerfile +++ b/docker/etcd_tests/Dockerfile @@ -25,10 +25,8 @@ RUN cd tmp/brotli && \ cmake .. && \ make && make install -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/etcd && \ - go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" +RUN cd main/etcd && \ + go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" RUN make etcd_build diff --git a/docker/fdb_tests/Dockerfile b/docker/fdb_tests/Dockerfile index 13fd8612c..0d6dc1a4a 100644 --- a/docker/fdb_tests/Dockerfile +++ b/docker/fdb_tests/Dockerfile @@ -15,9 +15,7 @@ COPY utility/ utility/ COPY Makefile Makefile ENV USE_BROTLI=1 -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/fdb && \ +RUN cd main/fdb && \ go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" RUN make fdb_build diff --git a/docker/mysql_tests/Dockerfile b/docker/mysql_tests/Dockerfile index 890df6840..db5a235ea 100644 --- a/docker/mysql_tests/Dockerfile +++ b/docker/mysql_tests/Dockerfile @@ -10,9 +10,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/mysql && \ +RUN cd main/mysql && \ go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" FROM wal-g/mysql:latest diff --git a/docker/mysql_tests/Dockerfile_base b/docker/mysql_tests/Dockerfile_base index 7857d042c..c992c3754 100644 --- a/docker/mysql_tests/Dockerfile_base +++ b/docker/mysql_tests/Dockerfile_base @@ -10,9 +10,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/mysql && \ +RUN cd main/mysql && \ go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" FROM wal-g/mysql:latest diff --git a/docker/mysql_tests/Dockerfile_copy b/docker/mysql_tests/Dockerfile_copy index 750356e24..07b0c671e 100644 --- a/docker/mysql_tests/Dockerfile_copy +++ b/docker/mysql_tests/Dockerfile_copy @@ -10,9 +10,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/mysql && \ +RUN cd main/mysql && \ go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" FROM wal-g/mysql:latest diff --git a/docker/mysql_tests/Dockerfile_delete b/docker/mysql_tests/Dockerfile_delete index 6f405305e..f19b8b425 100644 --- a/docker/mysql_tests/Dockerfile_delete +++ b/docker/mysql_tests/Dockerfile_delete @@ -10,9 +10,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/mysql && \ +RUN cd main/mysql && \ go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" FROM wal-g/mysql:latest diff --git a/docker/orioledb/Dockerfile b/docker/orioledb/Dockerfile index 6fee69b15..9f3d6a905 100644 --- a/docker/orioledb/Dockerfile +++ b/docker/orioledb/Dockerfile @@ -14,9 +14,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' \ +RUN sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' \ vendor/github.com/cyberdelia/lzo/lzo.go RUN --mount=type=cache,target=/gocache cd main/pg && GOCACHE=/gocache \ go build -mod vendor -race -o wal-g -tags "brotli lzo" -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" diff --git a/docker/redis_tests/Dockerfile b/docker/redis_tests/Dockerfile index 1b87a32d4..ab2058c13 100644 --- a/docker/redis_tests/Dockerfile +++ b/docker/redis_tests/Dockerfile @@ -14,9 +14,7 @@ COPY main/ main/ COPY utility/ utility/ ENV USE_BROTLI=1 -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - cd main/redis && \ +RUN cd main/redis && \ go build -mod vendor -tags brotli -race -o wal-g -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" FROM wal-g/redis:latest diff --git a/docker/st_tests/Dockerfile b/docker/st_tests/Dockerfile index 2413c7622..1ad4a9968 100644 --- a/docker/st_tests/Dockerfile +++ b/docker/st_tests/Dockerfile @@ -14,9 +14,7 @@ COPY cmd/ cmd/ COPY main/ main/ COPY utility/ utility/ -RUN sed -i 's|#cgo LDFLAGS: -lbrotli.*|&-static -lbrotlicommon-static -lm|' \ - vendor/github.com/google/brotli/go/cbrotli/cgo.go && \ - sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' \ +RUN sed -i 's|\(#cgo LDFLAGS:\) .*|\1 -Wl,-Bstatic -llzo2 -Wl,-Bdynamic|' \ vendor/github.com/cyberdelia/lzo/lzo.go && \ cd main/pg && \ go build -mod vendor -race -o wal-g -tags "brotli lzo" -ldflags "-s -w -X main.buildDate=`date -u +%Y.%m.%d_%H:%M:%S`" From 289fdcf74e4c037984377f53558a07d5cdbda919 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 22:58:14 +0000 Subject: [PATCH 7/7] Fix pg_receive_wal_test: stop postgres before wal-verify, handle NoticeResponse gracefully Co-authored-by: chipitsine <2217296+chipitsine@users.noreply.github.com> --- .../scripts/tests/test_functions/test_receive_wal.sh | 5 +++-- internal/databases/postgres/wal_segment.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/pg_tests/scripts/tests/test_functions/test_receive_wal.sh b/docker/pg_tests/scripts/tests/test_functions/test_receive_wal.sh index bb388b71c..b0c313d98 100755 --- a/docker/pg_tests/scripts/tests/test_functions/test_receive_wal.sh +++ b/docker/pg_tests/scripts/tests/test_functions/test_receive_wal.sh @@ -8,15 +8,16 @@ test_receive_wal() pg_ctl -D ${PGDATA} -w start wal-g --config=${TMP_CONFIG} wal-receive & + WAL_RECEIVE_PID=$! pgbench -i -s 5 postgres pg_dumpall -f /tmp/dump1 pgbench -c 2 -T 10 -S - sleep 1 + pg_ctl -D ${PGDATA} -w stop -m fast + wait $WAL_RECEIVE_PID || true VERIFY_OUTPUT=$(mktemp) # Verify and store in temp file wal-g --config=${TMP_CONFIG} wal-verify integrity > "${VERIFY_OUTPUT}" - pg_ctl -D ${PGDATA} -w stop -m immediate # parse verify results VERIFY_RESULT=$(awk 'BEGIN{FS=":"}$1~/integrity check status/{print $2}' $VERIFY_OUTPUT) diff --git a/internal/databases/postgres/wal_segment.go b/internal/databases/postgres/wal_segment.go index 79cd77603..9c3cbb213 100644 --- a/internal/databases/postgres/wal_segment.go +++ b/internal/databases/postgres/wal_segment.go @@ -152,6 +152,9 @@ func (seg *WalSegment) processMessage(message pgproto3.BackendMessage) (ProcessM } case *pgproto3.CopyDone: return ProcessMessageCopyDone, nil + case *pgproto3.NoticeResponse: + tracelog.WarningLogger.Printf("Received notice from server: %s\n", msg.Message) + return ProcessMessageOK, nil default: return ProcessMessageUnknown, segmentError{errors.Errorf("Received unexpected message: %#v\n", msg)} }