Skip to content

Commit

Permalink
[FAB-6288] remove test TestStoreConcurrentReadWrite
Browse files Browse the repository at this point in the history
This test checks a specific concurrent execution path that
resulted in a deadlock, but now after it is fixed, it makes
no sense to keep this test anymore in CI.

Change-Id: I2efd64fe51957b817ec94897c7a9fdb7d4da3b52
Signed-off-by: yacovm <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Sep 25, 2017
1 parent 7c12814 commit 39881fb
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions core/ledger/ledgerstorage/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ limitations under the License.
package ledgerstorage

import (
"fmt"
"os"
"runtime"
"testing"
"time"

"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/common/ledger/blkstorage"
"github.com/hyperledger/fabric/common/ledger/blkstorage/fsblkstorage"
"github.com/hyperledger/fabric/common/ledger/testutil"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/ledgerconfig"
"github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/ledger/rwset"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
Expand All @@ -42,50 +38,6 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}

func TestStoreConcurrentReadWrite(t *testing.T) {
testEnv := newTestEnv(t)
defer testEnv.cleanup()
provider := NewProvider()
defer provider.Close()
store, err := provider.Open("testLedger")
assert.NoError(t, err)
defer store.Shutdown()

// Modify store to have a BlockStore that has a custom slowdown
store.BlockStore = newSlowBlockStore(store.BlockStore, time.Second)

sampleData := sampleData(t)
// Commit first block
store.CommitWithPvtData(sampleData[0])
go func() {
time.Sleep(time.Millisecond * 500)
// Commit all but first block
for _, sampleDatum := range sampleData[1:] {
store.CommitWithPvtData(sampleDatum)
}

}()

c := make(chan struct{})
go func() {
// Read first block
_, err := store.GetPvtDataAndBlockByNum(0, nil)
assert.NoError(t, err)
c <- struct{}{}
}()

select {
case <-c:
t.Log("Obtained private data and block by number")
case <-time.After(time.Second * 10):
assert.Fail(t, "Didn't finish within a timely manner, perhaps the system is deadlocked?")
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Printf("%s", buf)
}

}

func TestStore(t *testing.T) {
testEnv := newTestEnv(t)
defer testEnv.cleanup()
Expand Down Expand Up @@ -236,25 +188,3 @@ func samplePvtData(t *testing.T, txNums []uint64) map[uint64]*ledger.TxPvtData {
}
return constructPvtdataMap(pvtData)
}

type slowBlockStore struct {
delay time.Duration
blkstorage.BlockStore
}

func newSlowBlockStore(store blkstorage.BlockStore, delay time.Duration) blkstorage.BlockStore {
return &slowBlockStore{
delay: delay,
BlockStore: store,
}
}

func (bs *slowBlockStore) RetrieveBlockByNumber(blockNum uint64) (*common.Block, error) {
time.Sleep(bs.delay)
return bs.BlockStore.RetrieveBlockByNumber(blockNum)
}

func (bs *slowBlockStore) AddBlock(block *common.Block) error {
time.Sleep(bs.delay)
return bs.BlockStore.AddBlock(block)
}

0 comments on commit 39881fb

Please sign in to comment.