!15 backport broken db: fix assertion in leveldb::InternalKey::Encode, mark base as corrupt
From: @ikernel-mryao Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
4693a97ca6
@ -0,0 +1,45 @@
|
|||||||
|
From 7d060117fa0d5cab7cb15b0cf127533bea9ffbc7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: proller <proller@github.com>
|
||||||
|
Date: Mon, 3 Oct 2016 19:40:07 +0300
|
||||||
|
Subject: [PATCH] broken db: fix assertion in leveldb::InternalKey::Encode,
|
||||||
|
mark base as corrupt
|
||||||
|
|
||||||
|
---
|
||||||
|
db/dbformat.h | 6 +++++-
|
||||||
|
db/version_edit.cc | 3 +--
|
||||||
|
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/db/dbformat.h b/db/dbformat.h
|
||||||
|
index ea897b1..415dc96 100644
|
||||||
|
--- a/db/dbformat.h
|
||||||
|
+++ b/db/dbformat.h
|
||||||
|
@@ -150,7 +150,11 @@ class InternalKey {
|
||||||
|
AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t));
|
||||||
|
}
|
||||||
|
|
||||||
|
- void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); }
|
||||||
|
+ bool DecodeFrom(const Slice& s) {
|
||||||
|
+ rep_.assign(s.data(), s.size());
|
||||||
|
+ return !rep_.empty();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
Slice Encode() const {
|
||||||
|
assert(!rep_.empty());
|
||||||
|
return rep_;
|
||||||
|
diff --git a/db/version_edit.cc b/db/version_edit.cc
|
||||||
|
index f10a2d5..1eea2d1 100644
|
||||||
|
--- a/db/version_edit.cc
|
||||||
|
+++ b/db/version_edit.cc
|
||||||
|
@@ -88,8 +88,7 @@ void VersionEdit::EncodeTo(std::string* dst) const {
|
||||||
|
static bool GetInternalKey(Slice* input, InternalKey* dst) {
|
||||||
|
Slice str;
|
||||||
|
if (GetLengthPrefixedSlice(input, &str)) {
|
||||||
|
- dst->DecodeFrom(str);
|
||||||
|
- return true;
|
||||||
|
+ return dst->DecodeFrom(str);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.40.0.windows.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: leveldb
|
Name: leveldb
|
||||||
Version: 1.20
|
Version: 1.20
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: A key/value database library
|
Summary: A key/value database library
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: https://github.com/google/leveldb
|
URL: https://github.com/google/leveldb
|
||||||
@ -10,6 +10,7 @@ Patch0001: 0001-Allow-leveldbjni-build.patch
|
|||||||
Patch0002: 0002-Added-a-DB-SuspendCompations-and-DB-ResumeCompaction.patch
|
Patch0002: 0002-Added-a-DB-SuspendCompations-and-DB-ResumeCompaction.patch
|
||||||
Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch
|
Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch
|
||||||
Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch
|
Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch
|
||||||
|
Patch0005: 0005-broken-db-fix-assertion-in-leveldb-InternalKey-Encod.patch
|
||||||
|
|
||||||
BuildRequires: make gcc-c++ snappy-devel
|
BuildRequires: make gcc-c++ snappy-devel
|
||||||
|
|
||||||
@ -71,5 +72,8 @@ make -j1 check
|
|||||||
%{_libdir}/pkgconfig/leveldb.pc
|
%{_libdir}/pkgconfig/leveldb.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 18 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 1.20-5
|
||||||
|
- fix assertion in leveldb::InternalKey::Encode, mark base as corrupt
|
||||||
|
|
||||||
* Fri Dec 20 2019 wangyiru <wangyiru1@huawei.com> - 1.20-4
|
* Fri Dec 20 2019 wangyiru <wangyiru1@huawei.com> - 1.20-4
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user