Skip to content

Commit c3ca1fb

Browse files
authored
Merge pull request #201 from arangodb-helper/bugfix/prevent-useless-clusterupdate
Prevent storing an "updated" ClusterConfig when it has not changed
2 parents ffbed61 + 6f133cd commit c3ca1fb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Changes from version 0.13.3 to master
44

5+
- Starter cluster configuration no longer written to `setup.json` when
6+
it has not changed.
7+
58
## Changes from version 0.13.2 to 0.13.3
69

710
- Fixed a bug in the RECOVERY procedure which was declined if a new

service/service.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"net"
3434
"net/http"
3535
"path/filepath"
36+
"reflect"
3637
"strconv"
3738
"strings"
3839
"sync"
@@ -1043,9 +1044,14 @@ func (s *Service) UpdateClusterConfig(newConfig ClusterConfig) {
10431044
return
10441045
}
10451046

1046-
// TODO only update when changed
1047-
s.myPeers = newConfig
1048-
s.saveSetup()
1047+
// Only update when changed
1048+
if !reflect.DeepEqual(s.myPeers, newConfig) {
1049+
s.myPeers = newConfig
1050+
s.saveSetup()
1051+
s.log.Debug().Msg("Updated cluster config")
1052+
} else {
1053+
s.log.Debug().Msg("Updating cluster config is not needed")
1054+
}
10491055
}
10501056

10511057
// MasterChangedCallback interrupts the runtime cluster manager

0 commit comments

Comments
 (0)