[
https://issues.apache.org/jira/browse/PHOENIX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14088707#comment-14088707
]
James Taylor commented on PHOENIX-1147:
---------------------------------------
I think the problem is that MutationState is using its TableRef that has a
pointer to the old/stale PTable. You shouldn't need the change to FromCompiler
if this gets fixed. I suspect it'll fix the other test failure you're seeing
too. You'll need to re-put the entry in the hash map if the updateCache returns
an updated PTable here:
{code}
private long[] validate() throws SQLException {
int i = 0;
Long scn = connection.getSCN();
PName tenantId = connection.getTenantId();
MetaDataClient client = new MetaDataClient(connection);
long[] timeStamps = new long[this.mutations.size()];
for (Map.Entry<TableRef, Map<ImmutableBytesPtr,Map<PColumn,byte[]>>>
entry : mutations.entrySet()) {
TableRef tableRef = entry.getKey();
long serverTimeStamp = tableRef.getTimeStamp();
PTable table = tableRef.getTable();
if (!connection.getAutoCommit()) {
MetaDataMutationResult result =
client.updateCache(table.getSchemaName().getString(),
table.getTableName().getString());
long timestamp = result.getMutationTime();
if (timestamp != QueryConstants.UNSET_TIMESTAMP) {
serverTimeStamp = timestamp;
if (result.wasUpdated()) {
// TODO: use bitset?
PColumn[] columns = new
PColumn[table.getColumns().size()];
for (Map.Entry<ImmutableBytesPtr,Map<PColumn,byte[]>>
rowEntry : entry.getValue().entrySet()) {
Map<PColumn,byte[]> valueEntry =
rowEntry.getValue();
if (valueEntry != PRow.DELETE_MARKER) {
for (PColumn column : valueEntry.keySet()) {
columns[column.getPosition()] = column;
}
}
}
table = connection.getMetaDataCache().getTable(new
PTableKey(tenantId, table.getName().getString()));
for (PColumn column : columns) {
if (column != null) {
table.getColumnFamily(column.getFamilyName().getString())
.getColumn(column.getName().getString());
}
}
// TODO: create new TableRef from table (through new
copy constructor)
// Add TableRef with current value to new map and at
end of loop, do a putAll
}
{code}
> Add test cases to cover more index update failure scenarios
> -----------------------------------------------------------
>
> Key: PHOENIX-1147
> URL: https://issues.apache.org/jira/browse/PHOENIX-1147
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.0.0, 5.0.0
> Reporter: Jeffrey Zhong
> Assignee: Jeffrey Zhong
> Attachments: Phoenix-1147-v1.patch, Phoenix-1147-v2.patch
>
>
> Add one test to cover RegionServer being killed while index is begin updated
> Add steps to make sure UPSERT & SELECT should still work after index is
> disabled.
--
This message was sent by Atlassian JIRA
(v6.2#6252)