You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2016/11/04 22:13:54 UTC
[27/50] [abbrv] phoenix git commit: PHOENIX-3432 Upgrade Phoenix
4.8.0 to 4.9.0 fails because of illegal characters in snapshot name
PHOENIX-3432 Upgrade Phoenix 4.8.0 to 4.9.0 fails because of illegal characters in snapshot name
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1ed90b6a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1ed90b6a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1ed90b6a
Branch: refs/heads/encodecolumns2
Commit: 1ed90b6a2b48013923f5a84f7b4d7c759825e82d
Parents: c5fed78
Author: Samarth <sa...@salesforce.com>
Authored: Wed Nov 2 10:49:18 2016 -0700
Committer: Samarth <sa...@salesforce.com>
Committed: Wed Nov 2 10:49:49 2016 -0700
----------------------------------------------------------------------
.../phoenix/query/ConnectionQueryServicesImpl.java | 11 +++++++----
.../main/java/org/apache/phoenix/util/UpgradeUtil.java | 5 +++--
2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/1ed90b6a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index ff4e404..b1b7bab 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -33,7 +33,7 @@ import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_RENEW_LEASE_
import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_RENEW_LEASE_THREAD_POOL_SIZE;
import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_RENEW_LEASE_THRESHOLD_MILLISECONDS;
import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_RUN_RENEW_LEASE_FREQUENCY_INTERVAL_MILLISECONDS;
-import static org.apache.phoenix.util.UpgradeUtil.getUpgradeSnapshotName;
+import static org.apache.phoenix.util.UpgradeUtil.getSysCatalogSnapshotName;
import static org.apache.phoenix.util.UpgradeUtil.upgradeTo4_5_0;
import java.io.IOException;
@@ -2493,6 +2493,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
boolean acquiredMutexLock = false;
byte[] mutexRowKey = SchemaUtil.getTableKey(null, PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA,
PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE);
+ boolean snapshotCreated = false;
try {
if (!ConnectionQueryServicesImpl.this.upgradeRequired.get()) {
throw new UpgradeNotRequiredException();
@@ -2516,9 +2517,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
sysCatalogTableName = e.getTable().getPhysicalName().getString();
if (currentServerSideTableTimeStamp < MIN_SYSTEM_TABLE_TIMESTAMP
&& (acquiredMutexLock = acquireUpgradeMutex(currentServerSideTableTimeStamp, mutexRowKey))) {
- snapshotName = getUpgradeSnapshotName(sysCatalogTableName,
- currentServerSideTableTimeStamp);
+ snapshotName = getSysCatalogSnapshotName(currentServerSideTableTimeStamp);
createSnapshot(snapshotName, sysCatalogTableName);
+ snapshotCreated = true;
}
String columnsToAdd = "";
// This will occur if we have an older SYSTEM.CATALOG and we need to update it to
@@ -2810,7 +2811,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
} finally {
try {
- restoreFromSnapshot(sysCatalogTableName, snapshotName, success);
+ if (snapshotCreated) {
+ restoreFromSnapshot(sysCatalogTableName, snapshotName, success);
+ }
} catch (SQLException e) {
if (toThrow != null) {
toThrow.setNextException(e);
http://git-wip-us.apache.org/repos/asf/phoenix/blob/1ed90b6a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
index df283c5..2b04ac1 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
@@ -1899,8 +1899,9 @@ public class UpgradeUtil {
}
}
- public static final String getUpgradeSnapshotName(String tableString, long currentSystemTableTimestamp) {
- Format formatter = new SimpleDateFormat("yyyyMMddHHmmssZ");
+ public static final String getSysCatalogSnapshotName(long currentSystemTableTimestamp) {
+ String tableString = SYSTEM_CATALOG_NAME;
+ Format formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String date = formatter.format(new Date(System.currentTimeMillis()));
String upgradingFrom = getVersion(currentSystemTableTimestamp);
return "SNAPSHOT_" + tableString + "_" + upgradingFrom + "_TO_" + CURRENT_CLIENT_VERSION + "_" + date;