-
Notifications
You must be signed in to change notification settings - Fork 387
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
[#5154] refactor(drop-metalake): re-define drop metalake #5155
Conversation
This PR is based on #5067 |
aea5e9b
to
53167c9
Compare
53167c9
to
9d106b1
Compare
ErrorResponse resp = | ||
restClient.get( | ||
API_METALAKES_IDENTIFIER_PATH + name + "/activate", | ||
ErrorResponse.class, | ||
Collections.emptyMap(), | ||
ErrorHandlers.metalakeErrorHandler()); |
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.
So you didn't update the code here for metalake, it should align with catalog to use patch
with request body.
NameIdentifier metalakeIdent = NameIdentifier.of(ident.namespace().levels()); | ||
checkMetalake(metalakeIdent, store); | ||
|
||
if (!getInUseValue(store, ident)) { |
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.
It is better rename to getCatalogInUseValue
for clear understanding.
@@ -116,14 +165,13 @@ public BaseMetalake createMetalake( | |||
NameIdentifier ident, String comment, Map<String, String> properties) | |||
throws MetalakeAlreadyExistsException { | |||
long uid = idGenerator.nextId(); | |||
StringIdentifier stringId = StringIdentifier.fromId(uid); |
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.
Why do we remove this?
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.
ince the uid was already in the metalake entity field and I don't see that uid being used in properties, I removed it.
boolean inUse = metalakeInUse(store, ident); | ||
if (inUse && !force) { | ||
throw new MetalakeInUseException( | ||
"Metalake %s is in use, please deactivate it first or use force option", ident); |
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.
disable, not deactivate.
// If reached here, it implies that the metalake is not in use or force is true. | ||
if (inUse) { | ||
// force is true, so deactivate the metalake first. | ||
disableMetalake(ident); | ||
} |
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.
The same here for metalake, we don't need to disable this before the drop.
@Produces("application/vnd.gravitino.v1+json") | ||
@Timed(name = "activate-metalake." + MetricNames.HTTP_PROCESS_DURATION, absolute = true) | ||
@ResponseMetered(name = "activate-metalake", absolute = true) | ||
public Response activateMetalake(@PathParam("name") String metalakeName) { |
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.
Why do we still keep this method and the below one?
* Otherwise, a {@link MetalakeInUseException} will be thrown. | ||
* </ul> | ||
* | ||
* It is equivalent to calling {@code dropMetalake(ident, false)}. |
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.
{@code dropMetalake(name, false)}
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.
fixed
Overall LGTM, just one small comment. |
…e#5155) ### What changes were proposed in this pull request? - Add an in-use property to the metalake with the default value of true. - Only empty metalake with in-use=false can be dropped when `force=false` - User can use `dorce` option to drop metalake - More drop metalake limitations please see the JavaDoc of `dropMetalake` in API module ### Why are the changes needed? Fix: apache#5154 ### Does this PR introduce _any_ user-facing change? yes, users now can not drop an in used metalake ### How was this patch tested? tests added
What changes were proposed in this pull request?
force=false
dorce
option to drop metalakedropMetalake
in API moduleWhy are the changes needed?
Fix: #5154
Does this PR introduce any user-facing change?
yes, users now can not drop an in used metalake
How was this patch tested?
tests added