Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kafka compression type for Kafka Metastore Listener #98

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 7.3.7 - 2023-07-19
### Added
- `compression.type` [Kafka property](https://docs.confluent.io/platform/current/installation/configuration/broker-configs.html#compression-type) in `kafka-metastore-listener`.

## 7.3.6 - 2022-11-14
### Fixed
- `apiary-gluesync-listener` when getting null `SortOrder` in Hive & Iceberg tables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.BOOTSTRAP_SERVERS;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.BUFFER_MEMORY;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.CLIENT_ID;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.COMPRESSION_TYPE;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.LINGER_MS;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.RETRIES;
Expand Down Expand Up @@ -77,6 +78,7 @@ static Properties kafkaProperties(Configuration conf) {
props.put(BATCH_SIZE.unprefixedKey(), intProperty(conf, BATCH_SIZE));
props.put(LINGER_MS.unprefixedKey(), longProperty(conf, LINGER_MS));
props.put(BUFFER_MEMORY.unprefixedKey(), longProperty(conf, BUFFER_MEMORY));
props.put(COMPRESSION_TYPE.unprefixedKey(), stringProperty(conf, COMPRESSION_TYPE));
props.put("key.serializer", "org.apache.kafka.common.serialization.LongSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
return props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public enum KafkaProducerProperty implements Property {
BATCH_SIZE("batch.size", 16384),
LINGER_MS("linger.ms", 1L),
BUFFER_MEMORY("buffer.memory", 33554432L),
SERDE_CLASS("serde.class", JsonMetaStoreEventSerDe.class.getName());
SERDE_CLASS("serde.class", JsonMetaStoreEventSerDe.class.getName()),
COMPRESSION_TYPE("compression.type", "producer");
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the default right we don't really need this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

nevermind this is just to set the default again and allow for overrides in hive-site.xml


private static final String HADOOP_CONF_PREFIX = "com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.BOOTSTRAP_SERVERS;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.BUFFER_MEMORY;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.CLIENT_ID;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.COMPRESSION_TYPE;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.LINGER_MS;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION;
import static com.expediagroup.apiary.extensions.events.metastore.kafka.messaging.KafkaProducerProperty.RETRIES;
Expand All @@ -40,7 +41,7 @@ private static String prefixedKey(String key) {

@Test
public void numberOfProperties() {
assertThat(KafkaProducerProperty.values().length).isEqualTo(10);
assertThat(KafkaProducerProperty.values().length).isEqualTo(11);
}

@Test
Expand Down Expand Up @@ -115,4 +116,11 @@ public void serdeClass() {
assertThat(SERDE_CLASS.defaultValue()).isEqualTo(JsonMetaStoreEventSerDe.class.getName());
}

@Test
public void compressionType() {
assertThat(COMPRESSION_TYPE.unprefixedKey()).isEqualTo("compression.type");
assertThat(COMPRESSION_TYPE.key()).isEqualTo(prefixedKey("compression.type"));
assertThat(COMPRESSION_TYPE.defaultValue()).isEqualTo("producer");
}

}
Loading