Skip to content

Commit

Permalink
FAB 18365 evictionsuspicion failing when osn failed (#2780)
Browse files Browse the repository at this point in the history
after committing config block in orderer but before applying
it raft.

Signed-off-by: Parameswaran Selvam <parselva@in.ibm.com>
  • Loading branch information
Param-S authored Jul 23, 2021
1 parent fe71474 commit 463271e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
15 changes: 7 additions & 8 deletions orderer/consensus/etcdraft/eviction.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ func (es *evictionSuspector) confirmSuspicion(cumulativeSuspicion time.Duration)

es.logger.Infof("Last config block was found to be block [%d]", lastConfigBlock.Header.Number)

height := es.height()

if lastConfigBlock.Header.Number+1 <= height {
es.logger.Infof("Our height is higher or equal than the height of the orderer we pulled the last block from, aborting.")
return
}

err = es.amIInChannel(lastConfigBlock)
if err != cluster.ErrNotInChannel && err != cluster.ErrForbidden {
details := fmt.Sprintf(", our certificate was found in config block with sequence %d", lastConfigBlock.Header.Number)
Expand All @@ -131,12 +124,18 @@ func (es *evictionSuspector) confirmSuspicion(cumulativeSuspicion time.Duration)
es.triggerCatchUp(&raftpb.Snapshot{Data: protoutil.MarshalOrPanic(lastConfigBlock)})
return
}

es.logger.Warningf("Detected our own eviction from the channel in block [%d]", lastConfigBlock.Header.Number)

es.logger.Infof("Waiting for chain to halt")
es.halt()
es.halted = true

height := es.height()
if lastConfigBlock.Header.Number+1 <= height {
es.logger.Infof("Our height is higher or equal than the height of the orderer we pulled the last block from, aborting.")
return
}

es.logger.Infof("Chain has been halted, pulling remaining blocks up to (and including) eviction block.")

nextBlock := height
Expand Down
17 changes: 9 additions & 8 deletions orderer/consensus/etcdraft/eviction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,6 @@ func TestEvictionSuspector(t *testing.T) {
expectedPanic: "Failed creating a block puller: oops",
halt: t.Fail,
},
{
description: "our height is the highest",
expectedLog: "Our height is higher or equal than the height of the orderer we pulled the last block from, aborting",
evictionSuspicionThreshold: 10*time.Minute - time.Second,
blockPuller: puller,
height: 10,
halt: t.Fail,
},
{
description: "failed pulling the block",
expectedLog: "Cannot confirm our own eviction from the channel: bad block",
Expand All @@ -194,6 +186,15 @@ func TestEvictionSuspector(t *testing.T) {
height: 9,
halt: t.Fail,
},
{
description: "our height is the highest",
expectedLog: "Our height is higher or equal than the height of the orderer we pulled the last block from, aborting",
evictionSuspicionThreshold: 10*time.Minute - time.Second,
amIInChannelReturns: cluster.ErrNotInChannel,
blockPuller: puller,
height: 10,
halt: func() {},
},
{
description: "we are not in the channel",
expectedLog: "Detected our own eviction from the channel in block [9]",
Expand Down

0 comments on commit 463271e

Please sign in to comment.