-
Notifications
You must be signed in to change notification settings - Fork 72
Document failover support #818
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
Comments
This is documentation on Failover in DMSDK. Failover Support
However, these default settings can be customized according to user needs by the static method available within the HostAvailabilityListener.getInstance(Batcher)
.withSuspendTimeForHostUnavailable(Duration.ofMinutes(60))
.withMinHosts(2) Provided Listeners like
|
Kim, Sam had a comment on the priority of a section in the document which I had sent to you over mail. Please take that into account when you document. Many Thanks. Vivek |
Thank, @vivekmuniyandi , I will. Is Sam's comment reflected in the version of your writeup that is shown here in this issue, or should I look for his feedback elsewhere? I will take up this topic in earnest as soon as we're done with 9.0-3. Thank you for making the details available so promptly. |
@vivekmuniyandi, this is a great write-up. Really helpful. Is the failover behavior the default?
That seems to imply so. Presumably then this will change the behavior of existing code (albeit generally for the better). Or am I misunderstanding. |
@kcoleman-marklogic The following section in the write up is of low priority. His feedback is in the document I sent to you over mail. Sorry, I should have changed it.
Thanks |
It's fine. I just wanted to be sure I knew where to look. Thanks for the clarification, Vivek. |
@jmakeig Yes, the failover behaviour is default.
I don't understand. This was the behavior right from the start I guess and we are just documenting it now. Let me know if I have misunderstood the question. Thanks. |
@vivekmuniyandi I have a question about this section of your most excellent writeup:
Do ApplyTransformListener and DeleteListener have such a retry listener attached by default, or is it something the user must do? The ApplyTransformListener javadoc talks only about the empty response case, so that didn't clear it up for me, either. |
Actually @vivekmuniyandi now that I've given it more thought, it would be very helpful thave an example of how to do what you said with a RetryListener. I looked through the tests and could not find any use of this class. I would like to include an example the documentation. For example, if I had a block of code like the following, how would I change to enable retry of the transform in the event of failover?
|
@vivekmuniyandi Is it true that custom listeners that do not go through a QueryBatcher do not need to do anything special wrt failover handling? In your writeup, you only mentioned custom listeners invoked via a QueryBatcher. |
With NoResponseListener, we have two types of RetryListeners.
For DeleteListener, we have initialized both the RetryListeners and hence the customer doesn't need to do anything since deletion is an idempotent operation. But for ApplyTransformListener, since they cannot be assumed as idempotent operations, we have intialized 1 and not 2. The empty response case is for 2 and we won't be sure if the transform has been applied on the server. Hence it is not ideal to retry but we leave it to the customer to decide how they want to retry for the failed batches. Please see this comment #813 (comment) for detailed explanation |
Currently all the custom listeners we have are associated with the QueryBatcher. And retries become complicated with the QueryBatcher only. With WriteBatcher, we keep retrying until all the documents have been successfully written since they are idempotent. |
For listeners doing idempotent operations like DeleteListener, we have overrided the initializeListener(QueryBatcher) method like this
This would take care of all the retries and the customer need not do anything. If they are implementing custom listeners which does idempotent operation, they have to override the above method with the implementation shown above and this would take care of failover. But in case of ApplyTransform, if it is idempotent, we have to have code something like this
For non idempotent transforms, we shouldn't initialize the NoResponseListener's RetryListener as shown above but the customer should write their own BatchFailureListener which would check if the batch has been transformed or not and retry only if the batch has not been transformed. Hope that helps. |
OK, let me say this back in words to see if I understand what you said in wrt to custom listeners. Case 1: You want to retry the custom operation if there is a failoverCreate a class that implements QueryBatchListener and override the initializeListener method to do the following:
Case 2: You do not want to retry the custom operaton if there is a failover
Case 3: You want to conditionally retry
To retry a batch, call QueryBatcher.retry from your BatchFailureListener |
Case 1 and 3 looks good to me. If we don't want to retry then we don't need to do anything - the steps you mentioned in Case 2 also handles failover scenarios. These are scenarios where we get no response from the server during failover. NoResponseListener is used to handle that. So you don't need to do anything if you don't want to retry at all. |
Perfect. Thank you, @vivekmuniyandi . |
@kcoleman-marklogic can we ship this issue? |
Yes, I suppose. I am not convinced what we have makes sufficient sense, but I guess we'll just have to see. |
No description provided.
The text was updated successfully, but these errors were encountered: