Browse Source

Merge pull request #3399 from tendermint/release/v0.30.2

Release/v0.30.2
pull/3415/head v0.30.2
Ethan Buchman 6 years ago
committed by GitHub
parent
commit
976819537d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 52 additions and 1 deletions
  1. +19
    -0
      CHANGELOG.md
  2. +5
    -0
      libs/db/c_level_db.go
  3. +5
    -0
      libs/db/debug_db.go
  4. +4
    -0
      libs/db/go_level_db.go
  5. +4
    -0
      libs/db/mem_batch.go
  6. +4
    -0
      libs/db/prefix_db.go
  7. +1
    -0
      libs/db/remotedb/grpcdb/server.go
  8. +4
    -0
      libs/db/remotedb/remotedb.go
  9. +2
    -0
      libs/db/types.go
  10. +1
    -0
      lite/dbprovider.go
  11. +2
    -0
      state/txindex/kv/kv.go
  12. +1
    -1
      version/version.go

+ 19
- 0
CHANGELOG.md View File

@ -1,5 +1,24 @@
# Changelog
## v0.30.2
*March 10th, 2019*
This release fixes a CLevelDB memory leak. It was happening because we were not
closing the WriteBatch object after use. See [levigo's
godoc](https://godoc.org/github.com/jmhodges/levigo#WriteBatch.Close) for the
Close method. Special thanks goes to @Stumble who both reported an issue in
[cosmos-sdk](https://github.com/cosmos/cosmos-sdk/issues/3842) and provided a
fix here.
### BREAKING CHANGES:
* Go API
- [libs/db] [\#3842](https://github.com/cosmos/cosmos-sdk/issues/3842) Add Close() method to Batch interface (@Stumble)
### BUG FIXES:
- [libs/db] [\#3842](https://github.com/cosmos/cosmos-sdk/issues/3842) Fix CLevelDB memory leak (@Stumble)
## v0.30.1
*February 20th, 2019*


+ 5
- 0
libs/db/c_level_db.go View File

@ -179,6 +179,11 @@ func (mBatch *cLevelDBBatch) WriteSync() {
}
}
// Implements Batch.
func (mBatch *cLevelDBBatch) Close() {
mBatch.batch.Close()
}
//----------------------------------------
// Iterator
// NOTE This is almost identical to db/go_level_db.Iterator


+ 5
- 0
libs/db/debug_db.go View File

@ -250,3 +250,8 @@ func (dbch debugBatch) WriteSync() {
fmt.Printf("%v.batch.WriteSync()\n", dbch.label)
dbch.bch.WriteSync()
}
// Implements Batch.
func (dbch debugBatch) Close() {
dbch.bch.Close()
}

+ 4
- 0
libs/db/go_level_db.go View File

@ -184,6 +184,10 @@ func (mBatch *goLevelDBBatch) WriteSync() {
}
}
// Implements Batch.
// Close is no-op for goLevelDBBatch.
func (mBatch *goLevelDBBatch) Close() {}
//----------------------------------------
// Iterator
// NOTE This is almost identical to db/c_level_db.Iterator


+ 4
- 0
libs/db/mem_batch.go View File

@ -46,6 +46,10 @@ func (mBatch *memBatch) WriteSync() {
mBatch.write(true)
}
func (mBatch *memBatch) Close() {
mBatch.ops = nil
}
func (mBatch *memBatch) write(doSync bool) {
if mtx := mBatch.db.Mutex(); mtx != nil {
mtx.Lock()


+ 4
- 0
libs/db/prefix_db.go View File

@ -248,6 +248,10 @@ func (pb prefixBatch) WriteSync() {
pb.source.WriteSync()
}
func (pb prefixBatch) Close() {
pb.source.Close()
}
//----------------------------------------
// prefixIterator


+ 1
- 0
libs/db/remotedb/grpcdb/server.go View File

@ -180,6 +180,7 @@ func (s *server) BatchWriteSync(c context.Context, b *protodb.Batch) (*protodb.N
func (s *server) batchWrite(c context.Context, b *protodb.Batch, sync bool) (*protodb.Nothing, error) {
bat := s.db.NewBatch()
defer bat.Close()
for _, op := range b.Ops {
switch op.Type {
case protodb.Operation_SET:


+ 4
- 0
libs/db/remotedb/remotedb.go View File

@ -260,3 +260,7 @@ func (bat *batch) WriteSync() {
panic(fmt.Sprintf("RemoteDB.BatchWriteSync: %v", err))
}
}
func (bat *batch) Close() {
bat.ops = nil
}

+ 2
- 0
libs/db/types.go View File

@ -57,10 +57,12 @@ type DB interface {
//----------------------------------------
// Batch
// Batch Close must be called when the program no longer needs the object.
type Batch interface {
SetDeleter
Write()
WriteSync()
Close()
}
type SetDeleter interface {


+ 1
- 0
lite/dbprovider.go View File

@ -54,6 +54,7 @@ func (dbp *DBProvider) SaveFullCommit(fc FullCommit) error {
dbp.logger.Info("DBProvider.SaveFullCommit()...", "fc", fc)
batch := dbp.db.NewBatch()
defer batch.Close()
// Save the fc.validators.
// We might be overwriting what we already have, but


+ 2
- 0
state/txindex/kv/kv.go View File

@ -78,6 +78,7 @@ func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) {
// AddBatch indexes a batch of transactions using the given list of tags.
func (txi *TxIndex) AddBatch(b *txindex.Batch) error {
storeBatch := txi.store.NewBatch()
defer storeBatch.Close()
for _, result := range b.Ops {
hash := result.Tx.Hash()
@ -109,6 +110,7 @@ func (txi *TxIndex) AddBatch(b *txindex.Batch) error {
// Index indexes a single transaction using the given list of tags.
func (txi *TxIndex) Index(result *types.TxResult) error {
b := txi.store.NewBatch()
defer b.Close()
hash := result.Tx.Hash()


+ 1
- 1
version/version.go View File

@ -20,7 +20,7 @@ const (
// Must be a string because scripts like dist.sh read this file.
// XXX: Don't change the name of this variable or you will break
// automation :)
TMCoreSemVer = "0.30.1"
TMCoreSemVer = "0.30.2"
// ABCISemVer is the semantic version of the ABCI library
ABCISemVer = "0.15.0"


Loading…
Cancel
Save