[
https://issues.apache.org/jira/browse/PHOENIX-1674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15005067#comment-15005067
]
ASF GitHub Bot commented on PHOENIX-1674:
-----------------------------------------
Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/127#discussion_r44852801
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---
@@ -1607,42 +1680,105 @@ private PTable
createTableInternal(CreateTableStatement statement, byte[][] spli
addSaltColumn = (saltBucketNum != null);
}
- boolean removedProp = false;
// Can't set MULTI_TENANT or DEFAULT_COLUMN_FAMILY_NAME on an
INDEX or a non mapped VIEW
if (tableType != PTableType.INDEX && (tableType !=
PTableType.VIEW || viewType == ViewType.MAPPED)) {
- Boolean multiTenantProp = (Boolean)
tableProps.remove(PhoenixDatabaseMetaData.MULTI_TENANT);
+ Boolean multiTenantProp = (Boolean)
tableProps.get(PhoenixDatabaseMetaData.MULTI_TENANT);
multiTenant = Boolean.TRUE.equals(multiTenantProp);
- defaultFamilyName =
(String)tableProps.remove(PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME);
- removedProp = (defaultFamilyName != null);
+ defaultFamilyName =
(String)tableProps.get(PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME);
}
boolean disableWAL = false;
- Boolean disableWALProp = (Boolean)
tableProps.remove(PhoenixDatabaseMetaData.DISABLE_WAL);
+ Boolean disableWALProp = (Boolean)
tableProps.get(PhoenixDatabaseMetaData.DISABLE_WAL);
if (disableWALProp != null) {
disableWAL = disableWALProp;
}
- Boolean storeNullsProp = (Boolean)
tableProps.remove(PhoenixDatabaseMetaData.STORE_NULLS);
- storeNulls = storeNullsProp == null
- ? connection.getQueryServices().getProps().getBoolean(
- QueryServices.DEFAULT_STORE_NULLS_ATTRIB,
- QueryServicesOptions.DEFAULT_STORE_NULLS)
- : storeNullsProp;
+ Boolean storeNullsProp = (Boolean)
tableProps.get(PhoenixDatabaseMetaData.STORE_NULLS);
+ if (storeNullsProp == null) {
+ if (parent == null) {
+ storeNulls =
connection.getQueryServices().getProps().getBoolean(
+
QueryServices.DEFAULT_STORE_NULLS_ATTRIB,
+
QueryServicesOptions.DEFAULT_STORE_NULLS);
+ tableProps.put(PhoenixDatabaseMetaData.STORE_NULLS,
Boolean.valueOf(storeNulls));
+ }
+ } else {
+ storeNulls = storeNullsProp;
+ }
+ Boolean transactionalProp = (Boolean)
tableProps.get(PhoenixDatabaseMetaData.TRANSACTIONAL);
+ if (transactionalProp != null && parent != null) {
+ throw new
SQLExceptionInfo.Builder(SQLExceptionCode.ONLY_TABLE_MAY_BE_DECLARED_TRANSACTIONAL)
+ .setSchemaName(schemaName).setTableName(tableName)
+ .build().buildException();
+ }
+ if (parent == null) {
+ if (transactionalProp == null) {
+ transactional =
connection.getQueryServices().getProps().getBoolean(
+
QueryServices.DEFAULT_TRANSACTIONAL_ATTRIB,
+
QueryServicesOptions.DEFAULT_TRANSACTIONAL);
+ } else {
+ transactional = transactionalProp;
+ }
+ }
+ tableProps.put(PhoenixDatabaseMetaData.TRANSACTIONAL,
transactional);
+ if (transactional) {
+ // If TTL set, use Tephra TTL property name instead
+ Object ttl =
commonFamilyProps.remove(HColumnDescriptor.TTL);
+ if (ttl != null) {
+ commonFamilyProps.put(TxConstants.PROPERTY_TTL, ttl);
+ }
+ }
+
+ boolean sharedTable = statement.getTableType() ==
PTableType.VIEW || indexId != null;
+ if (transactional) {
+ // FIXME: remove once Tephra handles storing multiple
versions of a cell value,
--- End diff --
Remove this FIXME and replace with this comment:
// Tephra uses an empty value cell as its delete marker, so we need to turn
on storeNulls for transactional tables.
// If we use regular column delete markers (which is what non transactional
tables use), then they get converted
// on the server, but this can mess up our secondary index code as the
changes get committed prior to the
// maintenance code being able to see the prior state to update the rows
correctly.
> Snapshot isolation transaction support through Tephra
> -----------------------------------------------------
>
> Key: PHOENIX-1674
> URL: https://issues.apache.org/jira/browse/PHOENIX-1674
> Project: Phoenix
> Issue Type: Improvement
> Reporter: James Taylor
> Labels: SFDC
>
> Tephra (http://tephra.io/ and https://github.com/caskdata/tephra) is one
> option for getting transaction support in Phoenix. Let's use this JIRA to
> discuss the way in which this could be integrated along with the pros and
> cons.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)