-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Get accurate start time and bytes started for each file uploaded to Remote Translog Store #9729
Description
Is your feature request related to a problem? Please describe.
Currently, there is no way to capture the exact start time for a given file being uploaded to the Remote Translog Store. This information is essential to emit an accurate time duration spent on uploads.
Additionally, the same solution can be leveraged to emit the more accurate, point-in-time value of upload bytes started for Remote Translog Store uploads.
Describe the solution you'd like
Currently, we depend on the ActionListener interface and LatchedActionListener to run logic on a successful or failed response for the remote upload:
However, there is no way to pass a beforeUpload callback here. There is ActionListener#runBefore(), but that is triggered before passing on the received response. What we need is a way to trigger some logic before starting the actual upload.
Describe alternatives you've considered
For the meantime, we are planning to consider the start time of sync to remote as the start time for calculating the time duration spent on uploads. Similarly, we add all the bytes of all files being attempted in the sync as the uploadBytesStarted value to add. Consequently, these values would likely be somewhat higher than the actual point-in-time values.
Additional context
Current callback logic on upload success:
OpenSearch/server/src/main/java/org/opensearch/index/translog/transfer/FileTransferTracker.java
Lines 35 to 38 in d375e4c
| @Override | |
| public void onSuccess(TransferFileSnapshot fileSnapshot) { | |
| add(fileSnapshot.getName(), TransferState.SUCCESS); | |
| } |
Current callback logic on upload failure:
OpenSearch/server/src/main/java/org/opensearch/index/translog/transfer/FileTransferTracker.java
Lines 54 to 57 in d375e4c
| @Override | |
| public void onFailure(TransferFileSnapshot fileSnapshot, Exception e) { | |
| add(fileSnapshot.getName(), TransferState.FAILED); | |
| } |
OpenSearch/server/src/main/java/org/opensearch/index/translog/transfer/TranslogTransferManager.java
Lines 109 to 121 in d375e4c
| assert ex instanceof FileTransferException; | |
| logger.error( | |
| () -> new ParameterizedMessage( | |
| "Exception during transfer for file {}", | |
| ((FileTransferException) ex).getFileSnapshot().getName() | |
| ), | |
| ex | |
| ); | |
| FileTransferException e = (FileTransferException) ex; | |
| fileTransferTracker.onFailure(e.getFileSnapshot(), ex); | |
| exceptionList.add(ex); | |
| }), | |
| latch |
Initial changes for capturing the upload start time and upload bytes started are being added as part of #9263
Metadata
Metadata
Assignees
Labels
Type
Projects
Status