steveloughran commented on code in PR #5621:
URL: https://github.com/apache/hadoop/pull/5621#discussion_r1190995547


##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/audit/TestHttpReferrerAuditHeader.java:
##########
@@ -350,6 +335,48 @@ public void testGetObjectWithoutRange() throws Throwable {
     assertMapNotContains(params, PARAM_RANGE);
   }
 
+  @Test
+  public void testHttpReferrerForBulkDelete() throws Throwable {
+    AuditSpan span = span();
+    long ts = span.getTimestamp();
+    DeleteObjectsRequest request = headForBulkDelete(
+        "key_01",
+        "key_02",
+        "key_03");
+    Map<String, String> headers
+        = request.getCustomRequestHeaders();
+    assertThat(headers)
+        .describedAs("Custom headers")
+        .containsKey(HEADER_REFERRER);
+    String header = headers.get(HEADER_REFERRER);
+    LOG.info("Header is {}", header);
+    Map<String, String> params
+        = HttpReferrerAuditHeader.extractQueryParameters(header);
+    compareCommonHeaders(params, PATH_1, PATH_2, span);
+    assertMapContains(params, DELETE_KEYS_SIZE, "3");
+    assertThat(span.getTimestamp())
+        .describedAs("Timestamp of " + span)
+        .isEqualTo(ts);
+    assertMapNotContains(params, PARAM_RANGE);
+
+    assertMapContains(params, PARAM_TIMESTAMP,
+        Long.toString(ts));
+  }
+
+  private void compareCommonHeaders(Map<String, String> params, String path1, 
String path2,

Review Comment:
   1. add some javadocs
   2. can you add threadid as a param to pass in, just to be clearer how it is 
picked up



##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/audit/impl/LoggingAuditor.java:
##########
@@ -359,6 +362,8 @@ public <T extends AmazonWebServiceRequest> T 
beforeExecution(
         final T request) {
       // attach range for GetObject requests
       attachRangeFromRequest(request);
+      // for delete op, attach num of files to delete

Review Comment:
   nit "the number"



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to