MINOR: Fixes version lookup exception.#748
Conversation
|
Thanks for the PR. Could you please add a test too? |
|
Test added. Let me know if you want any additional tests. |
|
LGTM (assuming that tests pass). |
There was a problem hiding this comment.
Instead of using length of the versions list, would it make sense to check if the value is greater than the latest version?
There was a problem hiding this comment.
I don't have the full source open in front of me, is there a convenient getter for latest version available already? As far as performance, I believe an array length check is about as fast as it gets short of a constant value. For readability though I think version > versions.latest would be more clear if that is an available thing.
There was a problem hiding this comment.
This class, ProtoUtils, has public static short latestVersion(int apiKey)
There was a problem hiding this comment.
That seems like a reasonable course of action:
if (version < 0 || version > latestVersion(apiKey) {
throw ...
}I'll try to make that change this evening.
|
Can you change the title of the PR to include "MINOR: "? Just a few small comments otherwise it looks good. |
Simple off-by-one error.
|
All outstanding issues addressed and rebased on latest trunk. |
|
LGTM |
|
@ewencp maybe you could review this simple fix? |
|
Hmm, seems like now we're doing a duplicate check on |
|
@ewencp Yeah, I noticed that when I switched over to using the |
|
@Zoltu Sure, that makes sense. LGTM. |
With 6f81bb1 merged, we can now use c4.xlarge instances with our system tests, which are much more reliable for spot than m3.xlarge.
Given a schema with 2 versions (0 and 1), if you pass in a version of
2you will get anOutOfBoundsExceptioninstead of anIllegalArgumentException.This fixes the problem by changing the check from
>to>=, which will now return true in the given scenario.