Skip to content

Commit

Permalink
Fix wrong replication in the sharded setting
Browse files Browse the repository at this point in the history
  • Loading branch information
aminst committed Feb 22, 2024
1 parent 5dbe9ce commit 3f02c9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ansible/templates/oblishard-oramnode.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ExecStart=/root/oblishard/oramnode/oramnode \
-replicaid {{ item.replicaid }} \
-raftport {{ item.raftport }} \
{% if item.replicaid!=0 %}
{{'-joinaddr=' + oramnode_endpoints.endpoints[item.id].exposed_ip + ':' + oramnode_endpoints.endpoints[item.id].port | string }} \
# this assumes there are 3 replicas (Dangerous assmumption)
{{'-joinaddr=' + oramnode_endpoints.endpoints[item.id * 3].exposed_ip + ':' + oramnode_endpoints.endpoints[item.id].port | string }} \
{% endif %}
-conf /root/oblishard/ \
-logpath {{ '/root/oblishard/oramnode/' + item.id | string + '/' + item.replicaid | string + '/all.log' }}
Expand Down
3 changes: 2 additions & 1 deletion ansible/templates/oblishard-shardnode.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ ExecStart=/root/oblishard/shardnode/shardnode \
-replicaid {{ item.replicaid }} \
-raftport {{ item.raftport }} \
{% if item.replicaid!=0 %}
{{'-joinaddr=' + shardnode_endpoints.endpoints[item.id].exposed_ip + ':' + shardnode_endpoints.endpoints[item.id].port | string }} \
# this assumes there are 3 replicas (Dangerous assmumption)
{{'-joinaddr=' + shardnode_endpoints.endpoints[item.id * 3].exposed_ip + ':' + shardnode_endpoints.endpoints[item.id].port | string }} \
{% endif %}
-conf /root/oblishard/ \
-logpath {{ '/root/oblishard/shardnode/' + item.id | string + '/' + item.replicaid | string + '/all.log' }}
Expand Down
7 changes: 4 additions & 3 deletions pkg/shardnode/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ func (fsm *shardNodeFSM) Restore(rc io.ReadCloser) error {
func startRaftServer(isFirst bool, bindIP string, advertiseIP string, replicaID int, raftPort int, shardshardNodeFSM *shardNodeFSM) (*raft.Raft, error) {

raftConfig := raft.DefaultConfig()
raftConfig.ElectionTimeout = 150 * time.Millisecond
raftConfig.HeartbeatTimeout = 150 * time.Millisecond
raftConfig.LeaderLeaseTimeout = 150 * time.Millisecond
// TODO: set these carefuly for the crash experiments
// raftConfig.ElectionTimeout = 150 * time.Millisecond
// raftConfig.HeartbeatTimeout = 150 * time.Millisecond
// raftConfig.LeaderLeaseTimeout = 150 * time.Millisecond
raftConfig.Logger = hclog.New(&hclog.LoggerOptions{Output: log.Logger})
raftConfig.LocalID = raft.ServerID(strconv.Itoa(replicaID))

Expand Down

0 comments on commit 3f02c9f

Please sign in to comment.