Skip to content

Commit

Permalink
find and fix error
Browse files Browse the repository at this point in the history
Signed-off-by: Fedor Partanskiy <pfi79@mail.ru>
  • Loading branch information
pfi79 committed Jan 10, 2024
1 parent 16856f9 commit dc4ebca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion integration/gateway/gateway_bft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var _ = Describe("GatewayService with BFT ordering service", func() {
})

It("Submit transaction", func() {
ctx, cancel := context.WithTimeout(context.Background(), network.EventuallyTimeout)
ctx, cancel := context.WithTimeout(context.Background(), network.EventuallyTimeout*2)
defer cancel()

org1Peer0 := network.Peer("Org1", "peer0")
Expand Down
2 changes: 1 addition & 1 deletion integration/raft/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
o2 := network.Orderer("orderer2")
o3 := network.Orderer("orderer3")

By("Waiting for them to elect a leader")
By("Waiting for them to select a leader")
FindLeader(ordererRunners)

assertBlockReception(map[string]int{
Expand Down
17 changes: 13 additions & 4 deletions orderer/common/multichannel/registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ var logger = flogging.MustGetLogger("orderer.common.multichannel")
type Registrar struct {
config localconfig.TopLevel

lock sync.RWMutex
chains map[string]*ChainSupport
followers map[string]*follower.Chain
lock sync.RWMutex
removeChLock sync.Mutex
chains map[string]*ChainSupport
followers map[string]*follower.Chain
// existence indicates removal is in-progress or failed
// when failed, the status will indicate failed all other states
// denote an in-progress removal
Expand Down Expand Up @@ -489,6 +490,11 @@ func (r *Registrar) createNewChain(configtx *cb.Envelope) *ChainSupport {
// It is called when a follower detects a config block that indicates cluster membership and halts, transferring
// execution to the consensus.Chain.
func (r *Registrar) SwitchFollowerToChain(channelID string) {
if !r.removeChLock.TryLock() {
return
}
defer r.removeChLock.Unlock()

r.lock.Lock()
defer r.lock.Unlock()

Expand All @@ -504,7 +510,7 @@ func (r *Registrar) SwitchFollowerToChain(channelID string) {
delete(r.followers, channelID)
logger.Debugf("Removed follower for channel %s", channelID)
cs := r.createNewChain(configTx(lf))
if err := r.removeJoinBlock(channelID); err != nil {
if err = r.removeJoinBlock(channelID); err != nil {
logger.Panicf("Failed removing join-block for channel: %s: %v", channelID, err)
}
cs.start()
Expand Down Expand Up @@ -767,6 +773,9 @@ func (r *Registrar) createFollower(

// RemoveChannel instructs the orderer to remove a channel.
func (r *Registrar) RemoveChannel(channelID string) error {
r.removeChLock.Lock()
defer r.removeChLock.Unlock()

r.lock.Lock()
defer r.lock.Unlock()

Expand Down

0 comments on commit dc4ebca

Please sign in to comment.