phoenix git commit: PHOENIX-2949 Fix estimated region size when checking for serial query
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 bb8d7cd0d -> 6e75b6aff PHOENIX-2949 Fix estimated region size when checking for serial query Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6e75b6af Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6e75b6af Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6e75b6af Branch: refs/heads/4.x-HBase-0.98 Commit: 6e75b6aff59583517208031e2ed3117e705abdc5 Parents: bb8d7cd Author: Ankit SinghalAuthored: Thu Jun 23 13:57:52 2016 -0700 Committer: Ankit Singhal Committed: Thu Jun 23 13:57:52 2016 -0700 -- .../org/apache/phoenix/execute/ScanPlan.java| 46 ++-- .../org/apache/phoenix/query/QueryServices.java | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e75b6af/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java index c55a1cc..0975b3f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java @@ -25,7 +25,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; -import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.compile.GroupByCompiler.GroupBy; import org.apache.phoenix.compile.OrderByCompiler.OrderBy; @@ -62,7 +62,6 @@ import org.apache.phoenix.schema.SaltingUtil; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.stats.GuidePostsInfo; import org.apache.phoenix.schema.stats.PTableStats; -import org.apache.phoenix.schema.stats.StatisticsUtil; import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ScanUtil; @@ -118,7 +117,7 @@ public class ScanPlan extends BaseQueryPlan { Scan scan = context.getScan(); /* * If a limit is provided and we have no filter, run the scan serially when we estimate that - * the limit's worth of data will fit into a single region. + * the limit's worth of data is less than the threshold bytes provided in QueryServices.QUERY_PARALLEL_LIMIT_THRESHOLD */ Integer perScanLimit = !allowPageFilter ? null : limit; if (perScanLimit == null || scan.getFilter() != null) { @@ -127,32 +126,35 @@ public class ScanPlan extends BaseQueryPlan { long scn = context.getConnection().getSCN() == null ? Long.MAX_VALUE : context.getConnection().getSCN(); PTableStats tableStats = context.getConnection().getQueryServices().getTableStats(table.getName().getBytes(), scn); GuidePostsInfo gpsInfo = tableStats.getGuidePosts().get(SchemaUtil.getEmptyColumnFamily(table)); -long estRowSize = SchemaUtil.estimateRowSize(table); -long estRegionSize; +ConnectionQueryServices services = context.getConnection().getQueryServices(); +long estRowSize; +long estimatedParallelThresholdBytes; if (gpsInfo == null) { -// Use guidepost depth as minimum size -ConnectionQueryServices services = context.getConnection().getQueryServices(); -HTableDescriptor desc = services.getTableDescriptor(table.getPhysicalName().getBytes()); -int guidepostPerRegion = services.getProps().getInt(QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION); -long guidepostWidth = services.getProps().getLong(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_WIDTH_BYTES); -estRegionSize = StatisticsUtil.getGuidePostDepth(guidepostPerRegion, guidepostWidth, desc); +estRowSize = SchemaUtil.estimateRowSize(table); +estimatedParallelThresholdBytes = services.getProps().getLong(HConstants.HREGION_MAX_FILESIZE, +HConstants.DEFAULT_MAX_FILE_SIZE); } else { -// Region size estimated based on total number of bytes divided by number of regions long totByteSize = 0; +long totRowCount = 0; for (long byteCount : gpsInfo.getByteCounts()) { totByteSize += byteCount; } -estRegionSize = totByteSize / (gpsInfo.getGuidePostsCount()+1); +for (long rowCount :
phoenix git commit: PHOENIX-2949 Fix estimated region size when checking for serial query
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 88c380925 -> 4de25dea4 PHOENIX-2949 Fix estimated region size when checking for serial query Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4de25dea Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4de25dea Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4de25dea Branch: refs/heads/4.x-HBase-1.0 Commit: 4de25dea48c95c0abc810b2678dbdbea0d86e1ab Parents: 88c3809 Author: Ankit SinghalAuthored: Thu Jun 23 13:56:21 2016 -0700 Committer: Ankit Singhal Committed: Thu Jun 23 13:56:21 2016 -0700 -- .../org/apache/phoenix/execute/ScanPlan.java| 46 ++-- .../org/apache/phoenix/query/QueryServices.java | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4de25dea/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java index c55a1cc..0975b3f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java @@ -25,7 +25,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; -import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.compile.GroupByCompiler.GroupBy; import org.apache.phoenix.compile.OrderByCompiler.OrderBy; @@ -62,7 +62,6 @@ import org.apache.phoenix.schema.SaltingUtil; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.stats.GuidePostsInfo; import org.apache.phoenix.schema.stats.PTableStats; -import org.apache.phoenix.schema.stats.StatisticsUtil; import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ScanUtil; @@ -118,7 +117,7 @@ public class ScanPlan extends BaseQueryPlan { Scan scan = context.getScan(); /* * If a limit is provided and we have no filter, run the scan serially when we estimate that - * the limit's worth of data will fit into a single region. + * the limit's worth of data is less than the threshold bytes provided in QueryServices.QUERY_PARALLEL_LIMIT_THRESHOLD */ Integer perScanLimit = !allowPageFilter ? null : limit; if (perScanLimit == null || scan.getFilter() != null) { @@ -127,32 +126,35 @@ public class ScanPlan extends BaseQueryPlan { long scn = context.getConnection().getSCN() == null ? Long.MAX_VALUE : context.getConnection().getSCN(); PTableStats tableStats = context.getConnection().getQueryServices().getTableStats(table.getName().getBytes(), scn); GuidePostsInfo gpsInfo = tableStats.getGuidePosts().get(SchemaUtil.getEmptyColumnFamily(table)); -long estRowSize = SchemaUtil.estimateRowSize(table); -long estRegionSize; +ConnectionQueryServices services = context.getConnection().getQueryServices(); +long estRowSize; +long estimatedParallelThresholdBytes; if (gpsInfo == null) { -// Use guidepost depth as minimum size -ConnectionQueryServices services = context.getConnection().getQueryServices(); -HTableDescriptor desc = services.getTableDescriptor(table.getPhysicalName().getBytes()); -int guidepostPerRegion = services.getProps().getInt(QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION); -long guidepostWidth = services.getProps().getLong(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_WIDTH_BYTES); -estRegionSize = StatisticsUtil.getGuidePostDepth(guidepostPerRegion, guidepostWidth, desc); +estRowSize = SchemaUtil.estimateRowSize(table); +estimatedParallelThresholdBytes = services.getProps().getLong(HConstants.HREGION_MAX_FILESIZE, +HConstants.DEFAULT_MAX_FILE_SIZE); } else { -// Region size estimated based on total number of bytes divided by number of regions long totByteSize = 0; +long totRowCount = 0; for (long byteCount : gpsInfo.getByteCounts()) { totByteSize += byteCount; } -estRegionSize = totByteSize / (gpsInfo.getGuidePostsCount()+1); +for (long rowCount :
phoenix git commit: PHOENIX-2949 Fix estimated region size when checking for serial query
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 18a47b051 -> 2f10476a8 PHOENIX-2949 Fix estimated region size when checking for serial query Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2f10476a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2f10476a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2f10476a Branch: refs/heads/4.x-HBase-1.1 Commit: 2f10476a8e75fe1c831729ef1ce18f0dbbddeb2c Parents: 18a47b0 Author: Ankit SinghalAuthored: Thu Jun 23 13:54:55 2016 -0700 Committer: Ankit Singhal Committed: Thu Jun 23 13:54:55 2016 -0700 -- .../org/apache/phoenix/execute/ScanPlan.java| 46 ++-- .../org/apache/phoenix/query/QueryServices.java | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2f10476a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java index c55a1cc..0975b3f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java @@ -25,7 +25,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; -import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.compile.GroupByCompiler.GroupBy; import org.apache.phoenix.compile.OrderByCompiler.OrderBy; @@ -62,7 +62,6 @@ import org.apache.phoenix.schema.SaltingUtil; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.stats.GuidePostsInfo; import org.apache.phoenix.schema.stats.PTableStats; -import org.apache.phoenix.schema.stats.StatisticsUtil; import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ScanUtil; @@ -118,7 +117,7 @@ public class ScanPlan extends BaseQueryPlan { Scan scan = context.getScan(); /* * If a limit is provided and we have no filter, run the scan serially when we estimate that - * the limit's worth of data will fit into a single region. + * the limit's worth of data is less than the threshold bytes provided in QueryServices.QUERY_PARALLEL_LIMIT_THRESHOLD */ Integer perScanLimit = !allowPageFilter ? null : limit; if (perScanLimit == null || scan.getFilter() != null) { @@ -127,32 +126,35 @@ public class ScanPlan extends BaseQueryPlan { long scn = context.getConnection().getSCN() == null ? Long.MAX_VALUE : context.getConnection().getSCN(); PTableStats tableStats = context.getConnection().getQueryServices().getTableStats(table.getName().getBytes(), scn); GuidePostsInfo gpsInfo = tableStats.getGuidePosts().get(SchemaUtil.getEmptyColumnFamily(table)); -long estRowSize = SchemaUtil.estimateRowSize(table); -long estRegionSize; +ConnectionQueryServices services = context.getConnection().getQueryServices(); +long estRowSize; +long estimatedParallelThresholdBytes; if (gpsInfo == null) { -// Use guidepost depth as minimum size -ConnectionQueryServices services = context.getConnection().getQueryServices(); -HTableDescriptor desc = services.getTableDescriptor(table.getPhysicalName().getBytes()); -int guidepostPerRegion = services.getProps().getInt(QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION); -long guidepostWidth = services.getProps().getLong(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_WIDTH_BYTES); -estRegionSize = StatisticsUtil.getGuidePostDepth(guidepostPerRegion, guidepostWidth, desc); +estRowSize = SchemaUtil.estimateRowSize(table); +estimatedParallelThresholdBytes = services.getProps().getLong(HConstants.HREGION_MAX_FILESIZE, +HConstants.DEFAULT_MAX_FILE_SIZE); } else { -// Region size estimated based on total number of bytes divided by number of regions long totByteSize = 0; +long totRowCount = 0; for (long byteCount : gpsInfo.getByteCounts()) { totByteSize += byteCount; } -estRegionSize = totByteSize / (gpsInfo.getGuidePostsCount()+1); +for (long rowCount :
phoenix git commit: PHOENIX-2949 Fix estimated region size when checking for serial query
Repository: phoenix Updated Branches: refs/heads/master 8a72032e2 -> a44387358 PHOENIX-2949 Fix estimated region size when checking for serial query Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a4438735 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a4438735 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a4438735 Branch: refs/heads/master Commit: a44387358d6b58b77358a42f38c5baac9e2ab527 Parents: 8a72032 Author: Ankit SinghalAuthored: Thu Jun 23 13:54:33 2016 -0700 Committer: Ankit Singhal Committed: Thu Jun 23 13:54:33 2016 -0700 -- .../org/apache/phoenix/execute/ScanPlan.java| 46 ++-- .../org/apache/phoenix/query/QueryServices.java | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a4438735/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java index c55a1cc..0975b3f 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java @@ -25,7 +25,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; -import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.Scan; import org.apache.phoenix.compile.GroupByCompiler.GroupBy; import org.apache.phoenix.compile.OrderByCompiler.OrderBy; @@ -62,7 +62,6 @@ import org.apache.phoenix.schema.SaltingUtil; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.stats.GuidePostsInfo; import org.apache.phoenix.schema.stats.PTableStats; -import org.apache.phoenix.schema.stats.StatisticsUtil; import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ScanUtil; @@ -118,7 +117,7 @@ public class ScanPlan extends BaseQueryPlan { Scan scan = context.getScan(); /* * If a limit is provided and we have no filter, run the scan serially when we estimate that - * the limit's worth of data will fit into a single region. + * the limit's worth of data is less than the threshold bytes provided in QueryServices.QUERY_PARALLEL_LIMIT_THRESHOLD */ Integer perScanLimit = !allowPageFilter ? null : limit; if (perScanLimit == null || scan.getFilter() != null) { @@ -127,32 +126,35 @@ public class ScanPlan extends BaseQueryPlan { long scn = context.getConnection().getSCN() == null ? Long.MAX_VALUE : context.getConnection().getSCN(); PTableStats tableStats = context.getConnection().getQueryServices().getTableStats(table.getName().getBytes(), scn); GuidePostsInfo gpsInfo = tableStats.getGuidePosts().get(SchemaUtil.getEmptyColumnFamily(table)); -long estRowSize = SchemaUtil.estimateRowSize(table); -long estRegionSize; +ConnectionQueryServices services = context.getConnection().getQueryServices(); +long estRowSize; +long estimatedParallelThresholdBytes; if (gpsInfo == null) { -// Use guidepost depth as minimum size -ConnectionQueryServices services = context.getConnection().getQueryServices(); -HTableDescriptor desc = services.getTableDescriptor(table.getPhysicalName().getBytes()); -int guidepostPerRegion = services.getProps().getInt(QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION); -long guidepostWidth = services.getProps().getLong(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, -QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_WIDTH_BYTES); -estRegionSize = StatisticsUtil.getGuidePostDepth(guidepostPerRegion, guidepostWidth, desc); +estRowSize = SchemaUtil.estimateRowSize(table); +estimatedParallelThresholdBytes = services.getProps().getLong(HConstants.HREGION_MAX_FILESIZE, +HConstants.DEFAULT_MAX_FILE_SIZE); } else { -// Region size estimated based on total number of bytes divided by number of regions long totByteSize = 0; +long totRowCount = 0; for (long byteCount : gpsInfo.getByteCounts()) { totByteSize += byteCount; } -estRegionSize = totByteSize / (gpsInfo.getGuidePostsCount()+1); +for (long rowCount : gpsInfo.getRowCounts()) { +