diff --git a/api.go b/api.go index 018eb8091..9f4190535 100644 --- a/api.go +++ b/api.go @@ -812,6 +812,9 @@ func (api *API) Usage() (map[string]int64, int64, error) { if !file.IsDir() { continue } + if api.holder.Txf().IsTxDatabasePath(file.Name()) { + continue + } fullName := path.Join(dirName, file.Name()) indexSizes[file.Name()], err = diskUsage(fullName) if err != nil { diff --git a/txfactory_internal_test.go b/txfactory_internal_test.go index dd8225aa7..d172099d5 100644 --- a/txfactory_internal_test.go +++ b/txfactory_internal_test.go @@ -95,9 +95,9 @@ func Test_TxFactory_Qcx_query_context(t *testing.T) { // allow all goro to finish before Closing the lmdb.env, otherwise // we will crash as the goroutines making Tx will try to use the env // after it is closed. It can take quite a while. - // one writer might be blocking the other... so ask for only N-1 at first. - barrier.BlockUntil(N - 1) - //barrier.BlockUntil(N) + // one writer might be blocking the other... so ask for only N-2 at first + // to avoid deadlock. + barrier.BlockUntil(N - 2) barrier.UnblockReaders() time.Sleep(1 * time.Second) }