jojochuang commented on code in PR #10741:
URL: https://github.com/apache/ozone/pull/10741#discussion_r3589456403


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOFSIsDirectoryBenchmark.java:
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.ozone;
+
+import static 
org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.MiniOzoneCluster;
+import org.apache.hadoop.ozone.OzoneConsts;
+import org.apache.hadoop.ozone.client.ObjectStore;
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.om.OMConfigKeys;
+import org.apache.hadoop.ozone.om.helpers.BucketLayout;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.Timeout;
+
+/**
+ * On-demand benchmark (not part of {@code mvn test}) for HDDS-15678.
+ *
+ * <p>Measures OFS {@link FileSystem#isFile}/{@link FileSystem#isDirectory}
+ * (the metadata-only head-op path added by this change) against a full
+ * {@link FileSystem#getFileStatus} on the same <b>file</b> path. For a file,
+ * the full path makes the OM contact SCM to refresh pipeline/block locations;
+ * the head-op path skips that round-trip. The A/B in a single run isolates the
+ * eliminated SCM refresh (FULL = pre-fix behaviour, HEAD = this fix).
+ *
+ * <p>To instead run a classic before/after across two builds, revert the
+ * {@code isDirectory}/{@code isFile} overrides in
+ * {@link BasicRootedOzoneFileSystem} and compare the HEAD numbers.
+ *
+ * <pre>
+ *   mvn -pl hadoop-ozone/integration-test test \
+ *     -Dtest=TestOFSIsDirectoryBenchmark -DskipShade -DskipRecon \
+ *     -Dsurefire.failIfNoSpecifiedTests=false
+ * </pre>
+ */
+@Tag("benchmark")

Review Comment:
   I wonder if we want a separate Maven module for the benchmark test. It would 
be useful to develop & collect benchmark tests somewhere, which are run on 
demand or before release.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ClientProtocol.java:
##########
@@ -991,6 +977,26 @@ TenantUserList listUsersInTenant(String tenantId, String 
prefix)
   OzoneFileStatus getOzoneFileStatus(String volumeName, String bucketName,
       String keyName) throws IOException;
 
+  /**
+   * Get the Ozone File Status for a particular Ozone key.
+   *
+   * @param volumeName volume name.
+   * @param bucketName bucket name.
+   * @param keyName    key name.
+   * @param headOp     when true, this is a metadata-only (type) check: the OM
+   *                   skips the pipeline refresh (SCM round-trip) and datanode
+   *                   sorting since block locations are not needed.
+   * @return OzoneFileStatus for the key.
+   * @throws OMException if file does not exist
+   *                     if bucket does not exist
+   * @throws IOException if there is error in the db
+   *                     invalid arguments
+   */
+  default OzoneFileStatus getOzoneFileStatus(String volumeName,
+      String bucketName, String keyName, boolean headOp) throws IOException {
+    return getOzoneFileStatus(volumeName, bucketName, keyName);

Review Comment:
   headOp ommitted? in this case, it returns an OzoneFileStatus object with 
everything regardless of headOp



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