Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
nginthfs committed Sep 30, 2024
1 parent 2a36491 commit c400bd1
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions solr/core/src/java/org/apache/solr/storage/SizeAwareDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,23 +393,22 @@ public Sizes setSizeWriter(SizeWriter sizeWriter) {
@Override
@SuppressWarnings("try")
public void close() throws IOException {
backing.close();

long onDiskSize;
if (backing instanceof CompressingDirectory.SizeReportingIndexOutput) {
long finalBytesWritten = getBytesWritten(backing);
onDiskSize = finalBytesWritten;
// logical size should already be set through writeByte(s), but we need to finalize the
// on-disk size here
sizeWriter.apply(0, finalBytesWritten - lastBytesWritten, name);
} else if (backingDirectory instanceof DirectoryFactory.OnDiskSizeDirectory) {
onDiskSize = 0;
} else {
onDiskSize = getFilePointer();
}
fileSizeMap.put(name, new Sizes(backing.getFilePointer(), onDiskSize));
liveOutputs.remove(name);
backing.close();

long onDiskSize;
if (backing instanceof CompressingDirectory.SizeReportingIndexOutput) {
long finalBytesWritten = getBytesWritten(backing);
onDiskSize = finalBytesWritten;
// logical size should already be set through writeByte(s), but we need to finalize the
// on-disk size here
sizeWriter.apply(0, finalBytesWritten - lastBytesWritten, name);
} else if (backingDirectory instanceof DirectoryFactory.OnDiskSizeDirectory) {
onDiskSize = 0;
} else {
onDiskSize = getFilePointer();
}
fileSizeMap.put(name, new Sizes(backing.getFilePointer(), onDiskSize));
liveOutputs.remove(name);
}

@Override
Expand Down

0 comments on commit c400bd1

Please sign in to comment.