Apache-Phoenix | Master | Hadoop1 | Build Successful
Master branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master-hadoop1/lastSuccessfulBuild/artifact/ Last Complete Test Report https://builds.apache.org/job/Phoenix-master-hadoop1/lastCompletedBuild/testReport/ Changes [jtaylor] PHOENIX-1157 Improve abstraction for meta data cache [jtaylor] PHOENIX-1157 Improve abstraction for meta data cache
Apache-Phoenix | 4.0 | Hadoop1 | Build Successful
4.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/ Changes [jtaylor] PHOENIX-1157 Improve abstraction for meta data cache [jtaylor] PHOENIX-1157 Improve abstraction for meta data cache
[1/2] git commit: PHOENIX-1157 Improve abstraction for meta data cache
Repository: phoenix Updated Branches: refs/heads/master 1ef7e57da -> b2519c03f PHOENIX-1157 Improve abstraction for meta data cache Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7e3ba5b2 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7e3ba5b2 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7e3ba5b2 Branch: refs/heads/master Commit: 7e3ba5b2ac6c5bdd124a00aa4a8a4416ca104033 Parents: 1ef7e57 Author: James Taylor Authored: Sat Aug 9 15:09:12 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 19:02:02 2014 -0700 -- .../org/apache/phoenix/schema/PMetaData.java| 12 +- .../apache/phoenix/schema/PMetaDataImpl.java| 412 +++ .../phoenix/compile/ViewCompilerTest.java | 2 +- .../java/org/apache/phoenix/query/BaseTest.java | 4 - .../phoenix/schema/PMetaDataImplTest.java | 78 ++-- 5 files changed, 279 insertions(+), 229 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7e3ba5b2/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java index 5ddd5bb..c104473 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java @@ -20,18 +20,12 @@ package org.apache.phoenix.schema; import org.apache.phoenix.query.MetaDataMutated; -public interface PMetaData extends MetaDataMutated { -public static interface Cache extends Iterable { -public Cache clone(); -public PTable get(PTableKey key); -public PTable put(PTableKey key, PTable value); -public PTable remove(PTableKey key); -public int size(); -} +public interface PMetaData extends MetaDataMutated, Iterable, Cloneable { public static interface Pruner { public boolean prune(PTable table); } -public Cache getTables(); +public int size(); +public PMetaData clone(); public PTable getTable(PTableKey key) throws TableNotFoundException; public PMetaData pruneTables(Pruner pruner); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/7e3ba5b2/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java index a487020..dff0e40 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java @@ -19,9 +19,9 @@ package org.apache.phoenix.schema; import java.sql.SQLException; import java.util.Comparator; -import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.phoenix.util.TimeKeeper; @@ -39,220 +39,270 @@ import com.google.common.primitives.Longs; * */ public class PMetaDataImpl implements PMetaData { -private final Cache metaData; - -public PMetaDataImpl(int initialCapacity, long maxByteSize) { -this.metaData = new CacheImpl(initialCapacity, maxByteSize, TimeKeeper.SYSTEM); -} - -public PMetaDataImpl(int initialCapacity, long maxByteSize, TimeKeeper timeKeeper) { -this.metaData = new CacheImpl(initialCapacity, maxByteSize, timeKeeper); -} - -public PMetaDataImpl(Cache tables) { -this.metaData = tables.clone(); -} - -private static class CacheImpl implements Cache, Cloneable { -private static final int MIN_REMOVAL_SIZE = 3; -private static final Comparator COMPARATOR = new Comparator() { -@Override -public int compare(PTableAccess tableAccess1, PTableAccess tableAccess2) { -return Longs.compare(tableAccess1.lastAccessTime, tableAccess2.lastAccessTime); +private static final class PTableRef { +public final PTable table; +public final int estSize; +public volatile long lastAccessTime; + +public PTableRef(PTable table, long lastAccessTime, int estSize) { +this.table = table; +this.lastAccessTime = lastAccessTime; +this.estSize = estSize; } -}; -private static final MinMaxPriorityQueue.Builder BUILDER = MinMaxPriorityQueue.orderedBy(COMPARATOR); - -private long currentSize; -private final long maxByteSize; -private final int expectedCapacity; -private fi
[2/2] git commit: PHOENIX-1157 Improve abstraction for meta data cache
PHOENIX-1157 Improve abstraction for meta data cache Conflicts: phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b2519c03 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b2519c03 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b2519c03 Branch: refs/heads/master Commit: b2519c03f0241df37e1630860d5f1a3850372f34 Parents: 7e3ba5b Author: James Taylor Authored: Sat Aug 9 18:21:22 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 19:02:21 2014 -0700 -- .../apache/phoenix/jdbc/PhoenixConnection.java | 6 +- .../query/ConnectionQueryServicesImpl.java | 10 +-- .../query/ConnectionlessQueryServicesImpl.java | 4 +- .../query/DelegateConnectionQueryServices.java | 4 +- .../apache/phoenix/query/MetaDataMutated.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 +- .../apache/phoenix/schema/PMetaDataImpl.java| 68 +--- .../phoenix/schema/PMetaDataImplTest.java | 3 +- 8 files changed, 64 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b2519c03/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java index 364e61f..70f88f2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java @@ -726,10 +726,10 @@ public class PhoenixConnection implements Connection, org.apache.phoenix.jdbc.Jd } @Override -public PMetaData removeTable(PName tenantId, String tableName) throws SQLException { -metaData = metaData.removeTable(tenantId, tableName); +public PMetaData removeTable(PName tenantId, String tableName, String parentTableName, long tableTimeStamp) throws SQLException { +metaData = metaData.removeTable(tenantId, tableName, parentTableName, tableTimeStamp); //Cascade through to connectionQueryServices too -getQueryServices().removeTable(tenantId, tableName); +getQueryServices().removeTable(tenantId, tableName, parentTableName, tableTimeStamp); return metaData; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/b2519c03/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 eb77d53..9bfd0df 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 @@ -462,7 +462,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // and the next time it's used it'll be pulled over from the server. if (waitTime <= 0) { logger.warn("Unable to update meta data repo within " + (DEFAULT_OUT_OF_ORDER_MUTATIONS_WAIT_TIME_MS/1000) + " seconds for " + tableName); -metaData = metaData.removeTable(tenantId, tableName); +// There will never be a parentTableName here, as that would only +// be non null for an index an we never add/remove columns from an index. +metaData = metaData.removeTable(tenantId, tableName, null, HConstants.LATEST_TIMESTAMP); break; } latestMetaDataLock.wait(waitTime); @@ -493,10 +495,10 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } @Override -public PMetaData removeTable(PName tenantId, final String tableName) throws SQLException { -synchronized(latestMetaDataLock) { +public PMetaData removeTable(PName tenantId, final String tableName, String parentTableName, long tableTimeStamp) throws SQLException { +synchronized (latestMetaDataLock) { throwConnectionClosedIfNullMetaData(); -latestMetaData = latestMetaData.removeTable(tenantId, tableName); +latestMetaData = latestMetaData.removeTable(tenantId, tableName, parentTableName, tableTimeStamp); latestMetaDataLock.notifyAll();
[2/2] git commit: PHOENIX-1157 Improve abstraction for meta data cache
PHOENIX-1157 Improve abstraction for meta data cache Conflicts: phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/64d136d1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/64d136d1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/64d136d1 Branch: refs/heads/4.0 Commit: 64d136d15707bb5122ae1cfc00717c757086385e Parents: d5a7803 Author: James Taylor Authored: Sat Aug 9 18:21:22 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 18:27:51 2014 -0700 -- .../apache/phoenix/jdbc/PhoenixConnection.java | 6 +- .../query/ConnectionQueryServicesImpl.java | 10 +-- .../query/ConnectionlessQueryServicesImpl.java | 4 +- .../query/DelegateConnectionQueryServices.java | 4 +- .../apache/phoenix/query/MetaDataMutated.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 +- .../apache/phoenix/schema/PMetaDataImpl.java| 68 +--- .../phoenix/schema/PMetaDataImplTest.java | 3 +- 8 files changed, 64 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/64d136d1/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java index 364e61f..70f88f2 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java @@ -726,10 +726,10 @@ public class PhoenixConnection implements Connection, org.apache.phoenix.jdbc.Jd } @Override -public PMetaData removeTable(PName tenantId, String tableName) throws SQLException { -metaData = metaData.removeTable(tenantId, tableName); +public PMetaData removeTable(PName tenantId, String tableName, String parentTableName, long tableTimeStamp) throws SQLException { +metaData = metaData.removeTable(tenantId, tableName, parentTableName, tableTimeStamp); //Cascade through to connectionQueryServices too -getQueryServices().removeTable(tenantId, tableName); +getQueryServices().removeTable(tenantId, tableName, parentTableName, tableTimeStamp); return metaData; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/64d136d1/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 5065632..ee0be95 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 @@ -462,7 +462,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // and the next time it's used it'll be pulled over from the server. if (waitTime <= 0) { logger.warn("Unable to update meta data repo within " + (DEFAULT_OUT_OF_ORDER_MUTATIONS_WAIT_TIME_MS/1000) + " seconds for " + tableName); -metaData = metaData.removeTable(tenantId, tableName); +// There will never be a parentTableName here, as that would only +// be non null for an index an we never add/remove columns from an index. +metaData = metaData.removeTable(tenantId, tableName, null, HConstants.LATEST_TIMESTAMP); break; } latestMetaDataLock.wait(waitTime); @@ -493,10 +495,10 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } @Override -public PMetaData removeTable(PName tenantId, final String tableName) throws SQLException { -synchronized(latestMetaDataLock) { +public PMetaData removeTable(PName tenantId, final String tableName, String parentTableName, long tableTimeStamp) throws SQLException { +synchronized (latestMetaDataLock) { throwConnectionClosedIfNullMetaData(); -latestMetaData = latestMetaData.removeTable(tenantId, tableName); +latestMetaData = latestMetaData.removeTable(tenantId, tableName, parentTableName, tableTimeStamp); latestMetaDataLock.notifyAll();
Apache-Phoenix | 3.0 | Hadoop1 | Build Successful
3.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastSuccessfulBuild/artifact/ Last Complete Test Report https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastCompletedBuild/testReport/ Changes [jtaylor] PHOENIX-1157 Improve abstraction for meta data cache [jtaylor] PHOENIX-1157 Improve abstraction for meta data cache
[1/2] git commit: PHOENIX-1157 Improve abstraction for meta data cache
Repository: phoenix Updated Branches: refs/heads/4.0 152ce872c -> 64d136d15 PHOENIX-1157 Improve abstraction for meta data cache Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d5a78038 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d5a78038 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d5a78038 Branch: refs/heads/4.0 Commit: d5a78038b85058ab0667ab669c863ce1aeb34ef2 Parents: 152ce87 Author: James Taylor Authored: Sat Aug 9 15:09:12 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 18:24:35 2014 -0700 -- .../org/apache/phoenix/schema/PMetaData.java| 12 +- .../apache/phoenix/schema/PMetaDataImpl.java| 412 +++ .../phoenix/compile/ViewCompilerTest.java | 2 +- .../java/org/apache/phoenix/query/BaseTest.java | 4 - .../phoenix/schema/PMetaDataImplTest.java | 78 ++-- 5 files changed, 279 insertions(+), 229 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5a78038/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java index 5ddd5bb..c104473 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java @@ -20,18 +20,12 @@ package org.apache.phoenix.schema; import org.apache.phoenix.query.MetaDataMutated; -public interface PMetaData extends MetaDataMutated { -public static interface Cache extends Iterable { -public Cache clone(); -public PTable get(PTableKey key); -public PTable put(PTableKey key, PTable value); -public PTable remove(PTableKey key); -public int size(); -} +public interface PMetaData extends MetaDataMutated, Iterable, Cloneable { public static interface Pruner { public boolean prune(PTable table); } -public Cache getTables(); +public int size(); +public PMetaData clone(); public PTable getTable(PTableKey key) throws TableNotFoundException; public PMetaData pruneTables(Pruner pruner); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5a78038/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java index a487020..dff0e40 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java @@ -19,9 +19,9 @@ package org.apache.phoenix.schema; import java.sql.SQLException; import java.util.Comparator; -import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.phoenix.util.TimeKeeper; @@ -39,220 +39,270 @@ import com.google.common.primitives.Longs; * */ public class PMetaDataImpl implements PMetaData { -private final Cache metaData; - -public PMetaDataImpl(int initialCapacity, long maxByteSize) { -this.metaData = new CacheImpl(initialCapacity, maxByteSize, TimeKeeper.SYSTEM); -} - -public PMetaDataImpl(int initialCapacity, long maxByteSize, TimeKeeper timeKeeper) { -this.metaData = new CacheImpl(initialCapacity, maxByteSize, timeKeeper); -} - -public PMetaDataImpl(Cache tables) { -this.metaData = tables.clone(); -} - -private static class CacheImpl implements Cache, Cloneable { -private static final int MIN_REMOVAL_SIZE = 3; -private static final Comparator COMPARATOR = new Comparator() { -@Override -public int compare(PTableAccess tableAccess1, PTableAccess tableAccess2) { -return Longs.compare(tableAccess1.lastAccessTime, tableAccess2.lastAccessTime); +private static final class PTableRef { +public final PTable table; +public final int estSize; +public volatile long lastAccessTime; + +public PTableRef(PTable table, long lastAccessTime, int estSize) { +this.table = table; +this.lastAccessTime = lastAccessTime; +this.estSize = estSize; } -}; -private static final MinMaxPriorityQueue.Builder BUILDER = MinMaxPriorityQueue.orderedBy(COMPARATOR); - -private long currentSize; -private final long maxByteSize; -private final int expectedCapacity; -private final Ti
[3/3] git commit: PHOENIX-1157 Improve abstraction for meta data cache
PHOENIX-1157 Improve abstraction for meta data cache Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ece6aaf0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ece6aaf0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ece6aaf0 Branch: refs/heads/3.0 Commit: ece6aaf06acee35e954b2c735eff3041d982c3d9 Parents: 2deaf47 Author: James Taylor Authored: Sat Aug 9 18:21:22 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 18:21:22 2014 -0700 -- .../apache/phoenix/jdbc/PhoenixConnection.java | 6 +- .../query/ConnectionQueryServicesImpl.java | 8 ++- .../query/ConnectionlessQueryServicesImpl.java | 4 +- .../query/DelegateConnectionQueryServices.java | 4 +- .../apache/phoenix/query/MetaDataMutated.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 +- .../apache/phoenix/schema/PMetaDataImpl.java| 68 +--- .../phoenix/schema/PMetaDataImplTest.java | 3 +- 8 files changed, 63 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ece6aaf0/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java index e712819..76ce483 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java @@ -690,10 +690,10 @@ public class PhoenixConnection implements Connection, org.apache.phoenix.jdbc.Jd } @Override -public PMetaData removeTable(PName tenantId, String tableName) throws SQLException { -metaData = metaData.removeTable(tenantId, tableName); +public PMetaData removeTable(PName tenantId, String tableName, String parentTableName, long tableTimeStamp) throws SQLException { +metaData = metaData.removeTable(tenantId, tableName, parentTableName, tableTimeStamp); //Cascade through to connectionQueryServices too -getQueryServices().removeTable(tenantId, tableName); +getQueryServices().removeTable(tenantId, tableName, parentTableName, tableTimeStamp); return metaData; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/ece6aaf0/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 12224f9..9eaddf0 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 @@ -431,7 +431,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // and the next time it's used it'll be pulled over from the server. if (waitTime <= 0) { logger.warn("Unable to update meta data repo within " + (DEFAULT_OUT_OF_ORDER_MUTATIONS_WAIT_TIME_MS/1000) + " seconds for " + tableName); -metaData = metaData.removeTable(tenantId, tableName); +// There will never be a parentTableName here, as that would only +// be non null for an index an we never add/remove columns from an index. +metaData = metaData.removeTable(tenantId, tableName, null, HConstants.LATEST_TIMESTAMP); break; } latestMetaDataLock.wait(waitTime); @@ -462,10 +464,10 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } @Override -public PMetaData removeTable(PName tenantId, final String tableName) throws SQLException { +public PMetaData removeTable(PName tenantId, final String tableName, String parentTableName, long tableTimeStamp) throws SQLException { synchronized (latestMetaDataLock) { throwConnectionClosedIfNullMetaData(); -latestMetaData = latestMetaData.removeTable(tenantId, tableName); +latestMetaData = latestMetaData.removeTable(tenantId, tableName, parentTableName, tableTimeStamp); latestMetaDataLock.notifyAll(); return latestMetaData; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/ece6aaf0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java ---
[1/3] git commit: PHOENIX-1157 Improve abstraction for meta data cache
Repository: phoenix Updated Branches: refs/heads/3.0 067bfa83b -> ece6aaf06 PHOENIX-1157 Improve abstraction for meta data cache Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/df869d18 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/df869d18 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/df869d18 Branch: refs/heads/3.0 Commit: df869d180af3198d5ae9db2974b1de82e66ba58e Parents: fdfabba Author: James Taylor Authored: Sat Aug 9 15:09:12 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 15:09:12 2014 -0700 -- .../org/apache/phoenix/schema/PMetaData.java| 12 +- .../apache/phoenix/schema/PMetaDataImpl.java| 412 +++ .../phoenix/compile/ViewCompilerTest.java | 2 +- .../java/org/apache/phoenix/query/BaseTest.java | 4 - .../phoenix/schema/PMetaDataImplTest.java | 78 ++-- 5 files changed, 279 insertions(+), 229 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/df869d18/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java index 5ddd5bb..c104473 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaData.java @@ -20,18 +20,12 @@ package org.apache.phoenix.schema; import org.apache.phoenix.query.MetaDataMutated; -public interface PMetaData extends MetaDataMutated { -public static interface Cache extends Iterable { -public Cache clone(); -public PTable get(PTableKey key); -public PTable put(PTableKey key, PTable value); -public PTable remove(PTableKey key); -public int size(); -} +public interface PMetaData extends MetaDataMutated, Iterable, Cloneable { public static interface Pruner { public boolean prune(PTable table); } -public Cache getTables(); +public int size(); +public PMetaData clone(); public PTable getTable(PTableKey key) throws TableNotFoundException; public PMetaData pruneTables(Pruner pruner); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/df869d18/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java index a487020..dff0e40 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java @@ -19,9 +19,9 @@ package org.apache.phoenix.schema; import java.sql.SQLException; import java.util.Comparator; -import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.phoenix.util.TimeKeeper; @@ -39,220 +39,270 @@ import com.google.common.primitives.Longs; * */ public class PMetaDataImpl implements PMetaData { -private final Cache metaData; - -public PMetaDataImpl(int initialCapacity, long maxByteSize) { -this.metaData = new CacheImpl(initialCapacity, maxByteSize, TimeKeeper.SYSTEM); -} - -public PMetaDataImpl(int initialCapacity, long maxByteSize, TimeKeeper timeKeeper) { -this.metaData = new CacheImpl(initialCapacity, maxByteSize, timeKeeper); -} - -public PMetaDataImpl(Cache tables) { -this.metaData = tables.clone(); -} - -private static class CacheImpl implements Cache, Cloneable { -private static final int MIN_REMOVAL_SIZE = 3; -private static final Comparator COMPARATOR = new Comparator() { -@Override -public int compare(PTableAccess tableAccess1, PTableAccess tableAccess2) { -return Longs.compare(tableAccess1.lastAccessTime, tableAccess2.lastAccessTime); +private static final class PTableRef { +public final PTable table; +public final int estSize; +public volatile long lastAccessTime; + +public PTableRef(PTable table, long lastAccessTime, int estSize) { +this.table = table; +this.lastAccessTime = lastAccessTime; +this.estSize = estSize; } -}; -private static final MinMaxPriorityQueue.Builder BUILDER = MinMaxPriorityQueue.orderedBy(COMPARATOR); - -private long currentSize; -private final long maxByteSize; -private final int expectedCapacity; -private final Ti
[2/3] git commit: Merge branch '3.0' of https://git-wip-us.apache.org/repos/asf/phoenix into 3.0
Merge branch '3.0' of https://git-wip-us.apache.org/repos/asf/phoenix into 3.0 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2deaf478 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2deaf478 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2deaf478 Branch: refs/heads/3.0 Commit: 2deaf478b9426468704cc2e86f8b70710ca044d1 Parents: df869d1 067bfa8 Author: James Taylor Authored: Sat Aug 9 15:25:28 2014 -0700 Committer: James Taylor Committed: Sat Aug 9 15:25:28 2014 -0700 -- .../apache/phoenix/util/CSVCommonsLoader.java | 83 +++- 1 file changed, 65 insertions(+), 18 deletions(-) --
Apache-Phoenix | Master | Hadoop1 | Build Successful
Master branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master-hadoop1/lastSuccessfulBuild/artifact/ Last Complete Test Report https://builds.apache.org/job/Phoenix-master-hadoop1/lastCompletedBuild/testReport/ Changes [gabrielr] PHOENIX-902 Allow family qualifiers in CSV loader
Apache-Phoenix | 3.0 | Hadoop1 | Build Successful
3.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastSuccessfulBuild/artifact/ Last Complete Test Report https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastCompletedBuild/testReport/ Changes [gabrielr] PHOENIX-902 Allow family qualifiers in CSV loader
Apache-Phoenix | 4.0 | Hadoop1 | Build Successful
4.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/ Changes [gabrielr] PHOENIX-902 Allow family qualifiers in CSV loader
git commit: PHOENIX-902 Allow family qualifiers in CSV loader
Repository: phoenix Updated Branches: refs/heads/master a71ad867e -> 1ef7e57da PHOENIX-902 Allow family qualifiers in CSV loader Allow qualifying input column names with the column family. Contributed by James Violette. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1ef7e57d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1ef7e57d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1ef7e57d Branch: refs/heads/master Commit: 1ef7e57daa6bfaa6981238307f07326d0baac511 Parents: a71ad86 Author: Gabriel Reid Authored: Sat Aug 9 22:37:53 2014 +0200 Committer: Gabriel Reid Committed: Sat Aug 9 22:43:49 2014 +0200 -- .../apache/phoenix/util/CSVCommonsLoader.java | 83 +++- 1 file changed, 65 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1ef7e57d/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java index 494696b..ef4375c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java @@ -17,18 +17,10 @@ */ package org.apache.phoenix.util; -import java.io.File; -import java.io.Reader; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - +import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; @@ -40,9 +32,19 @@ import org.apache.phoenix.util.csv.CsvUpsertExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Joiner; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import java.io.File; +import java.io.Reader; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /*** * Upserts CSV data using Phoenix JDBC connection @@ -119,7 +121,7 @@ public class CSVCommonsLoader { /** * default settings - * delimiter = ',' + * delimiter = ',' * quoteChar = '"', * escape = null * recordSeparator = CRLF, CR, or LF @@ -281,6 +283,8 @@ public class CSVCommonsLoader { String tableName, List columns, boolean strict) throws SQLException { Map columnNameToTypeMap = Maps.newLinkedHashMap(); +Set ambiguousColumnNames = new HashSet(); +Map fullColumnNameToTypeMap = Maps.newLinkedHashMap(); DatabaseMetaData dbmd = conn.getMetaData(); int unfoundColumnCount = 0; // TODO: escape wildcard characters here because we don't want that @@ -294,9 +298,22 @@ public class CSVCommonsLoader { (schemaAndTable.length == 1 ? escapedTableName : schemaAndTable[1]), null); while (rs.next()) { +String colName = rs.getString(QueryUtil.COLUMN_NAME_POSITION); +String colFam = rs.getString(QueryUtil.COLUMN_FAMILY_POSITION); + +// use family qualifier, if available, otherwise, use column name +String fullColumn = (colFam==null?colName:String.format("%s.%s",colFam,colName)); String sqlTypeName = rs.getString(QueryUtil.DATA_TYPE_NAME_POSITION); + +// allow for both bare and family qualified names. +if (columnNameToTypeMap.keySet().contains(colName)) { +ambiguousColumnNames.add(colName); +} columnNameToTypeMap.put( -rs.getString(QueryUtil.COLUMN_NAME_POSITION), +colName, +PDataType.fromSqlTypeName(sqlTypeName).getSqlType()); +fullColumnNameToTypeMap.put( +fullColumn, PDataType.fromSqlTypeName(sqlTypeName).getSqlType()); } if (columnNameToTypeMap.isEmpty()) { @@ -308,8 +325,10 @@ public class CSVCommonsLoader { } } List columnInfoList = Lists.newArrayList(); +
git commit: PHOENIX-902 Allow family qualifiers in CSV loader
Repository: phoenix Updated Branches: refs/heads/3.0 fdfabba92 -> 067bfa83b PHOENIX-902 Allow family qualifiers in CSV loader Allow qualifying input column names with the column family. Contributed by James Violette. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/067bfa83 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/067bfa83 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/067bfa83 Branch: refs/heads/3.0 Commit: 067bfa83bd8608f205b0735098f1bf182ce0d810 Parents: fdfabba Author: Gabriel Reid Authored: Sat Aug 9 22:37:53 2014 +0200 Committer: Gabriel Reid Committed: Sat Aug 9 22:37:53 2014 +0200 -- .../apache/phoenix/util/CSVCommonsLoader.java | 83 +++- 1 file changed, 65 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/067bfa83/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java index 494696b..ef4375c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java @@ -17,18 +17,10 @@ */ package org.apache.phoenix.util; -import java.io.File; -import java.io.Reader; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - +import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; @@ -40,9 +32,19 @@ import org.apache.phoenix.util.csv.CsvUpsertExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Joiner; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import java.io.File; +import java.io.Reader; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /*** * Upserts CSV data using Phoenix JDBC connection @@ -119,7 +121,7 @@ public class CSVCommonsLoader { /** * default settings - * delimiter = ',' + * delimiter = ',' * quoteChar = '"', * escape = null * recordSeparator = CRLF, CR, or LF @@ -281,6 +283,8 @@ public class CSVCommonsLoader { String tableName, List columns, boolean strict) throws SQLException { Map columnNameToTypeMap = Maps.newLinkedHashMap(); +Set ambiguousColumnNames = new HashSet(); +Map fullColumnNameToTypeMap = Maps.newLinkedHashMap(); DatabaseMetaData dbmd = conn.getMetaData(); int unfoundColumnCount = 0; // TODO: escape wildcard characters here because we don't want that @@ -294,9 +298,22 @@ public class CSVCommonsLoader { (schemaAndTable.length == 1 ? escapedTableName : schemaAndTable[1]), null); while (rs.next()) { +String colName = rs.getString(QueryUtil.COLUMN_NAME_POSITION); +String colFam = rs.getString(QueryUtil.COLUMN_FAMILY_POSITION); + +// use family qualifier, if available, otherwise, use column name +String fullColumn = (colFam==null?colName:String.format("%s.%s",colFam,colName)); String sqlTypeName = rs.getString(QueryUtil.DATA_TYPE_NAME_POSITION); + +// allow for both bare and family qualified names. +if (columnNameToTypeMap.keySet().contains(colName)) { +ambiguousColumnNames.add(colName); +} columnNameToTypeMap.put( -rs.getString(QueryUtil.COLUMN_NAME_POSITION), +colName, +PDataType.fromSqlTypeName(sqlTypeName).getSqlType()); +fullColumnNameToTypeMap.put( +fullColumn, PDataType.fromSqlTypeName(sqlTypeName).getSqlType()); } if (columnNameToTypeMap.isEmpty()) { @@ -308,8 +325,10 @@ public class CSVCommonsLoader { } } List columnInfoList = Lists.newArrayList(); +Se
git commit: PHOENIX-902 Allow family qualifiers in CSV loader
Repository: phoenix Updated Branches: refs/heads/4.0 fc1862d93 -> 152ce872c PHOENIX-902 Allow family qualifiers in CSV loader Allow qualifying input column names with the column family. Contributed by James Violette. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/152ce872 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/152ce872 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/152ce872 Branch: refs/heads/4.0 Commit: 152ce872cc76aa1af10f54d92d2e956fc9c81ae4 Parents: fc1862d Author: Gabriel Reid Authored: Sat Aug 9 22:37:53 2014 +0200 Committer: Gabriel Reid Committed: Sat Aug 9 22:39:38 2014 +0200 -- .../apache/phoenix/util/CSVCommonsLoader.java | 83 +++- 1 file changed, 65 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/152ce872/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java index 494696b..ef4375c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/CSVCommonsLoader.java @@ -17,18 +17,10 @@ */ package org.apache.phoenix.util; -import java.io.File; -import java.io.Reader; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - +import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; @@ -40,9 +32,19 @@ import org.apache.phoenix.util.csv.CsvUpsertExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Joiner; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import java.io.File; +import java.io.Reader; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /*** * Upserts CSV data using Phoenix JDBC connection @@ -119,7 +121,7 @@ public class CSVCommonsLoader { /** * default settings - * delimiter = ',' + * delimiter = ',' * quoteChar = '"', * escape = null * recordSeparator = CRLF, CR, or LF @@ -281,6 +283,8 @@ public class CSVCommonsLoader { String tableName, List columns, boolean strict) throws SQLException { Map columnNameToTypeMap = Maps.newLinkedHashMap(); +Set ambiguousColumnNames = new HashSet(); +Map fullColumnNameToTypeMap = Maps.newLinkedHashMap(); DatabaseMetaData dbmd = conn.getMetaData(); int unfoundColumnCount = 0; // TODO: escape wildcard characters here because we don't want that @@ -294,9 +298,22 @@ public class CSVCommonsLoader { (schemaAndTable.length == 1 ? escapedTableName : schemaAndTable[1]), null); while (rs.next()) { +String colName = rs.getString(QueryUtil.COLUMN_NAME_POSITION); +String colFam = rs.getString(QueryUtil.COLUMN_FAMILY_POSITION); + +// use family qualifier, if available, otherwise, use column name +String fullColumn = (colFam==null?colName:String.format("%s.%s",colFam,colName)); String sqlTypeName = rs.getString(QueryUtil.DATA_TYPE_NAME_POSITION); + +// allow for both bare and family qualified names. +if (columnNameToTypeMap.keySet().contains(colName)) { +ambiguousColumnNames.add(colName); +} columnNameToTypeMap.put( -rs.getString(QueryUtil.COLUMN_NAME_POSITION), +colName, +PDataType.fromSqlTypeName(sqlTypeName).getSqlType()); +fullColumnNameToTypeMap.put( +fullColumn, PDataType.fromSqlTypeName(sqlTypeName).getSqlType()); } if (columnNameToTypeMap.isEmpty()) { @@ -308,8 +325,10 @@ public class CSVCommonsLoader { } } List columnInfoList = Lists.newArrayList(); +Se
Apache-Phoenix | 3.0 | Hadoop1 | Build Successful
3.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastSuccessfulBuild/artifact/ Last Complete Test Report https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastCompletedBuild/testReport/ Changes [jtaylor] Fixing warnings for MutableIndexFailureIT test