Skip to content

cluster: release reloading with delay. #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2015

Conversation

vmihailenco
Copy link
Collaborator

/cc @dim

See comment for details.

@vmihailenco
Copy link
Collaborator Author

@dim ping

@dim
Copy link
Contributor

dim commented May 10, 2015

Sorry, busy recently :) I'm no a big fan of artificial delays but the only alternative solution I can think of is a background channel-select loop, where a c.reloading <- struct{}{} channel is triggering a reload.

@vmihailenco
Copy link
Collaborator Author

How that would help? The problem here is that sequence

  • start processing command
  • get hash slot
  • slot moved - reloading
  • finish processing

is not synchronized and we can't tell if we need to reload slots or there was a race between reloading and command processing.

@dim
Copy link
Contributor

dim commented May 11, 2015

Sorry, I thought the problem was that:

  1. start processing command add license please #1
  2. get hash slot, MOVED
  3. trigger reloading
  4. start processing command Fixed the "Getting started" example for client.set() #2
  5. get hash slot, MOVED
  6. trigger reloading again

I don't quite understand what you mean by:

there was a race between reloading and command processing

@vmihailenco
Copy link
Collaborator Author

The sequence is:

So there is a race between cmd1: reloading finished and cmd2: trigger reloading.

@vmihailenco
Copy link
Collaborator Author

@dim ping

@dim
Copy link
Contributor

dim commented May 14, 2015

I think adding a 1s delay will cause more problems than it solves. You could have a genuine slot reallocation by redis in the meantime. I don't see the 'race' being much on an issue, it will trigger another slot sync, but is this really causing much overhead? I don't believe we will ever end up in a spinning state. If you are really keen to avoid it, why don't compare you compare addr returned by isMovedError against the stored address for that slot? Then, you would only trigger lazyReloadSlots if they are different.

As said, I really don't like artificial delays, they always tend to cause not trivial issues downstream.

@vmihailenco vmihailenco force-pushed the fix/release-reloading-with-delay branch from 449a362 to 45bb06c Compare May 14, 2015 13:35
@vmihailenco vmihailenco force-pushed the fix/release-reloading-with-delay branch from 45bb06c to 40bad36 Compare May 14, 2015 13:37
@vmihailenco
Copy link
Collaborator Author

@dim done. PTAL

@vmihailenco
Copy link
Collaborator Author

@dim gentle ping. I think I addressed your comment.

@dim
Copy link
Contributor

dim commented May 26, 2015

@vmihailenco really sorry, been pretty busy, LGTM now

vmihailenco added a commit that referenced this pull request May 26, 2015
@vmihailenco vmihailenco merged commit b70f364 into master May 26, 2015
@vmihailenco vmihailenco deleted the fix/release-reloading-with-delay branch May 26, 2015 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants