Unverified Commit 3713cc30 authored by yacovm's avatar yacovm Committed by Artem Barger
Browse files

[FAB-13150] Re-enable etcdraft for v2.0 development



This change set re-enables etcdraft to resume v2.0 development
after v1.4 branch is cut.

Change-Id: I384247a9de2763a207bbde4fa8e519d703241ad5
Signed-off-by: default avataryacovm <yacovm@il.ibm.com>
Signed-off-by: default avatarArtem Barger <bartem@il.ibm.com>
parent 52296172
......@@ -256,7 +256,6 @@ func TestNewOrdererGroup(t *testing.T) {
})
t.Run("etcd/raft-based Orderer", func(t *testing.T) {
t.Skip()
config := configtxgentest.Load(genesisconfig.SampleDevModeEtcdRaftProfile)
group, _ := NewOrdererGroup(config.Orderer)
consensusType := group.GetValues()[channelconfig.ConsensusTypeKey]
......
......@@ -25,7 +25,7 @@ import (
"github.com/tedsuo/ifrit/grouper"
)
var _ = PDescribe("EndToEnd Crash Fault Tolerance", func() {
var _ = Describe("EndToEnd Crash Fault Tolerance", func() {
var (
testDir string
client *docker.Client
......
......@@ -151,7 +151,7 @@ var _ = Describe("EndToEnd", func() {
})
})
PDescribe("basic single node etcdraft network with 2 orgs", func() {
Describe("basic single node etcdraft network with 2 orgs", func() {
BeforeEach(func() {
network = nwo.New(nwo.BasicEtcdRaft(), testDir, client, BasePort(), components)
network.GenerateConfigTree()
......@@ -172,7 +172,7 @@ var _ = Describe("EndToEnd", func() {
})
})
PDescribe("three node etcdraft network with 2 orgs", func() {
Describe("three node etcdraft network with 2 orgs", func() {
BeforeEach(func() {
network = nwo.New(nwo.MultiNodeEtcdRaft(), testDir, client, BasePort(), components)
network.GenerateConfigTree()
......@@ -250,7 +250,7 @@ var _ = Describe("EndToEnd", func() {
})
})
PDescribe("etcd raft, checking valid configuration update of type B", func() {
Describe("etcd raft, checking valid configuration update of type B", func() {
BeforeEach(func() {
network = nwo.New(nwo.BasicEtcdRaft(), testDir, client, BasePort(), components)
network.GenerateConfigTree()
......@@ -299,7 +299,7 @@ var _ = Describe("EndToEnd", func() {
})
})
PDescribe("basic single node etcdraft network with 2 orgs and 2 channels", func() {
Describe("basic single node etcdraft network with 2 orgs and 2 channels", func() {
BeforeEach(func() {
network = nwo.New(nwo.MultiChannelEtcdRaft(), testDir, client, BasePort(), components)
network.GenerateConfigTree()
......
......@@ -21,7 +21,6 @@ import (
)
func TestSpawnEtcdRaft(t *testing.T) {
t.Skip()
gt := NewGomegaWithT(t)
cwd, err := filepath.Abs(".")
......
......@@ -19,6 +19,7 @@ import (
"syscall"
"time"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-lib-go/healthz"
"github.com/hyperledger/fabric/common/channelconfig"
"github.com/hyperledger/fabric/common/crypto"
......@@ -51,7 +52,7 @@ import (
"github.com/hyperledger/fabric/protos/utils"
"go.uber.org/zap/zapcore"
"google.golang.org/grpc"
kingpin "gopkg.in/alecthomas/kingpin.v2"
"gopkg.in/alecthomas/kingpin.v2"
)
var logger = flogging.MustGetLogger("orderer.common.server")
......@@ -357,8 +358,24 @@ func initializeBootstrapChannel(genesisBlock *cb.Block, lf blockledger.Factory)
}
}
func isClusterType(_ *cb.Block) bool {
return false
func isClusterType(genesisBlock *cb.Block) bool {
if genesisBlock.Data == nil || len(genesisBlock.Data.Data) == 0 {
logger.Fatalf("Empty genesis block")
}
env := &cb.Envelope{}
if err := proto.Unmarshal(genesisBlock.Data.Data[0], env); err != nil {
logger.Fatalf("Failed to unmarshal the genesis block's envelope: %v", err)
}
bundle, err := channelconfig.NewBundleFromEnvelope(env)
if err != nil {
logger.Fatalf("Failed creating bundle from the genesis block: %v", err)
}
ordConf, exists := bundle.OrdererConfig()
if !exists {
logger.Fatalf("Orderer config doesn't exist in bundle derived from genesis block")
}
_, exists = clusterTypes[ordConf.ConsensusType()]
return exists
}
func initializeGrpcServer(conf *localconfig.TopLevel, serverConfig comm.ServerConfig) *comm.GRPCServer {
......
......@@ -287,6 +287,61 @@ Orderer: &OrdererDefaults
- kafka1:9092
- kafka2:9092
# EtcdRaft defines configuration which must be set when the "etcdraft"
# orderertype is chosen.
EtcdRaft:
# The set of Raft replicas for this network. For the etcd/raft-based
# implementation, we expect every replica to also be an OSN. Therefore,
# a subset of the host:port items enumerated in this list should be
# replicated under the Orderer.Addresses key above.
Consenters:
- Host: raft0.example.com
Port: 7050
ClientTLSCert: path/to/ClientTLSCert0
ServerTLSCert: path/to/ServerTLSCert0
- Host: raft1.example.com
Port: 7050
ClientTLSCert: path/to/ClientTLSCert1
ServerTLSCert: path/to/ServerTLSCert1
- Host: raft2.example.com
Port: 7050
ClientTLSCert: path/to/ClientTLSCert2
ServerTLSCert: path/to/ServerTLSCert2
# Options to be specified for all the etcd/raft nodes. The values here
# are the defaults for all new channels and can be modified on a
# per-channel basis via configuration updates.
Options:
# TickInterval is the time interval between two Node.Tick
# invocations.
# Unit: millisecond
TickInterval: 100
# ElectionTick is the number of Node.Tick invocations that must pass
# between elections. That is, if a follower does not receive any
# message from the leader of current term before ElectionTick has
# elapsed, it will become candidate and start an election.
# ElectionTick must be greater than HeartbeatTick.
ElectionTick: 10
# HeartbeatTick is the number of Node.Tick invocations that must
# pass between heartbeats. That is, a leader sends heartbeat
# messages to maintain its leadership every HeartbeatTick ticks.
HeartbeatTick: 1
# MaxInflightMsgs limits the max number of in-flight append messages
# during optimistic replication phase.
MaxInflightMsgs: 256
# MaxSizePerMsg limits the max size of each append message. Smaller
# value lowers the raft recovery cost(initial probing and message
# lost during normal operation). On the other side, it might affect
# the throughput during normal replication.
MaxSizePerMsg: 1048576
# SnapshotInterval defines number of blocks per which a snapshot is taken
SnapshotInterval: 500
# Organizations lists the orgs participating on the orderer side of the
# network.
Organizations:
......@@ -491,4 +546,37 @@ Profiles:
Application:
<<: *ApplicationDefaults
Organizations:
- *SampleOrg
\ No newline at end of file
- *SampleOrg
# SampleDevModeEtcdRaft defines a configuration that differs from the
# SampleDevModeSolo one only in that it uses the etcd/raft-based orderer.
SampleDevModeEtcdRaft:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
OrdererType: etcdraft
Organizations:
- <<: *SampleOrg
Policies:
<<: *SampleOrgPolicies
Admins:
Type: Signature
Rule: "OR('SampleOrg.member')"
Application:
<<: *ApplicationDefaults
Organizations:
- <<: *SampleOrg
Policies:
<<: *SampleOrgPolicies
Admins:
Type: Signature
Rule: "OR('SampleOrg.member')"
Consortiums:
SampleConsortium:
Organizations:
- <<: *SampleOrg
Policies:
<<: *SampleOrgPolicies
Admins:
Type: Signature
Rule: "OR('SampleOrg.member')"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment