facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.27k stars 1.08k forks source link

Patching DDB fails after changing git branches #10252

Open kgpai opened 2 weeks ago

kgpai commented 2 weeks ago

Problem description

Very frequently when I change my git branches, I get DDB patching errors like shown below on my CLion. The only way to resolve this seems to nuke my build directory and start afresh.

System information

Velox System Info v0.0.2 Commit: 8e5fae37e4161ea65af635b6d2aa859be2b27fa3 CMake Version: 3.29.1 System: Darwin-23.4.0 Arch: arm64 C++ Compiler: /Library/Developer/CommandLineTools/usr/bin/c++ C++ Compiler Version: 15.0.0.15000309 C Compiler: /Library/Developer/CommandLineTools/usr/bin/cc C Compiler Version: 15.0.0.15000309 CMake Prefix Path: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr;/Users/kpai/homebrew;/usr/local;/usr;/;/Users/kpai/homebrew/Cellar/cmake/3.29.1;/usr/local;/usr/X11R6;/usr/pkg;/opt;/sw;/opt/local

Conda Env

``` # packages in environment at /opt/homebrew/Caskroom/miniconda/base: # # Name Version Build Channel abseil-cpp 20230802.0 h313beb8_2 alabaster 0.7.13 pypi_0 pypi arrow-cpp 14.0.2 hc7aafb3_1 aws-c-auth 0.6.19 h80987f9_0 aws-c-cal 0.5.20 h80987f9_0 aws-c-common 0.8.5 h80987f9_0 aws-c-compression 0.2.16 h80987f9_0 aws-c-event-stream 0.2.15 h313beb8_0 aws-c-http 0.6.25 h80987f9_0 aws-c-io 0.13.10 h80987f9_0 aws-c-mqtt 0.7.13 h80987f9_0 aws-c-s3 0.1.51 h80987f9_0 aws-c-sdkutils 0.1.6 h80987f9_0 aws-checksums 0.1.13 h80987f9_0 aws-crt-cpp 0.18.16 h313beb8_0 aws-sdk-cpp 1.10.55 h313beb8_0 babel 2.12.1 pypi_0 pypi blas 2.121 openblas conda-forge blas-devel 3.9.0 21_osxarm64_openblas conda-forge boost-cpp 1.82.0 h48ca7d4_2 brotli 1.0.9 h1a28f6b_7 brotli-bin 1.0.9 h1a28f6b_7 brotlipy 0.7.0 py310h1a28f6b_1002 bzip2 1.0.8 h620ffc9_4 c-ares 1.19.1 h80987f9_0 ca-certificates 2024.3.11 hca03da5_0 certifi 2024.2.2 py310hca03da5_0 cffi 1.15.1 py310h80987f9_3 charset-normalizer 2.0.4 pyhd3eb1b0_0 chevron 0.14.0 pypi_0 pypi clang-format 16.0.0 pypi_0 pypi cmake-format 0.6.13 pypi_0 pypi cmakelang 0.6.13 pypi_0 pypi conda 23.1.0 py310hca03da5_0 conda-content-trust 0.1.3 py310hca03da5_0 conda-package-handling 2.0.2 py310hca03da5_0 conda-package-streaming 0.7.0 py310hca03da5_0 cryptography 38.0.4 py310h834c97f_0 docutils 0.20.1 pypi_0 pypi gflags 2.2.2 h313beb8_1 glog 0.5.0 h313beb8_1 grpc-cpp 1.48.2 hc60591f_4 gtest 1.14.0 h48ca7d4_0 icu 73.1 h313beb8_0 idna 3.4 py310hca03da5_0 imagesize 1.4.1 pypi_0 pypi jinja2 3.1.2 pypi_0 pypi krb5 1.20.1 hf3e1bf2_1 libblas 3.9.0 21_osxarm64_openblas conda-forge libboost 1.82.0 h0bc93f9_2 libbrotlicommon 1.0.9 h1a28f6b_7 libbrotlidec 1.0.9 h1a28f6b_7 libbrotlienc 1.0.9 h1a28f6b_7 libcblas 3.9.0 21_osxarm64_openblas conda-forge libcurl 8.5.0 h3e2b118_0 libcxx 14.0.6 h848a8c0_0 libedit 3.1.20230828 h80987f9_0 libev 4.33 h1a28f6b_1 libevent 2.1.12 h02f6b3c_1 libffi 3.4.2 hca03da5_6 libgfortran 5.0.0 13_2_0_hd922786_3 conda-forge libgfortran5 13.2.0 hf226fd6_3 conda-forge libiconv 1.16 h1a28f6b_2 liblapack 3.9.0 21_osxarm64_openblas conda-forge liblapacke 3.9.0 21_osxarm64_openblas conda-forge libnghttp2 1.57.0 h62f6fdd_0 libopenblas 0.3.26 openmp_h6c19121_0 conda-forge libprotobuf 3.20.3 h514c7bf_0 libssh2 1.10.0 h02f6b3c_2 libthrift 0.15.0 h73c2103_2 llvm-openmp 18.1.1 hcd81f8e_0 conda-forge lz4-c 1.9.4 h313beb8_0 markupsafe 2.1.3 pypi_0 pypi mypy-extensions 1.0.0 pypi_0 pypi ncurses 6.4 h313beb8_0 numpy 1.25.1 pypi_0 pypi numpy-base 1.26.4 py310ha9811e2_0 openblas 0.3.26 openmp_h55c453e_0 conda-forge openssl 3.0.13 h1a28f6b_0 orc 1.7.4 hdca1487_1 packaging 23.1 pypi_0 pypi pip 22.3.1 py310hca03da5_0 pluggy 1.0.0 py310hca03da5_1 pyarrow 12.0.1 pypi_0 pypi pycosat 0.6.4 py310h1a28f6b_0 pycparser 2.21 pyhd3eb1b0_0 pygments 2.15.1 pypi_0 pypi pyopenssl 22.0.0 pyhd3eb1b0_0 pysocks 1.7.1 py310hca03da5_0 python 3.10.13 hb885b13_0 python.app 3 py310h1a28f6b_0 pyyaml 6.0.1 pypi_0 pypi re2 2022.04.01 hc377ac9_0 readline 8.2 h1a28f6b_0 regex 2023.3.23 pypi_0 pypi requests 2.28.1 py310hca03da5_0 ruamel.yaml 0.17.21 py310h1a28f6b_0 ruamel.yaml.clib 0.2.6 py310h1a28f6b_1 setuptools 65.6.3 py310hca03da5_0 six 1.16.0 pyhd3eb1b0_1 snappy 1.1.10 h313beb8_1 snowballstemmer 2.2.0 pypi_0 pypi sphinx 7.0.1 pypi_0 pypi sphinxcontrib-applehelp 1.0.4 pypi_0 pypi sphinxcontrib-devhelp 1.0.2 pypi_0 pypi sphinxcontrib-htmlhelp 2.0.1 pypi_0 pypi sphinxcontrib-jsmath 1.0.1 pypi_0 pypi sphinxcontrib-qthelp 1.0.3 pypi_0 pypi sphinxcontrib-serializinghtml 1.1.5 pypi_0 pypi sqlite 3.41.2 h80987f9_0 tabulate 0.9.0 pypi_0 pypi tk 8.6.12 hb8d0fd4_0 toolz 0.12.0 py310hca03da5_0 tqdm 4.64.1 py310hca03da5_0 typing 3.7.4.3 pypi_0 pypi typing-extensions 4.7.1 pypi_0 pypi typing-inspect 0.9.0 pypi_0 pypi tzdata 2022g h04d1e81_0 urllib3 1.26.14 py310hca03da5_0 utf8proc 2.6.1 h80987f9_1 wheel 0.37.1 pyhd3eb1b0_0 xz 5.4.6 h80987f9_0 zlib 1.2.13 h5a0b063_0 zstandard 0.18.0 py310h1a28f6b_0 zstd 1.5.5 hd90d995_0 ```

