Compare commits
5 Commits
76159f819d
...
9116bb761b
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | 9116bb761b | |
Vitaliy Filippov | 258f0d7d1f | |
Vitaliy Filippov | e912747ebb | |
Vitaliy Filippov | dea46388d2 | |
Vitaliy Filippov | 76239ea24c |
|
@ -161,7 +161,6 @@ class AntiCluster
|
|||
dumps: {},
|
||||
loads: {},
|
||||
};
|
||||
this.resync_state.dumps[this.cfg.node_id] = { ...this.antietcd.etctree.dump(), term: this.antietcd.stored_term };
|
||||
}
|
||||
const seen = {};
|
||||
for (const f of followers)
|
||||
|
@ -205,15 +204,16 @@ class AntiCluster
|
|||
|
||||
_continueResync()
|
||||
{
|
||||
if (Object.values(this.resync_state.dumps).filter(d => !d).length > 0)
|
||||
{
|
||||
// Some dump(s) are still pending
|
||||
return;
|
||||
}
|
||||
this.resync_state.dumps[this.cfg.node_id] = { ...this.antietcd.etctree.dump(), term: this.antietcd.stored_term };
|
||||
let max_term = -1, with_max = [];
|
||||
for (const follower in this.resync_state.dumps)
|
||||
{
|
||||
const dump = this.resync_state.dumps[follower];
|
||||
if (!dump)
|
||||
{
|
||||
// Some dump(s) are still pending
|
||||
return;
|
||||
}
|
||||
if (dump.term > max_term)
|
||||
{
|
||||
max_term = dump.term;
|
||||
|
@ -228,8 +228,8 @@ class AntiCluster
|
|||
{
|
||||
throw new Error('BUG: no max term during resync');
|
||||
}
|
||||
with_max = with_max.filter(w => w != this.cfg.node_id);
|
||||
console.log('Local term '+this.antietcd.stored_term+', max follower term '+max_term+' at nodes '+with_max.join(', '));
|
||||
with_max = with_max.filter(w => w != this.cfg.node_id);
|
||||
// Merge databases of all nodes with maximum term
|
||||
// Force other nodes to replicate the merged DB, throwing away their own states
|
||||
for (let i = 0; i < with_max.length; i++)
|
||||
|
|
Loading…
Reference in New Issue