Will-Lo commented on code in PR #3751:
URL: https://github.com/apache/gobblin/pull/3751#discussion_r1306183270


##########
gobblin-modules/gobblin-orc/src/main/java/org/apache/gobblin/writer/GobblinBaseOrcWriter.java:
##########
@@ -140,9 +190,17 @@ public State getFinalState() {
   @Override
   public void flush()
       throws IOException {
-    if (rowBatch.size > 0) {
-      orcFileWriter.addRowBatch(rowBatch);
-      rowBatch.reset();
+    try {
+      this.orcFileWriterLock.readLock().lock();
+      if (rowBatch.size > 0) {
+        if (this.orcFileWriter == null) {

Review Comment:
   Lazy init is so that we can estimate first before creating the orcFileWriter 
as it's only able to be created once per file, though I think this check is a 
relic of me hitting some race condition that should no longer be possible with 
the re-entrant locks, will take a deeper look



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