Skip to content

Revert "Use private Thrift members (#6430)"#6455

Open
dlmarion wants to merge 1 commit into
apache:mainfrom
dlmarion:revert-thrift-private-members
Open

Revert "Use private Thrift members (#6430)"#6455
dlmarion wants to merge 1 commit into
apache:mainfrom
dlmarion:revert-thrift-private-members

Conversation

@dlmarion

Copy link
Copy Markdown
Contributor

GarbageCollectorIT.gcLotsOfCandidatesIT has 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.

@dlmarion dlmarion self-assigned this Jun 30, 2026
@dlmarion

Copy link
Copy Markdown
Contributor Author

I think I found a real issue with #6430 and we might want to actually revert it. The original code would access a ByteBuffer directly. #6430 made those member variables private and the methods for accessing the ByteBuffer's make a copy before returning them.

@dlmarion

Copy link
Copy Markdown
Contributor Author

Here's a good example of the impact of this change.

ArrayList<Entry<Key,Value>> entries = new ArrayList<>(scanResult.getResults().size());
for (TKeyValue kv : scanResult.getResults()) {
entries.add(new SimpleImmutableEntry<>(new Key(kv.getKey()), new Value(kv.getValue())));
}

The current version of Key(TKey) looks like:

public Key(TKey tkey) {
this.row = ByteBufferUtil.toBytes(tkey.bufferForRow());
this.colFamily = ByteBufferUtil.toBytes(tkey.bufferForColFamily());
this.colQualifier = ByteBufferUtil.toBytes(tkey.bufferForColQualifier());
this.colVisibility = ByteBufferUtil.toBytes(tkey.bufferForColVisibility());
this.timestamp = tkey.getTimestamp();
this.deleted = false;
if (row == null) {
throw new IllegalArgumentException("null row");
}
if (colFamily == null) {
throw new IllegalArgumentException("null column family");
}
if (colQualifier == null) {
throw new IllegalArgumentException("null column qualifier");
}
if (colVisibility == null) {
throw new IllegalArgumentException("null column visibility");
}
}

The same code prior to #6430 looks like:

public Key(TKey tkey) {
this.row = toBytes(tkey.row);
this.colFamily = toBytes(tkey.colFamily);
this.colQualifier = toBytes(tkey.colQualifier);
this.colVisibility = toBytes(tkey.colVisibility);
this.timestamp = tkey.timestamp;
this.deleted = false;
if (row == null) {
throw new IllegalArgumentException("null row");
}
if (colFamily == null) {
throw new IllegalArgumentException("null column family");
}
if (colQualifier == null) {
throw new IllegalArgumentException("null column qualifier");
}
if (colVisibility == null) {
throw new IllegalArgumentException("null column visibility");
}

The calls to bufferForX create a copy of the ByteBuffer.

@dlmarion dlmarion marked this pull request as ready for review June 30, 2026 18:48
@dlmarion dlmarion requested review from DomGarguilo and ctubbsii June 30, 2026 18:49
@ctubbsii

Copy link
Copy Markdown
Member

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.

@ctubbsii

Copy link
Copy Markdown
Member

I created #6457 as an alternative to reverting all this. It will remove the unwanted protective copies that are likely causing the performance problem.

@ctubbsii ctubbsii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd prefer to resolve the issue with #6457 instead, if works.

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.

3 participants