Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,22 @@ public OzoneClient createClientForS3Commands(
} else {
// If om service id is not specified, consider it as a non-HA cluster.
// But before that check if serviceId is defined. If it is defined
// throw an error om service ID needs to be specified.
// and has length = 1, then take that ID as default.
// otherwise throw an error om service ID needs to be specified.
if (OmUtils.isServiceIdsDefined(conf)) {
throw new OzoneClientException("Service ID must not"
+ " be omitted when " + OZONE_OM_SERVICE_IDS_KEY + " is defined. " +
"Configured " + OZONE_OM_SERVICE_IDS_KEY + " are " +
conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY));
Collection<String> serviceIds=conf.
getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY);
if (serviceIds.size() == 1) {
return OzoneClientFactory.getRpcClient(serviceIds.iterator().next(),
conf);
}
else {
throw new OzoneClientException("Service ID must not"
+ " be omitted when " + OZONE_OM_SERVICE_IDS_KEY + " is defined."
+ " Configured " + OZONE_OM_SERVICE_IDS_KEY + " are " +
conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY));
}

}
return OzoneClientFactory.getRpcClient(conf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public abstract class S3Handler extends Handler {

@CommandLine.Option(names = {"--om-service-id"},
required = false,
description = "OM Service ID is required to be specified for OM HA" +
" cluster")
description = "OM Service ID is preferred to be specified for OM HA" +
" cluster when there are multiple service IDs")
private String omServiceID;

public String getOmServiceID() {
Expand Down