-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yingjianw/additional safety rollout #602
Conversation
22761f7
to
8317b70
Compare
807fc52
to
c91c57e
Compare
f0a6bab
to
300947a
Compare
5ef08bb
to
13fe8a7
Compare
13fe8a7
to
17ad8a2
Compare
@Path("parents/catalog/{catalog-name}/database/{database-name}/table/{table-name}") | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
Set<ParentInfoDto> getParents( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one the one hand, i would suggest we rename this to getParent
since we are enforcing the one-parent-per-child rule and its a little confusing as the name implies we can expect more than one results. on the other hand, this API does technically return more than one result, so we would need to have a different return type to make this change. i have a weak preference to rename it and change the contract despite it becoming less flexible, but its up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the api stays having multiple return values then plural is better so that the correspondence holds, otherwise singular. There is no current use case for multiple parents but keeping the flexibility is reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the same thing before the implementation but ultimately choose to have the api flexibile that can return multiple parents.
Another benefit is if indeed somehow we end up with two parents on the same child table due to db isolation issues, we can still get them instead of just one.
@@ -72,4 +73,35 @@ public Set<ChildInfoDto> getChildren( | |||
) | |||
); | |||
} | |||
|
|||
/** | |||
* Return the list of children for a given table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Return the list of children for a given table. | |
* Return the list of parent info for a given table. |
* @param catalogName catalogName | ||
* @param databaseName databaseName | ||
* @param tableName tableName | ||
* @return list of childInfoDto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return list of childInfoDto | |
* @return list of parentInfoDto |
maxAllow = props.getMaxAllow(); | ||
} | ||
|
||
// if maxAllow < 0, this means we can create as many child table under the parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if maxAllow < 0, this means we can create as many child table under the parent | |
// if maxAllow < 0, this means we can create unlimited child tables under the parent |
throw new RuntimeException(name + " is a child table and " | ||
+ "dropping a child table is currently disabled"); | ||
} | ||
if (parentChildRelMetadataService.isParentTable(name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of this check the dropping of parent table should be disabled anyways right
final String type, | ||
final ParentChildRelationshipProperties props) { | ||
// Validate max clone allow | ||
// First check if the parent table have configured max allowed on the table config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// First check if the parent table have configured max allowed on the table config | |
// First check if the parent table has a configured max allowed setting on the table config |
true | ||
); | ||
|
||
// Then check if the parent have configured max allowed on the db config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Then check if the parent have configured max allowed on the db config | |
// Then check if the parent has a configured max allowed setting on the db config |
); | ||
} | ||
|
||
// If not specified in maxAllowPerDBPerRelType,check the default max Allow based on relationType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If not specified in maxAllowPerDBPerRelType,check the default max Allow based on relationType | |
// If not specified in maxAllowPerDBPerRelType, check the default maxAllow based on relationType |
@Path("parents/catalog/{catalog-name}/database/{database-name}/table/{table-name}") | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
Set<ParentInfoDto> getParents( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the api stays having multiple return values then plural is better so that the correspondence holds, otherwise singular. There is no current use case for multiple parents but keeping the flexibility is reasonable.
Thanks all, I will address the comments in the next PR. |
First commit:
More specifically the bug is:
Second commit
Third commit
Forth commit
Fifth commit
Make all the flags to false by default