Skip to content

Commit 9445274

Browse files
authored
Merge pull request #203 from arangodb-helper/bug-fix/instance-up-timeout
Make instance up timeout configurable and by default higher. Do not use --javascript.copy-installation for 3.3.17 and 3.3.18
2 parents 55b2d9c + eff4c92 commit 9445274

File tree

4 files changed

+39
-17
lines changed

4 files changed

+39
-17
lines changed

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
# ArangoDB Starter Changelog
22

3-
## Changes from version 0.13.3 to master
3+
## Changes from version 0.13.6 to master
4+
5+
## Changes from version 0.13.5 to 0.13.6
6+
7+
- Do not use --javascript.copy-installation for 3.3.18 any more.
8+
- Increase timeout when checking instances for readiness and make it
9+
configurable.
10+
11+
## Changes from version 0.13.3 to 0.13.5
412

513
- Starter cluster configuration no longer written to `setup.json` when
614
it has not changed.
15+
- Added advertised endpoint to coordinators and active failover servers.
16+
- Give option --javascript.copy-installation to versions of ArangoDB
17+
which have it.
718

819
## Changes from version 0.13.2 to 0.13.3
920

@@ -24,8 +35,6 @@
2435

2536
## Changes from version 0.12.0 to 0.13.0
2637

27-
- Added advertised endpoint to coordinators and active failover servers.
28-
2938
- Database upgrade procedure has changed.
3039
It is now much more automated and can be triggered using
3140
an `arangodb upgrade --starter.endpoint=...` command.

main.go

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,23 @@ import (
5454
// Configuration data with defaults:
5555

5656
const (
57-
projectName = "arangodb"
58-
logFileName = projectName + ".log"
59-
defaultDockerGCDelay = time.Minute * 10
60-
defaultDockerStarterImage = "arangodb/arangodb-starter"
61-
defaultArangodPath = "/usr/sbin/arangod"
62-
defaultArangoSyncPath = "/usr/sbin/arangosync"
63-
defaultLogRotateFilesToKeep = 5
64-
defaultLogRotateInterval = time.Minute * 60 * 24
57+
projectName = "arangodb"
58+
logFileName = projectName + ".log"
59+
defaultDockerGCDelay = time.Minute * 10
60+
defaultDockerStarterImage = "arangodb/arangodb-starter"
61+
defaultArangodPath = "/usr/sbin/arangod"
62+
defaultArangoSyncPath = "/usr/sbin/arangosync"
63+
defaultLogRotateFilesToKeep = 5
64+
defaultLogRotateInterval = time.Minute * 60 * 24
65+
defaultInstanceUpTimeoutLinux = time.Second * 300
66+
defaultInstanceUpTimeoutWindows = time.Second * 900
6567
)
6668

6769
var (
68-
projectVersion = "dev"
69-
projectBuild = "dev"
70-
cmdMain = &cobra.Command{
70+
defaultInstanceUpTimeout = defaultInstanceUpTimeoutLinux
71+
projectVersion = "dev"
72+
projectBuild = "dev"
73+
cmdMain = &cobra.Command{
7174
Use: projectName,
7275
Short: "Start ArangoDB clusters & single servers with ease",
7376
Run: cmdMainRun,
@@ -141,6 +144,7 @@ var (
141144
passthroughOptions = make(map[string]*service.PassthroughOption)
142145
debugCluster bool
143146
enableSync bool
147+
instanceUpTimeout time.Duration
144148
syncMonitoringToken string
145149
syncMasterKeyFile string // TLS keyfile of local sync master
146150
syncMasterClientCAFile string // CA Certificate used for client certificate verification
@@ -166,6 +170,10 @@ func init() {
166170
defaultLogColor = false
167171
}
168172

173+
if runtime.GOOS == "windows" {
174+
defaultInstanceUpTimeout = defaultInstanceUpTimeoutWindows
175+
}
176+
169177
// Prepare commandline parser
170178
cmdMain.AddCommand(cmdVersion)
171179

@@ -186,6 +194,7 @@ func init() {
186194
f.BoolVar(&debugCluster, "starter.debug-cluster", getEnvVar("DEBUG_CLUSTER", "") != "", "If set, log more information to debug a cluster")
187195
f.BoolVar(&disableIPv6, "starter.disable-ipv6", !net.IsIPv6Supported(), "If set, no IPv6 notation will be used. Use this only when IPv6 address family is disabled")
188196
f.BoolVar(&enableSync, "starter.sync", false, "If set, the starter will also start arangosync instances")
197+
f.DurationVar(&instanceUpTimeout, "starter.instance-up-timeout", defaultInstanceUpTimeout, "Timeout to wait for an instance start")
189198

190199
pf.BoolVar(&verbose, "log.verbose", false, "Turn on debug logging")
191200
pf.BoolVar(&logOutput.Console, "log.console", true, "Send log output to console")
@@ -727,6 +736,7 @@ func mustPrepareService(generateAutoKeyFile bool) (*service.Service, service.Boo
727736
AllPortOffsetsUnique: allPortOffsetsUnique,
728737
LogRotateFilesToKeep: logRotateFilesToKeep,
729738
LogRotateInterval: logRotateInterval,
739+
InstanceUpTimeout: instanceUpTimeout,
730740
RunningInDocker: isRunningInDocker(),
731741
DockerContainerName: dockerContainerName,
732742
DockerEndpoint: dockerEndpoint,

service/database_features.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type DatabaseFeatures driver.Version
3030

3131
const (
3232
v32 driver.Version = "3.2.0"
33-
v33_17 driver.Version = "3.3.17"
33+
v33_19 driver.Version = "3.3.19"
3434
v34 driver.Version = "3.4.0"
3535
)
3636

@@ -59,7 +59,7 @@ func (v DatabaseFeatures) HasCopyInstallationFiles() bool {
5959
if driver.Version(v).CompareTo(v34) >= 0 {
6060
return true
6161
}
62-
if driver.Version(v).CompareTo(v33_17) >= 0 {
62+
if driver.Version(v).CompareTo(v33_19) >= 0 {
6363
return true
6464
}
6565
return false

service/service.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type Config struct {
7474
DebugCluster bool
7575
LogRotateFilesToKeep int
7676
LogRotateInterval time.Duration
77+
InstanceUpTimeout time.Duration
7778

7879
DockerContainerName string // Name of the container running this process
7980
DockerEndpoint string // Where to reach the docker daemon
@@ -763,7 +764,9 @@ func (s *Service) TestInstance(ctx context.Context, serverType ServerType, addre
763764
return false
764765
}
765766

766-
for i := 0; i < 300; i++ {
767+
var maxNumberOfRounds int
768+
maxNumberOfRounds = int(s.cfg.InstanceUpTimeout * 2 / time.Second)
769+
for i := 0; i < maxNumberOfRounds; i++ {
767770
if checkInstanceOnce() {
768771
return
769772
}

0 commit comments

Comments
 (0)