Revert "Use private Thrift members (#6430)"#6455
Conversation
This reverts commit bdcd798.
|
Here's a good example of the impact of this change. The current version of accumulo/core/src/main/java/org/apache/accumulo/core/data/Key.java Lines 687 to 707 in 1234b63 The same code prior to #6430 looks like: accumulo/core/src/main/java/org/apache/accumulo/core/data/Key.java Lines 688 to 707 in 1852dbf The calls to |
|
I'm currently looking into alternatives. I think the private thrift members is a nice change, but I also recognize the problem with the extra protective copy. Please hold on merging this for now, while I investigate. |
|
I created #6457 as an alternative to reverting all this. It will remove the unwanted protective copies that are likely causing the performance problem. |
|
GarbageCollectorIT is now passing again with these changes. Will probably end up closing this in favor of #6457 though if that also fixes the issue. |
I saw it fail due to the same timeout on the first pass, and then pass on the second attempt. I think that test is flaky already, and a revert will not entirely fix the issue. It's possible the changes in #6430 contributed to a performance issue, but I do not think the performance of that particular test is a reliable enough metric to determine whether #6430 is a good change or not. Even though I am reluctant to revert #6430, for fear of reversing progress, I do think there's more that probably needs to be done here. As it turns out, the getters that return a byte array is not even the code path that creates redundant protective copies. It's the versions of the methods that look like So really, we should be avoiding the I have abandoned #6457 |
|
My next attempt to address the issue is #6459 |
I don't think that's correct. It appears to me that the code currently in main performs a copy for both calls to The call to Your change in #6457 to use the |
|
https://issues.apache.org/jira/browse/THRIFT-4555 is the original issue where |
|
I was focused on the behavior of the rightSize method and overlooked that the getRow method would call the setter, where it does another protective copy. This is frustrating. The setter should have a protective copy, but the getRow method shouldn't be calling it. It should be doing some internal setRow instead. The unsafe_binaries option is nice, but we really only should have unsafe access directly via the bufferFor methods; we still want protective copies on the setters and constructor. I think we'll need to make a fix upstream, and am in favor of reverting until it's fixed upstream. The alternative to reverting at this point seems to either modify the code after it is generated, to avoid calling the setter in the getter, or to strip out the protective copy only from the bufferFor methods without using the unsafe_binaries option, or to use the unsafe_binaries option and make sure we're doing our own protective copies in calling code everywhere we call the setter or constructor. None of those seem like good options, so hopefully it's not so bad to push a fix upstream. |
|
I updated #6459 to work around the apparent bug in Thrift that calls the public API setter and making an unnecessary copy when the array is requested from the getter. |
GarbageCollectorIT.gcLotsOfCandidatesIThas consistently failed on a server since #6430 was merged. The failure happens when the garbage collector process is started with 32 MB of memory. This PR branch exists so that I can test this on that server.This reverts commit bdcd798.