ExpediaGroup / circus-train

Circus Train is a dataset replication tool that copies Hive tables between clusters and clouds.
Apache License 2.0
86 stars 15 forks source link

Use PartitionIterator for getPartition calls #215

Open patduin opened 3 years ago

patduin commented 3 years ago

Depending on the batch size given we're doing potentially large listPartition calls here: https://github.com/HotelsDotCom/circus-train/blob/main/circus-train-core/src/main/java/com/hotels/bdp/circustrain/core/HiveEndpoint.java#L152 and https://github.com/HotelsDotCom/circus-train/blob/main/circus-train-core/src/main/java/com/hotels/bdp/circustrain/core/HiveEndpoint.java#L154

We should use a partitionIterator: https://github.com/HotelsDotCom/hcommon-hive-metastore/blob/master/src/main/java/com/hotels/hcommon/hive/metastore/iterator/PartitionIterator.java if possible.

Benefit is that we'll be nicer to the Hive Metastore as calling getPartition with a very high number of will cause OOMs in the Metastore. Good rule of thumb is to try and not fetch more than 1000 partitions in one call.

Wether CT will fail trying to replicate 10000 partitions is another matter but at least we stop causing issues to the Metastore.