Skip to content

Commit

Permalink
[TIEREDSTORAGE] Don't require both region and endpoint to be specified (
Browse files Browse the repository at this point in the history
#5355)

There's a bug in how user metadata is attached to a block that if the
user doesn't specify both the region and the endpoint, offloading will
throw an exception, as you can't add a null value to an immutable
map.

This change elides null to the empty string in these cases, so that
offloading can continue.

(cherry picked from commit 3e70d36)
  • Loading branch information
ivankelly authored and wolfstudy committed Nov 19, 2019
1 parent 4a6f1d3 commit df6a902
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ protected void internalTriggerOffload(boolean authoritative, MessageIdImpl messa
} catch (AlreadyRunningException e) {
throw new RestException(Status.CONFLICT, e.getMessage());
} catch (Exception e) {
log.warn("Unexpected error triggering offload", e);
throw new RestException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ public String getOffloadDriverName() {
public Map<String, String> getOffloadDriverMetadata() {
return ImmutableMap.of(
METADATA_FIELD_BUCKET, writeBucket,
METADATA_FIELD_REGION, writeRegion,
METADATA_FIELD_ENDPOINT, writeEndpoint
METADATA_FIELD_REGION, Strings.nullToEmpty(writeRegion),
METADATA_FIELD_ENDPOINT, Strings.nullToEmpty(writeEndpoint)
);
}

Expand Down

0 comments on commit df6a902

Please sign in to comment.