jerryshao commented on code in PR #5075:
URL: https://github.com/apache/gravitino/pull/5075#discussion_r1794798128
##########
core/src/main/java/org/apache/gravitino/utils/MetadataObjectUtil.java:
##########
@@ -98,4 +104,77 @@ public static NameIdentifier toEntityIdent(String
metalakeName, MetadataObject m
"Unknown metadata object type: " + metadataObject.type());
}
}
+
+ /**
+ * This method will check if the entity is existed explicitly, internally
this check will load the
+ * entity from underlying sources to entity store if not stored, and will
allocate an uid for this
+ * entity, with this uid tags can be associated with this entity. This
method should be called out
+ * of the tree lock, otherwise it will cause deadlock.
+ *
+ * @param metalake The metalake name
+ * @param object The metadata object
+ * @param env The Gravitino environment
+ * @throws NoSuchMetadataObjectException if the metadata object type doesn't
exist.
+ */
+ public static void checkMetadataObject(String metalake, MetadataObject
object, GravitinoEnv env) {
+ NameIdentifier identifier = toEntityIdent(metalake, object);
Review Comment:
Using `env` as method parameter will make the mock test easy to achieve.
##########
core/src/main/java/org/apache/gravitino/utils/MetadataObjectUtil.java:
##########
@@ -98,4 +104,77 @@ public static NameIdentifier toEntityIdent(String
metalakeName, MetadataObject m
"Unknown metadata object type: " + metadataObject.type());
}
}
+
+ /**
+ * This method will check if the entity is existed explicitly, internally
this check will load the
+ * entity from underlying sources to entity store if not stored, and will
allocate an uid for this
+ * entity, with this uid tags can be associated with this entity. This
method should be called out
+ * of the tree lock, otherwise it will cause deadlock.
+ *
+ * @param metalake The metalake name
+ * @param object The metadata object
+ * @param env The Gravitino environment
+ * @throws NoSuchMetadataObjectException if the metadata object type doesn't
exist.
+ */
+ public static void checkMetadataObject(String metalake, MetadataObject
object, GravitinoEnv env) {
+ NameIdentifier identifier = toEntityIdent(metalake, object);
Review Comment:
Using `env` as a method parameter will make the mock test easy to achieve.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]