Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
98b0ea62
Unverified
Commit
98b0ea62
authored
2 years ago
by
rjl493456442
Committed by
GitHub
2 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ethdb/pebble: fix range compaction (#26771)
* ethdb/pebble: fix range compaction * ethdb/pebble: add comment
parent
2ea48f8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
pebble.go
ethdb/pebble/pebble.go
+12
-0
No files found.
ethdb/pebble/pebble.go
View file @
98b0ea62
...
...
@@ -20,6 +20,7 @@
package
pebble
import
(
"bytes"
"fmt"
"runtime"
"sync"
...
...
@@ -361,6 +362,17 @@ func (d *Database) Stat(property string) (string, error) {
// is treated as a key after all keys in the data store. If both is nil then it
// will compact entire data store.
func
(
d
*
Database
)
Compact
(
start
[]
byte
,
limit
[]
byte
)
error
{
// There is no special flag to represent the end of key range
// in pebble(nil in leveldb). Use an ugly hack to construct a
// large key to represent it.
// Note any prefixed database entry will be smaller than this
// flag, as for trie nodes we need the 32 byte 0xff because
// there might be a shared prefix starting with a number of
// 0xff-s, so 32 ensures than only a hash collision could touch it.
// https://github.com/cockroachdb/pebble/issues/2359#issuecomment-1443995833
if
limit
==
nil
{
limit
=
bytes
.
Repeat
([]
byte
{
0xff
},
32
)
}
return
d
.
db
.
Compact
(
start
,
limit
,
true
)
// Parallelization is preferred
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment