You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "JamesMurkin (via GitHub)" <gi...@apache.org> on 2025/09/03 11:03:09 UTC
[PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
JamesMurkin opened a new pull request, #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419
### Motivation
The properties on messages returned by PeekMessages is not returned consistently as described in #1418
This change makes sure we set all properties from headers before continuing on, so the returned message should consistently contain all properties.
Currently the properties returned is inconsistent on repeated calls, even if the message returned is the same each time.
### Modifications
I've made it so all headers are processed / al properties are set on every message, rather than exiting the loop early which can cause inconsistent results.
### Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): no
- The public API: no
- The schema: no
- The default values of configurations: no
- The wire protocol: no
### Documentation
- Does this pull request introduce a new feature? no
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419#discussion_r2319508508
##########
pulsaradmin/pkg/admin/subscription.go:
##########
@@ -280,6 +281,9 @@ func handleResp(topic utils.TopicName, resp *http.Response) ([]*utils.Message, e
}
}
+ if isBatch {
+ return getIndividualMsgsFromBatch(topic, ID, payload, properties)
+ }
Review Comment:
The `properties` map is being shared between all individual messages in a batch. In `getIndividualMsgsFromBatch`, properties are being modified by adding single message properties to the same map reference, which means all messages in the batch will share the same properties map and accumulate properties from all messages in the batch. This should create a copy of the properties map for each individual message to avoid property contamination between messages.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
Posted by "crossoverJie (via GitHub)" <gi...@apache.org>.
crossoverJie commented on PR #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419#issuecomment-3251415967
Great fix, could you please add some unit tests?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
Posted by "JamesMurkin (via GitHub)" <gi...@apache.org>.
JamesMurkin commented on PR #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419#issuecomment-3252633616
I absolutely can, I wasn't sure what style was sufficient
I've made a basic addition to an existing test, which should catch it
- It'll be flakey/fail if the bug were to happen again
I could write a dedicated test, but I wasn't sure how to go about asserting the time is as expected in a robust way
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
Posted by "JamesMurkin (via GitHub)" <gi...@apache.org>.
JamesMurkin commented on PR #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419#issuecomment-3253616082
OK I ended up updating TestPeekMessageWithProperties with a batched/non-batched variant which should well cover this scenario.
- It also now validates the batch number property gets set when using batched mode
I'm not sure if you'll like the style, I could split them into separate tests but from a functionality point of view I think it'll work.
I had to use the same "cheat" as the other batched unit test, but I've made it more explicit / not fail if you pause it in a debugger.
Let me know if you want something different :) .
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
Posted by "JamesMurkin (via GitHub)" <gi...@apache.org>.
JamesMurkin commented on code in PR #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419#discussion_r2324906053
##########
pulsaradmin/pkg/admin/subscription.go:
##########
@@ -280,6 +281,9 @@ func handleResp(topic utils.TopicName, resp *http.Response) ([]*utils.Message, e
}
}
+ if isBatch {
+ return getIndividualMsgsFromBatch(topic, ID, payload, properties)
+ }
Review Comment:
This feels like an issue with getIndividualMsgsFromBatch and not specifically anything changed in this PR
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Issue #1418] Fix: Properties not getting consistently set on pulsaradmin subscription message responses [pulsar-client-go]
Posted by "RobertIndie (via GitHub)" <gi...@apache.org>.
RobertIndie merged PR #1419:
URL: https://github.com/apache/pulsar-client-go/pull/1419
--
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.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org