Uh oh!
There was an error while loading. Please reload this page.
PHOENIX-6171 Child views should not be allowed to override the parent view PHOENIX_TTL attribute. - #916
PHOENIX-6171 Child views should not be allowed to override the parent view PHOENIX_TTL attribute.#916jpisaac wants to merge 3 commits into
Conversation
jpisaac
commented
Oct 9, 2020
stoty
commented
Oct 9, 2020
💔 -1 overall
This message was automatically generated. |
| PTable table = getTableFromCache(cacheKey, clientTimeStamp, clientVersion); | ||
| // Disallow if the parent has PHOENIX_TTL set. | ||
| if (parentTable != null && parentTable.getPhoenixTTL() != PHOENIX_TTL_NOT_DEFINED) { |
There was a problem hiding this comment.
just want to confirm that we don't support more than 2 level case. For example, we have a global view V1 of the TTL set. The V2 is a view on top of the V1. If we create a new V3 on of the v2 with a TTL value, this won't catch and allow the V3 view to have a TTL value, which might conflict with V1 TTL.
better to document somewhere to notice other ppl
There was a problem hiding this comment.
@yanxinyi Currently the PHOENIX_TTL value is stored with every view and at every level - so in this case V2 would have the same PHOENIX_TTL value as of V1. So when creating V3 the parentTable.getPhoenixTTL() != PHOENIX_TTL_NOT_DEFINED.
But realized as was going thru this that I need an additional check to ensure that the PHOENIX_TTL is being altered
stoty
commented
Oct 17, 2020
💔 -1 overall
This message was automatically generated. |
jpisaac
commented
Oct 26, 2020
@yanxinyi@ChinmaySKulkarni rebased and fixed conflicts |
| + "WHERE %s AND TABLE_SCHEM = '%s' AND TABLE_NAME = '%s' AND TABLE_TYPE = '%s'"; | ||
| private static final String | ||
| ALTER_PHOENIX_TTL_SQL = |
There was a problem hiding this comment.
nit: Modify formatting to avoid extra line
| "ALTER VIEW \"%s\".\"%s\" set PHOENIX_TTL=%s"; | ||
| private static final String ALTER_PHOENIX_TTL_SQL = "ALTER VIEW %s.%s set PHOENIX_TTL=%d"; | ||
| private static final String |
There was a problem hiding this comment.
nit: Modify formatting to avoid extra line
| RowFilter | ||
| schemaNameFilter = | ||
| new RowFilter(CompareFilter.CompareOp.EQUAL, new SubstringComparator(schemaName)); | ||
| QualifierFilter |
There was a problem hiding this comment.
Similar here. Can you please check if your IDE has the Phoenix IDE settings?
| final SchemaBuilder schemaBuilder = createLevel2TenantViewWithGlobalLevelTTL(null, null); | ||
| String tenantId = schemaBuilder.getDataOptions().getTenantId(); | ||
| String |
There was a problem hiding this comment.
nit: Same formatting issues here potentially.
| String.format(ALTER_SQL_WITH_NO_TTL, schemaName, globalViewName, "COL_30"); | ||
| stmt.execute(sql); | ||
| } | ||
| } catch (SQLException e) { |
There was a problem hiding this comment.
This catch block is unnecessary, you can remove it.
| // If a child view exists and the parent previously had a PHOENIX_TTL value set then that | ||
| // implies that the child view too has a valid PHOENIX_TTL (non zero). | ||
| // In this case we do not allow for ALTER of the parent view PHOENIX_TTL value. | ||
| if (!childViews.isEmpty()) { |
There was a problem hiding this comment.
What if we're setting the TTL for the first time for a parent view i.e. it was PHOENIX_TTL_NOT_DEFINED first and now we're setting it for the first time ever. This check will disallow that too. Is that intended?
There was a problem hiding this comment.
Will change the comment to be less confusing.
| } | ||
| // Since we do not allow propagation of PHOENIX_TTL values during ALTER for now. | ||
| // If a child view exists and the parent previously had a PHOENIX_TTL value set then that |
There was a problem hiding this comment.
We aren't checking the "and the parent previously had a PHOENIX_TTL value set " part. Shouldn't we do that too?
There was a problem hiding this comment.
As discussed offline, changing the comment will bring more clarity. The checks are for "this" view's parent and its children
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| // Checks whether a non-zero PHOENIX_TTL value is being set. | ||
| private boolean settingNewPhoenixTTLAttribute(List<Mutation> tableMetadata, byte[] phoenixTtlBytes) { |
There was a problem hiding this comment.
Can you rename this to settingNewPhoenixTTLAttributeForView() to indicate it only applies to views and then also add the check for the same inside the method?
Uh oh!
There was an error while loading. Please reload this page.
stoty
commented
Oct 26, 2020
💔 -1 overall
This message was automatically generated. |
jpisaac
commented
Oct 27, 2020
@ChinmaySKulkarni@yanxinyi Addressed review comments and rebased to resolve merge conflicts. |
stoty
commented
Oct 27, 2020
💔 -1 overall
This message was automatically generated. |
stoty
commented
Oct 28, 2020
💔 -1 overall
This message was automatically generated. |
gjacoby126
commented
Nov 2, 2020
JIRA appears to be closed as fixed. Closing PR. |
No description provided.