Skip to content

Commit f873157

Browse files
committed
*: new results, clean up everything
1 parent 0f1fd9d commit f873157

File tree

136 files changed

+5872
-7533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+5872
-7533
lines changed

.gitignore

-2
This file was deleted.

agent/agent_cetcd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ func startCetcd(fs *flags, t *transporterServer) error {
2626
return fmt.Errorf("cetcd binary %q does not exist", globalFlags.cetcdExec)
2727
}
2828

29-
peerIPs := strings.Split(t.req.PeerIPString, "___")
29+
peerIPs := strings.Split(t.req.PeerIPsString, "___")
3030
clientURLs := make([]string, len(peerIPs))
3131
for i, u := range peerIPs {
3232
clientURLs[i] = fmt.Sprintf("http://%s:2379", u)
3333
}
3434

3535
flags := []string{
3636
// "-consuladdr", "0.0.0.0:8500",
37-
"-consuladdr", fmt.Sprintf("%s:8500", peerIPs[t.req.ServerIndex]),
38-
"-etcd", clientURLs[t.req.ServerIndex], // etcd endpoint
37+
"-consuladdr", fmt.Sprintf("%s:8500", peerIPs[t.req.IpIndex]),
38+
"-etcd", clientURLs[t.req.IpIndex], // etcd endpoint
3939
}
4040
flagString := strings.Join(flags, " ")
4141

agent/agent_consul.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ func startConsul(fs *flags, t *transporterServer) error {
3131
return err
3232
}
3333

34-
peerIPs := strings.Split(t.req.PeerIPString, "___")
34+
peerIPs := strings.Split(t.req.PeerIPsString, "___")
3535

