Skip to content
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

REWRITEAOF #1330

Closed
someben opened this issue Oct 16, 2013 · 2 comments
Closed

REWRITEAOF #1330

someben opened this issue Oct 16, 2013 · 2 comments
Labels
state:to-be-closed requesting the core team to close the issue

Comments

@someben
Copy link

someben commented Oct 16, 2013

Add a command to rewrite an optimized version of the AOF but NOT in the background. This makes sense when a server is stressed and starting a background rewrite is too expensive.

@yoav-steinberg
Copy link
Contributor

yoav-steinberg commented Jun 10, 2021

I can imagine the following scenario:

  • There's lots of activity on the server and memory is stressed so a background rewrite is dangerous because it might crash the server if it runs out of memory due to the rewrite copy-on-write/diff buffers overhead.
  • Disk space is running low and we must do the rewrite now to avoid a crash due to running out of disk space.
    This is the only possible scenario I can think of when you'd need this. But in this scenario it's clear we have an inadequate configuration: too much activity and not enough free memory to handle rewrites (without disrupting clients). So ideally, if you reach such a state, you'd down the server and reconfigure it (or due a failover to another server). That's the best solution because if you have to disrupt clients best do it only once and not block server access periodically with a foreground aof rewrite.

You might say, I don't want to reconfigure my server, I'm ok with disrupting clients periodically and don't want to pay for a bigger server. If that's the case, you can solve this with a CLIENT PAUSE timeout WRITE and then a BGREWRITEAOF to achieve the desired functionality. Note that this also give you the advantage of tracking rewrite progress instead of blocking the server completely. Once rewrite is done you can issue a CLIENT UNPAUSE.

@yoav-steinberg yoav-steinberg added the state:to-be-closed requesting the core team to close the issue label Jun 10, 2021
@yoav-steinberg
Copy link
Contributor

I'm closing after discussing this with @oranagra and confirming with him the above proposed solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:to-be-closed requesting the core team to close the issue
Projects
None yet
Development

No branches or pull requests

2 participants