codope commented on code in PR #11951:
URL: https://github.com/apache/hudi/pull/11951#discussion_r1769484635


##########
hudi-spark-datasource/hudi-spark-common/src/main/java/org/apache/hudi/HoodieSparkIndexClient.java:
##########
@@ -56,24 +56,24 @@
 import static 
org.apache.hudi.metadata.HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX;
 import static 
org.apache.hudi.metadata.HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX;
 
-public class HoodieSparkFunctionalIndexClient extends 
BaseHoodieFunctionalIndexClient {
+public class HoodieSparkIndexClient extends BaseHoodieIndexClient {
 
-  private static final Logger LOG = 
LoggerFactory.getLogger(HoodieSparkFunctionalIndexClient.class);
+  private static final Logger LOG = 
LoggerFactory.getLogger(HoodieSparkIndexClient.class);
 
-  private static volatile HoodieSparkFunctionalIndexClient _instance;
+  private static volatile HoodieSparkIndexClient _instance;
 
   private final SparkSession sparkSession;
 
-  private HoodieSparkFunctionalIndexClient(SparkSession sparkSession) {
+  private HoodieSparkIndexClient(SparkSession sparkSession) {
     super();
     this.sparkSession = sparkSession;
   }
 
-  public static HoodieSparkFunctionalIndexClient getInstance(SparkSession 
sparkSession) {
+  public static HoodieSparkIndexClient getInstance(SparkSession sparkSession) {
     if (_instance == null) {
-      synchronized (HoodieSparkFunctionalIndexClient.class) {
+      synchronized (HoodieSparkIndexClient.class) {
         if (_instance == null) {
-          _instance = new HoodieSparkFunctionalIndexClient(sparkSession);
+          _instance = new HoodieSparkIndexClient(sparkSession);

Review Comment:
   This is the usual double-checked locking pattern. Probably you are concerned 
about memory visibility issues. The `_instance` could be non-null and yet not 
fully constructed when the first `if (_instance == null)` check passes, but 
before the object is fully initialized. However, note that `_instance` is 
declared as `volatile` which ensures that any writes to `_instance` are visible 
to all threads immediately and prevents the reordering of instructions during 
construction.



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