You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Randall Leeds (JIRA)" <ji...@apache.org> on 2011/03/02 07:23:36 UTC
[jira] Created: (COUCHDB-1080) fail fast with checkpoint conflicts
fail fast with checkpoint conflicts
-----------------------------------
Key: COUCHDB-1080
URL: https://issues.apache.org/jira/browse/COUCHDB-1080
Project: CouchDB
Issue Type: Improvement
Components: Replication
Affects Versions: 1.0.2
Reporter: Randall Leeds
Fix For: 1.1, 1.2
I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
When a checkpoint conflict occurs it is almost always the right thing to do to abort.
If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1080:
-----------------------------------
Attachment: COUCHDB-1009-3.patch
Ok I just tested the patch, under error conditions, and the following caused a nasty badarg stack trace
+ RepInfo = io_lib:format("replication `~s` (`~s` -> `~s`)",
+ [BaseId ++ Ext, Rep#rep_state.source_name, Rep#rep_state.target_name]),
Rep is not a #rep_state record but it's a #rep record.
I also changed the way to terminate the process. Instead of calling exit(Reason) now it terminates by returning {stop, Reason, State}, which is more OTPish.
The error sent in the JSON body to the client when one of the databases was re-opened is like this:
{"error":"checkpoint_commit_failure","reason":"Source database out of sync. Try to increase max_dbs_open at the source's server."}
cheers
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1009-3.patch, COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1080:
-----------------------------------
Attachment: (was: COUCHDB-1009-3.patch)
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Randall Leeds closed COUCHDB-1080.
----------------------------------
Verified. Thanks!
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Assignee: Filipe Manana
> Fix For: 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-4-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1080:
-----------------------------------
Attachment: COUCHDB-1080-2-fdmanana.patch
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001375#comment-13001375 ]
Filipe Manana commented on COUCHDB-1080:
----------------------------------------
Hi Randall, thanks for the patch. My comments:
1) I would remove the log message 'rebooting ...' - we don't really know if it's really going to be rebooted, it might be the last attempt made by the supervisor;
2) The log message this patch adds ""checkpoint failure: a database was restarted." is confusing in my opinion. What does "database was restarted" means? I would change the message to something like "checkpoint commit failure", because what realy happened in this case was that _ensure_full_commit failed for the source or the target. I would also not remove the part "`~s` (`~s` -> `~s`)" (replication id plus source and target information) from the log message, since it gives the user information about which exact replication is in trouble.
The rest seems fine to me.
cheers
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: paranoid_checkpoint_failure.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1080:
-----------------------------------
Attachment: COUCHDB-1080-fdmanana.patch
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002059#comment-13002059 ]
Randall Leeds commented on COUCHDB-1080:
----------------------------------------
Or just call exit() directly from commit_to_both, including {source_error, Reason} or target_error so it's logged by terminate/2, and then the max_dbs_open suggestion can stay in a 2-clause case statement, unless you want to be clear about *which* database changed start time (3-clause).
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1080:
-----------------------------------
Attachment: COUCHDB-1080-3-fdmanana.patch
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Randall Leeds updated COUCHDB-1080:
-----------------------------------
Attachment: paranoid_checkpoint_failure_v2.patch
Thanks for the feedback, Filipe.
This version I clarified the new log message to offer a suggestion about why it occurred as well.
The failure reason, along with the replication info, now get logged in one place in terminate/2. It should be easy for users to match up the first error (with suggestion about what to fix) with the replication that failed for the same reason (logged in terminate).
No suggestion is made at error time that the replication might restart. When the supervisor restarts the dead replication it will log that at INFO (couch_replicator.erl#L127).
How's this look to you?
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002000#comment-13002000 ]
Filipe Manana commented on COUCHDB-1080:
----------------------------------------
Randall,
+ ?LOG_ERROR("checkpoint failure: a database was closed (replication "
+ "count exceeds max_dbs_open?)", []),
+ exit({checkpoint_commit_failure, database_closed})
I still don't think this log message is right. The call to _ensure_full_commit might fail for several reasons, specially for remote databases. Why do you assume the database was closed, and completely ignore the failure reason? I think the right thing to do is exiting with {checkpoint_commit_failure, Reason}
A minor nitpick here:
+ RepInfo = io_lib:format("replication `~s` (`~s` -> `~s`)",
+ [BaseId ++ Ext, Rep#rep_state.source_name, Rep#rep_state.target_name]),
+ ?LOG_ERROR("~s failed: ~p", [lists:flatten(RepInfo), Reason]),
You don't need to flatten. All the "io:format" family functions accept IOLists for string place holders. Plus, the logger module is converting it to a binary anyway (before sending it to the couch_log gen_event).
I attach here an alternative patch. Let me know what you think.
cheers
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana updated COUCHDB-1080:
-----------------------------------
Attachment: COUCHDB-1080-4-fdmanana.patch
Thanks Randall. It was well spotted this issue, which affects both replicators.
I made further changes to be even more explicit when there's an error updating one of the checkpoints. It no longer bad matches when it fails to update a checkpoint and it sends a message like the following back to the client:
{"error":"checkpoint_commit_failure","reason":"Error updating the source checkpoint document: conflict"}
Also added the following clause:
+ {_NewSrcInstanceStartTime, _NewTgtInstanceStartTime} ->
+ {checkpoint_commit_failure, <<"Source and target databases out of "
+ "sync. Try to increase max_dbs_open at both servers.">>}
Maybe very unlikely to happen, but one never knows :)
I'll commit this 4th patch later today or tomorrow if no complaints are raised.
thanks again
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-4-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002192#comment-13002192 ]
Randall Leeds commented on COUCHDB-1080:
----------------------------------------
Hey, now that looks really clean and nice. Thanks for your help. Ship it!
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Filipe Manana resolved COUCHDB-1080.
------------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.1)
Assignee: Filipe Manana
Applied to trunk. Thanks.
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Assignee: Filipe Manana
> Fix For: 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-4-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COUCHDB-1080) fail fast with checkpoint conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Randall Leeds updated COUCHDB-1080:
-----------------------------------
Attachment: paranoid_checkpoint_failure.patch
Small patch to fix. I can argue more if you need justification but I was hard pressed to think of a case where this is a bad idea.
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: paranoid_checkpoint_failure.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002055#comment-13002055 ]
Randall Leeds commented on COUCHDB-1080:
----------------------------------------
With your patch, commit_to_both can return errors. Before it just threw badmatch exceptions. The old way, the only path to the case clause with my log message was when a successful _ensure_full_commit happened but the instance_start_time did not match (source or target crashed or closed, may have lost some changes we replicated, so we can't checkpoint).
I like the way you changed it, but I also like the helpful error message I added. Maybe now we can have four case clauses in do_checkpoint and that way we can be very clear to the user about what went wrong? Does this make sense to you now?
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002082#comment-13002082 ]
Filipe Manana commented on COUCHDB-1080:
----------------------------------------
My bad, didn't understand what all you're intentions were in the beginning.
Yes I do prefer to be very explicit about what went wrong. This makes it easier to identify issues users stumble upon. And I do like to suggest in the error message to increase the value for max_dbs_open. Good idea!
I added here a new patch.
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COUCHDB-1080) fail fast with checkpoint
conflicts
Posted by "Randall Leeds (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002195#comment-13002195 ]
Randall Leeds commented on COUCHDB-1080:
----------------------------------------
This probably qualifies as a bug fix, but if backporting it to the old replicator is a pain don't worry about it. We should get 1.1 out the door so we can branch 1.2 before long or this development cycle is going to get long again and there'll be temptation to creep in more features.
> fail fast with checkpoint conflicts
> -----------------------------------
>
> Key: COUCHDB-1080
> URL: https://issues.apache.org/jira/browse/COUCHDB-1080
> Project: CouchDB
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 1.0.2
> Reporter: Randall Leeds
> Fix For: 1.1, 1.2
>
> Attachments: COUCHDB-1080-2-fdmanana.patch, COUCHDB-1080-3-fdmanana.patch, COUCHDB-1080-fdmanana.patch, paranoid_checkpoint_failure.patch, paranoid_checkpoint_failure_v2.patch
>
>
> I've thought about this long and hard and probably should have submitted the bug a long time ago. I've also run this in production for months.
> When a checkpoint conflict occurs it is almost always the right thing to do to abort.
> If there is a rev mismatch it could mean there's are two conflicting (continuous and one-shot) replications between the same hosts running. Without reloading the history documents checkpoints will continue to fail forever. This could leave us in a state with many replicated changes but no checkpoints.
> Similarly, a successful checkpoint but a lost/timed-out response could cause this situation.
> Since the supervisor will restart the replication anyway, I think it's safer to abort and retry.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira