You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by vi...@apache.org on 2018/08/03 20:37:07 UTC
[06/50] [abbrv] phoenix git commit: PHOENIX-4726 save index build
timestamp -- for SYNC case only
PHOENIX-4726 save index build timestamp -- for SYNC case only
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7ebba49d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7ebba49d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7ebba49d
Branch: refs/heads/4.14-HBase-1.3
Commit: 7ebba49d000bb221a8de45e70b4c0afb3b9355a3
Parents: 39b92bf
Author: Vincent Poon <vi...@apache.org>
Authored: Mon May 14 10:10:32 2018 -0700
Committer: Vincent Poon <vi...@apache.org>
Committed: Mon May 14 10:11:48 2018 -0700
----------------------------------------------------------------------
.../phoenix/jdbc/PhoenixDatabaseMetaData.java | 1 +
.../org/apache/phoenix/schema/MetaDataClient.java | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7ebba49d/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 55de772..2e12ca2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -316,6 +316,7 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData {
public static final String ASYNC_CREATED_DATE = "ASYNC_CREATED_DATE";
public static final String SEQUENCE_TABLE_TYPE = SYSTEM_SEQUENCE_TABLE;
+ public static final String SYNC_INDEX_CREATED_DATE = "SYNC_INDEX_CREATED_DATE";
public static final String SYSTEM_MUTEX_TABLE_NAME = "MUTEX";
public static final String SYSTEM_MUTEX_NAME = SchemaUtil.getTableName(QueryConstants.SYSTEM_SCHEMA_NAME, SYSTEM_MUTEX_TABLE_NAME);
public static final TableName SYSTEM_MUTEX_HBASE_TABLE_NAME = TableName.valueOf(SYSTEM_MUTEX_NAME);
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7ebba49d/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 009289b..20ac732 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
@@ -74,6 +74,7 @@ import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.RETURN_TYPE;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SALT_BUCKETS;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SORT_ORDER;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.STORE_NULLS;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYNC_INDEX_CREATED_DATE;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_FUNCTION_TABLE;
@@ -263,6 +264,14 @@ public class MetaDataClient {
TABLE_NAME + "," +
ASYNC_CREATED_DATE + " " + PDate.INSTANCE.getSqlTypeName() +
") VALUES (?, ?, ?, ?)";
+
+ private static final String SET_INDEX_SYNC_CREATED_DATE =
+ "UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + SYSTEM_CATALOG_TABLE + "\"( " +
+ TENANT_ID + "," +
+ TABLE_SCHEM + "," +
+ TABLE_NAME + "," +
+ SYNC_INDEX_CREATED_DATE + " " + PDate.INSTANCE.getSqlTypeName() +
+ ") VALUES (?, ?, ?, ?)";
private static final String CREATE_TABLE =
"UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + SYSTEM_CATALOG_TABLE + "\"( " +
TENANT_ID + "," +
@@ -2678,6 +2687,14 @@ public class MetaDataClient {
setAsync.setString(3, tableName);
setAsync.setDate(4, asyncCreatedDate);
setAsync.execute();
+ } else {
+ Date syncCreatedDate = new Date(EnvironmentEdgeManager.currentTimeMillis());
+ PreparedStatement setSync = connection.prepareStatement(SET_INDEX_SYNC_CREATED_DATE);
+ setSync.setString(1, tenantIdStr);
+ setSync.setString(2, schemaName);
+ setSync.setString(3, tableName);
+ setSync.setDate(4, syncCreatedDate);
+ setSync.execute();
}
tableMetaData.addAll(connection.getMutationState().toMutations(timestamp).next().getSecond());
connection.rollback();