You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/06/25 14:48:06 UTC

[GitHub] [pulsar] zhanghaou commented on a change in pull request #7357: Fix bug related to managedLedger properties

zhanghaou commented on a change in pull request #7357:
URL: https://github.com/apache/pulsar/pull/7357#discussion_r445615755



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedger.java
##########
@@ -453,19 +453,23 @@
     /**
      * Update managed-ledger's properties.
      *
-     * @param properties key-values of properties
+     * @param properties  key-values of properties
+     * @param isOverwrite set true to overwrite original value of managed-ledger's properties; set false to append the
+     *                    properties to managed-ledger's properties.
      */
-    void setProperties(Map<String, String> properties) throws InterruptedException;
+    void setProperties(Map<String, String> properties, boolean isOverwrite) throws InterruptedException;

Review comment:
       OK. Thanks for the suggestion, I will add these APIs.

##########
File path: managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -1174,43 +1174,49 @@ public void testSetProperties() throws Exception {
         properties.put("key1", "value1");
         properties.put("key2", "value2");
         properties.put("key3", "value3");
-        ledger.setProperties(properties);
+        ledger.setProperties(properties, true);
         assertEquals(ledger.getProperties(), properties);
 
         Map<String, String> newProperties = new HashMap<>();
         newProperties.put("key4", "value4");
         newProperties.put("key5", "value5");
         newProperties.put("key6", "value6");
-        ledger.setProperties(newProperties);
+        ledger.setProperties(newProperties, true);
+        assertEquals(ledger.getProperties(), newProperties);
+
+        ledger.setProperties(properties, false);
+        newProperties.putAll(properties);

Review comment:
       OK.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org