You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2022/07/25 05:06:45 UTC

[phoenix] branch master updated: PHOENIX-6707. Replace getLong() with getLongBytes() for appropriate config items

This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new 51c8b023d9 PHOENIX-6707. Replace getLong() with getLongBytes() for appropriate config items
51c8b023d9 is described below

commit 51c8b023d9054476126dff5ac485acf7a365a173
Author: Andor Molnar <an...@cloudera.com>
AuthorDate: Mon May 16 14:01:30 2022 +0200

    PHOENIX-6707. Replace getLong() with getLongBytes() for appropriate config items
---
 .../DataTableLocalIndexRegionScanner.java          |  2 +-
 .../java/org/apache/phoenix/cache/GlobalCache.java |  5 ++-
 .../cache/aggcache/SpillableGroupByCache.java      |  3 +-
 .../org/apache/phoenix/compile/DeleteCompiler.java |  8 +++-
 .../org/apache/phoenix/compile/UpsertCompiler.java |  6 ++-
 .../coprocessor/GlobalIndexRegionScanner.java      |  2 +-
 .../UngroupedAggregateRegionObserver.java          |  2 +-
 .../UngroupedAggregateRegionScanner.java           |  2 +-
 .../org/apache/phoenix/execute/AggregatePlan.java  |  5 ++-
 .../phoenix/execute/ClientAggregatePlan.java       |  4 +-
 .../org/apache/phoenix/execute/ClientScanPlan.java |  2 +-
 .../org/apache/phoenix/execute/HashJoinPlan.java   |  2 +-
 .../apache/phoenix/execute/SortMergeJoinPlan.java  |  2 +-
 .../iterate/NonAggregateRegionScannerFactory.java  |  3 +-
 .../phoenix/iterate/SpoolingResultIterator.java    |  6 ++-
 .../org/apache/phoenix/jdbc/PhoenixConnection.java |  2 +-
 .../org/apache/phoenix/join/HashCacheClient.java   |  4 +-
 .../phoenix/mapreduce/MultiHfileOutputFormat.java  |  2 +-
 .../apache/phoenix/query/GuidePostsCacheImpl.java  |  2 +-
 .../apache/phoenix/query/QueryServicesOptions.java |  2 +-
 .../schema/stats/DefaultStatisticsCollector.java   |  2 +-
 .../java/org/apache/phoenix/util/JDBCUtil.java     |  5 ++-
 .../org/apache/phoenix/util/ReadOnlyProps.java     | 22 +++++++++
 .../org/apache/phoenix/util/ReadOnlyPropsTest.java | 52 ++++++++++++++++++++++
 24 files changed, 119 insertions(+), 28 deletions(-)

diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/DataTableLocalIndexRegionScanner.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/DataTableLocalIndexRegionScanner.java
index ec84cbcc30..5065d7cff4 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/DataTableLocalIndexRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/DataTableLocalIndexRegionScanner.java
@@ -77,7 +77,7 @@ public class DataTableLocalIndexRegionScanner extends DelegateRegionScanner {
         this.localIndexFamily = localIndexFamily;
         this.region=region;
         maxBatchSize = conf.getInt(MUTATE_BATCH_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE);
-        maxBatchSizeBytes = conf.getLong(MUTATE_BATCH_SIZE_BYTES_ATTRIB,
+        maxBatchSizeBytes = conf.getLongBytes(MUTATE_BATCH_SIZE_BYTES_ATTRIB,
             QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE_BYTES);
         mutationList=new UngroupedAggregateRegionObserver.MutationList(maxBatchSize);   
     }
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/GlobalCache.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/GlobalCache.java
index 3b3116b531..ba5bb4b1fd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/cache/GlobalCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/GlobalCache.java
@@ -99,7 +99,8 @@ public class GlobalCache extends TenantCacheImpl {
                     long maxTTL = config.getLong(
                             QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB,
                             QueryServicesOptions.DEFAULT_MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS);
-                    long maxSize = config.getLong(QueryServices.MAX_SERVER_METADATA_CACHE_SIZE_ATTRIB,
+                    long maxSize = config.getLongBytes(
+                            QueryServices.MAX_SERVER_METADATA_CACHE_SIZE_ATTRIB,
                             QueryServicesOptions.DEFAULT_MAX_SERVER_METADATA_CACHE_SIZE);
                     metaDataCache = result = CacheBuilder.newBuilder()
                             .maximumWeight(maxSize)
@@ -146,7 +147,7 @@ public class GlobalCache extends TenantCacheImpl {
     private static long getMaxMemorySize(Configuration config) {
         long maxSize = Runtime.getRuntime().maxMemory() * 
                 config.getInt(MAX_MEMORY_PERC_ATTRIB, QueryServicesOptions.DEFAULT_MAX_MEMORY_PERC) / 100;
-        maxSize = Math.min(maxSize, config.getLong(MAX_MEMORY_SIZE_ATTRIB, Long.MAX_VALUE));
+        maxSize = Math.min(maxSize, config.getLongBytes(MAX_MEMORY_SIZE_ATTRIB, Long.MAX_VALUE));
         return maxSize;
     }
     
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
index 17c5babe38..8c54753b0e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillableGroupByCache.java
@@ -136,7 +136,8 @@ public class SpillableGroupByCache implements GroupByCache {
 
         // Compute Map initial map
         final Configuration conf = env.getConfiguration();
-        final long maxCacheSizeConf = conf.getLong(GROUPBY_MAX_CACHE_SIZE_ATTRIB, DEFAULT_GROUPBY_MAX_CACHE_MAX);
+        final long maxCacheSizeConf = conf.getLongBytes(GROUPBY_MAX_CACHE_SIZE_ATTRIB,
+                DEFAULT_GROUPBY_MAX_CACHE_MAX);
         final int numSpillFilesConf = conf.getInt(GROUPBY_SPILL_FILES_ATTRIB, DEFAULT_GROUPBY_SPILL_FILES);
 
         final int maxSizeNum = (int)(maxCacheSizeConf / estValueSize);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
index 06eda59c85..e2f82556bd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java
@@ -145,7 +145,9 @@ public class DeleteCompiler {
         final boolean autoFlush = connection.getAutoCommit() || tableRef.getTable().isTransactional();
         ConnectionQueryServices services = connection.getQueryServices();
         final int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
-        final long maxSizeBytes = services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
+        final long maxSizeBytes = services.getProps()
+                .getLongBytes(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,
+                        QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
         final int batchSize = Math.min(connection.getMutateBatchSize(), maxSize);
         MultiRowMutationState mutations = new MultiRowMutationState(batchSize);
         List<MultiRowMutationState> otherMutations = null;
@@ -587,7 +589,9 @@ public class DeleteCompiler {
         }
 
         final int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
-        final long maxSizeBytes = services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
+        final long maxSizeBytes = services.getProps()
+                .getLongBytes(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,
+                        QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
  
         // If we're doing a query for a set of rows with no where clause, then we don't need to contact the server at all.
         if (noQueryReqd) {
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
index bbba71d9e5..23726b5349 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
@@ -216,7 +216,7 @@ public class UpsertCompiler {
         int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,
                 QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
         long maxSizeBytes =
-                services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,
+                services.getProps().getLongBytes(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,
                     QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
         int maxHBaseClientKeyValueSize =
                 services.getProps().getInt(QueryServices.HBASE_CLIENT_KEYVALUE_MAXSIZE,
@@ -369,7 +369,9 @@ public class UpsertCompiler {
         final PhoenixConnection connection = statement.getConnection();
         ConnectionQueryServices services = connection.getQueryServices();
         final int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
-        final long maxSizeBytes = services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
+        final long maxSizeBytes = services.getProps()
+                .getLongBytes(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,
+                        QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
         List<ColumnName> columnNodes = upsert.getColumns();
         TableRef tableRefToBe = null;
         PTable table = null;
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GlobalIndexRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GlobalIndexRegionScanner.java
index 0686e7a485..5e7beff683 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GlobalIndexRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GlobalIndexRegionScanner.java
@@ -182,7 +182,7 @@ public abstract class GlobalIndexRegionScanner extends BaseRegionScanner {
             }
         }
         maxBatchSize = config.getInt(MUTATE_BATCH_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE);
-        maxBatchSizeBytes = config.getLong(MUTATE_BATCH_SIZE_BYTES_ATTRIB,
+        maxBatchSizeBytes = config.getLongBytes(MUTATE_BATCH_SIZE_BYTES_ATTRIB,
                 QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE_BYTES);
         blockingMemstoreSize = UngroupedAggregateRegionObserver.getBlockingMemstoreSize(region, config);
         clientVersionBytes = scan.getAttribute(BaseScannerRegionObserver.CLIENT_VERSION);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index c32c7f2be0..010406e0d2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -377,7 +377,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
         long flushSize = region.getTableDescriptor().getMemStoreFlushSize();
 
         if (flushSize <= 0) {
-            flushSize = conf.getLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE,
+            flushSize = conf.getLongBytes(HConstants.HREGION_MEMSTORE_FLUSH_SIZE,
                     TableDescriptorBuilder.DEFAULT_MEMSTORE_FLUSH_SIZE);
         }
         return flushSize * (conf.getLong(HConstants.HREGION_MEMSTORE_BLOCK_MULTIPLIER,
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java
index 95f013605f..b3df15f678 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java
@@ -269,7 +269,7 @@ public class UngroupedAggregateRegionScanner extends BaseRegionScanner {
                 needToWrite = false;
             }
             maxBatchSize = conf.getInt(MUTATE_BATCH_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE);
-            maxBatchSizeBytes = conf.getLong(MUTATE_BATCH_SIZE_BYTES_ATTRIB,
+            maxBatchSizeBytes = conf.getLongBytes(MUTATE_BATCH_SIZE_BYTES_ATTRIB,
                     QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE_BYTES);
         }
         minMaxQualifiers = EncodedColumnsUtil.getMinMaxQualifiersFromScan(scan);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
index 5d4d1d3ef5..a781aaf619 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
@@ -200,7 +200,8 @@ public class AggregatePlan extends BaseQueryPlan {
                             true,
                             this.orderBy == OrderBy.REV_ROW_KEY_ORDER_BY);
             long threshold =
-                    services.getProps().getLong(QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
+                    services.getProps()
+                            .getLongBytes(QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                             QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES);
             boolean spoolingEnabled =
                     services.getProps().getBoolean(
@@ -321,7 +322,7 @@ public class AggregatePlan extends BaseQueryPlan {
             }
         } else {
             long thresholdBytes =
-                    context.getConnection().getQueryServices().getProps().getLong(
+                    context.getConnection().getQueryServices().getProps().getLongBytes(
                         QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                         QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES);
             boolean spoolingEnabled =
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
index 001a2a94d5..9c15237da8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java
@@ -152,7 +152,7 @@ public class ClientAggregatePlan extends ClientProcessingPlan {
                 aggResultIterator = new ClientGroupedAggregatingResultIterator(LookAheadResultIterator.wrap(iterator), serverAggregators, keyExpressions);
             } else {
                 long thresholdBytes =
-                        context.getConnection().getQueryServices().getProps().getLong(
+                        context.getConnection().getQueryServices().getProps().getLongBytes(
                             QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                             QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES);
                 boolean spoolingEnabled =
@@ -201,7 +201,7 @@ public class ClientAggregatePlan extends ClientProcessingPlan {
             }
         } else {
             long thresholdBytes =
-                    context.getConnection().getQueryServices().getProps().getLong(
+                    context.getConnection().getQueryServices().getProps().getLongBytes(
                         QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                         QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES);
             boolean spoolingEnabled =
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientScanPlan.java
index 549354494b..caec1b69d2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientScanPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ClientScanPlan.java
@@ -95,7 +95,7 @@ public class ClientScanPlan extends ClientProcessingPlan {
         
         if (!orderBy.getOrderByExpressions().isEmpty()) { // TopN
             long thresholdBytes =
-                    context.getConnection().getQueryServices().getProps().getLong(
+                    context.getConnection().getQueryServices().getProps().getLongBytes(
                         QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                         QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES);
             boolean spoolingEnabled =
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/HashJoinPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/HashJoinPlan.java
index 25d9fb3818..eace84187c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/HashJoinPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/HashJoinPlan.java
@@ -151,7 +151,7 @@ public class HashJoinPlan extends DelegateQueryPlan {
         QueryServices services = plan.getContext().getConnection().getQueryServices();
         this.maxServerCacheTimeToLive = services.getProps().getInt(
                 QueryServices.MAX_SERVER_CACHE_TIME_TO_LIVE_MS_ATTRIB, QueryServicesOptions.DEFAULT_MAX_SERVER_CACHE_TIME_TO_LIVE_MS);
-        this.serverCacheLimit = services.getProps().getLong(
+        this.serverCacheLimit = services.getProps().getLongBytes(
                 QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MAX_SERVER_CACHE_SIZE);
     }
     
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
index 9f46d0f500..7a3dcb84a4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/SortMergeJoinPlan.java
@@ -152,7 +152,7 @@ public class SortMergeJoinPlan implements QueryPlan {
         this.tableRefs.addAll(lhsPlan.getSourceRefs());
         this.tableRefs.addAll(rhsPlan.getSourceRefs());
         this.thresholdBytes =
-                context.getConnection().getQueryServices().getProps().getLong(
+                context.getConnection().getQueryServices().getProps().getLongBytes(
                     QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                     QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES);
         this.spoolingEnabled =
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
index 0cb510299c..dce4f785cb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/NonAggregateRegionScannerFactory.java
@@ -169,7 +169,8 @@ public class NonAggregateRegionScannerFactory extends RegionScannerFactory {
                         QueryServices.SERVER_ORDERBY_SPOOLING_ENABLED_ATTRIB,
                         QueryServicesOptions.DEFAULT_SERVER_ORDERBY_SPOOLING_ENABLED);
         long thresholdBytes =
-                env.getConfiguration().getLong(QueryServices.SERVER_SPOOL_THRESHOLD_BYTES_ATTRIB,
+                env.getConfiguration()
+                        .getLongBytes(QueryServices.SERVER_SPOOL_THRESHOLD_BYTES_ATTRIB,
                         QueryServicesOptions.DEFAULT_SERVER_SPOOL_THRESHOLD_BYTES);
         final OrderedResultIterator iterator =
                 deserializeFromScan(scan, innerScanner, spoolingEnabled, thresholdBytes);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index b2d379400f..7214fdab73 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -98,9 +98,11 @@ public class SpoolingResultIterator implements PeekingResultIterator {
 
     private SpoolingResultIterator(SpoolingMetricsHolder spoolMetrics, MemoryMetricsHolder memoryMetrics, ResultIterator scanner, QueryServices services) throws SQLException {
         this (spoolMetrics, memoryMetrics, scanner, services.getMemoryManager(),
-                services.getProps().getLong(QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
+                services.getProps().getLongBytes(QueryServices.CLIENT_SPOOL_THRESHOLD_BYTES_ATTRIB,
                     QueryServicesOptions.DEFAULT_CLIENT_SPOOL_THRESHOLD_BYTES),
-                services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES),
+                services.getProps()
+                        .getLongBytes(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB,
+                                QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES),
                 services.getProps().get(QueryServices.SPOOL_DIRECTORY, QueryServicesOptions.DEFAULT_SPOOL_DIRECTORY));
     }
 
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 8e30accc4f..bea1a84bf1 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
@@ -344,7 +344,7 @@ public class PhoenixConnection implements Connection, MetaDataMutated, SQLClosea
             int maxSize = this.services.getProps().getInt(
                     QueryServices.MAX_MUTATION_SIZE_ATTRIB,
                     QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE);
-            long maxSizeBytes = this.services.getProps().getLong(
+            long maxSizeBytes = this.services.getProps().getLongBytes(
                     QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,
                     QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES);
             String timeZoneID = this.services.getProps().get(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB,
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheClient.java b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheClient.java
index fad3828022..fa0ce6d134 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/join/HashCacheClient.java
@@ -128,7 +128,9 @@ public class HashCacheClient  {
     }
     
     private void serialize(ImmutableBytesWritable ptr, ResultIterator iterator, long estimatedSize, List<Expression> onExpressions, boolean singleValueOnly, Expression keyRangeRhsExpression, List<Expression> keyRangeRhsValues) throws SQLException {
-        long maxSize = serverCache.getConnection().getQueryServices().getProps().getLong(QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MAX_SERVER_CACHE_SIZE);
+        long maxSize = serverCache.getConnection().getQueryServices().getProps()
+                .getLongBytes(QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB,
+                        QueryServicesOptions.DEFAULT_MAX_SERVER_CACHE_SIZE);
         estimatedSize = Math.min(estimatedSize, maxSize);
         if (estimatedSize > Integer.MAX_VALUE) {
             throw new IllegalStateException("Estimated size(" + estimatedSize + ") must not be greater than Integer.MAX_VALUE(" + Integer.MAX_VALUE + ")");
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
index 00cdcdc55b..7a7ea39ac3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/MultiHfileOutputFormat.java
@@ -130,7 +130,7 @@ public class MultiHfileOutputFormat extends FileOutputFormat<TableRowkeyPair, Ce
         final Configuration conf = context.getConfiguration();
         final FileSystem fs = outputdir.getFileSystem(conf);
      
-        final long maxsize = conf.getLong(HConstants.HREGION_MAX_FILESIZE,
+        final long maxsize = conf.getLongBytes(HConstants.HREGION_MAX_FILESIZE,
             HConstants.DEFAULT_MAX_FILE_SIZE);
         // Invented config.  Add to hbase-*.xml if other than default compression.
         final String defaultCompressionStr = conf.get("hfile.compression",
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCacheImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCacheImpl.java
index 0b7a4bfdd1..8de051f3c5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCacheImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCacheImpl.java
@@ -52,7 +52,7 @@ public class GuidePostsCacheImpl implements GuidePostsCache {
                 QueryServicesOptions.DEFAULT_STATS_UPDATE_FREQ_MS);
 
         // Maximum total weight (size in bytes) of stats entries
-        final long maxTableStatsCacheSize = config.getLong(
+        final long maxTableStatsCacheSize = config.getLongBytes(
                 QueryServices.STATS_MAX_CACHE_SIZE,
                 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
 
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index 05e3c6a730..965791d709 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -676,7 +676,7 @@ public class QueryServicesOptions {
     }
 
     public long getSpillableGroupByMaxCacheSize() {
-        return config.getLong(GROUPBY_MAX_CACHE_SIZE_ATTRIB, DEFAULT_GROUPBY_MAX_CACHE_MAX);
+        return config.getLongBytes(GROUPBY_MAX_CACHE_SIZE_ATTRIB, DEFAULT_GROUPBY_MAX_CACHE_MAX);
     }
 
     public int getSpillableGroupByNumSpillFiles() {
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
index 84ea65e0cb..8c2dbf88d2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
@@ -153,7 +153,7 @@ public class DefaultStatisticsCollector implements StatisticsCollector {
                         configuration.getInt(
                                 QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB,
                                 QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION),
-                        configuration.getLong(
+                        configuration.getLongBytes(
                                 QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB,
                                 QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_WIDTH_BYTES),
                         region.getTableDescriptor());
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/JDBCUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/JDBCUtil.java
index b0dbdb5d62..44a66efc72 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/JDBCUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/JDBCUtil.java
@@ -146,7 +146,10 @@ public class JDBCUtil {
 
     public static long getMutateBatchSizeBytes(String url, Properties info, ReadOnlyProps props) throws SQLException {
         String batchSizeStr = findProperty(url, info, PhoenixRuntime.UPSERT_BATCH_SIZE_BYTES_ATTRIB);
-        return (batchSizeStr == null ? props.getLong(QueryServices.MUTATE_BATCH_SIZE_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE_BYTES) : Long.parseLong(batchSizeStr));
+        return batchSizeStr == null ?
+                props.getLongBytes(QueryServices.MUTATE_BATCH_SIZE_BYTES_ATTRIB,
+                QueryServicesOptions.DEFAULT_MUTATE_BATCH_SIZE_BYTES)
+                : Long.parseLong(batchSizeStr);
     }
 
     public static @Nullable PName getTenantId(String url, Properties info) throws SQLException {
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
index a817581502..9b9de68bfd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
@@ -28,6 +28,7 @@ import java.util.regex.Pattern;
 
 import javax.annotation.Nonnull;
 
+import org.apache.hadoop.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -263,6 +264,27 @@ public class ReadOnlyProps implements Iterable<Entry<String, String>> {
       }
     }
 
+    /**
+     * Get the value of the <code>name</code> property as a <code>long</code> or
+     * human-readable format. If no such property exists, the provided default value
+     * is returned, or if the specified value is not a valid <code>long</code> or
+     * human-readable format, then an error is thrown. You can use the following
+     * suffix (case insensitive): k(kilo), m(mega), g(giga), t(tera), p(peta), e(exa)
+     *
+     * @param name property name.
+     * @param defaultValue default value.
+     * @return property value as a <code>long</code>,
+     *         or <code>defaultValue</code>.
+     * @throws NumberFormatException - when the value is invalid
+     */
+    public long getLongBytes(String name, long defaultValue) {
+        String valueString = get(name);
+        if (valueString == null) {
+            return defaultValue;
+        }
+        return StringUtils.TraditionalBinaryPrefix.string2long(valueString);
+    }
+
     /** 
      * Get the value of the <code>name</code> property as a <code>float</code>.  
      * If no such property is specified, or if the specified value is not a valid
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/ReadOnlyPropsTest.java b/phoenix-core/src/test/java/org/apache/phoenix/util/ReadOnlyPropsTest.java
new file mode 100644
index 0000000000..5c5c28759c
--- /dev/null
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/ReadOnlyPropsTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.util;
+
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+public class ReadOnlyPropsTest {
+
+    @Test
+    public void testGetLongBytesMissingProperty() {
+        Map<String, String> props = new HashMap<>();
+        ReadOnlyProps readOnlyProps = new ReadOnlyProps(props);
+        assertEquals(1L, readOnlyProps.getLongBytes("missing-prop", 1L));
+    }
+
+    @Test
+    public void testGetLongBytesValidValue() {
+        Map<String, String> props = new HashMap<>();
+        props.put("prop1", "1K");
+        ReadOnlyProps readOnlyProps = new ReadOnlyProps(props);
+        assertEquals(1024, readOnlyProps.getLongBytes("prop1", 0L));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testGetLongBytesInvalidValue() {
+        Map<String, String> props = new HashMap<>();
+        props.put("prop1", "1KY");
+        ReadOnlyProps readOnlyProps = new ReadOnlyProps(props);
+        assertEquals(1024, readOnlyProps.getLongBytes("prop1", 0L));
+    }
+}