You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Sumit Nigam <su...@yahoo.com> on 2016/06/02 03:52:15 UTC

Secondary index rebuilding

Hi,
I recently noticed that one of my secondary index was short of 2 entries compared to data table. 
AFAIK, the first update is always to index table. So, the only way an index table could fall behind the main table is when the index was disabled by phoenix. Maybe the region server hosting that index was not able to take the update.
If that is the case, then I had following questions:
1. Is there a flag which forces phoenix to internally cause an index rebuild instead of totally disabling it? Or do I have to manually rebuild index? 2. Is there a flag which can prevent disabling of index altogether? In that case an error would get returned to the client that a write failed. This is more useful because I'd like to always keep index and main table in sync.
Thanks,Sumit

Re: Secondary index rebuilding

Posted by Sumit Nigam <su...@yahoo.com>.
Thank you James. This is exactly what I wanted.
I have another point about this topic. Are updates written to index table first or to the primary table? The link you gave below states that updates are first written to primary table (unless WAL is disabled). Another link https://github.com/forcedotcom/phoenix/wiki/Secondary-Indexing mentions that index is written to, first.
I use Phoenix 4.5.1
Thanks,Sumit

      From: James Taylor <ja...@apache.org>
 To: "user@phoenix.apache.org" <us...@phoenix.apache.org>; Sumit Nigam <su...@yahoo.com> 
 Sent: Thursday, June 2, 2016 9:59 AM
 Subject: Re: Secondary index rebuilding
   
Yes, see https://phoenix.apache.org/secondary_indexing.html#Consistency_Guarantees

On Wednesday, June 1, 2016, Sumit Nigam <su...@yahoo.com> wrote:

Hi,
I recently noticed that one of my secondary index was short of 2 entries compared to data table. 
AFAIK, the first update is always to index table. So, the only way an index table could fall behind the main table is when the index was disabled by phoenix. Maybe the region server hosting that index was not able to take the update.
If that is the case, then I had following questions:
1. Is there a flag which forces phoenix to internally cause an index rebuild instead of totally disabling it? Or do I have to manually rebuild index? 2. Is there a flag which can prevent disabling of index altogether? In that case an error would get returned to the client that a write failed. This is more useful because I'd like to always keep index and main table in sync.
Thanks,Sumit


  

Re: Secondary index rebuilding

Posted by James Taylor <ja...@apache.org>.
Yes, see https://phoenix.apache.org/secondary_indexing.html#Consistency_
Guarantees

On Wednesday, June 1, 2016, Sumit Nigam <su...@yahoo.com> wrote:

> Hi,
>
> I recently noticed that one of my secondary index was short of 2 entries
> compared to data table.
>
> AFAIK, the first update is always to index table. So, the only way an
> index table could fall behind the main table is when the index was disabled
> by phoenix. Maybe the region server hosting that index was not able to take
> the update.
>
> If that is the case, then I had following questions:
>
> 1. Is there a flag which forces phoenix to internally cause an index
> rebuild instead of totally disabling it? Or do I have to manually rebuild
> index?
> 2. Is there a flag which can prevent disabling of index altogether? In
> that case an error would get returned to the client that a write failed.
> This is more useful because I'd like to always keep index and main table in
> sync.
>
> Thanks,
> Sumit
>