Skip to content

Add druid-rocketmq module#2231

Merged
fjy merged 7 commits intoapache:masterfrom
lizhanhui:pull_request
Feb 26, 2016
Merged

Add druid-rocketmq module#2231
fjy merged 7 commits intoapache:masterfrom
lizhanhui:pull_request

Conversation

@lizhanhui
Copy link
Copy Markdown
Contributor

Re-base on top of lastest master branch of druid-io repo, aka, d0b10c2

@nishantmonu51
Copy link
Copy Markdown
Member

@lizhanhui, Thanks for the contribution, just noticed you closed old pr and created a new one, when you make changes to your branch, github automatically adds them to existing PR, no need to create a new PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I dont think you need the RocketMQ version number in the name here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK, Will drop the version.

@fjy
Copy link
Copy Markdown
Contributor

fjy commented Jan 9, 2016

At a high level I think this PR is pretty good. A few comments overall.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's use camel casing
"rocketMQ"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK

@fjy
Copy link
Copy Markdown
Contributor

fjy commented Jan 11, 2016

👍. I think this module will not impact much in Druid and is solving the use cases of an organization

Comment thread extensions/druid-rocketmq/pom.xml Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

newline

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

drcrallen说去掉无用的空行

@drcrallen
Copy link
Copy Markdown
Contributor

PR is void of unit tests

2. Change RocketMQ to rocketMQ
3. Make swapRequests methods synchronized in all places.
4. Make comparator static and final and use Long.compare.
@lizhanhui
Copy link
Copy Markdown
Contributor Author

@drcrallen "PR is void of unit tests" Considering this module is sort of connector, it's unlikely to provide really useful unit tests without setting up messaging system and druid. Also, I just checked kafka-eight module, it lacks unit test too.

… onWaitEnd(), is only invoked in synchronized code blocks. There is no need to repeat sync it even if java's synchronized keyword holds a reentrant mutex semantic ^_^.
@fjy
Copy link
Copy Markdown
Contributor

fjy commented Jan 14, 2016

@drcrallen as per our discussion in the dev sync, I think we can merge these extensions and look into breaking them into a separate repo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be able to just log error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also same comment about Thread.currentThread.interrupt() and bubbling up the interruption in a runtime exception. (throw Throwables.propogate(e))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"Should be able to just log error" I originally directly use sl4j APIs which does not have such interface. Will update in case your logging wrapper provides.

"Also same comment about Thread.currentThread.interrupt() and bubbling up the interruption in a runtime exception. (throw Throwables.propogate(e))" you mean throw the interrupt exception up?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Call Thread.currentThread.interrupt() and throw the exception.

Nowhere in Druid is an Interrupted thread a good thing.

@drcrallen
Copy link
Copy Markdown
Contributor

I have a lot of questions about synchronization and lack of timeouts on polling and locking, but given that this is an isolated extension, I'm good with it being an experimental feature until either more unit tests are added or extensions are moved to their own repository. Logging comments need addressed though or else the exceptions will get eaten up by the logging framework.

@fjy
Copy link
Copy Markdown
Contributor

fjy commented Jan 20, 2016

@drcrallen is that a +1 ?

@drcrallen
Copy link
Copy Markdown
Contributor

@fjy Logging comments need addressed first.

@drcrallen
Copy link
Copy Markdown
Contributor

@lizhanhui If you get the logging stuff flipped around I think we're good here

@lizhanhui
Copy link
Copy Markdown
Contributor Author

"I have a lot of questions about synchronization and lack of timeouts on polling and locking, but given that this is an isolated extension, I'm good with it being an experimental feature until either more unit tests are added or extensions are moved to their own repository. Logging comments need addressed though or else the exceptions will get eaten up by the logging framework."

synchronization issues? Please raise them up. I do not see any.
"lack of timeouts on polling and locking", Obviously, you do not check the codebase or you do not think the default timeouts suffice? Is there any reason why default timeouts do not work well with Druid?

" but given that this is an isolated extension, I'm good with it being an experimental feature until either more unit tests are added or extensions are moved to their own repository. Logging comments need addressed though or else the exceptions will get eaten up by the logging framework." As I previously replied, I wish I could add some unit tests that make sense. Would you recommend a way to do this without setting up MQ and Druid system?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does MQClientException have any stuff that's helpful that could be logged here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, in case something is wrong. These info are pretty helpful to figure out what's going on, where the message consuming moves to. Anyway, if the caller of this connector has no chance logging these info down, we'd better do this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean, should e be used in the error message to enhance the logging? Either as LOGGER.error(e or using e's getMessage()?

@drcrallen
Copy link
Copy Markdown
Contributor

Actually , looking at com.alibaba.rocketmq.common.ServiceThread from http://grepcode.com/file/repo1.maven.org/maven2/com.alibaba.rocketmq/rocketmq-common/3.2.6/com/alibaba/rocketmq/common/ServiceThread.java/ it looks like ServiceThread does a lot of synchronization and notifying on itself. That makes this impl much harder to review without an intimate understanding of ServiceThread.

Regarding testing, The general recommendation if the framework does not have a unit-test friendly tool, is to use EasyMock to force the behaviors you are testing for.

@lizhanhui
Copy link
Copy Markdown
Contributor Author

Yes, I admit understanding ServiceThread is required. Fortunately, it's not that complex...5 min should suffice.

Sure, we may mock a few cases. But really limited few. How much can we get? maybe much fewer than a real test deployment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this just synchronizing and calling

                this.hasNotified = false;
                this.onWaitEnd();

?

@guobingkun
Copy link
Copy Markdown
Contributor

@lizhanhui Thanks for the PR. Since this is intended to be used by public, can we have some documentation that describes how to use this extension?

@fjy fjy modified the milestones: 0.9.1, 0.9.0 Feb 2, 2016
@fjy fjy added the Feature label Feb 6, 2016
@fjy
Copy link
Copy Markdown
Contributor

fjy commented Feb 24, 2016

@guobingkun @drcrallen going to merge this in 24 hours and then refactor extensions

@drcrallen
Copy link
Copy Markdown
Contributor

This is probably served better in extensions.contrib than in a PR, so 👍 to go into extensions.contrib

fjy added a commit that referenced this pull request Feb 26, 2016
@fjy fjy merged commit 3a9fe2a into apache:master Feb 26, 2016
@fjy
Copy link
Copy Markdown
Contributor

fjy commented Feb 26, 2016

seoeun25 added a commit to seoeun25/incubator-druid that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants