Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async call for broker stats #305

Merged
merged 15 commits into from
Apr 7, 2017
Merged

Conversation

jai1
Copy link
Contributor

@jai1 jai1 commented Mar 22, 2017

Motivation

Added async call for getBrokerConsumerStats and refactored the code to keep partitions abstract.

Modifications

Almost all Consumer* files modified to support BrokerConsumerStats

Result

@jai1 jai1 self-assigned this Mar 22, 2017
@jai1 jai1 added the c++ label Mar 22, 2017
@jai1 jai1 added this to the 1.17 milestone Mar 22, 2017
@merlimat merlimat modified the milestones: 1.17, 1.18 Mar 31, 2017
@jai1
Copy link
Contributor Author

jai1 commented Apr 6, 2017

@merlimat @saandrews @msb-at-yahoo - Can you please give me a +1 on this - need to get it into production

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but try to get more @msb-at-yahoo or @saandrews to check it as well

@msb-at-yahoo
Copy link
Contributor

can you rebase this to one commit?

@merlimat
Copy link
Contributor

merlimat commented Apr 6, 2017

@msb-at-yahoo Merging the PR will anyway force a squash. I've configured github to only leave that option ;)

private:
boost::shared_ptr<BrokerConsumerStatsImplBase> impl_;
public:
BrokerConsumerStats(boost::shared_ptr<BrokerConsumerStatsImplBase> impl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constructor should be explicit


friend std::ostream& operator<<(std::ostream &os, const BrokerConsumerStats &obj);
};
typedef boost::shared_ptr<BrokerConsumerStats> BrokerConsumerStatsPtr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need a shared_ptr here if BrokerConsumerStats is already basically a shared_ptr and is allowed to be invalid?

}

double BrokerConsumerStats::getMsgRateOut() const {
if (impl_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be more idiomatic to just document that no getXXX is allowed on an invalid BrokerConsumerStats object and get rid of the check. that avoids hiding bugs.

@jai1 jai1 force-pushed the AsyncCallForBrokerStats branch from f4933c8 to c5a2404 Compare April 6, 2017 21:30
@jai1 jai1 merged commit 2d07cd5 into apache:master Apr 7, 2017
@jai1 jai1 deleted the AsyncCallForBrokerStats branch April 17, 2017 17:01
hrsakai pushed a commit to hrsakai/pulsar that referenced this pull request Dec 10, 2020
…ageID for ReaderOptions (apache#305)

### Motivation

User of the client's client's [CreateReader](https://github.com/apache/pulsar-client-go/blob/master/pulsar/client.go#L109) API can use a custom type satisfying the [MessageID](https://github.com/apache/pulsar-client-go/blob/master/pulsar/message.go#L108) interface, when using it as a value for `StartMessageID` in [ReaderOptions](https://github.com/apache/pulsar-client-go/blob/master/pulsar/reader.go#L48) argument for the mentioned API.

The current reader creation does an untested type assertion here, when preparing the `consumerOptions` needed for creating a `partitionConsumer`.
https://github.com/apache/pulsar-client-go/blob/master/pulsar/reader_impl.go#L64 

This assertion of `MessageID` as `*messageID` will fail unless an instance of `MessageID` is created from one of these exported APIs because `messageID` is unexported
https://github.com/apache/pulsar-client-go/blob/master/pulsar/message.go#L114-#L126
Note: `newMessageID` returns `*messageID` which satisfies `MessageID` interface as well.


### Modifications

Test the type assertion of `MessageID` as `*messageID`, if it fails, re-create a new `MessageID` using this
https://github.com/apache/pulsar-client-go/blob/975eb3781644ebe588fc142e53eadf39fe50341a/pulsar/impl_message.go#L97
This will ensure that the custom type can be re-created as a `*messageID` which can be used by `partitionConsumerOpts`
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
Fixes apache#299

PulsarEntryFormatter doesn't handle null value correctly now. If a message with null value was sent by a producer, the consumer will receive a message with an empty string.

This PR fixes the bug and adds to tests to verify KoP could handle the null value no matter what the entry format is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants