Copilot commented on code in PR #10473: URL: https://github.com/apache/ozone/pull/10473#discussion_r3383239651
########## hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMProxyInfoDnsRefresh.java: ########## @@ -0,0 +1,154 @@ +/* + * 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.ozone.om.ha; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; Review Comment: Unused static import `assertEquals` will fail the project's UnusedImports checkstyle rule; remove it. ########## hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/HadoopRpcOMFollowerReadFailoverProxyProvider.java: ########## @@ -385,8 +385,14 @@ public void close() throws IOException { @Override public ConnectionId getConnectionId() { + // Read the proxy through the synchronized accessor instead of the + // inherited public field. With DNS-refresh-on-failure, OMProxyInfo + // mutates the proxy field under its monitor, so a direct field + // read can observe a torn value (a stale proxy whose underlying + // connection was just stopped, or a fresh proxy that was just + // installed without proper visibility for the reader). Review Comment: The comment says a direct reference read can observe a “torn value”. Reference reads are atomic; the actual concern here is stale visibility (seeing an old proxy reference) and/or seeing a proxy whose underlying connection was just stopped. Consider rewording to avoid the misleading “torn” terminology. -- 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]
