You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Prasad Bhalerao <pr...@gmail.com> on 2018/10/19 12:57:25 UTC

Sql execution with partitionId

Hi,

I am thinking to get partitionId using affinity function and then set it
in SqlFieldsQuery  object.

By doing this will I be able to execute the query only a node which is
primary for this partition?

As per the ignite doc it should work. But I just want to confirm there are
no caveats in it.

Can this create any issue if the primary node goes down during query
execution?

public class SqlFieldsQuery extends Query<List<?>> {
    /**
     * Sets partitions for a query.
     * The query will be executed only on nodes which are primary for
specified partitions.
     * <p>
     * Note what passed array'll be sorted in place for performance
reasons, if it wasn't sorted yet.
     *
     * @param parts Partitions.
     * @return {@code this} for chaining.
     */
    public SqlFieldsQuery setPartitions(@Nullable int... parts) {
        this.parts = prepare(parts);
        return this;
    }

Thanks,
Prasad

Re: Sql execution with partitionId

Posted by aealexsandrov <ae...@gmail.com>.
Hi,

It should work as described in the documentation. If the node with primary
partitions will fail then the node with backups will be used. If there are
no backups then an exception will be thrown.

BR,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/