mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
switch from jmhodges/levigo to DataDog/leveldb
Why: original fork is abandoned and not supported anymore. Changes: - LevelDB 1.19 (LevelDB and Snappy are both compiled and linked statically, so while you will not need them installed on your target machine, you should have a roughly compatible version of libstdc++.) - snappy and lz4 libs included by default
This commit is contained in:
parent
38bced2440
commit
5bfb9001eb
16
Gopkg.lock
generated
16
Gopkg.lock
generated
@ -1,6 +1,13 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5da259989116f6ab5e05a80086c639c82efdbdb799ca07183eb0b660edfd91fe"
|
||||
name = "github.com/DataDog/leveldb"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "12a0b6e10a5bf779330ed8b7c0f1f39f212d34e2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d"
|
||||
@ -161,13 +168,6 @@
|
||||
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||
version = "v1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:39b27d1381a30421f9813967a5866fba35dc1d4df43a6eefe3b7a5444cb07214"
|
||||
name = "github.com/jmhodges/levigo"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "c42d9e0ca023e2198120196f842701bb4c55d7b9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a64e323dc06b73892e5bb5d040ced475c4645d456038333883f58934abbf6f72"
|
||||
@ -511,6 +511,7 @@
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
input-imports = [
|
||||
"github.com/DataDog/leveldb",
|
||||
"github.com/btcsuite/btcutil/base58",
|
||||
"github.com/btcsuite/btcutil/bech32",
|
||||
"github.com/ebuchman/fail-test",
|
||||
@ -529,7 +530,6 @@
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/golang/protobuf/ptypes/timestamp",
|
||||
"github.com/gorilla/websocket",
|
||||
"github.com/jmhodges/levigo",
|
||||
"github.com/pkg/errors",
|
||||
"github.com/prometheus/client_golang/prometheus",
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp",
|
||||
|
@ -73,8 +73,8 @@
|
||||
## Pin to revision
|
||||
|
||||
[[override]]
|
||||
name = "github.com/jmhodges/levigo"
|
||||
revision = "c42d9e0ca023e2198120196f842701bb4c55d7b9"
|
||||
name = "github.com/DataDog/leveldb"
|
||||
revision = "12a0b6e10a5bf779330ed8b7c0f1f39f212d34e2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/ebuchman/fail-test"
|
||||
|
@ -113,7 +113,7 @@ type BaseConfig struct {
|
||||
// and verifying their commits
|
||||
FastSync bool `mapstructure:"fast_sync"`
|
||||
|
||||
// Database backend: leveldb | memdb
|
||||
// Database backend: leveldb | memdb | cleveldb
|
||||
DBBackend string `mapstructure:"db_backend"`
|
||||
|
||||
// Database directory
|
||||
@ -587,15 +587,15 @@ type TxIndexConfig struct {
|
||||
// Comma-separated list of tags to index (by default the only tag is "tx.hash")
|
||||
//
|
||||
// You can also index transactions by height by adding "tx.height" tag here.
|
||||
//
|
||||
//
|
||||
// It's recommended to index only a subset of tags due to possible memory
|
||||
// bloat. This is, of course, depends on the indexer's DB and the volume of
|
||||
// transactions.
|
||||
IndexTags string `mapstructure:"index_tags"`
|
||||
|
||||
// When set to true, tells indexer to index all tags (predefined tags:
|
||||
// "tx.hash", "tx.height" and all tags from DeliverTx responses).
|
||||
//
|
||||
// "tx.hash", "tx.height" and all tags from DeliverTx responses).
|
||||
//
|
||||
// Note this may be not desirable (see the comment above). IndexTags has a
|
||||
// precedence over IndexAllTags (i.e. when given both, IndexTags will be
|
||||
// indexed).
|
||||
|
@ -77,7 +77,7 @@ moniker = "{{ .BaseConfig.Moniker }}"
|
||||
# and verifying their commits
|
||||
fast_sync = {{ .BaseConfig.FastSync }}
|
||||
|
||||
# Database backend: leveldb | memdb
|
||||
# Database backend: leveldb | memdb | cleveldb
|
||||
db_backend = "{{ .BaseConfig.DBBackend }}"
|
||||
|
||||
# Database directory
|
||||
|
@ -48,6 +48,15 @@ to put the binary in `./build`.
|
||||
|
||||
The latest `tendermint version` is now installed.
|
||||
|
||||
## Run
|
||||
|
||||
To start a one-node blockchain with a simple in-process application:
|
||||
|
||||
```
|
||||
tendermint init
|
||||
tendermint node --proxy_app=kvstore
|
||||
```
|
||||
|
||||
## Reinstall
|
||||
|
||||
If you already have Tendermint installed, and you make updates, simply
|
||||
@ -66,11 +75,35 @@ make get_vendor_deps
|
||||
make install
|
||||
```
|
||||
|
||||
## Run
|
||||
## Compile with CLevelDB support
|
||||
|
||||
To start a one-node blockchain with a simple in-process application:
|
||||
Make sure you have a roughly compatible version of libstdc++ (tested with
|
||||
5.3.1). For example, on Ubuntu:
|
||||
|
||||
```
|
||||
tendermint init
|
||||
tendermint node --proxy_app=kvstore
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc
|
||||
sudo apt-cache show libstdc++6
|
||||
Version: 5.3.1-14ubuntu2
|
||||
```
|
||||
|
||||
Check out leveldb dependency using git (for some reason dep does not check out
|
||||
submodules):
|
||||
|
||||
```
|
||||
cd vendor/github.com/DataDog && rm -rf leveldb
|
||||
git clone https://github.com/DataDog/leveldb.git
|
||||
```
|
||||
|
||||
Set database backend to cleveldb:
|
||||
|
||||
```
|
||||
# config/config.toml
|
||||
db_backend = "cleveldb"
|
||||
```
|
||||
|
||||
To build Tendermint, run
|
||||
|
||||
```
|
||||
CGO_ENABLED=1 CGO_CXXFLAGS_ALLOW="(-fno-builtin-memcmp|-lpthread)" CGO_CFLAGS_ALLOW="-fno-builtin-memcmp" go build -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD`" -tags "tendermint gcc" -o build/tendermint ./cmd/tendermint/
|
||||
```
|
||||
|
@ -30,7 +30,7 @@ moniker = "anonymous"
|
||||
# and verifying their commits
|
||||
fast_sync = true
|
||||
|
||||
# Database backend: leveldb | memdb
|
||||
# Database backend: leveldb | memdb | cleveldb
|
||||
db_backend = "leveldb"
|
||||
|
||||
# Database directory
|
||||
|
4
libs/db/Makefile
Normal file
4
libs/db/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
test_gcc:
|
||||
CGO_CXXFLAGS_ALLOW="(-fno-builtin-memcmp|-lpthread)" CGO_CFLAGS_ALLOW="-fno-builtin-memcmp" go test -tags gcc
|
||||
|
||||
.PHONY: test_gcc
|
@ -55,9 +55,10 @@ func TestBackendsGetSetDelete(t *testing.T) {
|
||||
|
||||
func withDB(t *testing.T, creator dbCreator, fn func(DB)) {
|
||||
name := fmt.Sprintf("test_%x", cmn.RandStr(12))
|
||||
db, err := creator(name, "")
|
||||
defer cleanupDBDir("", name)
|
||||
assert.Nil(t, err)
|
||||
dir := os.TempDir()
|
||||
db, err := creator(name, dir)
|
||||
require.Nil(t, err)
|
||||
defer cleanupDBDir(dir, name)
|
||||
fn(db)
|
||||
db.Close()
|
||||
}
|
||||
@ -161,8 +162,9 @@ func TestDBIterator(t *testing.T) {
|
||||
|
||||
func testDBIterator(t *testing.T, backend DBBackendType) {
|
||||
name := fmt.Sprintf("test_%x", cmn.RandStr(12))
|
||||
db := NewDB(name, backend, "")
|
||||
defer cleanupDBDir("", name)
|
||||
dir := os.TempDir()
|
||||
db := NewDB(name, backend, dir)
|
||||
defer cleanupDBDir(dir, name)
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
if i != 6 { // but skip 6.
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/jmhodges/levigo"
|
||||
levigo "github.com/DataDog/leveldb"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -5,9 +5,11 @@ package db
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
)
|
||||
|
||||
@ -88,8 +90,9 @@ func bytes2Int64(buf []byte) int64 {
|
||||
|
||||
func TestCLevelDBBackend(t *testing.T) {
|
||||
name := fmt.Sprintf("test_%x", cmn.RandStr(12))
|
||||
db := NewDB(name, LevelDBBackend, "")
|
||||
defer cleanupDBDir("", name)
|
||||
dir := os.TempDir()
|
||||
db := NewDB(name, LevelDBBackend, dir)
|
||||
defer cleanupDBDir(dir, name)
|
||||
|
||||
_, ok := db.(*CLevelDB)
|
||||
assert.True(t, ok)
|
||||
|
Loading…
x
Reference in New Issue
Block a user