CMake log

error: patch failed: clion-debug-17/_deps/duckdb-src/CMakeLists.txt:32
error: clion-debug-17/_deps/duckdb-src/CMakeLists.txt: patch does not apply
FAILED: duckdb-populate-prefix/src/duckdb-populate-stamp/duckdb-populate-patch /Users/kpai/src/velox/clion-debug-17/_deps/duckdb-subbuild/duckdb-populate-prefix/src/duckdb-populate-stamp/duckdb-populate-patch 
cd /Users/kpai/src/velox/clion-debug-17/_deps/duckdb-src && git apply /Users/kpai/src/velox/CMake/resolve_dependency_modules/duckdb/remove-ccache.patch && git apply /Users/kpai/src/velox/CMake/resolve_dependency_modules/duckdb/fix-duckdbversion.patch && git apply /Users/kpai/src/velox/CMake/resolve_dependency_modules/duckdb/re2.patch && /Users/kpai/homebrew/Cellar/cmake/3.29.1/bin/cmake -E touch /Users/kpai/src/velox/clion-debug-17/_deps/duckdb-subbuild/duckdb-populate-prefix/src/duckdb-populate-stamp/duckdb-populate-patch
ninja: build stopped: subcommand failed.

CMake Error at /Users/kpai/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/FetchContent.cmake:1714 (message):
  Build step for duckdb failed: 1
Call Stack (most recent call first):
  /Users/kpai/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/FetchContent.cmake:1854:EVAL:2 (__FetchContent_directPopulate)
  /Users/kpai/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/FetchContent.cmake:1854 (cmake_language)
  /Users/kpai/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/FetchContent.cmake:2081 (FetchContent_Populate)
  CMake/resolve_dependency_modules/duckdb.cmake:49 (FetchContent_MakeAvailable)
  CMake/ResolveDependency.cmake:43 (include)
  CMake/ResolveDependency.cmake:75 (build_dependency)
  CMakeLists.txt:403 (resolve_dependency)

-- Configuring incomplete, errors occurred!
FAILED: build.ninja
kgpai commented 2 weeks ago

cc: @assignUser

majetideepak commented 1 week ago

@kgpai this is a limitation of CMake's apply patch. It applies all the patches if it sees a change in the patch command. The way around is to keep all the branches in sync with latest main and nuke the _deps/duckdb* folder once.