You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "lokiore (via GitHub)" <gi...@apache.org> on 2023/07/24 15:32:51 UTC
[GitHub] [phoenix] lokiore commented on a diff in pull request #1622: PHOENIX-6979 Use HBase TTL as TTL for Tables only at Phoenix Level when phoenix.table.ttl.enabled is true
lokiore commented on code in PR #1622:
URL: https://github.com/apache/phoenix/pull/1622#discussion_r1272429551
##########
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java:
##########
@@ -1938,6 +1946,44 @@ private void populateFamilyPropsList(Map<String, PName> familyNames, Map<String,
}
}
+ /**
+ * Get TTL defined for Index or View in its parent hierarchy as defining TTL directly on index or view is
+ * not allowed. View on SYSTEM table is not allowed and already handled during plan compilation.
+ * @param parent
+ * @return appropriate TTL for the entity calling the function.
+ * @throws TableNotFoundException
+ */
+ private Long getTTLFromParent(PTable parent) throws TableNotFoundException {
+ return (parent.getType() == TABLE) ? Long.valueOf(parent.getPhoenixTTL()) :
+ (parent.getType() == VIEW ? getTTLFromAncestor(parent) : null);
+ }
+
+ /**
+ * Get TTL defined for the given View according to its hierarchy.
+ * @param view
+ * @return appropriate TTL from Views defined above for the entity calling.
+ * @throws TableNotFoundException
+ */
+ private Long getTTLFromAncestor(PTable view) throws TableNotFoundException {
+ try {
+ return view.getPhoenixTTL() != PHOENIX_TTL_NOT_DEFINED ? Long.valueOf(view.getPhoenixTTL()) :
+ (checkIfParentIsTable(view) ? connection.getTable(new PTableKey(null ,
+ view.getPhysicalNames().get(0).getString())).getPhoenixTTL() :
+ getTTLFromAncestor(connection.getTable(new PTableKey(connection.getTenantId(), view.getParentName().getString()))));
+ } catch (TableNotFoundException tne) {
+ return getTTLFromAncestor(connection.getTable(new PTableKey(null, view.getParentName().getString())));
Review Comment:
I have added some comment, I don't think log line is necessary, as we are checking twice. Do we still want log line here!?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org