Location eventFile = StreamUtils.createStreamLocation(partitionDirectory, fileNamePrefix,
fileSequence, StreamFileType.EVENT);
Location indexFile = StreamUtils.createStreamLocation(partitionDirectory, fileNamePrefix,
fileSequence, StreamFileType.INDEX);
// The creation should succeed, as it's expected to only have one process running per fileNamePrefix.
if (!eventFile.createNew() || !indexFile.createNew()) {
throw new IOException("Failed to create new file at " + eventFile.toURI() + " and " + indexFile.toURI());
}
LOG.debug("New stream file created at {}", eventFile.toURI());
return new StreamDataFileWriter(createOutputSupplier(eventFile), createOutputSupplier(indexFile), indexInterval);