hitchyjs / scull

Raft Consensus for Node.js, backed by LevelDB
MIT License
3 stars 4 forks source link

Issue with reaching quorum when nodes starts randomly #2

Closed fuson closed 6 years ago

fuson commented 6 years ago

Hello guys, i just change one of your test for emulate situation when nodes start not in +- one time, but start with random delay. In case of 0-10 secs random delay quorum don' reach with 50% chance.

Try in your tests code like (+ setup lab timeout more test time waiting):

before( () => Promise.all( nodes.map( node => { return new Promise((resolve, reject) => { setTimeout(() => { node.start(true).then(resolve).catch(reject); }, Math.random() * 10000); }); })));

soletan commented 6 years ago

I'm currently reworking the code to achieve several improvements over previous versions. This includes use of promises, reducing dependencies and revising all unit and resilience tests. I will obey your case in revised testing.

Currently I can't give information on time of next release, but we are keen to get this revision process done short term.

soletan commented 6 years ago

Thanks for the information, again. After revising existing election tests I've added this case using two clusters different in size. The issue is due to expected "elected"-event emitted prior to last node having joined cluster. This case has been fixed by emitting "elected"-event on a pristine node entering follower state for the first time w/ knowing current leader. Local test cases keep succeeding in several successive runs.

soletan commented 6 years ago

The issue has been fixed in develop branch and tested using revised unit tests on leader election. It is due to be released with next major release.