homatthew commented on code in PR #3751:
URL: https://github.com/apache/gobblin/pull/3751#discussion_r1306066125
##########
gobblin-modules/gobblin-orc/src/main/java/org/apache/gobblin/writer/GobblinBaseOrcWriter.java:
##########
@@ -194,10 +295,30 @@ public void commit()
public void write(D record)
throws IOException {
Preconditions.checkState(!closed, "Writer already closed");
- valueWriter.write(record, rowBatch);
+ this.orcFileWriterLock.readLock().lock();
+ this.valueWriter.write(record, this.rowBatch);
+ int recordCount = this.recordCounter.incrementAndGet();
+ if (this.selfTuningWriter && recordCount == this.nextSelfTune) {
+ try {
+ this.orcFileWriterLock.readLock().unlock();
+ this.orcFileWriterLock.writeLock().lock();
+ this.tuneCheckCounter = Math.min(this.tuneCheckCounter + 1, 5);
+ long totalBytes = ((GenericRecordToOrcValueWriter)
valueWriter).getTotalBytesConverted();
+ long totalRecords = ((GenericRecordToOrcValueWriter)
valueWriter).getTotalRecordsConverted();
+ long averageSizePerRecord = totalRecords == 0 ? 0 : totalBytes /
totalRecords;
+ this.estimatedRecordSize = averageSizePerRecord;
Review Comment:
Size is in bytes right? Make sure it's part of the variable name somehow
--
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]