GlueSync partition comparator false-positives on volatile metadata, causing OOM on large-partition tables
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with HiveToGluePartitionComparator.java, especially equals() and its partition, storage-descriptor, and SerDe parameter comparisons, then trace synchronizePartitions() and batchUpdatePartitions() in GluePartitionService.java. Verify which metadata fields cause identical partitions to compare differently and confirm that the completed change no longer creates unnecessary partition updates or reproduces the large-table memory failure.
Written by the indexing model from the issue text.
Description
Title: GlueSync partition comparator false-positives on volatile metadata, causing OOM on large-partition tables
Summary
HiveToGluePartitionComparator.equals() classifies functionally-identical Hive/Glue partitions as "different" due to unfiltered comparison of volatile/generated metadata, inflating partitionsToUpdate and causing an OutOfMemoryError during a manual gluesync CLI run on a large-partition table.
Observed failure
Manual CLI backfill (gluesync --database-name-regex "^<database>$" --table-name-regex ".*") crashed:
INFO [main] com.expediagroup.apiary.extensions.gluesync.cli.GlueSyncCli - Syncing table: <table> in database: <database>
INFO [main] com.expediagroup.apiary.extensions.gluesync.listener.ApiaryGlueSync - <table> table already exists in glue, updating....
Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.expediagroup.apiary.extensions.gluesync.listener.service.HiveToGlueTransformer.extractColumns(HiveToGlueTransformer.java:174)
at com.expediagroup.apiary.extensions.gluesync.listener.service.HiveToGlueTransformer.transformPartition(HiveToGlueTransformer.java:117)
at com.expediagroup.apiary.extensions.gluesync.listener.service.GluePartitionService.batchUpdatePartitions(GluePartitionService.java:389)
at com.expediagroup.apiary.extensions.gluesync.listener.service.GluePartitionService.synchronizePartitions(GluePartitionService.java:322)
at com.expediagroup.apiary.extensions.gluesync.cli.GlueSyncCli.syncTable(GlueSyncCli.java:171)
at com.expediagroup.apiary.extensions.gluesync.cli.GlueSyncCli.syncAll(GlueSyncCli.java:127)
at com.expediagroup.apiary.extensions.gluesync.cli.GlueSyncCliParser.main(GlueSyncCliParser.java:80)
Manually verified afterward: table schema matches between Hive and Glue, and partition count matches between Hive and Glue. The underlying data has not diverged. This points to a comparator bug, not a real sync gap.
Root cause
HiveToGluePartitionComparator.equals() (hive-event-listeners/apiary-gluesync-listener/src/main/java/com/expediagroup/apiary/extensions/gluesync/listener/service/HiveToGluePartitionComparator.java:34-73):
- Unfiltered exact map equality on
parameters— at the partition level (line 57), storage-descriptor level (line 111), and SerDe level (line 162). No exclusion of volatile/generated keys such astransient_lastDdlTime,numRows,rawDataSize,totalSize,numFiles,COLUMN_STATS_ACCURATE. Any of these changing (which happens on almost every Hive touch) makesObjects.equals(...)returnfalsefor otherwise-identical partitions. - Exact
lastAccessTimeequality with zero tolerance (lines 61-64), likely compounded by a units bug — Hive'slastAccessTimeis epoch seconds, but the code doesnew Date(hiveLastAccess), which expects millis. Hive also updateslastAccessTimeon reads, so this field will differ across nearly every partition regardless of the units bug.
Because nearly every partition therefore gets misclassified as "needs update," GluePartitionService.synchronizePartitions (GluePartitionService.java:274-339) builds an oversized partitionsToUpdate map, and batchUpdatePartitions (:377-406) re-transforms every one of them (rebuilding columns/sort-orders/SerDe info from scratch per partition, with no caching) before batching — for a table with a large partition count, this exhausts the CLI's heap.
Suggested fix
- Exclude known-volatile keys (
transient_lastDdlTime, stats fields) from theparametersequality check at all three levels (partition, storage descriptor, SerDe), or compare only a defined allowlist of semantically-relevant keys. - Fix (or remove) the
lastAccessTimecomparison — it is not schema/data-relevant and appears to have a seconds/millis conversion bug. - Consider follow-up:
synchronizePartitions/batchUpdatePartitionshold the full partition diff in memory and re-transform every partition from scratch with no caching (no reuse between the equality check and the eventualtransformPartitioncall, andGluePartitionService.update()callstransformPartitiontwice for the same partition). Even with the comparator fixed, this remains a scaling risk for genuinely large partition counts and may be worth a follow-up streaming/caching pass.
Environment
- A Hive Metastore-backed environment with Glue sync enabled, on a table with a large partition count
- Manual CLI invocation, not the embedded listener's live-event path
- Dominant language
- Java
- Stars
- 13
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ExpediaGroup/apiary-extensions
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in ExpediaGroup/apiary-extensions
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
avaje/avaje-metrics#142 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RamazanKara/nightjar#299 ·
-
Support emergency=access_point (POI type and rendering)Possibly taken @julenepj claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
osmandapp/OsmAnd#27424 · 1 comment ·
Maintainers usually reply within 1 day
-
Link not working in the feedback concerning String.format() in exercise 'Tim from Marketing'Possibly taken @LaibaMunir016 claimed this 1 day ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
exercism/java-analyzer#379 · 1 comment ·