cychiu8 commented on code in PR #11897:
URL: https://github.com/apache/ozone/pull/11897#discussion_r4573332367


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSyncOverwriteWithOMHA.java:
##########
@@ -0,0 +1,322 @@
+/*
+ * 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.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME;
+import static org.apache.ozone.test.OzoneTestBase.uniqueObjectName;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.TimeoutException;
+import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hdds.client.OzoneQuota;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.utils.IOUtils;
+import org.apache.hadoop.hdds.utils.db.cache.CacheKey;
+import org.apache.hadoop.hdds.utils.db.cache.CacheValue;
+import org.apache.hadoop.ozone.DataTestUtil;
+import org.apache.hadoop.ozone.MiniOzoneCluster;
+import org.apache.hadoop.ozone.MiniOzoneHAClusterImpl;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.ozone.client.OzoneBucket;
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.om.OMMetadataManager;
+import org.apache.hadoop.ozone.om.OzoneManager;
+import org.apache.hadoop.ozone.om.exceptions.OMException;
+import org.apache.hadoop.ozone.om.helpers.BucketLayout;
+import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
+import org.apache.hadoop.ozone.om.ratis.OzoneManagerDoubleBuffer;
+import org.apache.ozone.test.GenericTestUtils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests hsync and a rejected overwrite commit in OM HA setup.
+ *
+ * <p>HDDS-16765: a rejected overwrite commit used to leave 
OVERWRITTEN_HSYNC_KEY on another writer's
+ * open entry in the open file table cache until the double buffer flushed and 
evicted that epoch.
+ *
+ * <p>Client sequence (FileSystem API only), bucket namespace quota = 2:
+ * <pre>
+ *   A: create f, write, hsync          (used namespace 1)
+ *   B: create f (overwrite), write     (create passes: 1 + 1 &lt;= 2)
+ *   C: create g, close                 (used namespace 2)
+ *   B: close                           -&gt; QUOTA_EXCEEDED, the overwrite 
never takes effect
+ *   A: write, hsync, close             -&gt; must still succeed
+ * </pre>
+ *
+ * <p>The same sequence is run in four situations, and each asserts the same 
outcome: writer A keeps
+ * its own stream writable and every OM ends up holding what A committed. What 
they showed before
+ * the fix:
+ * <pre>
+ *   no flush lag, repeated rounds -&gt; the window is not hit on timing alone
+ *   every OM flushed beforehand   -&gt; passes cleanly
+ *   one follower's flush held     -&gt; A sees success, but that follower's 
RocksDB diverges
+ *   the leader's flush held       -&gt; A's close is rejected, although the 
followers applied it
+ * </pre>
+ */
+public class TestHSyncOverwriteWithOMHA {

Review Comment:
   Thank you for reviewing. I agree with you. The new unit test already covers 
the issue, so there isn't much benefit to adding the integration test. I have 
already dropped it.



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