[
https://issues.apache.org/jira/browse/PHOENIX-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15095414#comment-15095414
]
James Taylor commented on PHOENIX-2221:
---------------------------------------
bq. Need to set index state to be ACTIVE in PUT of
PhoenixIndexFailurePolicy.java.
That's fine.
bq. In MetaDataClient.buildPartialIndexFromTimeStamp(....), have to set the
index state to be INACTIVE first for default disable index failure policy
That's fine too.
bq. With current implementation, it is hard to get the index disable timestamp
in the test
Looks like there's a change you need to make to ensure that the data table row
is invalidated from the cache in MetaDataEndPointImpl. That code is currently
only executed if the index state changes which isn't the case for your new
feature. Try tweaking the code below to enter that if block if the state
changes *or* the timestamp changes:
{code}
PTable returnTable = null;
if (currentState != newState) { // TODO: change this check
byte[] dataTableKey = null;
if(dataTableKV != null) {
dataTableKey = SchemaUtil.getTableKey(tenantId,
schemaName, dataTableKV.getValue());
}
if(dataTableKey != null) {
// make a copy of tableMetadata
tableMetadata = new ArrayList<Mutation>(tableMetadata);
// insert an empty KV to trigger time stamp update on
data table row
Put p = new Put(dataTableKey);
p.add(TABLE_FAMILY_BYTES,
QueryConstants.EMPTY_COLUMN_BYTES, timeStamp, ByteUtil.EMPTY_BYTE_ARRAY);
tableMetadata.add(p);
}
{code}
Bottom line, though, you'll need to write a test that demonstrates that this
feature works in order to get it committed.
One other minor nit. Remove this ignored test in ReadOnlyFailureIT that was
copy/pasted from the other IT:
{code}
+ @Ignore("See PHOENIX-2332")
+ @Test
+ public void testWriteFailureWithRegionServerDown() throws Exception {
{code}
> Option to make data regions not writable when index regions are not available
> -----------------------------------------------------------------------------
>
> Key: PHOENIX-2221
> URL: https://issues.apache.org/jira/browse/PHOENIX-2221
> Project: Phoenix
> Issue Type: Improvement
> Reporter: Devaraj Das
> Assignee: Alicia Ying Shu
> Fix For: 4.8.0
>
> Attachments: DelegateIndexFailurePolicy.java, PHOENIX-2221-v1.patch,
> PHOENIX-2221-v2.patch, PHOENIX-2221-v3.patch, PHOENIX-2221-v4.patch,
> PHOENIX-2221-v5.patch, PHOENIX-2221.patch, PHOENIX-2221.wip
>
>
> In one usecase, it was deemed better to not accept writes when the index
> regions are unavailable for any reason (as opposed to disabling the index and
> the queries doing bigger data-table scans).
> The idea is that the index regions are kept consistent with the data regions,
> and when a query runs against the index regions, one can be reasonably sure
> that the query ran with the most recent data in the data regions. When the
> index regions are unavailable, the writes to the data table are rejected.
> Read queries off of the index regions would have deterministic performance
> (and on the other hand if the index is disabled, then the read queries would
> have to go to the data regions until the indexes are rebuilt, and the queries
> would suffer).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)