提交 df6a9028 编写于 作者: I Ivan Kelly 提交者: xiaolong.ran

[TIEREDSTORAGE] Don't require both region and endpoint to be specified (#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 3e70d365)
上级 4a6f1d36
......@@ -1569,6 +1569,7 @@ public class PersistentTopicsBase extends AdminResource {
} catch (AlreadyRunningException e) {
throw new RestException(Status.CONFLICT, e.getMessage());
} catch (Exception e) {
log.warn("Unexpected error triggering offload", e);
throw new RestException(e);
}
}
......
......@@ -382,8 +382,8 @@ public class BlobStoreManagedLedgerOffloader implements LedgerOffloader {
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)
);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册