Skip to content

Commit

Permalink
Enhance orderer channel configuration in mainchannel_controller
Browse files Browse the repository at this point in the history
- Added methods to set various EtcdRaft options including ElectionInterval, HeartbeatTick, TickInterval, SnapshotIntervalSize, and MaxInflightBlocks in the updateOrdererChannelConfigTx function.
- Improved error handling for each configuration setting to ensure robust updates.

These changes facilitate better control over the orderer channel's Raft consensus parameters, enhancing overall system reliability.

Signed-off-by: David VIEJO <dviejo@kungfusoftware.es>
  • Loading branch information
dviejokfs committed Dec 17, 2024
1 parent 47482ee commit 44dd66f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions controllers/mainchannel/mainchannel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,36 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
}
}
}
err = currentConfigTX.Orderer().EtcdRaftOptions().SetElectionInterval(
newConfigTx.Orderer.EtcdRaft.Options.ElectionTick,
)
if err != nil {
return errors.Wrapf(err, "failed to set election interval")
}
err = currentConfigTX.Orderer().EtcdRaftOptions().SetHeartbeatTick(
newConfigTx.Orderer.EtcdRaft.Options.HeartbeatTick,
)
if err != nil {
return errors.Wrapf(err, "failed to set heartbeat tick")
}
err = currentConfigTX.Orderer().EtcdRaftOptions().SetTickInterval(
newConfigTx.Orderer.EtcdRaft.Options.TickInterval,
)
if err != nil {
return errors.Wrapf(err, "failed to set tick interval")
}
err = currentConfigTX.Orderer().EtcdRaftOptions().SetSnapshotIntervalSize(
newConfigTx.Orderer.EtcdRaft.Options.SnapshotIntervalSize,
)
if err != nil {
return errors.Wrapf(err, "failed to set snapshot interval size")
}
err = currentConfigTX.Orderer().EtcdRaftOptions().SetMaxInflightBlocks(
newConfigTx.Orderer.EtcdRaft.Options.MaxInflightBlocks,
)
if err != nil {
return errors.Wrapf(err, "failed to set max inflight blocks")
}
} else if newConfigTx.Orderer.OrdererType == orderer.ConsensusTypeBFT {
err = currentConfigTX.Orderer().SetConfiguration(newConfigTx.Orderer)
if err != nil {
Expand Down Expand Up @@ -1583,6 +1613,7 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
if err != nil {
return errors.Wrapf(err, "failed to set preferred max bytes")
}

err = currentConfigTX.Orderer().SetBatchTimeout(newConfigTx.Orderer.BatchTimeout)
if err != nil {
return errors.Wrapf(err, "failed to set batch timeout")
Expand Down

0 comments on commit 44dd66f

Please sign in to comment.