Skip to content

Commit

Permalink
Addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolanmol1234 committed Jan 29, 2025
1 parent 043cb31 commit a2011d9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ public synchronized void write(final byte[] data, final int off, final int lengt
throw new PathIOException(path, ERR_WRITE_WITHOUT_LEASE);
}
if (length == 0) {
LOG.debug("No data to write, length is 0 for path: {}", path);
return;
}

Expand Down Expand Up @@ -535,6 +536,7 @@ private void uploadBlockAsync(AbfsBlock blockToUpload,
try {
op = remoteWrite(blockToUpload, blockUploadData, reqParams, tracingContext);
} catch (InvalidIngressServiceException ex) {
LOG.debug("InvalidIngressServiceException caught for path: {}, switching handler and retrying remoteWrite.", getPath());
switchHandler();
// retry the operation with switched handler.
op = remoteWrite(blockToUpload, blockUploadData, reqParams, tracingContext);
Expand Down Expand Up @@ -862,6 +864,7 @@ private synchronized void flushWrittenBytesToServiceInternal(final long offset,
op = remoteFlush(offset, retainUncommitedData, isClose, leaseId,
tracingContext);
} catch (InvalidIngressServiceException ex) {
LOG.debug("InvalidIngressServiceException caught for path: {}, switching handler and retrying remoteFlush.", getPath());
// If an invalid ingress service is encountered, switch handler and retry.
switchHandler();
op = remoteFlush(offset, retainUncommitedData, isClose, leaseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected synchronized void updateEntry(AbfsBlock block) {
* @return whether we have some data to commit or not.
* @throws IOException if an I/O error occurs
*/
protected boolean hasListToCommit() throws IOException {
protected synchronized boolean hasListToCommit() throws IOException {
// Adds all the committed blocks if available to the list of blocks to be added in putBlockList.
if (blockEntryList.isEmpty()) {
return false; // No entries to commit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ protected void writeAppendBlobCurrentBufferToService() throws IOException {
activeBlock, reqParams,
new TracingContext(getAbfsOutputStream().getTracingContext()));
} catch (InvalidIngressServiceException ex) {
LOG.debug("InvalidIngressServiceException caught for path: {}, switching handler and retrying remoteAppendBlobWrite.", getAbfsOutputStream().getPath());
getAbfsOutputStream().switchHandler();
op = getAbfsOutputStream().getIngressHandler()
.remoteAppendBlobWrite(getAbfsOutputStream().getPath(), uploadData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ protected void writeAppendBlobCurrentBufferToService() throws IOException {
activeBlock, reqParams,
new TracingContext(getAbfsOutputStream().getTracingContext()));
} catch (InvalidIngressServiceException ex) {
LOG.debug("InvalidIngressServiceException caught for path: {}, switching handler and retrying remoteAppendBlobWrite.", getAbfsOutputStream().getPath());
getAbfsOutputStream().switchHandler();
op = getAbfsOutputStream().getIngressHandler()
.remoteAppendBlobWrite(getAbfsOutputStream().getPath(), uploadData,
Expand Down

0 comments on commit a2011d9

Please sign in to comment.