Guys,

I was looking at this ticket and have a question related to the lock
semantics:

Suppose I have a node which has already acquired the lock, and then all
affinity nodes related to the lock leave topology. In this case, if we
automatically re-created the lock, we would end up having two lock owners
in the grid, which is unacceptable.

I think throwing an exception and forcing a user to re-create the lock by
himself is a correct way to resolve this.

2016-11-02 14:36 GMT+03:00 Andrey Gura <ag...@apache.org>:

> Vladisav,
>
> I've ran this test with partitioned cache and 1 backup and with replicated
> cache (4 nodes in topology). Behavior is the same. I think it is bug. But
> the first I wanted make sure that I understand failoverSafe flag correctly.
>
> Thank you for reply. I'll create ticket.
>
> On Tue, Nov 1, 2016 at 8:48 PM, Vladisav Jelisavcic <vladis...@gmail.com>
> wrote:
>
> > Hi,
> >
> > when failoverSafe == true, semaphore should silently redistribute the
> > permits acquired on the failing node.
> > If failoverSafe is set to false, exception is thrown to every node
> > attempting to acquire.
> >
> > It seems to me that when the first instance left topology,
> > no backups were available (this is similar to:
> > https://issues.apache.org/jira/browse/IGNITE-3386).
> > This should be fixed (semaphore should be recreated when create==true, as
> > suggested by Denis in the ticket).
> >
> > It should be a minor fix, will be ready for 1.8.
> >
> > Best regards,
> > Vladisav
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Nov 1, 2016 at 5:41 PM, Andrey Gura <ag...@apache.org> wrote:
> >
> > > Hi all!
> > >
> > > Guys, could somebody explain semantic of failoverSafe flag in
> > > IgniteSemaphore. From my point of view the test below should work but
> it
> > > fails:
> > >
> > >     public void testFailoverReleasePermits() throws Exception {
> > >         Ignite ignite = grid(0);
> > >
> > >         IgniteSemaphore sem = ignite.semaphore("sem", 1, true, true);
> > >
> > >         sem.acquire(1);
> > >
> > >         ignite.close();
> > >
> > >         U.sleep(5000);
> > >
> > >         ignite = grid(1);
> > >
> > >         sem = ignite.semaphore("sem", 1, true, true);
> > >
> > >         boolean acquire = sem.tryAcquire(1, 5000,
> TimeUnit.MILLISECONDS);
> > >
> > >         assertTrue(acquire); // fails here
> > >     }
> > >
> > > From my point of view permit should be available after the first ignite
> > > instance left topology.
> > >
> >
>

Reply via email to