[
https://issues.apache.org/jira/browse/PHOENIX-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
James Taylor updated PHOENIX-2221:
----------------------------------
Attachment: PHOENIX-2221-v4.patch
[~ayingshu] - thanks for the patch. It's looking better. Take a look at this
new one, as it fixes a few things:
- call builder.setIndexDisableTimestamp(table.getIndexDisableTimestamp()) when
building protobuf in PTableImpl so that INDEX_DISABLE_TIMESTAMP value makes it
over to client.
- freezes timestamp in MetaDataEndPointImpl.getTable() based on minimum index
table value of INDEX_DISABLE_TIMESTAMP
- only sets index status when INDEX_FAILURE_BLOCK_WRITE is not set in
PhoenixIndexFailurePolicy
- uses delegate for PhoenixIndexFailurePolicy which makes more sense
(functionally is the same, though).
- takes into account both index status and INDEX_DISABLE_TIMESTAMP when
blocking writes to data table
- added missing fail() call in ReadOnlyIndexFailureIT when commit() called.
I think we still could use a bit more testing around this. For example,
confirming that the timestamp is frozen for the data table until the index
rebuilds complete (to maintain consistency). If you can finish this off in the
next day or so, then it might be able to make the 4.7.0 release.
Also, one more change not in my patch - the change to
MetaDataClient.buildPartialIndexFromTimeStamp should not be required here:
{code}
+ public void buildPartialIndexFromTimeStamp(PTable index, TableRef
dataTableRef, boolean blockWriteRebuildIndex) throws SQLException {
+ boolean needRestoreIndexState = true;
+ AlterIndexStatement indexStatement = null;
+ if (!blockWriteRebuildIndex) {
+ // Need to change index state from Disable to InActive when build
index partially so that
+ // new changes will be indexed during index rebuilding
+ indexStatement = FACTORY.alterIndex(FACTORY.namedTable(null,
+ TableName.create(index.getSchemaName().getString(),
index.getTableName().getString())),
+ dataTableRef.getTable().getTableName().getString(), false,
PIndexState.INACTIVE);
+ alterIndex(indexStatement);
+ }
{code}
Instead, if the current state (index.getIndexState()) is ACTIVE, then you don't
need to set the index status.
> 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: PHOENIX-2221-v1.patch, PHOENIX-2221-v2.patch,
> PHOENIX-2221-v3.patch, PHOENIX-2221-v4.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)