phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kiran Kumar Maturi (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (PHOENIX-5094) Index can transition from INACTIVE to ACTIVE via Phoenix Client
Date Wed, 23 Jan 2019 10:12:00 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-5094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16749577#comment-16749577
] 

Kiran Kumar Maturi edited comment on PHOENIX-5094 at 1/23/19 10:11 AM:
-----------------------------------------------------------------------

[~vincentpoon] as suggested I have made the change to increment the counter when the index
transition happens to inactive from disabled.
{code:java}
if (indexState == PIndexState.DISABLE) {
IndexUtil.incrementCounterForIndex(conn, indexTableFullName, 1);
IndexUtil.updateIndexState(conn, indexTableFullName, PIndexState.INACTIVE, null);
continue; // Must wait until clients start to do index maintenance again
}{code}
and decrement counter  for indices that are going to be made active
{code:java}
public List<PTable> decrementIndexesPendingDisableCount(PhoenixConnection conn, PTable
dataPTable, List<PTable> indexes, int amount){
List<PTable> indexesIncremented = new ArrayList<>();
for(PTable index :indexes) {
try {
String indexName = index.getName().getString();
IndexUtil.incrementCounterForIndex(conn, indexName, amount);
indexesIncremented.add(index);
}catch(Exception e) {
LOG.warn("Increment " + amount +" for index :" + index.getName().getString() + "of table:
" + dataPTable.getName().getString() + e);
}
}
return indexesIncremented;
}{code}
i am not checking for the pending disable count == 1 as the count might have been incremented
by temporary failures, which might have been fixed by the rebuilder.

 

I have moved PhoeinixIndexFailurePolicy#incrementCounterForIndex to IndexUtil#incrementCounterForIndex 

please review and suggest any other changes to be made. Thanks


was (Author: kiran.maturi):
[~vincentpoon] as suggested I have made the change to increment the counter when the index
transition happens to inactive from disabled.
{code:java}
if (indexState == PIndexState.DISABLE) {
IndexUtil.incrementCounterForIndex(conn, indexTableFullName, 1);
IndexUtil.updateIndexState(conn, indexTableFullName, PIndexState.INACTIVE, null);
continue; // Must wait until clients start to do index maintenance again
}{code}
and decrement counter  for indices that are going to be made active
{code:java}
public List<PTable> decrementIndexesPendingDisableCount(PhoenixConnection conn, PTable
dataPTable, List<PTable> indexes, int amount){
List<PTable> indexesIncremented = new ArrayList<>();
for(PTable index :indexes) {
try {
String indexName = index.getName().getString();
IndexUtil.incrementCounterForIndex(conn, indexName, amount);
indexesIncremented.add(index);
}catch(Exception e) {
LOG.warn("Increment " + amount +" for index :" + index.getName().getString() + "of table:
" + dataPTable.getName().getString() + e);
}
}
return indexesIncremented;
}{code}
i am not checking for the pending disable count == 1 as the count might have been incremented
by temporary failures, which might have been fixed by the rebuilder.

Good to have changes

1) make PhoenixIndexFailurePolicy#incrementCounterForIndex(old) public or use IndexUtil#incrementCounterForIndex(new)
every where  as the function is currently repeated at. please suggest.

2) Move IndexRebuildIncrementDisableCountIT#mutateRandomly to IndexTestUtil currently i
am using the same code again and again. I will try to find if any other static methods exist
for this please let me know if any better way to do it.

please review and suggest any other changes to be made. Thanks

> Index can transition from INACTIVE to ACTIVE via Phoenix Client
> ---------------------------------------------------------------
>
>                 Key: PHOENIX-5094
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5094
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 4.14.1
>            Reporter: Monani Mihir
>            Assignee: Kiran Kumar Maturi
>            Priority: Major
>         Attachments: PHOENIX-5094-4.14-HBase-1.3.01.patch
>
>
> Suppose Index is in INACTIVE state and Client load is running continuously. With INACTIVE
State, client will keep maintaining index.
> Before Rebuilder could run and bring index back in sync with data table, If some mutation
for Index fails from client side, then client will transition Index state (From INACTIVE-->
PENDING_DISABLE).
> If client succeeds in writing mutation in subsequent retries, it will transition Index
state again ( From PENDING_DISABLE --> ACTIVE) .
> Above scenario will leave some part of Index out of sync with data table.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message