Skip to content

Commit

Permalink
Merge pull request #171 from gdiazlo/validate_snapshot
Browse files Browse the repository at this point in the history
Validate snapshot
  • Loading branch information
gdiazlo committed Sep 30, 2019
2 parents d167cb1 + 931ec28 commit 4f50b5c
Show file tree
Hide file tree
Showing 13 changed files with 426 additions and 1,532 deletions.
11 changes: 5 additions & 6 deletions c-deps/builddeps.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env bash

set -e
set -e

BASE=$(pwd)
LIBS="$BASE/libs"
mkdir -p $LIBS

# build jemalloc
if [ ! -f $LIBS/libjemalloc.a ]; then
if [ ! -f $LIBS/libjemalloc.a ]; then
cd jemalloc
bash autogen.sh
make -j8
Expand All @@ -18,7 +18,7 @@ fi
cd $BASE

# build snappy shared lib
if [ ! -f $LIBS/libsnappy.a ]; then
if [ ! -f $LIBS/libsnappy.a ]; then
cd snappy
mkdir -p build
cd build
Expand All @@ -34,12 +34,11 @@ fi
cd $BASE

if [ ! -f $LIBS/librocksdb.a ]; then
# build rocksdb shared with those libraries
# build rocksdb shared with those libraries
cd rocksdb
mkdir -p build
cd build

cmake -DWITH_GFLAGS=OFF -DPORTABLE=ON \
cmake -DWITH_GFLAGS=OFF -DPORTABLE=ON \
-DWITH_SNAPPY=ON -DSNAPPY_LIBRARIES="$LIBS/libsnappy.a" -DSNAPPY_INCLUDE_DIR="$BASE/snappy" \
-DWITH_JEMALLOC=ON -DJEMALLOC_LIBRARIES="$LIBS/libjemalloc.a" -DJEMALLOC_INCLUDE_DIR="$BASE/jemalloc/include" \
-DCMAKE_BUILD_TYPE=Release -DUSE_RTTI=1 ../
Expand Down
8 changes: 8 additions & 0 deletions consensus/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ func NewRaftNodeWithLogger(opts *ClusteringOptions, store storage.ManagedStore,
func (n *RaftNode) Close(wait bool) error {
n.Lock()

n.log.Trace("RaftNode is cosing down")

if n.closed {
n.Unlock()
return nil
Expand All @@ -291,13 +293,15 @@ func (n *RaftNode) Close(wait bool) error {
return e.Error()
}
}
n.log.Trace("RaftNode closed Raft")
n.raft = nil
}

if n.transport != nil {
if err := n.transport.Close(); err != nil {
return err
}
n.log.Trace("RaftNode closed transport")
n.transport = nil
}

Expand All @@ -306,12 +310,14 @@ func (n *RaftNode) Close(wait bool) error {
return err
}
n.raftLog = nil
n.log.Trace("RaftNode closed raft log")
}

// close fsm
if n.balloon != nil {
n.balloon.Close()
n.balloon = nil
n.log.Trace("RaftNode closed balloon")
}

// close the database
Expand All @@ -320,8 +326,10 @@ func (n *RaftNode) Close(wait bool) error {
return err
}
n.db = nil
n.log.Trace("RaftNode closed database")
}

n.log.Info("RaftNode has stopped")
return nil
}

Expand Down

0 comments on commit 4f50b5c

Please sign in to comment.