-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
IGNITE-20688 Fixed broken handles after binary object detached. #11272
Conversation
958161e
to
58a1649
Compare
@@ -179,6 +181,9 @@ | |||
|
|||
BinaryMetadataMoveLegacyFolderTest.class, | |||
BinaryContextPredefinedTypesTest.class, | |||
|
|||
RawBytesObjectReaderTest.class, | |||
CrossObjetReferenceSerializationTest.class |
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.
Let's add comma at the end of the line.
|
||
U.arrayCopy(arr, start, arr0, 0, len); | ||
CrossObjectReferenceDetector detector = new CrossObjectReferenceDetector(BinaryHeapInputStream.create(arr, start)); |
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.
Can we use information about handles here as an additional hint?
For example:
- Pass to this (or new one) method some parameter like
checkObjectReferences
- Only if this parameter is true analyze array by detector.
- Pass this parameter as false if handles is empty (if there are no handles, there can't be references to this handle)
In this case we can also revert changes to BinaryReaderExImpl.readObjectDetached
, since, for root binary object, handles will always be empty.
} | ||
|
||
/** */ | ||
public void readObject(BinaryOutputStream out) { |
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.
It's not a good name for this method (and following methods with BinaryOutputStream out
parameter), perhaps something like copyObject
is better.
|
||
if (isCrossObjRefDetected) { | ||
try (BinaryOutputStream out = new BinaryHeapOutputStream(2 * len)) { | ||
CrossObjectReferenceResolver resolver = new CrossObjectReferenceResolver(BinaryHeapInputStream.create(arr, start), out); |
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.
Reuse the same BinaryHeapInputStream
as for CrossObjectReferenceDetector
?
import org.apache.ignite.internal.binary.streams.BinaryOutputStream; | ||
|
||
/** */ | ||
public class RawBytesObjectReader implements BinaryPositionReadable { |
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.
...BinaryObjectReader
?
/** */ | ||
@RunWith(Parameterized.class) | ||
@WithSystemProperty(key = IGNITE_BINARY_SORT_OBJECT_FIELDS, value = "true") | ||
public class CrossObjetReferenceSerializationTest extends GridCommonAbstractTest { |
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.
Typo: CrossObjectReferenceSerializationTest
|
||
while (reader.position() < objDataEndPos) { | ||
if (findInNextObject()) { | ||
isFound = true; |
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.
Looks like is safe to return true;
here (we don't rely on reader.position anywhere after returning true by this method)
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
The Contribution Checklist
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summary
whereXXXX
- number of JIRA issue.(see the Maintainers list)
the
green visa
attached to the JIRA ticket (see TC.Bot: Check PR)Notes
If you need any help, please email [email protected] or ask anу advice on http://asf.slack.com #ignite channel.