[2/2] phoenix git commit: PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be property driven (Chinmay Kulkarni)

2018-04-13 Thread jamestaylor
PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be 
property driven (Chinmay Kulkarni)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2a8f0c0f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2a8f0c0f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2a8f0c0f

Branch: refs/heads/5.x-HBase-2.0
Commit: 2a8f0c0fe5b0afd2f154bbf0ad0932abfebdeda8
Parents: bbf454b
Author: James Taylor 
Authored: Fri Apr 13 14:30:00 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 15:17:18 2018 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  4 --
 .../query/ConnectionQueryServicesImpl.java  | 42 ++--
 .../query/ConnectionlessQueryServicesImpl.java  | 35 ++--
 .../apache/phoenix/query/QueryConstants.java| 14 +++
 .../org/apache/phoenix/query/QueryServices.java |  5 ++-
 .../phoenix/query/QueryServicesOptions.java |  3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  4 +-
 7 files changed, 74 insertions(+), 33 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2a8f0c0f/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 4af85bf..8f33d41 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,10 +72,6 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_MAX_META_DATA_VERSIONS = 1000;
-public static final boolean DEFAULT_META_DATA_KEEP_DELETED_CELLS = true;
-public static final int DEFAULT_MAX_STAT_DATA_VERSIONS = 1;
-public static final boolean DEFAULT_STATS_KEEP_DELETED_CELLS = false;
 public static final int DEFAULT_LOG_VERSIONS = 10;
 public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2a8f0c0f/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 bb94313..ffce2ea 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
