Skip to content

Commit

Permalink
HPCC4J-545 Resume read test causes OOM error
Browse files Browse the repository at this point in the history
- Updated resume read to use a smaller read buffer size

Signed-off-by: James McMullan [email protected]
  • Loading branch information
jpmcmu committed Oct 26, 2023
1 parent 28183cf commit b841481
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ public void readResumeTest() throws Exception
System.out.println("Messages from file part (" + i + ") read operation:\n" + fileReader.getRemoteReadMessages());
}

Runtime runtime = Runtime.getRuntime();
int readSizeKB = 100;
ArrayList<HPCCRecord> resumedRecords = new ArrayList<HPCCRecord>();
for (int i = 0; i < resumeInfo.size(); i++)
{
HPCCRecordBuilder recordBuilder = new HPCCRecordBuilder(file.getProjectedRecordDefinition());
HpccRemoteFileReader<HPCCRecord> fileReader = new HpccRemoteFileReader<HPCCRecord>(fileParts[resumeFilePart.get(i)], originalRD, recordBuilder, -1, -1, true, -1, resumeInfo.get(i));
HpccRemoteFileReader<HPCCRecord> fileReader = new HpccRemoteFileReader<HPCCRecord>(fileParts[resumeFilePart.get(i)], originalRD, recordBuilder, -1, -1, true, readSizeKB, resumeInfo.get(i));

if (fileReader.hasNext())
{
Expand All @@ -195,13 +195,10 @@ public void readResumeTest() throws Exception

resumedRecords.add(record);
}
fileReader.close();

// Periodically run garbage collector to prevent buffers in remote file readers from exhausting free memory
// This is only needed due to rapidly creating / destroying thousands of HpccRemoteFileReaders
if ((i % 10) == 0)
{
runtime.gc();
}
fileReader = null;
recordBuilder = null;
}

assertEquals("Number of records did not match during read resume.", records.size(), resumedRecords.size());
Expand Down

0 comments on commit b841481

Please sign in to comment.