Skip to content

[spark] Reduce driver memory usage when deserializing compact commit messages - #8897

Open
lilei1128 wants to merge 5 commits into
apache:masterfrom
lilei1128:optimize-spark-driver-memory
Open

[spark] Reduce driver memory usage when deserializing compact commit messages#8897
lilei1128 wants to merge 5 commits into
apache:masterfrom
lilei1128:optimize-spark-driver-memory

Conversation

@lilei1128

Copy link
Copy Markdown
Contributor

Purpose

Release serialized commit message byte arrays as they are deserialized to avoid
retaining both serialized and deserialized messages in driver memory.

Tests

No

@zhongyujiang zhongyujiang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. We applied the same fix in our internal fork, which reduced a lot of memory consumption during commits involving large tables.

}
}

private static List<CommitMessage> deserializeAndReleaseCommitMessages(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is actually releasing serialized bytes, not commit messages.

@lilei1128 lilei1128 Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! The deserialized commit messages are retained, while only the references to the serialized byte arrays are released. I’ll rename the method to deserializeCommitMessagesAndReleaseSerializedBytes to make this explicit.

@lilei1128

Copy link
Copy Markdown
Contributor Author

LGTM. We applied the same fix in our internal fork, which reduced a lot of memory consumption during commits involving large tables.

Thanks for taking a look!
Exactly, I ran into an issue where compacting a large table with tons of small files under tight resource limits was failing/OOMing. Glad to know this fix works well for your workloads as well!

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.

2 participants