PHOENIX-3228 Index tables should not be configured with a custom/smaller MAX_FILESIZE.
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fd6da35e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fd6da35e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fd6da35e Branch: refs/heads/calcite Commit: fd6da35eee5b366530f73a435ae4bc4de0f0eb25 Parents: d94d571 Author: Lars Hofhansl <la...@apache.org> Authored: Thu Sep 8 13:34:21 2016 -0700 Committer: Lars Hofhansl <la...@apache.org> Committed: Thu Sep 8 13:35:16 2016 -0700 ---------------------------------------------------------------------- .../query/ConnectionQueryServicesImpl.java | 10 --------- .../org/apache/phoenix/query/QueryServices.java | 1 - .../phoenix/query/QueryServicesOptions.java | 1 - .../apache/phoenix/schema/MetaDataClient.java | 22 -------------------- 4 files changed, 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/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 04c2c7b..86217e7 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 @@ -1274,16 +1274,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } byte[] physicalIndexName = MetaDataUtil.getViewIndexPhysicalName(physicalTableName); - int indexMaxFileSizePerc; - // Get percentage to use from table props first and then fallback to config - Integer indexMaxFileSizePercProp = (Integer)tableProps.remove(QueryServices.INDEX_MAX_FILESIZE_PERC_ATTRIB); - if (indexMaxFileSizePercProp == null) { - indexMaxFileSizePerc = this.props.getInt(QueryServices.INDEX_MAX_FILESIZE_PERC_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_MAX_FILESIZE_PERC); - } else { - indexMaxFileSizePerc = indexMaxFileSizePercProp; - } - long indexMaxFileSize = maxFileSize * indexMaxFileSizePerc / 100; - tableProps.put(HTableDescriptor.MAX_FILESIZE, indexMaxFileSize); tableProps.put(MetaDataUtil.IS_VIEW_INDEX_TABLE_PROP_NAME, TRUE_BYTES_AS_STRING); HTableDescriptor desc = ensureTableCreated(physicalIndexName, PTableType.TABLE, tableProps, families, splits, false, isNamespaceMapped); http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java index dbd0a99..8cd009a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java @@ -113,7 +113,6 @@ public interface QueryServices extends SQLCloseable { public static final String ZOOKEEPER_ROOT_NODE_ATTRIB = "zookeeper.znode.parent"; public static final String DISTINCT_VALUE_COMPRESS_THRESHOLD_ATTRIB = "phoenix.distinct.value.compress.threshold"; public static final String SEQUENCE_CACHE_SIZE_ATTRIB = "phoenix.sequence.cacheSize"; - public static final String INDEX_MAX_FILESIZE_PERC_ATTRIB = "phoenix.index.maxDataFileSizePerc"; public static final String MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB = "phoenix.coprocessor.maxMetaDataCacheTimeToLiveMs"; public static final String MAX_SERVER_METADATA_CACHE_SIZE_ATTRIB = "phoenix.coprocessor.maxMetaDataCacheSize"; public static final String MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB = "phoenix.client.maxMetaDataCacheSize"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java ---------------------------------------------------------------------- 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 475c141..669bcd2 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 @@ -152,7 +152,6 @@ public class QueryServicesOptions { public static final long DEFAULT_GROUPBY_MAX_CACHE_MAX = 1024L*1024L*100L; // 100 Mb public static final long DEFAULT_SEQUENCE_CACHE_SIZE = 100; // reserve 100 sequences at a time - public static final int DEFAULT_INDEX_MAX_FILESIZE_PERC = 50; // % of data table max file size for index table public static final long DEFAULT_MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS = 60000 * 30; // 30 mins public static final long DEFAULT_MAX_SERVER_METADATA_CACHE_SIZE = 1024L*1024L*20L; // 20 Mb public static final long DEFAULT_MAX_CLIENT_METADATA_CACHE_SIZE = 1024L*1024L*10L; // 10 Mb http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd6da35e/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index efe60ac..fd6b48c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -2133,28 +2133,6 @@ public class MetaDataClient { PNameFactory.newName(defaultFamilyName), null, Boolean.TRUE.equals(disableWAL), false, false, null, indexId, indexType, true, false, 0, 0L, isNamespaceMapped, autoPartitionSeq, isAppendOnlySchema); connection.addTable(table, MetaDataProtocol.MIN_TABLE_TIMESTAMP); - } else if (tableType == PTableType.INDEX && indexId == null) { - if (tableProps.get(HTableDescriptor.MAX_FILESIZE) == null) { - int nIndexRowKeyColumns = isPK ? 1 : pkColumnsNames.size(); - int nIndexKeyValueColumns = columns.size() - nIndexRowKeyColumns; - int nBaseRowKeyColumns = parent.getPKColumns().size() - (parent.getBucketNum() == null ? 0 : 1); - int nBaseKeyValueColumns = parent.getColumns().size() - parent.getPKColumns().size(); - /* - * Approximate ratio between index table size and data table size: - * More or less equal to the ratio between the number of key value columns in each. We add one to - * the key value column count to take into account our empty key value. We add 1/4 for any key - * value data table column that was moved into the index table row key. - */ - double ratio = (1+nIndexKeyValueColumns + (nIndexRowKeyColumns - nBaseRowKeyColumns)/4d)/(1+nBaseKeyValueColumns); - HTableDescriptor descriptor = connection.getQueryServices().getTableDescriptor(parent.getPhysicalName().getBytes()); - if (descriptor != null) { // Is null for connectionless - long maxFileSize = descriptor.getMaxFileSize(); - if (maxFileSize == -1) { // If unset, use default - maxFileSize = HConstants.DEFAULT_MAX_FILE_SIZE; - } - tableProps.put(HTableDescriptor.MAX_FILESIZE, (long)(maxFileSize * ratio)); - } - } } short nextKeySeq = 0;