3636
var flags []string
37-
switch t.req.ServerIndex {
37+
switch t.req.IpIndex {
3838
case 0: // leader
3939
flags = []string{
4040
"agent",
4141
"-server",
4242
"-data-dir", fs.consulDataDir,
43-
"-bind", peerIPs[t.req.ServerIndex],
44-
"-client", peerIPs[t.req.ServerIndex],
43+
"-bind", peerIPs[t.req.IpIndex],
44+
"-client", peerIPs[t.req.IpIndex],
4545
"-bootstrap-expect", "3",
4646
}
4747

@@ -50,8 +50,8 @@ func startConsul(fs *flags, t *transporterServer) error {
5050
"agent",
5151
"-server",
5252
"-data-dir", fs.consulDataDir,
53-
"-bind", peerIPs[t.req.ServerIndex],
54-
"-client", peerIPs[t.req.ServerIndex],
53+
"-bind", peerIPs[t.req.IpIndex],
54+
"-client", peerIPs[t.req.IpIndex],
5555
"-join", peerIPs[0],
5656
}
5757
}

agent/agent_etcd.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func startEtcd(fs *flags, t *transporterServer) error {
3131
return err
3232
}
3333

34-
peerIPs := strings.Split(t.req.PeerIPString, "___")
34+
peerIPs := strings.Split(t.req.PeerIPsString, "___")
3535

3636
names := make([]string, len(peerIPs))
3737
clientURLs := make([]string, len(peerIPs))
@@ -44,23 +44,23 @@ func startEtcd(fs *flags, t *transporterServer) error {
4444
members[i] = fmt.Sprintf("%s=%s", names[i], peerURLs[i])
4545
}
4646

47-
qv := t.req.EtcdQuotaSizeBytes
47+
qv := t.req.Etcdv3Config.QuotaSizeBytes
4848
if qv > 8000000000 {
4949
plog.Warningf("maximum etcd quota is 8GB (got %d)... resetting to 8GB...", qv)
5050
qv = 8000000000
5151
}
5252
flags := []string{
53-
"--name", names[t.req.ServerIndex],
53+
"--name", names[t.req.IpIndex],
5454
"--data-dir", fs.etcdDataDir,
5555
"--quota-backend-bytes", fmt.Sprintf("%d", qv),
5656

57-
"--snapshot-count", fmt.Sprintf("%d", t.req.EtcdSnapCount),
57+
"--snapshot-count", fmt.Sprintf("%d", t.req.Etcdv3Config.SnapCount),
5858

59-
"--listen-client-urls", clientURLs[t.req.ServerIndex],
60-
"--advertise-client-urls", clientURLs[t.req.ServerIndex],
59+
"--listen-client-urls", clientURLs[t.req.IpIndex],
60+
"--advertise-client-urls", clientURLs[t.req.IpIndex],
6161

62-
"--listen-peer-urls", peerURLs[t.req.ServerIndex],
63-
"--initial-advertise-peer-urls", peerURLs[t.req.ServerIndex],
62+
"--listen-peer-urls", peerURLs[t.req.IpIndex],
63+
"--initial-advertise-peer-urls", peerURLs[t.req.IpIndex],
6464

6565
"--initial-cluster-token", "dbtester-etcd-token",
6666
"--initial-cluster", strings.Join(members, ","),

agent/agent_zetcd.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ func startZetcd(fs *flags, t *transporterServer) error {
2626
return fmt.Errorf("zetcd binary %q does not exist", globalFlags.zetcdExec)
2727
}
2828

29-
peerIPs := strings.Split(t.req.PeerIPString, "___")
29+
peerIPs := strings.Split(t.req.PeerIPsString, "___")
3030
clientURLs := make([]string, len(peerIPs))
3131
for i, u := range peerIPs {
3232
clientURLs[i] = fmt.Sprintf("http://%s:2379", u)
3333
}
3434

3535
flags := []string{
3636
// "-zkaddr", "0.0.0.0:2181",
37-
"-zkaddr", fmt.Sprintf("%s:2181", peerIPs[t.req.ServerIndex]),
38-
"-endpoint", clientURLs[t.req.ServerIndex],
37+
"-zkaddr", fmt.Sprintf("%s:2181", peerIPs[t.req.IpIndex]),
38+
"-endpoint", clientURLs[t.req.IpIndex],
3939
}
4040
flagString := strings.Join(flags, " ")
4141

agent/agent_zookeeper.go

+27-39
Original file line numberDiff line numberDiff line change
@@ -30,47 +30,32 @@ dataDir={{.DataDir}}
3030
clientPort={{.ClientPort}}
3131
initLimit={{.InitLimit}}
3232
syncLimit={{.SyncLimit}}
33-
maxClientCnxns={{.MaxClientCnxns}}
33+
maxClientCnxns={{.MaxClientConnections}}
3434
snapCount={{.SnapCount}}
3535
{{range .Peers}}server.{{.MyID}}={{.IP}}:2888:3888
3636
{{end}}
3737
`
38-
39-
// this is Zookeeper default configuration
40-
// http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html
41-
zkConfigDefault = ZookeeperConfig{
42-
TickTime: 2000,
43-
ClientPort: "2181",
44-
InitLimit: 5,
45-
SyncLimit: 5,
46-
MaxClientCnxns: 60,
47-
Peers: []ZookeeperPeer{
48-
{MyID: 1, IP: ""},
49-
{MyID: 2, IP: ""},
50-
{MyID: 3, IP: ""},
51-
},
52-
}
5338
)
5439

40+
// ZookeeperConfig is zookeeper configuration.
41+
// http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html
42+
type ZookeeperConfig struct {
43+
TickTime int64
44+
DataDir string
45+
ClientPort int64
46+
InitLimit int64
47+
SyncLimit int64
48+
MaxClientConnections int64
49+
SnapCount int64
50+
Peers []ZookeeperPeer
51+
}
52+
5553
// ZookeeperPeer defines Zookeeper peer configuration.
5654
type ZookeeperPeer struct {
5755
MyID int
5856
IP string
5957
}
6058

61-
// ZookeeperConfig is zookeeper configuration.
62-
// http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html
63-
type ZookeeperConfig struct {
64-
TickTime int
65-
DataDir string
66-
ClientPort string
67-
InitLimit int
68-
SyncLimit int
69-
MaxClientCnxns int64
70-
SnapCount int64
71-
Peers []ZookeeperPeer
72-
}
73-
7459
var shell = os.Getenv("SHELL")
7560

7661
func init() {
@@ -99,23 +84,26 @@ func startZookeeper(fs *flags, t *transporterServer) error {
9984
}
10085

10186
ipath := filepath.Join(fs.zkDataDir, "myid")
102-
plog.Infof("writing Zookeeper myid file %d to %s", t.req.ZookeeperMyID, ipath)
103-
if err := toFile(fmt.Sprintf("%d", t.req.ZookeeperMyID), ipath); err != nil {
87+
plog.Infof("writing Zookeeper myid file %d to %s", t.req.ZookeeperConfig.MyID, ipath)
88+
if err := toFile(fmt.Sprintf("%d", t.req.ZookeeperConfig.MyID), ipath); err != nil {
10489
return err
10590
}
10691

107-
peerIPs := strings.Split(t.req.PeerIPString, "___")
92+
peerIPs := strings.Split(t.req.PeerIPsString, "___")
10893
peers := []ZookeeperPeer{}
10994
for i := range peerIPs {
11095
peers = append(peers, ZookeeperPeer{MyID: i + 1, IP: peerIPs[i]})
11196
}
112-
113-
cfg := zkConfigDefault
114-
cfg.DataDir = fs.zkDataDir
115-
cfg.Peers = peers
116-
cfg.SnapCount = t.req.ZookeeperSnapCount
117-
cfg.MaxClientCnxns = t.req.ZookeeperMaxClientCnxns
118-
97+
cfg := ZookeeperConfig{
98+
TickTime: t.req.ZookeeperConfig.TickTime,
99+
DataDir: fs.zkDataDir,
100+
ClientPort: t.req.ZookeeperConfig.ClientPort,
101+
InitLimit: t.req.ZookeeperConfig.InitLimit,
102+
SyncLimit: t.req.ZookeeperConfig.SyncLimit,
103+
MaxClientConnections: t.req.ZookeeperConfig.MaxClientConnections,
104+
Peers: peers,
105+
SnapCount: t.req.ZookeeperConfig.SnapCount,
106+
}
119107
tpl := template.Must(template.New("zkTemplate").Parse(zkTemplate))
120108
buf := new(bytes.Buffer)
121109
if err := tpl.Execute(buf, cfg); err != nil {

0 commit comments

Comments
 (0)