Skip to content

Commit

Permalink
[Dev] Update vendored ZSTD to v1.5.6 (duckdb#14360)
Browse files Browse the repository at this point in the history
This PR was sparked by work on new compression related functionality,
which made me notice that `ZDICT_trainFromBuffer_fastCover` was missing.

In an attempt to add the definition for that function, I was already
bringing in 6+ new files, so I figured I would spin it off in a new PR
that updates the entire ZSTD library we vendor to 1.5.6 (and adds the
missing function definitions + files)
  • Loading branch information
Mytherin authored Oct 18, 2024
2 parents d4a62a1 + 74164bb commit 4d19100
Show file tree
Hide file tree
Showing 77 changed files with 27,694 additions and 7,620 deletions.
52 changes: 52 additions & 0 deletions third_party/zstd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()

set(ZSTD_FILES
compress/zstd_compress_superblock.cpp
compress/zstdmt_compress.cpp
compress/zstd_double_fast.cpp
compress/zstd_fast.cpp
compress/zstd_compress_sequences.cpp
compress/zstd_ldm.cpp
compress/hist.cpp
compress/zstd_compress.cpp
compress/zstd_lazy.cpp
compress/zstd_compress_literals.cpp
compress/huf_compress.cpp
compress/zstd_opt.cpp
compress/fse_compress.cpp
decompress/zstd_ddict.cpp
decompress/huf_decompress.cpp
decompress/zstd_decompress.cpp
decompress/zstd_decompress_block.cpp
common/entropy_common.cpp
common/fse_decompress.cpp
common/debug.cpp
common/xxhash.cpp
common/pool.cpp
common/threading.cpp
common/zstd_common.cpp
common/error_private.cpp
dict/cover.cpp
dict/divsufsort.cpp
dict/fastcover.cpp
dict/zdict.cpp
deprecated/zbuff_common.cpp
deprecated/zbuff_decompress.cpp
deprecated/zbuff_compress.cpp
)

add_library(duckdb_zstd STATIC ${ZSTD_FILES})

target_include_directories(
duckdb_zstd
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
set_target_properties(duckdb_zstd PROPERTIES EXPORT_NAME duckdb_duckdb_zstd)

install(TARGETS duckdb_zstd
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")

disable_target_warnings(duckdb_zstd)
36 changes: 36 additions & 0 deletions third_party/zstd/common/debug.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* ******************************************************************
* debug
* Part of FSE library
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* You can contact the author at :
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */


/*
* This module only hosts one global variable
* which can be used to dynamically influence the verbosity of traces,
* such as DEBUGLOG and RAWLOG
*/

#include "zstd/common/debug.h"

#if !defined(ZSTD_LINUX_KERNEL) || (DEBUGLEVEL>=2)

namespace duckdb_zstd {

/* We only use this when DEBUGLEVEL>=2, but we get -Werror=pedantic errors if a
* translation unit is empty. So remove this from Linux kernel builds, but
* otherwise just leave it in.
*/
int g_debuglevel = DEBUGLEVEL;

} // namespace duckdb_zstd

#endif
Loading

0 comments on commit 4d19100

Please sign in to comment.