Repository: phoenix Updated Branches: refs/heads/master cc6cd9f56 -> 55c5be200
PHOENIX-2577 Use same timestamp technique for alter table as create table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/55c5be20 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/55c5be20 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/55c5be20 Branch: refs/heads/master Commit: 55c5be2000d7ee3042a6c971e30cff6cb0dfb301 Parents: cc6cd9f Author: James Taylor <[email protected]> Authored: Fri Jan 8 14:31:21 2016 -0800 Committer: James Taylor <[email protected]> Committed: Fri Jan 8 14:31:21 2016 -0800 ---------------------------------------------------------------------- .../org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 3 ++- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/55c5be20/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java index 8e2f0ed..8c905ba 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java @@ -1623,7 +1623,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso // found table = buildDeletedTable(key, cacheKey, region, clientTimeStamp); if (table != null) { - logger.info("Found newer table deleted as of " + table.getTimeStamp()); + logger.info("Found newer table deleted as of " + table.getTimeStamp() + " versus client timestamp of " + clientTimeStamp); return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null); } @@ -1631,6 +1631,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso EnvironmentEdgeManager.currentTimeMillis(), null); } if (table.getTimeStamp() >= clientTimeStamp) { + logger.info("Found newer table as of " + table.getTimeStamp() + " versus client timestamp of " + clientTimeStamp); return new MetaDataMutationResult(MutationCode.NEWER_TABLE_FOUND, EnvironmentEdgeManager.currentTimeMillis(), table); } else if (isTableDeleted(table)) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/55c5be20/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 7191a7c..2a514d5 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -109,6 +109,8 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import co.cask.tephra.TxConstants; + import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; @@ -211,8 +213,6 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.primitives.Ints; -import co.cask.tephra.TxConstants; - public class MetaDataClient { private static final Logger logger = LoggerFactory.getLogger(MetaDataClient.class); @@ -2585,7 +2585,6 @@ public class MetaDataClient { Map<String, List<Pair<String, Object>>> properties = new HashMap<>(stmtProperties.size()); TableRef tableRef = FromCompiler.getResolver(statement, connection).getTables().get(0); PTable table = tableRef.getTable(); - Long timeStamp = table.isTransactional() ? tableRef.getTimeStamp() : null; List<ColumnDef> columnDefs = statement.getColumnDefs(); if (columnDefs == null) { columnDefs = Collections.emptyList(); @@ -2694,11 +2693,11 @@ public class MetaDataClient { .setSchemaName(schemaName).setTableName(tableName) .build().buildException(); } - timeStamp = TransactionUtil.getTableTimestamp(connection, isTransactional); changingPhoenixTableProperty = true; nonTxToTx = true; } } + Long timeStamp = TransactionUtil.getTableTimestamp(connection, table.isTransactional() || nonTxToTx); int numPkColumnsAdded = 0; PreparedStatement colUpsert = connection.prepareStatement(INSERT_COLUMN_ALTER_TABLE);
