!9 update verison to 1.23

From: @huyab 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2022-12-30 10:14:20 +00:00 committed by Gitee
commit ddca73dca4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 169 additions and 345 deletions

View File

@ -1,49 +1,17 @@
From 77961bc308c89cda06a3fb1dc2cfa9c9ced2ba48 Mon Sep 17 00:00:00 2001
From: Hiram Chirino <chirino@gmail.com>
Date: Fri, 5 Jul 2013 18:32:28 +0400
Subject: [PATCH 1/4] Allow leveldbjni build
Subject: [PATCH] Allow leveldbjni build
---
build_detect_platform | 5 +++--
include/leveldb/slice.h | 1 -
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/build_detect_platform b/build_detect_platform
index d2a20ce5b6277594ec256004121195a22b049263..fb32ae9eab6f39d62e0478d87a73579c414e9f5a 100755
--- a/build_detect_platform
+++ b/build_detect_platform
@@ -245,12 +245,13 @@ PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS $COMMON_FLAGS"
echo "CC=$CC" >> $OUTPUT
echo "CXX=$CXX" >> $OUTPUT
echo "PLATFORM=$PLATFORM" >> $OUTPUT
echo "PLATFORM_LDFLAGS=$PLATFORM_LDFLAGS" >> $OUTPUT
echo "PLATFORM_LIBS=$PLATFORM_LIBS" >> $OUTPUT
-echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS" >> $OUTPUT
-echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS" >> $OUTPUT
+echo "PLATFORM_CCFLAGS=$PLATFORM_CCFLAGS $PLATFORM_SHARED_CFLAGS" >> $OUTPUT
+echo "PLATFORM_CXXFLAGS=$PLATFORM_CXXFLAGS $PLATFORM_SHARED_CFLAGS" >> $OUTPUT
+echo "PLATFORM_SHARED_CFLAGS=" >> $OUTPUT
echo "PLATFORM_SSEFLAGS=$PLATFORM_SSEFLAGS" >> $OUTPUT
echo "PLATFORM_SHARED_CFLAGS=$PLATFORM_SHARED_CFLAGS" >> $OUTPUT
echo "PLATFORM_SHARED_EXT=$PLATFORM_SHARED_EXT" >> $OUTPUT
echo "PLATFORM_SHARED_LDFLAGS=$PLATFORM_SHARED_LDFLAGS" >> $OUTPUT
echo "PLATFORM_SHARED_VERSIONED=$PLATFORM_SHARED_VERSIONED" >> $OUTPUT
diff --git a/include/leveldb/slice.h b/include/leveldb/slice.h
index bc367986f7e8e26fdf22afc02283d4dd13970158..6f2289aaad763b83d88ccffd259540c4827b1a6a 100644
index 2df417d..1af5635 100644
--- a/include/leveldb/slice.h
+++ b/include/leveldb/slice.h
@@ -75,11 +75,10 @@ class Slice {
bool starts_with(const Slice& x) const {
return ((size_ >= x.size_) &&
(memcmp(data_, x.data_, x.size_) == 0));
@@ -86,7 +86,6 @@ class LEVELDB_EXPORT Slice {
return ((size_ >= x.size_) && (memcmp(data_, x.data_, x.size_) == 0));
}
- private:
const char* data_;
size_t size_;
// Intentionally copyable
};
--
2.14.2

View File

@ -1,39 +1,26 @@
From 9f7a39eb2fc0bf4e7c4df64dca5e3ed01cbde2c1 Mon Sep 17 00:00:00 2001
From: Hiram Chirino <hiram@hiramchirino.com>
Date: Tue, 30 Oct 2012 16:56:52 -0400
Subject: [PATCH 2/4] Added a DB:SuspendCompations() and DB:ResumeCompactions()
Subject: [PATCH] Added a DB:SuspendCompations() and DB:ResumeCompactions()
methods. Fixes issue #184
https://code.google.com/p/leveldb/issues/detail?id=184
---
db/db_impl.cc | 36 ++++++++++++++++++++++++++++++++++++
db/db_impl.h | 9 +++++++++
db/db_test.cc | 4 ++++
include/leveldb/db.h | 6 ++++++
4 files changed, 55 insertions(+)
diff --git a/db/db_impl.cc b/db/db_impl.cc
index f43ad7679436b312959e5e0487c9313694d83ecc..60c483fab11177fb2d37726f3b2a94720e4dd1ff 100644
index 1a4e459..ae7b96d 100644
--- a/db/db_impl.cc
+++ b/db/db_impl.cc
@@ -123,10 +123,13 @@ DBImpl::DBImpl(const Options& raw_options, const std::string& dbname)
owns_info_log_(options_.info_log != raw_options.info_log),
owns_cache_(options_.block_cache != raw_options.block_cache),
dbname_(dbname),
db_lock_(NULL),
shutting_down_(NULL),
@@ -135,6 +135,9 @@ DBImpl::DBImpl(const Options& raw_options, const std::string& dbname)
table_cache_(new TableCache(dbname_, options_, TableCacheSize(options_))),
db_lock_(nullptr),
shutting_down_(false),
+ suspend_cv(&suspend_mutex),
+ suspend_count(0),
+ suspended(false),
bg_cv_(&mutex_),
mem_(NULL),
imm_(NULL),
logfile_(NULL),
logfile_number_(0),
@@ -1469,10 +1472,43 @@ void DBImpl::GetApproximateSizes(
MutexLock l(&mutex_);
v->Unref();
}
background_work_finished_signal_(&mutex_),
mem_(nullptr),
imm_(nullptr),
@@ -1464,6 +1467,39 @@ void DBImpl::GetApproximateSizes(const Range* range, int n, uint64_t* sizes) {
v->Unref();
}
+void DBImpl::SuspendCompactions() {
@ -42,7 +29,7 @@ index f43ad7679436b312959e5e0487c9313694d83ecc..60c483fab11177fb2d37726f3b2a9472
+ suspend_count++;
+ while( !suspended ) {
+ suspend_cv.Wait();
+ }
+ }
+}
+void DBImpl::SuspendWork(void* db) {
+ reinterpret_cast<DBImpl*>(db)->SuspendCallback();
@ -65,36 +52,28 @@ index f43ad7679436b312959e5e0487c9313694d83ecc..60c483fab11177fb2d37726f3b2a9472
+ suspend_cv.SignalAll();
+ while( suspended ) {
+ suspend_cv.Wait();
+ }
+ }
+}
+
+
// Default implementations of convenience methods that subclasses of DB
// can call if they wish
Status DB::Put(const WriteOptions& opt, const Slice& key, const Slice& value) {
WriteBatch batch;
batch.Put(key, value);
diff --git a/db/db_impl.h b/db/db_impl.h
index 8ff323e72879967a9ff27876155a21ffb2330d3d..78f910356318cfdd3bb4ee029a50d8a76161037f 100644
index c7b0172..d955c2a 100644
--- a/db/db_impl.h
+++ b/db/db_impl.h
@@ -39,10 +39,12 @@ class DBImpl : public DB {
virtual const Snapshot* GetSnapshot();
virtual void ReleaseSnapshot(const Snapshot* snapshot);
virtual bool GetProperty(const Slice& property, std::string* value);
virtual void GetApproximateSizes(const Range* range, int n, uint64_t* sizes);
virtual void CompactRange(const Slice* begin, const Slice* end);
+ virtual void SuspendCompactions();
+ virtual void ResumeCompactions();
@@ -48,6 +48,8 @@ class DBImpl : public DB {
bool GetProperty(const Slice& property, std::string* value) override;
void GetApproximateSizes(const Range* range, int n, uint64_t* sizes) override;
void CompactRange(const Slice* begin, const Slice* end) override;
+ void SuspendCompactions() override;
+ void ResumeCompactions() override;
// Extra methods (for testing) that are not in the public DB interface
// Compact any files in the named level that overlap [*begin,*end]
void TEST_CompactRange(int level, const Slice* begin, const Slice* end);
@@ -131,10 +133,17 @@ class DBImpl : public DB {
TableCache* table_cache_;
// Lock over the persistent DB state. Non-NULL iff successfully acquired.
@@ -170,6 +172,13 @@ class DBImpl : public DB {
// Lock over the persistent DB state. Non-null iff successfully acquired.
FileLock* db_lock_;
+ port::Mutex suspend_mutex;
@ -106,49 +85,34 @@ index 8ff323e72879967a9ff27876155a21ffb2330d3d..78f910356318cfdd3bb4ee029a50d8a7
+
// State below is protected by mutex_
port::Mutex mutex_;
port::AtomicPointer shutting_down_;
port::CondVar bg_cv_; // Signalled when background work finishes
MemTable* mem_;
std::atomic<bool> shutting_down_;
diff --git a/db/db_test.cc b/db/db_test.cc
index a0b08bc19c6510322dc65a94e135fa17ee922659..641fbabeeb6ed6e2537f024597c984cd4f3b846b 100644
index 908b41d..2e65370 100644
--- a/db/db_test.cc
+++ b/db/db_test.cc
@@ -1864,10 +1864,14 @@ class ModelDB: public DB {
KVMap map_;
@@ -2051,6 +2051,8 @@ class ModelDB : public DB {
};
explicit ModelDB(const Options& options): options_(options) { }
~ModelDB() { }
+
+ virtual void SuspendCompactions() {}
+ virtual void ResumeCompactions() {}
+
virtual Status Put(const WriteOptions& o, const Slice& k, const Slice& v) {
explicit ModelDB(const Options& options) : options_(options) {}
+ virtual void SuspendCompactions() override {}
+ virtual void ResumeCompactions() override {}
~ModelDB() override = default;
Status Put(const WriteOptions& o, const Slice& k, const Slice& v) override {
return DB::Put(o, k, v);
}
virtual Status Delete(const WriteOptions& o, const Slice& key) {
return DB::Delete(o, key);
diff --git a/include/leveldb/db.h b/include/leveldb/db.h
index bfab10a0b725be9ed218783ee8fc98110fa77988..a69704d297c3feb1f60dc2856d6f9709a8879a86 100644
index a13d147..61c29c0 100644
--- a/include/leveldb/db.h
+++ b/include/leveldb/db.h
@@ -140,10 +140,16 @@ class DB {
// end==NULL is treated as a key after all keys in the database.
@@ -145,6 +145,12 @@ class LEVELDB_EXPORT DB {
// Therefore the following call will compact the entire database:
// db->CompactRange(NULL, NULL);
// db->CompactRange(nullptr, nullptr);
virtual void CompactRange(const Slice* begin, const Slice* end) = 0;
+
+ // Suspends the background compaction thread. This methods
+ // returns once suspended.
+ virtual void SuspendCompactions() = 0;
+ // Resumes a suspended background compation thread.
+ virtual void ResumeCompactions() = 0;
+
private:
// No copying allowed
DB(const DB&);
void operator=(const DB&);
};
--
2.14.2
// Destroy the contents of the specified database.

View File

@ -1,7 +1,6 @@
From d2505cb2966d016b4b28214eb81f4a38860549ea Mon Sep 17 00:00:00 2001
From: Steve Vinoski <vinoski@ieee.org>
Date: Thu, 20 Dec 2012 16:14:11 -0500
Subject: [PATCH 3/4] allow Get() calls to avoid copies into std::string
Subject: [PATCH] allow Get() calls to avoid copies into std::string
Add a new abstract base class leveldb::Value that applications can easily
derive from to supply their own memory management for values retrieved via
@ -9,25 +8,13 @@ Get(). Add an internal class derived from Value that provides std::string
management to preserve backward compatibility. Overload DBImpl::Get() to
accept a Value*, and to preserve backward compatibility also keep the
original version taking a std::string*.
---
db/db_impl.cc | 23 +++++++++++++++++++++++
db/db_impl.h | 3 +++
db/db_test.cc | 5 +++++
db/memtable.cc | 2 +-
db/memtable.h | 2 +-
db/version_set.cc | 4 ++--
db/version_set.h | 2 +-
include/leveldb/db.h | 13 +++++++++++++
8 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/db/db_impl.cc b/db/db_impl.cc
index 60c483fab11177fb2d37726f3b2a94720e4dd1ff..50ee5ef22d3416b7bf256b06659e4e705278515d 100644
index ae7b96d..5c3a05c 100644
--- a/db/db_impl.cc
+++ b/db/db_impl.cc
@@ -79,10 +79,26 @@ struct DBImpl::CompactionState {
builder(NULL),
total_bytes(0) {
}
@@ -85,6 +85,22 @@ struct DBImpl::CompactionState {
uint64_t total_bytes;
};
+Value::~Value() {}
@ -47,15 +34,11 @@ index 60c483fab11177fb2d37726f3b2a94720e4dd1ff..50ee5ef22d3416b7bf256b06659e4e70
+};
+
// Fix user-supplied options to be reasonable
template <class T,class V>
template <class T, class V>
static void ClipToRange(T* ptr, V minvalue, V maxvalue) {
if (static_cast<V>(*ptr) > maxvalue) *ptr = maxvalue;
if (static_cast<V>(*ptr) < minvalue) *ptr = minvalue;
@@ -1110,10 +1126,17 @@ int64_t DBImpl::TEST_MaxNextLevelOverlappingBytes() {
}
@@ -1117,6 +1133,13 @@ int64_t DBImpl::TEST_MaxNextLevelOverlappingBytes() {
Status DBImpl::Get(const ReadOptions& options,
const Slice& key,
Status DBImpl::Get(const ReadOptions& options, const Slice& key,
std::string* value) {
+ StringValue stringvalue(*value);
+ return DBImpl::Get(options, key, &stringvalue);
@ -67,53 +50,41 @@ index 60c483fab11177fb2d37726f3b2a94720e4dd1ff..50ee5ef22d3416b7bf256b06659e4e70
Status s;
MutexLock l(&mutex_);
SequenceNumber snapshot;
if (options.snapshot != NULL) {
snapshot = reinterpret_cast<const SnapshotImpl*>(options.snapshot)->number_;
diff --git a/db/db_impl.h b/db/db_impl.h
index 78f910356318cfdd3bb4ee029a50d8a76161037f..14c44d8751bc838ffd18e44f7398e1f728375b48 100644
index d955c2a..3127110 100644
--- a/db/db_impl.h
+++ b/db/db_impl.h
@@ -33,10 +33,13 @@ class DBImpl : public DB {
virtual Status Delete(const WriteOptions&, const Slice& key);
virtual Status Write(const WriteOptions& options, WriteBatch* updates);
virtual Status Get(const ReadOptions& options,
const Slice& key,
std::string* value);
@@ -42,6 +42,9 @@ class DBImpl : public DB {
Status Write(const WriteOptions& options, WriteBatch* updates) override;
Status Get(const ReadOptions& options, const Slice& key,
std::string* value) override;
+ virtual Status Get(const ReadOptions& options,
+ const Slice& key,
+ Value* value);
virtual Iterator* NewIterator(const ReadOptions&);
virtual const Snapshot* GetSnapshot();
virtual void ReleaseSnapshot(const Snapshot* snapshot);
virtual bool GetProperty(const Slice& property, std::string* value);
virtual void GetApproximateSizes(const Range* range, int n, uint64_t* sizes);
+ const Slice& key,
+ Value* value);
Iterator* NewIterator(const ReadOptions&) override;
const Snapshot* GetSnapshot() override;
void ReleaseSnapshot(const Snapshot* snapshot) override;
diff --git a/db/db_test.cc b/db/db_test.cc
index 641fbabeeb6ed6e2537f024597c984cd4f3b846b..a1769d24aea84863716cd242de4457fb75dd0413 100644
index 2e65370..db778d9 100644
--- a/db/db_test.cc
+++ b/db/db_test.cc
@@ -1879,10 +1879,15 @@ class ModelDB: public DB {
virtual Status Get(const ReadOptions& options,
const Slice& key, std::string* value) {
assert(false); // Not implemented
@@ -2065,6 +2065,11 @@ class ModelDB : public DB {
assert(false); // Not implemented
return Status::NotFound(key);
}
+ virtual Status Get(const ReadOptions& options,
+ const Slice& key, Value* value) {
+ Status Get(const ReadOptions& options,
+ const Slice& key, Value* value) override {
+ assert(false); // Not implemented
+ return Status::NotFound(key);
+ }
virtual Iterator* NewIterator(const ReadOptions& options) {
if (options.snapshot == NULL) {
Iterator* NewIterator(const ReadOptions& options) override {
if (options.snapshot == nullptr) {
KVMap* saved = new KVMap;
*saved = map_;
return new ModelIter(saved, true);
diff --git a/db/memtable.cc b/db/memtable.cc
index bfec0a7e7a1dc210b44dd527b9547e33e829d9bb..82a875fc3abc6ca833c5a396f695652ff8a3dd52 100644
index f42774d..4689e2d 100644
--- a/db/memtable.cc
+++ b/db/memtable.cc
@@ -103,11 +103,11 @@ void MemTable::Add(SequenceNumber s, ValueType type,
memcpy(p, value.data(), val_size);
assert((p + val_size) - buf == encoded_len);
@@ -98,7 +98,7 @@ void MemTable::Add(SequenceNumber s, ValueType type, const Slice& key,
table_.Insert(buf);
}
@ -122,15 +93,11 @@ index bfec0a7e7a1dc210b44dd527b9547e33e829d9bb..82a875fc3abc6ca833c5a396f695652f
Slice memkey = key.memtable_key();
Table::Iterator iter(&table_);
iter.Seek(memkey.data());
if (iter.Valid()) {
// entry format is:
diff --git a/db/memtable.h b/db/memtable.h
index 9f41567cde23dfd645b19d290c6e4a4256804900..6c3f56699798c936531f153a1b45707668935b80 100644
index 9d986b1..85c4cce 100644
--- a/db/memtable.h
+++ b/db/memtable.h
@@ -56,11 +56,11 @@ class MemTable {
// If memtable contains a value for key, store it in *value and return true.
@@ -60,7 +60,7 @@ class MemTable {
// If memtable contains a deletion for key, store a NotFound() error
// in *status and return true.
// Else, return false.
@ -138,64 +105,48 @@ index 9f41567cde23dfd645b19d290c6e4a4256804900..6c3f56699798c936531f153a1b457076
+ bool Get(const LookupKey& key, Value* value, Status* s);
private:
~MemTable(); // Private since only Unref() should be used to delete it
struct KeyComparator {
friend class MemTableIterator;
diff --git a/db/version_set.cc b/db/version_set.cc
index b1256f90e1c2bc6f9f6f449029bed9266bbb55b9..f0a523930d3382983fddfe27ee700574ddd06b3d 100644
index 1963353..c83a4d2 100644
--- a/db/version_set.cc
+++ b/db/version_set.cc
@@ -260,11 +260,11 @@ enum SaverState {
};
struct Saver {
@@ -256,7 +256,7 @@ struct Saver {
SaverState state;
const Comparator* ucmp;
Slice user_key;
- std::string* value;
+ Value* value;
};
}
} // namespace
static void SaveValue(void* arg, const Slice& ikey, const Slice& v) {
Saver* s = reinterpret_cast<Saver*>(arg);
ParsedInternalKey parsed_key;
@@ -329,11 +329,11 @@ void Version::ForEachOverlapping(Slice user_key, Slice internal_key,
}
@@ -322,7 +322,7 @@ void Version::ForEachOverlapping(Slice user_key, Slice internal_key, void* arg,
}
Status Version::Get(const ReadOptions& options,
const LookupKey& k,
- std::string* value,
+ Value* value,
GetStats* stats) {
Slice ikey = k.internal_key();
Slice user_key = k.user_key();
const Comparator* ucmp = vset_->icmp_.user_comparator();
Status s;
Status Version::Get(const ReadOptions& options, const LookupKey& k,
- std::string* value, GetStats* stats) {
+ Value* value, GetStats* stats) {
stats->seek_file = nullptr;
stats->seek_file_level = -1;
diff --git a/db/version_set.h b/db/version_set.h
index c4e7ac360b87d842ee9dbc0a2bf80f122a65dad7..2d31542cff63b9058c991e3bd0b67f41102edbed 100644
index 69f3d70..0f0a463 100644
--- a/db/version_set.h
+++ b/db/version_set.h
@@ -68,11 +68,11 @@ class Version {
// REQUIRES: lock is not held
struct GetStats {
FileMetaData* seek_file;
int seek_file_level;
};
@@ -72,7 +72,7 @@ class Version {
// REQUIRES: This version has been saved (see VersionSet::SaveTo)
void AddIterators(const ReadOptions&, std::vector<Iterator*>* iters);
- Status Get(const ReadOptions&, const LookupKey& key, std::string* val,
+ Status Get(const ReadOptions&, const LookupKey& key, Value* val,
GetStats* stats);
// Adds "stats" into the current state. Returns true if a new
// compaction may need to be triggered, false otherwise.
// REQUIRES: lock is held
diff --git a/include/leveldb/db.h b/include/leveldb/db.h
index a69704d297c3feb1f60dc2856d6f9709a8879a86..12f788ebf76341102832f45132388ef432db7e25 100644
index 61c29c0..1a93feb 100644
--- a/include/leveldb/db.h
+++ b/include/leveldb/db.h
@@ -36,10 +36,21 @@ struct Range {
Range() { }
Range(const Slice& s, const Slice& l) : start(s), limit(l) { }
@@ -40,6 +40,17 @@ struct LEVELDB_EXPORT Range {
Slice limit; // Not included in the range
};
+// Abstract holder for a DB value.
@ -212,21 +163,3 @@ index a69704d297c3feb1f60dc2856d6f9709a8879a86..12f788ebf76341102832f45132388ef4
// A DB is a persistent ordered map from keys to values.
// A DB is safe for concurrent access from multiple threads without
// any external synchronization.
class DB {
public:
@@ -80,10 +91,12 @@ class DB {
// a status for which Status::IsNotFound() returns true.
//
// May return some other Status on an error.
virtual Status Get(const ReadOptions& options,
const Slice& key, std::string* value) = 0;
+ virtual Status Get(const ReadOptions& options,
+ const Slice& key, Value* value) = 0;
// Return a heap-allocated iterator over the contents of the database.
// The result of NewIterator() is initially invalid (caller must
// call one of the Seek methods on the iterator before using it).
//
--
2.14.2

View File

@ -1,7 +1,6 @@
From 9992080e51c3deff0b82ce838b64ef6b68bd81f0 Mon Sep 17 00:00:00 2001
From: Yehuda Sadeh <yehuda@inktank.com>
Date: Mon, 2 Jul 2012 14:29:06 -0700
Subject: [PATCH 4/4] bloom_test failure on big endian archs
Subject: [PATCH] bloom_test failure on big endian archs
When running bloom_test on big endian machines it fails due to unacceptable
false positive rate. I've looked into the issue and it seems that the
@ -12,27 +11,17 @@ This issue holds up inclusion of ceph to debian due to ceph's use of
leveldb. The fix can be to bump up the acceptable false positives.
https://groups.google.com/d/topic/leveldb/SbVPvl4j4vU/discussion
---
util/bloom_test.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/bloom_test.cc b/util/bloom_test.cc
index 1b87a2be3f540c673ee1749b0b855d396251f5aa..e464548c339d8a8a3f9a620ddcd73710c3825c2f 100644
index 520473e..e4053e6 100644
--- a/util/bloom_test.cc
+++ b/util/bloom_test.cc
@@ -140,11 +140,11 @@ TEST(BloomTest, VaryingLengths) {
double rate = FalsePositiveRate();
if (kVerbose >= 1) {
fprintf(stderr, "False positives: %5.2f%% @ length = %6d ; bytes = %6d\n",
rate*100.0, length, static_cast<int>(FilterSize()));
@@ -136,7 +136,7 @@ TEST_F(BloomTest, VaryingLengths) {
"False positives: %5.2f%% @ length = %6d ; bytes = %6d\n",
rate * 100.0, length, static_cast<int>(FilterSize()));
}
- ASSERT_LE(rate, 0.02); // Must not be over 2%
+ ASSERT_LE(rate, 0.03); // Must not be over 2%
if (rate > 0.0125) mediocre_filters++; // Allowed, but not too often
else good_filters++;
}
if (kVerbose >= 1) {
fprintf(stderr, "Filters: %d good, %d mediocre\n",
--
2.14.2
- ASSERT_LE(rate, 0.02); // Must not be over 2%
+ ASSERT_LE(rate, 0.03); // Must not be over 3%
if (rate > 0.0125)
mediocre_filters++; // Allowed, but not too often
else

15
0006-revert-no-rtti.patch Normal file
View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8285b8..7ab9fe1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,10 +70,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Disable C++ exceptions.
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
-
- # Disable RTTI.
- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Test whether -Wthread-safety is available. See

View File

@ -1,36 +0,0 @@
# leveldb
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,39 +0,0 @@
# leveldb
#### 介绍
{**以下是码云平台说明,您可以替换此简介**
码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

Binary file not shown.

BIN
leveldb-1.23.tar.gz Normal file

Binary file not shown.

View File

@ -1,76 +1,110 @@
%undefine __cmake_in_source_build
Name: leveldb
Version: 1.20
Release: 5
Summary: A key/value database library
Version: 1.23
Release: 1
Summary: A fast and lightweight key/value database library by Google
License: BSD-3-Clause
URL: https://github.com/google/leveldb
Source0: https://github.com/google/leveldb/archive/v%{version}/%{name}-%{version}.tar.gz
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0001: 0001-Allow-leveldbjni-build.patch
Patch0002: 0002-Added-a-DB-SuspendCompations-and-DB-ResumeCompaction.patch
Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch
Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch
Patch0006: 0006-revert-no-rtti.patch
BuildRequires: make gcc-c++ snappy-devel
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: snappy-devel
BuildRequires: sqlite-devel
%description
LevelDB is a fast key-value storage library written at Google that provides an
ordered mapping from string keys to string values.
%package devel
Summary: Development files for leveldb
%package devel
Summary: Development files for %{name}
Requires: cmake-filesystem
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel
Development files for leveldb.
%description devel
%{summary}.
%prep
%autosetup -p1
cat > leveldb.pc << EOF
cat > %{name}.pc << EOF
prefix=%{_prefix}
exec_prefix=${prefix}
libdir=%{_libdir}
includedir=%{_includedir}
Name: leveldb
Description: A key/value database library
Name: %{name}
Description: %{summary}
Version: %{version}
Libs: -lleveldb
Libs: -l%{name}
EOF
%global configure() {export OPT="-DNDEBUG" export CFLAGS="%{optflags}" export CXXFLAGS="%{optflags}" export LDFLAGS="%{__global_ldflags}" }
%build
%configure
make -O -j1
export CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/generic-hardened-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection '
export CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/generic-hardened-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection '
export FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/generic-hardened-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib64/gfortran/modules'
export FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/generic-hardened-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib64/gfortran/modules'
export LDFLAGS='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld'
mkdir build && cd build
cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=%_buildrootdir/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DLEVELDB_BUILD_TESTS:BOOL=OFF -DLEVELDB_BUILD_BENCHMARKS:BOOL=OFF ..
cmake --build .
%install
install -d %{buildroot}{%{_libdir}/pkgconfig,%{_includedir}}
cp -a out-shared/libleveldb.so* %{buildroot}%{_libdir}/
mkdir -p %{buildroot}%{_libdir}/pkgconfig
install -p leveldb.pc %{buildroot}%{_libdir}/pkgconfig/leveldb.pc
cp -a include/leveldb/ %{buildroot}%{_includedir}/
cp build/libleveldb.so* %{buildroot}%{_libdir}/
cd build
make install
%ldconfig_scriptlets
%check
%configure
make -j1 check
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%license LICENSE
%doc AUTHORS README.md NEWS
%{_libdir}/lib%{name}.so.*
%files devel
%doc doc/ CONTRIBUTING.md TODO
%{_includedir}/leveldb/
%{_libdir}/libleveldb.so
%{_libdir}/pkgconfig/leveldb.pc
%{_includedir}/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Fri Dec 16 2022 huyab<1229981468@qq.com> - 1.23-1
- update version to 1.23
* Tue May 10 2022 yaoxin <yaoxin30@h-partners.com> - 1.20-5
- License compliance rectification

View File

@ -1,4 +0,0 @@
version_control: github
src_repo: google/leveldb
tag_prefix: ^v
seperator: .