From 0e42ee4d1283b12eef8f6c443022d78dfaf5396d Mon Sep 17 00:00:00 2001 From: Stepan Bagritsevich Date: Wed, 8 Jan 2025 21:40:57 +0100 Subject: [PATCH] fix(json): Revert new jsoncons version fixes dragonflydb#4391 Signed-off-by: Stepan Bagritsevich --- src/CMakeLists.txt | 4 +++- src/core/compact_object.cc | 7 ------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4f15e2af2fb8..b0611d0dc122 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,8 +74,10 @@ set(REFLEX "${THIRD_PARTY_LIB_DIR}/reflex/bin/reflex") add_third_party( jsoncons GIT_REPOSITORY https://github.com/dragonflydb/jsoncons - GIT_TAG Dragonfly.178 + # URL https://github.com/danielaparker/jsoncons/archive/refs/tags/v0.171.1.tar.gz + GIT_TAG Dragonfly GIT_SHALLOW 1 + # PATCH_COMMAND patch -p1 -i "${CMAKE_SOURCE_DIR}/patches/jsoncons-v0.171.0.patch" CMAKE_PASS_FLAGS "-DJSONCONS_BUILD_TESTS=OFF -DJSONCONS_HAS_POLYMORPHIC_ALLOCATOR=ON" LIB "none" ) diff --git a/src/core/compact_object.cc b/src/core/compact_object.cc index 9b79315ed192..261a7f4bdfbd 100644 --- a/src/core/compact_object.cc +++ b/src/core/compact_object.cc @@ -878,9 +878,6 @@ void CompactObj::SetJson(JsonType&& j) { if (taglen_ == JSON_TAG && JsonEnconding() == kEncodingJsonCons) { DCHECK(u_.json_obj.cons.json_ptr != nullptr); // must be allocated u_.json_obj.cons.json_ptr->swap(j); - DCHECK(jsoncons::is_trivial_storage(u_.json_obj.cons.json_ptr->storage_kind()) || - u_.json_obj.cons.json_ptr->get_allocator().resource() == tl.local_mr); - // We do not set bytes_used as this is needed. Consider the two following cases: // 1. old json contains 50 bytes. The delta for new one is 50, so the total bytes // the new json occupies is 100. @@ -892,10 +889,6 @@ void CompactObj::SetJson(JsonType&& j) { SetMeta(JSON_TAG); u_.json_obj.cons.json_ptr = AllocateMR(std::move(j)); - - // With trivial storage json_ptr->get_allocator() throws an exception. - DCHECK(jsoncons::is_trivial_storage(u_.json_obj.cons.json_ptr->storage_kind()) || - u_.json_obj.cons.json_ptr->get_allocator().resource() == tl.local_mr); u_.json_obj.cons.bytes_used = 0; }