已开启
backport broken db: fix assertion in leveldb::InternalKey::Encode, mark base as corrupt #12
ikernel-mryao创建于 2023年4月19日
backport broken db: fix assertion in leveldb::InternalKey::Encode, mark base as corrupt #12
已开启
从refs/pull/12/head合入到openEuler-20.03-LTS
共 2 个文件变更+50-1
| @@ -0,0 +1,45 @@ | |||
| 1 | +From 7d060117fa0d5cab7cb15b0cf127533bea9ffbc7 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: proller <proller@github.com> | ||
| 3 | +Date: Mon, 3 Oct 2016 19:40:07 +0300 | ||
| 4 | +Subject: [PATCH] broken db: fix assertion in leveldb::InternalKey::Encode, | ||
| 5 | + mark base as corrupt | ||
| 6 | + | ||
| 7 | +--- | ||
| 8 | + db/dbformat.h | 6 +++++- | ||
| 9 | + db/version_edit.cc | 3 +-- | ||
| 10 | + 2 files changed, 6 insertions(+), 3 deletions(-) | ||
| 11 | + | ||
| 12 | +diff --git a/db/dbformat.h b/db/dbformat.h | ||
| 13 | +index ea897b1..415dc96 100644 | ||
| 14 | +--- a/db/dbformat.h | ||
| 15 | ++++ b/db/dbformat.h | ||
| 16 | +@@ -150,7 +150,11 @@ class InternalKey { | ||
| 17 | + AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t)); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | +- void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); } | ||
| 21 | ++ bool DecodeFrom(const Slice& s) { | ||
| 22 | ++ rep_.assign(s.data(), s.size()); | ||
| 23 | ++ return !rep_.empty(); | ||
| 24 | ++ } | ||
| 25 | ++ | ||
| 26 | + Slice Encode() const { | ||
| 27 | + assert(!rep_.empty()); | ||
| 28 | + return rep_; | ||
| 29 | +diff --git a/db/version_edit.cc b/db/version_edit.cc | ||
| 30 | +index f10a2d5..1eea2d1 100644 | ||
| 31 | +--- a/db/version_edit.cc | ||
| 32 | ++++ b/db/version_edit.cc | ||
| 33 | +@@ -88,8 +88,7 @@ void VersionEdit::EncodeTo(std::string* dst) const { | ||
| 34 | + static bool GetInternalKey(Slice* input, InternalKey* dst) { | ||
| 35 | + Slice str; | ||
| 36 | + if (GetLengthPrefixedSlice(input, &str)) { | ||
| 37 | +- dst->DecodeFrom(str); | ||
| 38 | +- return true; | ||
| 39 | ++ return dst->DecodeFrom(str); | ||
| 40 | + } else { | ||
| 41 | + return false; | ||
| 42 | + } | ||
| 43 | +-- | ||
| 44 | +2.40.0.windows.1 | ||
| 45 | + | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | Name: leveldb | 1 | Name: leveldb |
| 2 | Version: 1.20 | 2 | Version: 1.20 |
| 3 | -Release: 4 | 3 | +Release: 5 |
| 4 | Summary: A key/value database library | 4 | Summary: A key/value database library |
| 5 | License: BSD | 5 | License: BSD |
| 6 | URL: https://github.com/google/leveldb | 6 | URL: https://github.com/google/leveldb |
| @@ -10,6 +10,7 @@ Patch0001: 0001-Allow-leveldbjni-build.patch | |||
| 10 | Patch0002: 0002-Added-a-DB-SuspendCompations-and-DB-ResumeCompaction.patch | 10 | Patch0002: 0002-Added-a-DB-SuspendCompations-and-DB-ResumeCompaction.patch |
| 11 | Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch | 11 | Patch0003: 0003-allow-Get-calls-to-avoid-copies-into-std-string.patch |
| 12 | Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch | 12 | Patch0004: 0004-bloom_test-failure-on-big-endian-archs.patch |
| 13 | +Patch0005: 0005-broken-db-fix-assertion-in-leveldb-InternalKey-Encod.patch | ||
| 13 | 14 | ||
| 14 | BuildRequires: make gcc-c++ snappy-devel | 15 | BuildRequires: make gcc-c++ snappy-devel |
| 15 | 16 | ||
| @@ -71,5 +72,8 @@ make -j1 check | |||
| 71 | %{_libdir}/pkgconfig/leveldb.pc | 72 | %{_libdir}/pkgconfig/leveldb.pc |
| 72 | 73 | ||
| 73 | %changelog | 74 | %changelog |
| 75 | +* Tue Apr 18 2023 yaoguangzhong <yaoguangzhong@xfusion.com> - 1.20-5 | ||
| 76 | +- fix assertion in leveldb::InternalKey::Encode, mark base as corrupt | ||
| 77 | + | ||
| 74 | * Fri Dec 20 2019 wangyiru <wangyiru1@huawei.com> - 1.20-4 | 78 | * Fri Dec 20 2019 wangyiru <wangyiru1@huawei.com> - 1.20-4 |
| 75 | - Package init | 79 | - Package init |