The IndexTask is working as expected...To handle multiple request creating the 
same index.
It looks like, when there is multiple index creation request; It is handled 
properly (using the Future task)
What is the case when it throws Index already exists? 
The other option is if the index request matches (index type and expression) we 
should just ignore the exception; and consider index is successfully created.

-Anil.
 

On 12/7/21, 8:49 AM, "Mario Kevo" <mario.k...@est.tech> wrote:

    Are you thinking about not sending it to the remote nodes or not sending 
requests from locator to the each node?

    Also, there is one map where indexTask is stored, and there is putIfAbsent 
method which seems is not working properly.
    // This will return either the Index FutureTask or Index itself, based
    // on whether the index creation is in process or completed.
    Object ind = this.indexes.putIfAbsent(indexTask, indexFutureTask);
    ​In case we change it to something like:
    Object ind = null;
    if(!this.indexes.containsKey(indexTask)) {
      ind = this.indexes.put(indexTask, indexFutureTask);
    }
    ​If it already has that indexTask it will not go again to run creating it, 
whether or not that index is created by remote request or locally. And in that 
case, the command will be successful and the cluster config is updated.

    BR,
    Mario

    ________________________________
    Šalje: Anilkumar Gingade <aging...@vmware.com>
    Poslano: 7. prosinca 2021. 16:41
    Prima: dev@geode.apache.org <dev@geode.apache.org>
    Predmet: Re: Creating index failed

    In case if you are planning to fix; the probable fix is not to send gfsh 
create command to all the nodes when its partitioned region..

    On 12/7/21, 6:37 AM, "Mario Kevo" <mario.k...@est.tech> wrote:

        Hi Jason,

        I agree with you that the user wanted to index all the data in the 
region when using a partitioned region. But when the command is not successful, 
the cluster config is not updated.
        After the server restart, it will not have indexes as it is not stored 
in the cluster configuration.
        So there should be some changes, as the index is created on all members 
but the command is not successful.
        I'm working on a fix. As soon as possible I will create PR on the 
already mentioned ticket.

        BR,
        Mario
        ________________________________
        Šalje: Jason Huynh <jhu...@vmware.com>
        Poslano: 6. prosinca 2021. 18:45
        Prima: dev@geode.apache.org <dev@geode.apache.org>
        Predmet: Re: Creating index failed

        Hi Mario,

        A lot of the indexing code pre-dates GFSH. The behavior you are seeing 
is when an index is created on a partition region.  When creating an index on a 
partition region, the idea is that the user wanted to index all the data in the 
region.  So the server will let all other servers know to create an index on 
the partition region.

        This is slightly different for an index on a replicated region.  That 
is when the index can be created on a per member basis, which is what I think 
the -member flag is for.

        GFSH however defaults to sending the create index message to all 
members for any index type from what I remember and from what is being 
described. That is why you’ll see the race condition with indexes created on 
partitioned regions but the end result being that the index that someone wanted 
to create is either created or already there.

        -Jason

        On 12/6/21, 6:37 AM, "Mario Kevo" <mario.k...@est.tech> wrote:

            Hi devs,

            While doing some testing, I found the issue which is already 
reported there. https://issues.apache.org/jira/browse/GEODE-7875

            If we run the create index command it will create an index locally 
and send a request to create an index on other members of that region.
            The problem happened if the remote request comes before the request 
from the locator, in that case, a request from the locator failed with the 
following message: Index "index1" already exists.  Create failed due to 
duplicate name.

            This can be reproduced by running 6 servers with DEBUG log 
level(due to this system will be slower), creating a partitioned region, and 
then creating an index.

            Why does the server send remote requests to other members as they 
will get a request from the locator to create an index?
            Also when running the gfsh command to create an index on one 
member, it will send create index requests to all other members. In that case, 
what is the purpose of this --member flag?

            BR,
            Mario




Reply via email to