Skip to content

TopicAndPartition fix when partition leader = -1 #109

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

Merged
merged 10 commits into from
Mar 22, 2014
Merged

Conversation

mrtheb
Copy link
Collaborator

@mrtheb mrtheb commented Jan 18, 2014

Includes unittests and added mock dependency for unit tests

@turtlesoupy
Copy link
Contributor

👍 this was my bad, thanks for adding a test for it and fixing the issue.

if key not in self.topics_to_brokers:
# reload metadata whether the partition is not available
# or has no leader (broker is None)
if self.topics_to_brokers.get(key) is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be if key not in self.topics_to_brokers:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No because I want to handle cases where key is not in dict and when the value at key is None. Get returns None by default in both cases which suits my need.

Should I clarify the comment because that is what it is supposed to say.

@wizzat
Copy link
Collaborator

wizzat commented Feb 11, 2014

Is this going to be merged back to the 0.8.0 release branch?

@rdiomar
Copy link
Collaborator

rdiomar commented Feb 11, 2014

The next release branch will be 0.9.0 when it's ready. This will be merged into master before that branch is created.

@wizzat
Copy link
Collaborator

wizzat commented Feb 13, 2014

Is the 0.9.0 release going to support 0.8.0? Kafka 0.8.0 is the current stable release.

@rdiomar
Copy link
Collaborator

rdiomar commented Feb 13, 2014

Yup. We decided to divorce kafka-python's version number from kafka's. The README should always tell you what server versions are supported.

@wizzat
Copy link
Collaborator

wizzat commented Feb 14, 2014

Right, my point is that the current README shows kafka-python (compatible with 0.8.1, 0.9.0) is not compatible with the current stable version of Kafka (0.8.0).

@rdiomar
Copy link
Collaborator

rdiomar commented Feb 14, 2014

Ah. The truth is that kafka 0.8.0 is supported, except kafka-python has offset fetch/commit logic that kafka 0.8.0 doesn't support, so things will break if you use it. I believe it should be compatible otherwise.

@mrtheb
Copy link
Collaborator Author

mrtheb commented Feb 15, 2014

@rdiomar (or anyone else interested) let me know what you think of my latest changes. I don't have a lot of time on hand but this week-end would be a good time for me to solve a few pending issues.

cheers :-)

# client loads metadata at init
client = KafkaClient(host='broker_1', port=4567)
self.assertItemsEqual({
TopicAndPartition('topic_1', 0): brokers[0],
Copy link
Owner

Choose a reason for hiding this comment

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

should this be brokers[1] based on:

topics['topic_1'] = { 0: PartitionMetadata('topic_1', 0, 1, [1, 2], [1, 2]) }

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Woah, great catch! incoming fix... I am using the wrong assertion which lead me to believe the test was right. The downsides of unit tests.

mrtheb and others added 3 commits March 17, 2014 15:43
@wizzat
Copy link
Collaborator

wizzat commented Mar 20, 2014

I like this change. I also believe it should be merged soon because it looks like there are many pull requests that attempt to address the same problem, less effectively.

@rdiomar
Copy link
Collaborator

rdiomar commented Mar 20, 2014

Sorry for the wait, been super busy. I'll take another look at it soon if no one else does

dpkp added a commit that referenced this pull request Mar 22, 2014
TopicAndPartition fix when partition has no leader = -1
@dpkp dpkp merged commit e937e3f into dpkp:master Mar 22, 2014
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.

5 participants