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.
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.
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.
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.
| } | ||
|
|
||
| /** | ||
| * Return the list of children for a given table. |
There was a problem hiding this comment.
| * 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.
| * @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.
| // 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.
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.
| // 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.
| // 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.
| // 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.
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