nssalian commented on code in PR #1182:
URL: https://github.com/apache/iceberg-go/pull/1182#discussion_r3405083327


##########
internal/recipe/local_spark.go:
##########
@@ -140,3 +142,33 @@ func ExecuteSpark(t *testing.T, scriptPath string, args 
...string) (string, erro
 
        return string(output), nil
 }
+
+var (
+       sparkMajorOnce sync.Once
+       sparkMajor     int
+       sparkMajorErr  error
+)
+
+// SparkMajorVersion returns the major pyspark version (3 or 4) of the

Review Comment:
   Was able to fix this.
   switched to a mutex that only writes `sparkMajor` inside the success 
branches,  so transient exec failures leave it at 0 and the next caller 
retries.  On the race I couldn't reproduce it (`sync.Once.Do` runs the closure 
once during the first caller's lifetime, `ExecuteSpark` has no goroutines, so 
the captured `t` is held but never re-invoked) but the decoupling is still the 
right cleanup.



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