yihua commented on code in PR #13886:
URL: https://github.com/apache/hudi/pull/13886#discussion_r2411395926


##########
hudi-cli/src/main/java/org/apache/hudi/cli/commands/LockAuditingCommand.java:
##########
@@ -51,29 +54,82 @@ public class LockAuditingCommand {
   private static final Logger LOG = 
LoggerFactory.getLogger(LockAuditingCommand.class);
   private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
+  /**
+   * Represents a single audit log entry in the JSONL file.
+   * Maps to the structure written by StorageLockProviderAuditService.
+   */
+  public static class AuditRecord {
+    private final String ownerId;
+    private final long transactionStartTime;
+    private final long timestamp;
+    private final String state;
+    private final long lockExpiration;
+    private final boolean lockHeld;
+
+    @JsonCreator
+    public AuditRecord(
+        @JsonProperty("ownerId") String ownerId,
+        @JsonProperty("transactionStartTime") long transactionStartTime,
+        @JsonProperty("timestamp") long timestamp,
+        @JsonProperty("state") String state,
+        @JsonProperty("lockExpiration") long lockExpiration,
+        @JsonProperty("lockHeld") boolean lockHeld) {
+      this.ownerId = ownerId;
+      this.transactionStartTime = transactionStartTime;
+      this.timestamp = timestamp;
+      this.state = state;
+      this.lockExpiration = lockExpiration;
+      this.lockHeld = lockHeld;
+    }

Review Comment:
   It would be good for `StorageLockProviderAuditService` to use this record 
class as well.  That can be done in a separate PR.



##########
hudi-cli/src/test/java/org/apache/hudi/cli/commands/TestLockAuditingCommand.java:
##########
@@ -56,6 +61,76 @@ public class TestLockAuditingCommand extends 
CLIFunctionalTestHarness {
 
   private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
+  /**
+   * Represents a single audit record (JSON line in a .jsonl file)
+   */
+  static class AuditRecord {

Review Comment:
   I think `StorageLockProviderAuditService` should reuse the record class to 
avoid hand-crafting the JSON serde logic.  The refactoring in 
`StorageLockProviderAuditService` can be done in a separate PR.



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