This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e70d36  [TIEREDSTORAGE] Don't require both region and endpoint to be 
specified (#5355)
3e70d36 is described below

commit 3e70d365fbef6d219bec2386afa8f962b6cd12fb
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Thu Oct 10 16:00:11 2019 +0100

    [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.
---
 .../org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java     | 1 +
 .../mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
index 0545274..94412a9 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
@@ -1630,6 +1630,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);
         }
     }
diff --git 
a/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java
 
b/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java
index 38fe880..7f7acaf 100644
--- 
a/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java
+++ 
b/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java
@@ -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)
         );
     }
 

Reply via email to