Skip to content

Commit

Permalink
OAK-8610: Pass the full blob name to the IOMonitor for Azure
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1866675 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
trekawek committed Sep 9, 2019
1 parent 1053f80 commit f97df52
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,18 @@ public void writeSegment(long msb, long lsb, byte[] data, int offset, int size,
private void doWriteEntry(AzureSegmentArchiveEntry indexEntry, byte[] data, int offset, int size) throws IOException {
long msb = indexEntry.getMsb();
long lsb = indexEntry.getLsb();
ioMonitor.beforeSegmentWrite(pathAsFile(), msb, lsb, size);
String segmentName = getSegmentFileName(indexEntry);
CloudBlockBlob blob = getBlob(segmentName);
ioMonitor.beforeSegmentWrite(new File(blob.getName()), msb, lsb, size);
Stopwatch stopwatch = Stopwatch.createStarted();
try {
CloudBlockBlob blob = getBlob(getSegmentFileName(indexEntry));
blob.setMetadata(AzureBlobMetadata.toSegmentMetadata(indexEntry));
blob.uploadFromByteArray(data, offset, size);
blob.uploadMetadata();
} catch (StorageException e) {
throw new IOException(e);
}
ioMonitor.afterSegmentWrite(pathAsFile(), msb, lsb, size, stopwatch.elapsed(TimeUnit.NANOSECONDS));
ioMonitor.afterSegmentWrite(new File(blob.getName()), msb, lsb, size, stopwatch.elapsed(TimeUnit.NANOSECONDS));
}

@Override
Expand Down Expand Up @@ -196,10 +197,6 @@ public String getName() {
return AzureUtilities.getName(archiveDirectory);
}

private File pathAsFile() {
return new File(archiveDirectory.getUri().getPath());
}

private CloudBlockBlob getBlob(String name) throws IOException {
try {
return archiveDirectory.getBlockBlobReference(name);
Expand Down

0 comments on commit f97df52

Please sign in to comment.