@@ -726,11 +726,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private ColumnFamilyDescriptor 
generateColumnFamilyDescriptor(Pair> family, 
PTableType tableType) throws SQLException {
 ColumnFamilyDescriptorBuilder columnDescBuilder = 
ColumnFamilyDescriptorBuilder.newBuilder(family.getFirst());
 if (tableType != PTableType.VIEW) {
-if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != 
null){
-
columnDescBuilder.setKeepDeletedCells(props.getBoolean(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB,
-QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS) ? 
KeepDeletedCells.TRUE
-: KeepDeletedCells.FALSE);
-}
 
columnDescBuilder.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING);
 columnDescBuilder.setBloomFilterType(BloomType.NONE);
 for (Entry entry : family.getSecond().entrySet()) {
@@ -2494,8 +2489,29 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 // Available for testing
-protected String getSystemCatalogDML() {
-return QueryConstants.CREATE_TABLE_METADATA;
+protected String getSystemCatalogTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_TABLE_METADATA);
+}
+
+// Available for testing
+protected String getFunctionTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_FUNCTION_METADATA);
+}
+
+// Available for testing
+protected String getLogTableDDL() {
+return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
+}
+
+private String setSystemDDLProperties(String ddl) {
+return 

[2/2] phoenix git commit: PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be property driven (Chinmay Kulkarni)

2018-04-13 Thread jamestaylor
PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be 
property driven (Chinmay Kulkarni)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fce9af53
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fce9af53
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fce9af53

Branch: refs/heads/4.x-HBase-0.98
Commit: fce9af53423d1804f5dc8daf8f28f9f7b38bbff5
Parents: 0a28d6a
Author: James Taylor 
Authored: Fri Apr 13 14:30:00 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 15:04:44 2018 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  4 +--
 .../query/ConnectionQueryServicesImpl.java  | 32 ++--
 .../query/ConnectionlessQueryServicesImpl.java  | 29 --
 .../apache/phoenix/query/QueryConstants.java| 13 +++-
 .../org/apache/phoenix/query/QueryServices.java |  5 ++-
 .../phoenix/query/QueryServicesOptions.java |  3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  4 +--
 7 files changed, 64 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fce9af53/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index d6b2266..8a47d12 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,10 +72,10 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_MAX_META_DATA_VERSIONS = 1000;
-public static final boolean DEFAULT_META_DATA_KEEP_DELETED_CELLS = true;
 public static final int DEFAULT_MAX_STAT_DATA_VERSIONS = 1;
 public static final boolean DEFAULT_STATS_KEEP_DELETED_CELLS = false;
+public static final int DEFAULT_LOG_VERSIONS = 10;
+public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 
 // Min system table timestamps for every release.
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0 = 
MIN_TABLE_TIMESTAMP + 3;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fce9af53/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 7a1317d..c5d5e0d 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
@@ -703,10 +703,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private HColumnDescriptor 
generateColumnFamilyDescriptor(Pair> family, 
PTableType tableType) throws SQLException {
 HColumnDescriptor columnDesc = new 
HColumnDescriptor(family.getFirst());
 if (tableType != PTableType.VIEW) {
-if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != 
null){
-columnDesc.setKeepDeletedCells(props.getBoolean(
-QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS));
-}
 
columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING);
 columnDesc.setBloomFilterType(BloomType.NONE);
 for (Entry entry : family.getSecond().entrySet()) {
@@ -2436,8 +2432,24 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 // Available for testing
-protected String getSystemCatalogDML() {
-return QueryConstants.CREATE_TABLE_METADATA;
+protected String getSystemCatalogTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_TABLE_METADATA);
+}
+
+// Available for testing
+protected String getFunctionTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_FUNCTION_METADATA);
+}
+
+private String setSystemDDLProperties(String ddl) {
+return String.format(ddl,
+  props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS),
+  

[2/2] phoenix git commit: PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be property driven (Chinmay Kulkarni)

2018-04-13 Thread jamestaylor
PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be 
property driven (Chinmay Kulkarni)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a816061c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a816061c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a816061c

Branch: refs/heads/4.x-HBase-1.1
Commit: a816061c67a2ae812ef8fb39b15f1634e9f2ed79
Parents: 27c24ab
Author: James Taylor 
Authored: Fri Apr 13 14:30:00 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 15:01:59 2018 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  4 --
 .../query/ConnectionQueryServicesImpl.java  | 41 ++--
 .../query/ConnectionlessQueryServicesImpl.java  | 35 +++--
 .../apache/phoenix/query/QueryConstants.java| 14 +++
 .../org/apache/phoenix/query/QueryServices.java |  5 ++-
 .../phoenix/query/QueryServicesOptions.java |  3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  4 +-
 7 files changed, 74 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a816061c/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 26f8198..36d6f0d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,10 +72,6 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_MAX_META_DATA_VERSIONS = 1000;
-public static final boolean DEFAULT_META_DATA_KEEP_DELETED_CELLS = true;
-public static final int DEFAULT_MAX_STAT_DATA_VERSIONS = 1;
-public static final boolean DEFAULT_STATS_KEEP_DELETED_CELLS = false;
 public static final int DEFAULT_LOG_VERSIONS = 10;
 public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a816061c/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 c4a4d26..b61d8ce 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
@@ -719,10 +719,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private HColumnDescriptor 
generateColumnFamilyDescriptor(Pair> family, 
PTableType tableType) throws SQLException {
 HColumnDescriptor columnDesc = new 
HColumnDescriptor(family.getFirst());
 if (tableType != PTableType.VIEW) {
-if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != 
null){
-columnDesc.setKeepDeletedCells(props.getBoolean(
-QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS));
-}
 
columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING);
 columnDesc.setBloomFilterType(BloomType.NONE);
 for (Entry entry : family.getSecond().entrySet()) {
@@ -2456,8 +2452,29 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 // Available for testing
-protected String getSystemCatalogDML() {
-return QueryConstants.CREATE_TABLE_METADATA;
+protected String getSystemCatalogTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_TABLE_METADATA);
+}
+
+// Available for testing
+protected String getFunctionTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_FUNCTION_METADATA);
+}
+
+// Available for testing
+protected String getLogTableDDL() {
+return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
+}
+
+private String setSystemDDLProperties(String ddl) {
+return String.format(ddl,
+  props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS),
+  

[2/2] phoenix git commit: PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be property driven (Chinmay Kulkarni)

2018-04-13 Thread jamestaylor
PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be 
property driven (Chinmay Kulkarni)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/dd8f1dab
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/dd8f1dab
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/dd8f1dab

Branch: refs/heads/4.x-cdh5.11
Commit: dd8f1dab09aaec2b8c2ddead97c3d2f758c2b0a5
Parents: 83b0901
Author: James Taylor 
Authored: Fri Apr 13 14:30:00 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 14:46:45 2018 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  4 +--
 .../query/ConnectionQueryServicesImpl.java  | 32 ++--
 .../query/ConnectionlessQueryServicesImpl.java  | 29 --
 .../apache/phoenix/query/QueryConstants.java| 13 +++-
 .../org/apache/phoenix/query/QueryServices.java |  5 ++-
 .../phoenix/query/QueryServicesOptions.java |  3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  4 +--
 7 files changed, 64 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd8f1dab/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index d6b2266..8a47d12 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,10 +72,10 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_MAX_META_DATA_VERSIONS = 1000;
-public static final boolean DEFAULT_META_DATA_KEEP_DELETED_CELLS = true;
 public static final int DEFAULT_MAX_STAT_DATA_VERSIONS = 1;
 public static final boolean DEFAULT_STATS_KEEP_DELETED_CELLS = false;
+public static final int DEFAULT_LOG_VERSIONS = 10;
+public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 
 // Min system table timestamps for every release.
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0 = 
MIN_TABLE_TIMESTAMP + 3;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd8f1dab/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 7ea6b42..b853842 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
@@ -702,10 +702,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private HColumnDescriptor 
generateColumnFamilyDescriptor(Pair> family, 
PTableType tableType) throws SQLException {
 HColumnDescriptor columnDesc = new 
HColumnDescriptor(family.getFirst());
 if (tableType != PTableType.VIEW) {
-if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != 
null){
-columnDesc.setKeepDeletedCells(props.getBoolean(
-QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS));
-}
 
columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING);
 columnDesc.setBloomFilterType(BloomType.NONE);
 for (Entry entry : family.getSecond().entrySet()) {
@@ -2442,8 +2438,24 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 // Available for testing
-protected String getSystemCatalogDML() {
-return QueryConstants.CREATE_TABLE_METADATA;
+protected String getSystemCatalogTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_TABLE_METADATA);
+}
+
+// Available for testing
+protected String getFunctionTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_FUNCTION_METADATA);
+}
+
+private String setSystemDDLProperties(String ddl) {
+return String.format(ddl,
+  props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS),
+  

[2/2] phoenix git commit: PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be property driven (Chinmay Kulkarni)

2018-04-13 Thread jamestaylor
PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be 
property driven (Chinmay Kulkarni)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bc14ad5d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bc14ad5d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bc14ad5d

Branch: refs/heads/4.x-HBase-1.2
Commit: bc14ad5dc9f4f4dc2598e2e97c2a6afebdb3a096
Parents: c0e6e2a
Author: James Taylor 
Authored: Fri Apr 13 14:30:00 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 14:36:39 2018 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  4 --
 .../query/ConnectionQueryServicesImpl.java  | 41 ++--
 .../query/ConnectionlessQueryServicesImpl.java  | 35 +++--
 .../apache/phoenix/query/QueryConstants.java| 14 +++
 .../org/apache/phoenix/query/QueryServices.java |  5 ++-
 .../phoenix/query/QueryServicesOptions.java |  3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  4 +-
 7 files changed, 74 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bc14ad5d/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 26f8198..36d6f0d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,10 +72,6 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_MAX_META_DATA_VERSIONS = 1000;
-public static final boolean DEFAULT_META_DATA_KEEP_DELETED_CELLS = true;
-public static final int DEFAULT_MAX_STAT_DATA_VERSIONS = 1;
-public static final boolean DEFAULT_STATS_KEEP_DELETED_CELLS = false;
 public static final int DEFAULT_LOG_VERSIONS = 10;
 public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bc14ad5d/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 4c1902d..5985705 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
@@ -720,10 +720,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private HColumnDescriptor 
generateColumnFamilyDescriptor(Pair> family, 
PTableType tableType) throws SQLException {
 HColumnDescriptor columnDesc = new 
HColumnDescriptor(family.getFirst());
 if (tableType != PTableType.VIEW) {
-if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != 
null){
-columnDesc.setKeepDeletedCells(props.getBoolean(
-QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS));
-}
 
columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING);
 columnDesc.setBloomFilterType(BloomType.NONE);
 for (Entry entry : family.getSecond().entrySet()) {
@@ -2459,8 +2455,29 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 // Available for testing
-protected String getSystemCatalogDML() {
-return QueryConstants.CREATE_TABLE_METADATA;
+protected String getSystemCatalogTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_TABLE_METADATA);
+}
+
+// Available for testing
+protected String getFunctionTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_FUNCTION_METADATA);
+}
+
+// Available for testing
+protected String getLogTableDDL() {
+return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
+}
+
+private String setSystemDDLProperties(String ddl) {
+return String.format(ddl,
+  props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS),
+  

[2/2] phoenix git commit: PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be property driven (Chinmay Kulkarni)

2018-04-13 Thread jamestaylor
PHOENIX-4575 Phoenix metadata KEEP_DELETED_CELLS and VERSIONS should be 
property driven (Chinmay Kulkarni)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d525ba6a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d525ba6a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d525ba6a

Branch: refs/heads/4.x-HBase-1.3
Commit: d525ba6a0fda599018bc4259ba878984027ff99e
Parents: 8e61260
Author: James Taylor 
Authored: Fri Apr 13 14:30:00 2018 -0700
Committer: James Taylor 
Committed: Fri Apr 13 14:35:23 2018 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  4 --
 .../query/ConnectionQueryServicesImpl.java  | 41 ++--
 .../query/ConnectionlessQueryServicesImpl.java  | 35 +++--
 .../apache/phoenix/query/QueryConstants.java| 14 +++
 .../org/apache/phoenix/query/QueryServices.java |  5 ++-
 .../phoenix/query/QueryServicesOptions.java |  3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  4 +-
 7 files changed, 74 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d525ba6a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 26f8198..36d6f0d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -72,10 +72,6 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP = 0;
 public static final String MIGRATION_IN_PROGRESS = "MigrationInProgress";
 
-public static final int DEFAULT_MAX_META_DATA_VERSIONS = 1000;
-public static final boolean DEFAULT_META_DATA_KEEP_DELETED_CELLS = true;
-public static final int DEFAULT_MAX_STAT_DATA_VERSIONS = 1;
-public static final boolean DEFAULT_STATS_KEEP_DELETED_CELLS = false;
 public static final int DEFAULT_LOG_VERSIONS = 10;
 public static final int DEFAULT_LOG_TTL = 7 * 24 * 60 * 60; // 7 days 
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d525ba6a/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 4c1902d..5985705 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
@@ -720,10 +720,6 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 private HColumnDescriptor 
generateColumnFamilyDescriptor(Pair> family, 
PTableType tableType) throws SQLException {
 HColumnDescriptor columnDesc = new 
HColumnDescriptor(family.getFirst());
 if (tableType != PTableType.VIEW) {
-if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != 
null){
-columnDesc.setKeepDeletedCells(props.getBoolean(
-QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, 
QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS));
-}
 
columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING);
 columnDesc.setBloomFilterType(BloomType.NONE);
 for (Entry entry : family.getSecond().entrySet()) {
@@ -2459,8 +2455,29 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 }
 
 // Available for testing
-protected String getSystemCatalogDML() {
-return QueryConstants.CREATE_TABLE_METADATA;
+protected String getSystemCatalogTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_TABLE_METADATA);
+}
+
+// Available for testing
+protected String getFunctionTableDDL() {
+return setSystemDDLProperties(QueryConstants.CREATE_FUNCTION_METADATA);
+}
+
+// Available for testing
+protected String getLogTableDDL() {
+return setSystemLogDDLProperties(QueryConstants.CREATE_LOG_METADATA);
+}
+
+private String setSystemDDLProperties(String ddl) {
+return String.format(ddl,
+  props.getInt(DEFAULT_SYSTEM_MAX_VERSIONS_ATTRIB, 
QueryServicesOptions.DEFAULT_SYSTEM_MAX_VERSIONS),
+