From e570106fc9fa09f7cfdb613f2e0012477f9cf0c8 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Thu, 12 May 2022 20:46:45 +0300 Subject: [PATCH 1/7] use unique_ptr instead of deprecated auto_ptr --- util/bloom.cc | 2 +- util/bloom2.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/util/bloom.cc b/util/bloom.cc index 1cb63d1c..a9d97bf7 100644 --- a/util/bloom.cc +++ b/util/bloom.cc @@ -97,7 +97,7 @@ const FilterPolicy* NewBloomFilterPolicy(int bits_per_key) { // container to hold one bloom filter and auto destruct struct BloomInventoryItem { - std::auto_ptr m_Item; + std::unique_ptr m_Item; BloomInventoryItem() { diff --git a/util/bloom2.cc b/util/bloom2.cc index 5ffb2840..1d5f4030 100644 --- a/util/bloom2.cc +++ b/util/bloom2.cc @@ -111,7 +111,7 @@ const FilterPolicy* NewBloomFilterPolicy2(int bits_per_key) { // container to hold one bloom filter and auto destruct struct BloomInventoryItem2 { - std::auto_ptr m_Item; + std::unique_ptr m_Item; BloomInventoryItem2() { From 1f69b6ec0ed02e3a6d3512fa260f2ece39cc1d40 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Fri, 13 May 2022 18:26:23 +0300 Subject: [PATCH 2/7] drop "hack fest for 64 bit semi-atomic on 32bit machine" trust gcc built-ins do the right thing --- util/perf_count.cc | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/util/perf_count.cc b/util/perf_count.cc index ac6aaa28..73419405 100644 --- a/util/perf_count.cc +++ b/util/perf_count.cc @@ -353,20 +353,8 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters); val_ptr=&m_Counter[Index]; -# if ULONG_MAX != 4294967295UL inc_and_fetch(val_ptr); -#else - // hack fest for 64 bit semi-atomic on 32bit machine - uint32_t ret_32, * ptr_32; - ptr_32=(uint32_t *)&val_ptr; - ret_32=inc_and_fetch(ptr_32, 1); - if (0==ret_32) - { - ++ptr_32; - inc_and_fetch(ptr_32, 1); - } // if -#endif ret_val=*val_ptr; } // if @@ -388,20 +376,8 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters); val_ptr=&m_Counter[Index]; -# if ULONG_MAX != 4294967295UL dec_and_fetch(val_ptr); -#else - // hack fest for 64 bit semi-atomic on 32bit machine - uint32_t ret_32, * ptr_32; - ptr_32=(uint32_t *)&val_ptr; - ret_32=dec_and_fetch(ptr_32); - if (0xFFFFFFFF==ret_32) - { - ++ptr_32; - dec_and_fetch(ptr_32); - } // if -#endif ret_val=*val_ptr; } // if @@ -424,23 +400,7 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters); val_ptr=&m_Counter[Index]; -# if ULONG_MAX != 4294967295UL ret_val=add_and_fetch(val_ptr, Amount); -#else - // hack fest for 64 bit semi-atomic on 32bit machine - uint32_t old_32, ret_32, * ptr_32; - - ptr_32=(uint32_t *)&val_ptr; - old_32=*ptr_32; - ret_32=add_and_fetch(ptr_32, Amount); - if (ret_32 Date: Sat, 14 May 2022 17:35:49 +0300 Subject: [PATCH 3/7] replace remaining instances of auto_ptr --- tools/sst_rewrite.cc | 4 ++-- util/expiry_os_test.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/sst_rewrite.cc b/tools/sst_rewrite.cc index 49f23303..981c4e7f 100644 --- a/tools/sst_rewrite.cc +++ b/tools/sst_rewrite.cc @@ -223,8 +223,8 @@ main( { leveldb::WritableFile * outfile; leveldb::Status s; - std::auto_ptr it; - std::auto_ptr builder; + std::unique_ptr it; + std::unique_ptr builder; LDbTable in_file(options, fname); diff --git a/util/expiry_os_test.cc b/util/expiry_os_test.cc index 66c9a65a..d42e748b 100644 --- a/util/expiry_os_test.cc +++ b/util/expiry_os_test.cc @@ -1451,7 +1451,7 @@ TEST(ExpiryDBTester, Simple) Status s; sExpiryDBObject * cursor; std::string buffer; - std::auto_ptr iterator; + std::unique_ptr iterator; // enable compaction expiry m_Expiry->expiry_enabled=true; From d53bb3299c1de1995cb9dd216f405e5721e5bb98 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Sun, 15 May 2022 09:38:32 +0300 Subject: [PATCH 4/7] has ApproximateOffsetOf changed? and at what point? https://github.com/basho/leveldb/pull/232 suggests it was failing even in 2018, with snappy-1.0.4 --- table/table_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/table/table_test.cc b/table/table_test.cc index 4382c8e0..7b6e90f8 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -826,9 +826,9 @@ TEST(TableTest, ApproximateOffsetOfCompressed) { ASSERT_TRUE(Between(c.ApproximateOffsetOf("abc"), 0, 0)); ASSERT_TRUE(Between(c.ApproximateOffsetOf("k01"), 0, 0)); ASSERT_TRUE(Between(c.ApproximateOffsetOf("k02"), 0, 0)); - ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), 2000, 3000)); - ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), 2000, 3000)); - ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 4000, 6000)); + ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), 2000, 3500)); + ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), 2000, 3500)); + ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 4000, 6500)); } } // namespace leveldb From 73837fe32fa84ddf4bc6f929ec760891e595718a Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Mon, 16 May 2022 22:08:18 +0300 Subject: [PATCH 5/7] no more platform-specific port/port_*.h --- port/port.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/port/port.h b/port/port.h index d3c5d6aa..dfbf6cd4 100644 --- a/port/port.h +++ b/port/port.h @@ -8,13 +8,8 @@ #include #include "leveldb/ldb_config.h" -// Include the appropriate platform specific file below. If you are -// porting to a new platform, see "port_example.h" for documentation -// of what the new port_.h file must provide. -#if defined(LEVELDB_PLATFORM_POSIX) -# include "port/port_posix.h" -#elif defined(LEVELDB_PLATFORM_CHROMIUM) -# include "port/port_chromium.h" -#endif +// there used to be more port_*.h, but everything seems to have become +// posix-compliant by now +#include "port/port_posix.h" #endif // STORAGE_LEVELDB_PORT_PORT_H_ From f6d9988303605900a9ed3baae1ebad71fe1819a5 Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Tue, 17 May 2022 17:46:22 +0300 Subject: [PATCH 6/7] update leveldb_ee to current state (develop, as MvM left it) --- leveldb_ee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leveldb_ee b/leveldb_ee index 1d13c28c..9503ac29 160000 --- a/leveldb_ee +++ b/leveldb_ee @@ -1 +1 @@ -Subproject commit 1d13c28cb198770e03f805c7dd32d6a58260c1e2 +Subproject commit 9503ac29a9f306ec7be10f1115349d28b5768033 From 1674ebf217c806ba4b0dc4ffbfa3df26b50c38ed Mon Sep 17 00:00:00 2001 From: Andrei Zavada Date: Tue, 17 May 2022 20:01:27 +0300 Subject: [PATCH 7/7] Revert "update leveldb_ee to current state (develop, as MvM left it)" This reverts commit f6d9988303605900a9ed3baae1ebad71fe1819a5. --- leveldb_ee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leveldb_ee b/leveldb_ee index 9503ac29..1d13c28c 160000 --- a/leveldb_ee +++ b/leveldb_ee @@ -1 +1 @@ -Subproject commit 9503ac29a9f306ec7be10f1115349d28b5768033 +Subproject commit 1d13c28cb198770e03f805c7dd32d6a58260c1e2