[ https://issues.apache.org/jira/browse/PHOENIX-4785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16514483#comment-16514483 ]
Vincent Poon commented on PHOENIX-4785: --------------------------------------- [~an...@apache.org] good point, this is a tricky case to handle. I think if we simply disable the index if it's already in PENDING_DISABLE, then we would end up with a disabled index fairly frequently. The reason we allow a user to use an index in PENDING_DISABLE is that otherwise, *any* client index write failure would disable the index, which is too aggressive and the index would get disabled too often. On the server side, we are only trying the index write once after PHOENIX-4130, to avoid tying up the handler. Before PHOENIX-4130, we would have a number of retries of the index write, and only then would the index get disabled. By having a PENDING_DISABLE state, we are mimicking that behavior by having a grace period wherein we allow the client to retry before disabling the index. I think what we can try to do is pass the index_disabletimestamp back to the client. Then when the client retries, if all the retries fail, it marks the index DISABLE with the timestamp. The index_disabletimestamp should always be the minimum (i.e. the time of the first index write failure). So this behavior should be safe. Example: T0. Client A attempts write, index write fails. Disabletimestamp of T0. Client A retries T1. Client B attempts write, index write fails. Disabletimestamp is still T0 (min). Client B retries. T2. Client A succeeds. Index is marked Active, clearing disabletimestamp. T3. Client B exhausts retries, marks index disabled with disabletimestamp of T0. Rebuilder will rebuild as of T0. What do you think? > Unable to write to table if index is made active during retry > ------------------------------------------------------------- > > Key: PHOENIX-4785 > URL: https://issues.apache.org/jira/browse/PHOENIX-4785 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.14.0 > Reporter: Romil Choksi > Assignee: Vincent Poon > Priority: Blocker > Fix For: 5.0.0, 4.14.1 > > Attachments: PHOENIX-4785.v1.master.patch, PHOENIX-4785_test.patch > > > After PHOENIX-4130, we are unable to write to a table if an index is made > ACTIVE during the retry as client timestamp is not cleared when table state > is changed from PENDING_DISABLE to ACTIVE even if our policy is not to block > writes on data table in case of write failure for index. -- This message was sent by Atlassian JIRA (v7.6.3#76005)