yuqi1129 commented on code in PR #10793:
URL: https://github.com/apache/gravitino/pull/10793#discussion_r3130879728


##########
core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/base/OwnerMetaBaseSQLProvider.java:
##########
@@ -236,4 +237,18 @@ public String deleteOwnerMetasByLegacyTimeline(
         + OWNER_TABLE_NAME
         + " WHERE deleted_at > 0 AND deleted_at < #{legacyTimeline} LIMIT 
#{limit}";
   }
+
+  public String selectOwnerByMetadataObjectId(@Param("metadataObjectId") long 
metadataObjectId) {
+    return "SELECT owner_id as ownerId, owner_type as ownerType FROM "
+        + OWNER_TABLE_NAME
+        + " WHERE metadata_object_id = #{metadataObjectId} AND deleted_at = 0"
+        + " ORDER BY updated_at DESC, id DESC LIMIT 1";
+  }
+
+  public String selectChangedOwners(@Param("updatedAtAfter") long 
updatedAtAfter) {
+    return "SELECT metadata_object_id as metadataObjectId, updated_at as 
updatedAt"
+        + " FROM "
+        + OWNER_TABLE_NAME
+        + " WHERE deleted_at = 0 AND updated_at > #{updatedAtAfter} ORDER BY 
updated_at, id LIMIT 1000";

Review Comment:
   The id not monotonically increasing



-- 
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]

Reply via email to