-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix get schema version in HttpLookupService. #6193
Conversation
@@ -176,5 +176,12 @@ public void close() throws Exception { | |||
httpClient.close(); | |||
} | |||
|
|||
private long bytesToLong(byte[] bytes) { | |||
schemaVersionConvertBuffer.clear(); | |||
schemaVersionConvertBuffer.put(bytes, 0, bytes.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. this would result in copying memory. and it is not thread-safe.
I would suggest just using ByteBuffer.wrap(bytes)
to get a ByteBuffer and then read the long number.
@sijie I have addressed your comment, please take a look, thanks. |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
c9f0b74
to
8eb0790
Compare
/pulsarbot run-failure-checks |
…' into fix_get_schema_by_version
### Motivation Fix get schema version in HttpLookupService. The com.yahoo.sketches.Util.bytesToLong method need to flip the byte[]. Otherwise, will get a wrong long value. So use ByteBuffer to convert byte[] version to long. This issue will happens when users use http protocol client and multiple version schemas. ### Verifying this change New tests added for HttpLookupService and BinaryLookupService.
### Motivation Fix get schema version in HttpLookupService. The com.yahoo.sketches.Util.bytesToLong method need to flip the byte[]. Otherwise, will get a wrong long value. So use ByteBuffer to convert byte[] version to long. This issue will happens when users use http protocol client and multiple version schemas. ### Verifying this change New tests added for HttpLookupService and BinaryLookupService. (cherry picked from commit 44dd412)
### Motivation Fix get schema version in HttpLookupService. The com.yahoo.sketches.Util.bytesToLong method need to flip the byte[]. Otherwise, will get a wrong long value. So use ByteBuffer to convert byte[] version to long. This issue will happens when users use http protocol client and multiple version schemas. ### Verifying this change New tests added for HttpLookupService and BinaryLookupService. (cherry picked from commit 44dd412)
### Motivation Fix get schema version in HttpLookupService. The com.yahoo.sketches.Util.bytesToLong method need to flip the byte[]. Otherwise, will get a wrong long value. So use ByteBuffer to convert byte[] version to long. This issue will happens when users use http protocol client and multiple version schemas. ### Verifying this change New tests added for HttpLookupService and BinaryLookupService. (cherry picked from commit 44dd412)
### Motivation Fix get schema version in HttpLookupService. The com.yahoo.sketches.Util.bytesToLong method need to flip the byte[]. Otherwise, will get a wrong long value. So use ByteBuffer to convert byte[] version to long. This issue will happens when users use http protocol client and multiple version schemas. ### Verifying this change New tests added for HttpLookupService and BinaryLookupService.
Motivation
Fix get schema version in HttpLookupService. The com.yahoo.sketches.Util.bytesToLong method need to flip the byte[]. Otherwise, will get a wrong long value. So use ByteBuffer to convert byte[] version to long.
This issue will happens when users use http protocol client and multiple version schemas.
Verifying this change
New tests added for HttpLookupService and BinaryLookupService.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation