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/02/21 06:43:31 UTC

[GitHub] [pulsar] liudezhi2098 opened a new pull request #6390: fix duplicate key to send propertys

liudezhi2098 opened a new pull request #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390
 
 
   **Motivation**
   Fix when sending a message, set duplicate key to properties, can't pull the message while concumer
   ```javascript
   //org.apache.pulsar.client.impl.MessageImpl
   if (msgMetadata.getPropertiesCount() > 0) {
               this.properties = Collections.unmodifiableMap(msgMetadataBuilder.getPropertiesList().stream()
                       .collect(Collectors.toMap(KeyValue::getKey, KeyValue::getValue)));
           } else {
               properties = Collections.emptyMap();
           }
           this.schema = schema;
   ```
   Collectors.toMap can not allowed duplicate key
   
   **Changes**
   Replace old value with new value
   ```javascript
   if (msgMetadata.getPropertiesCount() > 0) {
               this.properties = Collections.unmodifiableMap(msgMetadataBuilder.getPropertiesList().stream()
                       .collect(Collectors.toMap(KeyValue::getKey, KeyValue::getValue,
                               (oldValue,newValue) -> newValue)));
           } else {
               properties = Collections.emptyMap();
           }
           this.schema = schema;
   ```

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] tuteng merged pull request #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
tuteng merged pull request #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390
 
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] sijie commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
sijie commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-590511231
 
 
   /pulsarbot run-failure-checks

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] jiazhai commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
jiazhai commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-593988675
 
 
   /pulsarbot run-failure-checks
   
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] sijie closed pull request #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
sijie closed pull request #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390
 
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] liudezhi2098 opened a new pull request #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
liudezhi2098 opened a new pull request #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390
 
 
   **Motivation**
   Fix when sending a message, set duplicate key to properties, can't pull the message while concumer #6388 
   ```javascript
   //org.apache.pulsar.client.impl.MessageImpl
   if (msgMetadata.getPropertiesCount() > 0) {
               this.properties = Collections.unmodifiableMap(msgMetadataBuilder.getPropertiesList().stream()
                       .collect(Collectors.toMap(KeyValue::getKey, KeyValue::getValue)));
           } else {
               properties = Collections.emptyMap();
           }
           this.schema = schema;
   ```
   Collectors.toMap can not allowed duplicate key
   
   **Changes**
   Replace old value with new value
   ```javascript
   if (msgMetadata.getPropertiesCount() > 0) {
               this.properties = Collections.unmodifiableMap(msgMetadataBuilder.getPropertiesList().stream()
                       .collect(Collectors.toMap(KeyValue::getKey, KeyValue::getValue,
                               (oldValue,newValue) -> newValue)));
           } else {
               properties = Collections.emptyMap();
           }
           this.schema = schema;
   ```

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] tuteng commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
tuteng commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-590670866
 
 
   /pulsarbot run-failure-checks

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] tuteng commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
tuteng commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-600923744
 
 
   /pulsarbot run-failure-checks

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] codelipenghui commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-590722772
 
 
   /pulsarbot run-failure-checks

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] tuteng commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
tuteng commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-600941471
 
 
   The test failure seems to be related to this pr. Please look at this test. @liudezhi2098 
   ```
   [ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 83.784 s <<< FAILURE! - in org.apache.pulsar.client.api.InterceptorsTest
   [ERROR] testProducerInterceptor(org.apache.pulsar.client.api.InterceptorsTest)  Time elapsed: 0.077 s  <<< FAILURE!
   java.lang.AssertionError: Collections not equal: expected: [int1, int2] and actual: null
   	at org.testng.Assert.fail(Assert.java:96)
   	at org.testng.Assert.assertEquals(Assert.java:815)
   	at org.testng.Assert.assertEquals(Assert.java:796)
   	at org.apache.pulsar.client.api.InterceptorsTest.testProducerInterceptor(InterceptorsTest.java:126)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
   	at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:54)
   	at org.testng.internal.InvokeMethodRunnable.run(InvokeMethodRunnable.java:44)
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   ```

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [pulsar] tuteng commented on issue #6390: fix duplicate key to send propertys

Posted by GitBox <gi...@apache.org>.
tuteng commented on issue #6390: fix duplicate key to send propertys
URL: https://github.com/apache/pulsar/pull/6390#issuecomment-600584774
 
 
   /pulsarbot run-failure-checks

----------------------------------------------------------------
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


With regards,
Apache Git Services