Skip to content

Commit 6e22dc6

Browse files
DaveCTurnernicktindall
authored andcommitted
Don't use cached time
1 parent ffdb941 commit 6e22dc6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4113,18 +4113,18 @@ protected void snapshotFile(SnapshotShardContext context, FileInfo fileInfo) thr
41134113
@Override
41144114
public int read() throws IOException {
41154115
checkAborted();
4116-
final long beforeReadNanos = threadPool.relativeTimeInNanos();
4116+
final long beforeReadNanos = System.nanoTime();
41174117
int value = super.read();
4118-
blobStoreSnapshotMetrics.incrementUploadReadTime(threadPool().relativeTimeInNanos() - beforeReadNanos);
4118+
blobStoreSnapshotMetrics.incrementUploadReadTime(System.nanoTime() - beforeReadNanos);
41194119
return value;
41204120
}
41214121

41224122
@Override
41234123
public int read(byte[] b, int off, int len) throws IOException {
41244124
checkAborted();
4125-
final long beforeReadNanos = threadPool.relativeTimeInNanos();
4125+
final long beforeReadNanos = System.nanoTime();
41264126
int amountRead = super.read(b, off, len);
4127-
blobStoreSnapshotMetrics.incrementUploadReadTime(threadPool().relativeTimeInNanos() - beforeReadNanos);
4127+
blobStoreSnapshotMetrics.incrementUploadReadTime(System.nanoTime() - beforeReadNanos);
41284128
return amountRead;
41294129
}
41304130

@@ -4134,9 +4134,9 @@ private void checkAborted() {
41344134
};
41354135
final String partName = fileInfo.partName(i);
41364136
logger.trace("[{}] Writing [{}] to [{}]", metadata.name(), partName, shardContainer.path());
4137-
final long startNanos = threadPool.relativeTimeInNanos();
4137+
final long startNanos = System.nanoTime();
41384138
shardContainer.writeBlob(OperationPurpose.SNAPSHOT_DATA, partName, inputStream, partBytes, false);
4139-
final long uploadTimeInNanos = threadPool.relativeTimeInNanos() - startNanos;
4139+
final long uploadTimeInNanos = System.nanoTime() - startNanos;
41404140
blobStoreSnapshotMetrics.incrementCountersForPartUpload(partBytes, uploadTimeInNanos);
41414141
logger.trace(
41424142
"[{}] Writing [{}] of size [{}b] to [{}] took [{}ms]",

0 commit comments

Comments
 (0)