forked from dominant-strategies/go-quai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This branch was produced by squashing all the commits below Cherry picked initial pebble db commit - ed51b8c5d - ethdb/pebble: fix nil callbacks (#26650) ethdb/pebble: Fix `MemTableStopWritesThreshold` (#26692) MemTableStopWritesThreshold was set to the max size of all memtables before blocking writing but should be set to the max number of memtables. This is documented [here](https://github.com/cockroachdb/pebble/blob/master/options.go#L738-L742). ethdb/pebble: fix range compaction (#26771) * ethdb/pebble: fix range compaction * ethdb/pebble: add comment ethdb/pebble: fix max memorytable size (#26776) core/rawdb, ethdb/pebble: disable pebble on openbsd (#26801) ethdb/pebble: use atomic type (#27014) ethdb/pebble: prevent shutdown-panic (#27238) One difference between pebble and leveldb is that the latter returns error when performing Get on a closed database, the former does a panic. This may be triggered during shutdown (see #27237) This PR changes the pebble driver so we check that the db is not closed already, for several operations. It also adds tests to the db test-suite, so the previously implicit assumption of "not panic:ing at ops on closed database" is covered by tests. ethdb/pebble: fix NewBatchWithSize to set db (#27350) ethdb/pebble: fsync for batch writes (#27522) This is likely the culprit behind several data corruption issues, e.g. where data has been written to the freezer, but the deletion from pebble does not go through due to process crash. ethdb/pebble: use sync mode for pebble writes (#27615)
- Loading branch information
1 parent
c5ef2c2
commit d299ee2
Showing
18 changed files
with
1,433 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2023 The go-ethereum Authors | ||
// This file is part of the go-ethereum library. | ||
// | ||
// The go-ethereum library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The go-ethereum library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/> | ||
|
||
//go:build (arm64 || amd64) && !openbsd | ||
|
||
package rawdb | ||
|
||
import ( | ||
"github.com/dominant-strategies/go-quai/ethdb" | ||
"github.com/dominant-strategies/go-quai/ethdb/pebble" | ||
) | ||
|
||
// Pebble is unsuported on 32bit architecture | ||
const PebbleEnabled = true | ||
|
||
// NewPebbleDBDatabase creates a persistent key-value database without a freezer | ||
// moving immutable chain segments into cold storage. | ||
func NewPebbleDBDatabase(file string, cache int, handles int, namespace string, readonly bool) (ethdb.Database, error) { | ||
db, err := pebble.New(file, cache, handles, namespace, readonly) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return NewDatabase(db), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2023 The go-ethereum Authors | ||
// This file is part of the go-ethereum library. | ||
// | ||
// The go-ethereum library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The go-ethereum library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//go:build !((arm64 || amd64) && !openbsd) | ||
|
||
package rawdb | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/dominant-strategies/go-quai/ethdb" | ||
) | ||
|
||
// Pebble is unsuported on 32bit architecture | ||
const PebbleEnabled = false | ||
|
||
// NewPebbleDBDatabase creates a persistent key-value database without a freezer | ||
// moving immutable chain segments into cold storage. | ||
func NewPebbleDBDatabase(file string, cache int, handles int, namespace string, readonly bool) (ethdb.Database, error) { | ||
return nil, errors.New("pebble is not supported on this platform") | ||
} |
Oops, something went wrong.