You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Stefan Egli <st...@apache.org> on 2015/09/09 14:12:36 UTC
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Hi all,
I'd like to follow up on the idea to restart DocumentNodeStore as a result
of a lease failure [0]: I suggest we don't do that and instead just stop
the oak-core bundle.
After some prototyping and running into OAK-3373 [1] I'm no longer sure if
restarting the DocumentNodeStore is a feasible path to go, esp in the
short term. The problem encountered so far is that Observers cannot be
easily switched from old to (restarted/)new store due to:
* as pointed out by MichaelD they could have a backlog yet to process
towards the old store - which they cannot access anymore as that one would
be forcibly closed
* there is not yet a proper way to switch from old to new ('reset') - esp
is there a risk that there could be a gap (this part we might be able to
fix though, not sure)
* both above carry the risk that Observers miss some changes - something
which would be unacceptable I guess.
I think the more kiss approach would be to just forcibly close the
DocumentNodeStore - or actually to stop the entire oak-core bundle - with
appropriate errors logged so that the issue becomes clear. The instance
would basically become unusable, mostly, but at least it would not be a
System.exit.
What do ppl think?
Cheers,
Stefan
--
[0] https://issues.apache.org/jira/browse/OAK-3250
[1] https://issues.apache.org/jira/browse/OAK-3373
On 18/08/15 16:45, "Stefan Egli" <eg...@adobe.com> wrote:
>I've created OAK-3250 to follow up on the DocumentNodeStore-restart idea.
>
>Cheers,
>Stefan
>--
>https://issues.apache.org/jira/browse/OAK-3250
>
>On 18/08/15 15:59, "Marcel Reutegger" <mr...@adobe.com> wrote:
>
>>On 18/08/15 15:38, "Stefan Egli" wrote:
>>>On 18/08/15 13:43, "Marcel Reutegger" <mr...@adobe.com> wrote:
>>>>On 18/08/15 11:14, "Stefan Egli" wrote:
>>>>>b) Oak does not do the System.exit but refuses to update anything
>>>>>towards
>>>>>the document store (thus just throws exceptions on each invocation) -
>>>>>and
>>>>>upper level code detects this situation (eg a Sling Health Check) and
>>>>>would do a System.exit based on how it is configured
>>>>>
>>>>>c) same as b) but upper level code does not do a System.exit (I¹m not
>>>>>sure
>>>>>if that makes sense - the instance is useless in such a situation)
>>>>
>>>>either b) or c) sounds reasonable to me.
>>>>
>>>>but if possible I'd like to avoid a System.exit(). would it be possible
>>>>to detect this situation in the DocumentNodeStoreService and restart
>>>>the DocumentNodeStore without the need to restart the JVM
>>>
>>>Good point. Perhaps restarting DocumentNodeStore is a valid alternative
>>>indeed. Is that feasible from a DocumentNodeStore point of view?
>>
>>it probably requires some changes to the DocumentNodeStore, because
>>we want it to tear down without doing any of the cleanup it
>>may otherwise perform. it must not release the cluster node info
>>nor update pending _lastRevs, etc.
>>
>>> What would be the consequences of a restarted DocumentNodeStore?
>>
>>to the DocumentNodeStore it will look like it was killed and it will
>>perform recovery (e.g. for the pending _lastRevs).
>>
>>Regards
>> Marcel
>>
>
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Manfred Baedke <ma...@gmail.com>.
Whatever the long term solution will be: we need a short term solution
that doesn't kill an entire application server, so +1.
On 09.09.15 14:12, Stefan Egli wrote:
> Hi all,
>
> I'd like to follow up on the idea to restart DocumentNodeStore as a result
> of a lease failure [0]: I suggest we don't do that and instead just stop
> the oak-core bundle.
>
> After some prototyping and running into OAK-3373 [1] I'm no longer sure if
> restarting the DocumentNodeStore is a feasible path to go, esp in the
> short term. The problem encountered so far is that Observers cannot be
> easily switched from old to (restarted/)new store due to:
>
> * as pointed out by MichaelD they could have a backlog yet to process
> towards the old store - which they cannot access anymore as that one would
> be forcibly closed
> * there is not yet a proper way to switch from old to new ('reset') - esp
> is there a risk that there could be a gap (this part we might be able to
> fix though, not sure)
> * both above carry the risk that Observers miss some changes - something
> which would be unacceptable I guess.
>
> I think the more kiss approach would be to just forcibly close the
> DocumentNodeStore - or actually to stop the entire oak-core bundle - with
> appropriate errors logged so that the issue becomes clear. The instance
> would basically become unusable, mostly, but at least it would not be a
> System.exit.
>
> What do ppl think?
>
> Cheers,
> Stefan
> --
> [0] https://issues.apache.org/jira/browse/OAK-3250
> [1] https://issues.apache.org/jira/browse/OAK-3373
>
> On 18/08/15 16:45, "Stefan Egli" <eg...@adobe.com> wrote:
>
>> I've created OAK-3250 to follow up on the DocumentNodeStore-restart idea.
>>
>> Cheers,
>> Stefan
>> --
>> https://issues.apache.org/jira/browse/OAK-3250
>>
>> On 18/08/15 15:59, "Marcel Reutegger" <mr...@adobe.com> wrote:
>>
>>> On 18/08/15 15:38, "Stefan Egli" wrote:
>>>> On 18/08/15 13:43, "Marcel Reutegger" <mr...@adobe.com> wrote:
>>>>> On 18/08/15 11:14, "Stefan Egli" wrote:
>>>>>> b) Oak does not do the System.exit but refuses to update anything
>>>>>> towards
>>>>>> the document store (thus just throws exceptions on each invocation) -
>>>>>> and
>>>>>> upper level code detects this situation (eg a Sling Health Check) and
>>>>>> would do a System.exit based on how it is configured
>>>>>>
>>>>>> c) same as b) but upper level code does not do a System.exit (I¹m not
>>>>>> sure
>>>>>> if that makes sense - the instance is useless in such a situation)
>>>>> either b) or c) sounds reasonable to me.
>>>>>
>>>>> but if possible I'd like to avoid a System.exit(). would it be possible
>>>>> to detect this situation in the DocumentNodeStoreService and restart
>>>>> the DocumentNodeStore without the need to restart the JVM
>>>> Good point. Perhaps restarting DocumentNodeStore is a valid alternative
>>>> indeed. Is that feasible from a DocumentNodeStore point of view?
>>> it probably requires some changes to the DocumentNodeStore, because
>>> we want it to tear down without doing any of the cleanup it
>>> may otherwise perform. it must not release the cluster node info
>>> nor update pending _lastRevs, etc.
>>>
>>>> What would be the consequences of a restarted DocumentNodeStore?
>>> to the DocumentNodeStore it will look like it was killed and it will
>>> perform recovery (e.g. for the pending _lastRevs).
>>>
>>> Regards
>>> Marcel
>>>
>
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Stefan Egli <st...@apache.org>.
My vote would also be (b) for the short-term. If we figure out a way to
properly restart the nodestore (c) we can still come back to that at a
later time.
Hence I've created https://issues.apache.org/jira/browse/OAK-3397 and
unless the list vetoes I'll follow up on that next.
Cheers,
Stefan
On 11/09/15 11:38, "Julian Sedding" <js...@gmail.com> wrote:
>My preference is (b), even though I think stopping the NodeStore
>service should be sufficient (it may not currently be sufficient, I
>don't know).
>
>Particularly, I believe that "trying harder" is detrimental to the
>overall stability of a cluster/topology. We are dealing with a
>possibly faulty instance, so who can decide that it is ok again after
>trying harder? The faulty instance itself?
>
>"Read-only" doesn't sound too useful either, because that may fool
>clients into thinking they are dealing with a "healthy" instance for
>longer than necessary and thus can lead to bigger issues downstream.
>
>I believe that "fail early and fail often" is the path to a stable
>cluster.
>
>Regards
>Julian
>
>On Thu, Sep 10, 2015 at 6:43 PM, Stefan Egli <st...@apache.org>
>wrote:
>> On 09/09/15 18:11, "Stefan Egli" <st...@apache.org> wrote:
>>
>>>On 09/09/15 18:01, "Stefan Egli" <st...@apache.org> wrote:
>>>
>>>>I think if the observers would all be 'OSGi-ified' then this could be
>>>>achieved. But currently eg the BackgroundObserver is just a pojo and
>>>>not
>>>>an osgi component (thus doesn't support any activate/deactivate method
>>>>hooks).
>>>
>>>.. I take that back - going via OsgiWhiteboard should work as desired -
>>>so
>>>perhaps implementing deactivate/activate methods in the
>>>(Background)Observer(s) would do the trick .. I'll give it a try ..
>>
>> ootb this wont work as the BackgroundObserver, as one example, is not an
>> OSGi component, so wont get any deactivate/activate calls atm. so to
>> achieve this, it would have to be properly OSGi-ified - something which
>> sounds like a bigger task and not only limited to this one class - which
>> means making DocumentNodeStore 'restart capable' sounds like a bigger
>>task
>> too and the question is indeed if it is worth while ('will it work?') or
>> if there are alternatives..
>>
>> which brings me back to the original question as to what should be done
>>in
>> case of a lease failure - to recap the options left (if System.exit is
>>not
>> one of them) are:
>>
>> a) 'go read-only': prevent writes by throwing exceptions from this
>>moment
>> until eternity
>>
>> b) 'stop oak': stop the oak-core bundle (prevent writes by throwing
>> exceptions for those still reaching out for the nodeStore)
>>
>> c) 'try harder': try to reactivate the lease - continue allowing writes
>>-
>> and make sure the next backgroundWrite has correctly updated the
>> 'unsavedLastRevisions' (cos others could have done a recover of this
>>node,
>> so unsavedLastRevisions contains superfluous stuff that must no longer
>>be
>> written). this would open the door for edge cases ('change of longer
>>time
>> window with multiple leaders') but perhaps is not entirely impossible...
>>
>> additionally/independently:
>>
>> * in all cases the discovery-lite descriptor should expose this lease
>> failure/partitioning situation - so that anyone can react who would like
>> to, esp should anyone no longer assume that the local instance is leader
>> or part of the cluster - and to support that optional Sling Health Check
>> which still does a System.exit :)
>>
>> * also, we should probably increase the lease thread's priority to
>>reduce
>> the likelihood of the lease timing out (same would be true for
>> discovery.impl's heartbeat thread)
>>
>>
>> * plus increasing the lease time from 1min to perhaps 5min as the
>>default
>> would also reduce the number of cases that hit problems dramatically
>>
>> wdyt?
>>
>> Cheers,
>> Stefan
>>
>>
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Julian Sedding <js...@gmail.com>.
My preference is (b), even though I think stopping the NodeStore
service should be sufficient (it may not currently be sufficient, I
don't know).
Particularly, I believe that "trying harder" is detrimental to the
overall stability of a cluster/topology. We are dealing with a
possibly faulty instance, so who can decide that it is ok again after
trying harder? The faulty instance itself?
"Read-only" doesn't sound too useful either, because that may fool
clients into thinking they are dealing with a "healthy" instance for
longer than necessary and thus can lead to bigger issues downstream.
I believe that "fail early and fail often" is the path to a stable cluster.
Regards
Julian
On Thu, Sep 10, 2015 at 6:43 PM, Stefan Egli <st...@apache.org> wrote:
> On 09/09/15 18:11, "Stefan Egli" <st...@apache.org> wrote:
>
>>On 09/09/15 18:01, "Stefan Egli" <st...@apache.org> wrote:
>>
>>>I think if the observers would all be 'OSGi-ified' then this could be
>>>achieved. But currently eg the BackgroundObserver is just a pojo and not
>>>an osgi component (thus doesn't support any activate/deactivate method
>>>hooks).
>>
>>.. I take that back - going via OsgiWhiteboard should work as desired - so
>>perhaps implementing deactivate/activate methods in the
>>(Background)Observer(s) would do the trick .. I'll give it a try ..
>
> ootb this wont work as the BackgroundObserver, as one example, is not an
> OSGi component, so wont get any deactivate/activate calls atm. so to
> achieve this, it would have to be properly OSGi-ified - something which
> sounds like a bigger task and not only limited to this one class - which
> means making DocumentNodeStore 'restart capable' sounds like a bigger task
> too and the question is indeed if it is worth while ('will it work?') or
> if there are alternatives..
>
> which brings me back to the original question as to what should be done in
> case of a lease failure - to recap the options left (if System.exit is not
> one of them) are:
>
> a) 'go read-only': prevent writes by throwing exceptions from this moment
> until eternity
>
> b) 'stop oak': stop the oak-core bundle (prevent writes by throwing
> exceptions for those still reaching out for the nodeStore)
>
> c) 'try harder': try to reactivate the lease - continue allowing writes -
> and make sure the next backgroundWrite has correctly updated the
> 'unsavedLastRevisions' (cos others could have done a recover of this node,
> so unsavedLastRevisions contains superfluous stuff that must no longer be
> written). this would open the door for edge cases ('change of longer time
> window with multiple leaders') but perhaps is not entirely impossible...
>
> additionally/independently:
>
> * in all cases the discovery-lite descriptor should expose this lease
> failure/partitioning situation - so that anyone can react who would like
> to, esp should anyone no longer assume that the local instance is leader
> or part of the cluster - and to support that optional Sling Health Check
> which still does a System.exit :)
>
> * also, we should probably increase the lease thread's priority to reduce
> the likelihood of the lease timing out (same would be true for
> discovery.impl's heartbeat thread)
>
>
> * plus increasing the lease time from 1min to perhaps 5min as the default
> would also reduce the number of cases that hit problems dramatically
>
> wdyt?
>
> Cheers,
> Stefan
>
>
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Stefan Egli <st...@apache.org>.
On 10/09/15 18:43, "Stefan Egli" <st...@apache.org> wrote:
>additionally/independently:
>
>[...]
>
>* also, we should probably increase the lease thread's priority to reduce
>the likelihood of the lease timing out (same would be true for
>discovery.impl's heartbeat thread)
>
>* plus increasing the lease time from 1min to perhaps 5min as the default
>would also reduce the number of cases that hit problems dramatically
FYI: Put these suggested improvements into:
https://issues.apache.org/jira/browse/OAK-3398
most noteworthy: I suggest to increase the lease timeout by default to
120sec. (not 5min, I think that's too much)
Cheers,
Stefan
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Stefan Egli <st...@apache.org>.
On 09/09/15 18:11, "Stefan Egli" <st...@apache.org> wrote:
>On 09/09/15 18:01, "Stefan Egli" <st...@apache.org> wrote:
>
>>I think if the observers would all be 'OSGi-ified' then this could be
>>achieved. But currently eg the BackgroundObserver is just a pojo and not
>>an osgi component (thus doesn't support any activate/deactivate method
>>hooks).
>
>.. I take that back - going via OsgiWhiteboard should work as desired - so
>perhaps implementing deactivate/activate methods in the
>(Background)Observer(s) would do the trick .. I'll give it a try ..
ootb this wont work as the BackgroundObserver, as one example, is not an
OSGi component, so wont get any deactivate/activate calls atm. so to
achieve this, it would have to be properly OSGi-ified - something which
sounds like a bigger task and not only limited to this one class - which
means making DocumentNodeStore 'restart capable' sounds like a bigger task
too and the question is indeed if it is worth while ('will it work?') or
if there are alternatives..
which brings me back to the original question as to what should be done in
case of a lease failure - to recap the options left (if System.exit is not
one of them) are:
a) 'go read-only': prevent writes by throwing exceptions from this moment
until eternity
b) 'stop oak': stop the oak-core bundle (prevent writes by throwing
exceptions for those still reaching out for the nodeStore)
c) 'try harder': try to reactivate the lease - continue allowing writes -
and make sure the next backgroundWrite has correctly updated the
'unsavedLastRevisions' (cos others could have done a recover of this node,
so unsavedLastRevisions contains superfluous stuff that must no longer be
written). this would open the door for edge cases ('change of longer time
window with multiple leaders') but perhaps is not entirely impossible...
additionally/independently:
* in all cases the discovery-lite descriptor should expose this lease
failure/partitioning situation - so that anyone can react who would like
to, esp should anyone no longer assume that the local instance is leader
or part of the cluster - and to support that optional Sling Health Check
which still does a System.exit :)
* also, we should probably increase the lease thread's priority to reduce
the likelihood of the lease timing out (same would be true for
discovery.impl's heartbeat thread)
* plus increasing the lease time from 1min to perhaps 5min as the default
would also reduce the number of cases that hit problems dramatically
wdyt?
Cheers,
Stefan
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Stefan Egli <st...@apache.org>.
On 09/09/15 18:01, "Stefan Egli" <st...@apache.org> wrote:
>I think if the observers would all be 'OSGi-ified' then this could be
>achieved. But currently eg the BackgroundObserver is just a pojo and not
>an osgi component (thus doesn't support any activate/deactivate method
>hooks).
.. I take that back - going via OsgiWhiteboard should work as desired - so
perhaps implementing deactivate/activate methods in the
(Background)Observer(s) would do the trick .. I'll give it a try ..
Cheers,
Stefan
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Stefan Egli <st...@apache.org>.
Hi,
On 09/09/15 17:39, "Marcel Reutegger" <mr...@adobe.com> wrote:
>>* as pointed out by MichaelD they could have a backlog yet to process
>>towards the old store - which they cannot access anymore as that one
>>would
>>be forcibly closed
>
>in my view, those observers should be unregistered from the store before
>it is shut down and any backlog cleared, i.e. it will be lost.
yes they do get unregistered right away indeed - but atm there's no handle
as to prevent eg the BackgroundObserver from still having entries in the
queue and continuing to process them. so those queued entries will indeed
fail as the store is closed.
>>* there is not yet a proper way to switch from old to new ('reset') - esp
>>is there a risk that there could be a gap (this part we might be able to
>>fix though, not sure)
>
>I don't see a requirement for this. if you restart the entire stack you
>will also have a gap.
the difference is perhaps that if you restart the stack this is done as an
explicit admin operation, knowingly. While as what we're trying to achieve
here is something automated, 'under the hood', which has a different
quality requirement imv.
>>* both above carry the risk that Observers miss some changes - something
>>which would be unacceptable I guess.
>
>same as above. I don't think observers must survive a node store restart.
>I even think it is wrong. Every client of the node store should be
>restarted in that case, including Observers.
I think if the observers would all be 'OSGi-ified' then this could be
achieved. But currently eg the BackgroundObserver is just a pojo and not
an osgi component (thus doesn't support any activate/deactivate method
hooks).
Cheers,
Stefan
RE: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Rob Ryan <rr...@adobe.com>.
This starts to sound like Oak should have an explicit interface to announce the situation to clients, allowing them to implement their own policy about whether to attempt a restart or not.
-Rob
-----Original Message-----
From: Marcel Reutegger [mailto:mreutegg@adobe.com]
Sent: Wednesday, September 09, 2015 8:39 AM
To: oak-dev@jackrabbit.apache.org
Subject: Re: System.exit()???? , was: svn commit: r1696202 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document: ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java DocumentNodeStoreService.java util/LeaseCheckDoc...
Hi,
On 09/09/15 14:12, "Stefan Egli" wrote:
>After some prototyping and running into OAK-3373 [1] I'm no longer sure
>if restarting the DocumentNodeStore is a feasible path to go, esp in
>the short term. The problem encountered so far is that Observers cannot
>be easily switched from old to (restarted/)new store due to:
>
> * as pointed out by MichaelD they could have a backlog yet to process
>towards the old store - which they cannot access anymore as that one
>would be forcibly closed
in my view, those observers should be unregistered from the store before it is shut down and any backlog cleared, i.e. it will be lost.
> * there is not yet a proper way to switch from old to new ('reset') -
>esp is there a risk that there could be a gap (this part we might be
>able to fix though, not sure)
I don't see a requirement for this. if you restart the entire stack you will also have a gap.
> * both above carry the risk that Observers miss some changes -
>something which would be unacceptable I guess.
same as above. I don't think observers must survive a node store restart.
I even think it is wrong. Every client of the node store should be restarted in that case, including Observers.
Regards
Marcel
Re: System.exit()???? , was: svn commit: r1696202 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
ClusterNodeInfo.java DocumentMK.java DocumentNodeStore.java
DocumentNodeStoreService.java util/LeaseCheckDoc...
Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,
On 09/09/15 14:12, "Stefan Egli" wrote:
>After some prototyping and running into OAK-3373 [1] I'm no longer sure if
>restarting the DocumentNodeStore is a feasible path to go, esp in the
>short term. The problem encountered so far is that Observers cannot be
>easily switched from old to (restarted/)new store due to:
>
> * as pointed out by MichaelD they could have a backlog yet to process
>towards the old store - which they cannot access anymore as that one would
>be forcibly closed
in my view, those observers should be unregistered from the store before
it is shut down and any backlog cleared, i.e. it will be lost.
> * there is not yet a proper way to switch from old to new ('reset') - esp
>is there a risk that there could be a gap (this part we might be able to
>fix though, not sure)
I don't see a requirement for this. if you restart the entire stack you
will also have a gap.
> * both above carry the risk that Observers miss some changes - something
>which would be unacceptable I guess.
same as above. I don't think observers must survive a node store restart.
I even think it is wrong. Every client of the node store should be
restarted in that case, including Observers.
Regards
Marcel