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 <[email protected]>
  • Loading branch information
pfi79 committed Jan 8, 2024
1 parent 16856f9 commit c19d261
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration/raft/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {

By("Launching the orderers")
for _, o := range orderers {
runner := network.OrdererRunner(o, "FABRIC_LOGGING_SPEC=orderer.consensus.etcdraft=debug:info")
runner := network.OrdererRunner(o, "FABRIC_LOGGING_SPEC=orderer.consensus.etcdraft=debug:debug")
ordererRunners = append(ordererRunners, runner)
process := ifrit.Invoke(runner)
ordererProcesses = append(ordererProcesses, process)
Expand Down 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
4 changes: 4 additions & 0 deletions orderer/common/follower/follower_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ func (c *Chain) Start() {
// Halt signals the Chain to stop and waits for the internal go-routine to exit.
func (c *Chain) Halt() {
c.halt()
c.logger.Info("PFI03")
<-c.doneChan
c.logger.Info("PFI04")
}

func (c *Chain) halt() {
Expand Down Expand Up @@ -354,7 +356,9 @@ func (c *Chain) pull() error {
// Trigger creation of a new consensus.Chain.
c.logger.Info("Block pulling finished successfully, going to switch from follower to a consensus.Chain")
c.halt()
c.logger.Info("PFI01")
c.chainCreator.SwitchFollowerToChain(c.ledgerResources.ChannelID())
c.logger.Info("PFI02")

return nil
}
Expand Down
5 changes: 5 additions & 0 deletions orderer/common/multichannel/registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,24 +489,29 @@ 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) {
logger.Info("PFI10")
r.lock.Lock()
defer r.lock.Unlock()

logger.Info("PFI11")
lf, err := r.ledgerFactory.GetOrCreate(channelID)
if err != nil {
logger.Panicf("Failed obtaining ledger factory for channel %s: %v", channelID, err)
}

logger.Info("PFI12")
if _, chainExists := r.chains[channelID]; chainExists {
logger.Panicf("Programming error, channel already exists: %s", channelID)
}

logger.Info("PFI13")
delete(r.followers, channelID)
logger.Debugf("Removed follower for channel %s", channelID)
cs := r.createNewChain(configTx(lf))
if err := r.removeJoinBlock(channelID); err != nil {
logger.Panicf("Failed removing join-block for channel: %s: %v", channelID, err)
}
logger.Info("PFI14")
cs.start()
logger.Infof("Created and started channel %s", cs.ChannelID())
}
Expand Down

0 comments on commit c19d261

Please sign in to comment.