-
Notifications
You must be signed in to change notification settings - Fork 36
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
use fixed partition instead of random partition in Audit client library #80
Conversation
...er-commons/src/main/java/com/pinterest/singer/loggingaudit/client/AuditEventKafkaSender.java
Outdated
Show resolved
Hide resolved
...er-commons/src/main/java/com/pinterest/singer/loggingaudit/client/AuditEventKafkaSender.java
Outdated
Show resolved
Hide resolved
@@ -232,13 +255,13 @@ public void run() { | |||
while (!cancelled.get()) { | |||
try { | |||
refreshPartitionIfNeeded(); | |||
resetDefaultPartitionIfNeeded(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't resetDefaultPartition be called within refreshPartition? Partition Id setting can be done in one method instead of two.
Also setting valid partitionId should only be done during refresh interval checks for efficiency reasons else resetDefaultPartitionIfNeeded
method will unnecessarily run the same logic again.
f0f885c
to
10feb1a
Compare
updated the PR |
resetCurrentPartitionIdIfNeeded() is called within refreshPartitionIfNeeded(). it will update currentPartitionId as long as it is in badPartitions set. If there is no available partitions, i.e. partitionInfoList is empty, then currentPartitionId will be set as -1. |
… currentPartitionId of the audit_event topic to send audit events. This reduces the number of TCP connections from audit client to Kafka cluster hosting the auditi_event topic. currentPartitionId is updated if it is in badPartitions set.
Summary: pinterest#80 pinterest#81 pinterest#82 Test Plan: on devapp mvn clean package Reviewers: vhashemian, O913 LoggingSOX, ambudsharma Reviewed By: vhashemian, O913 LoggingSOX JIRA Issue(s): LP-4635 Differential Revision: https://phabricator.pinadmin.com/D605941
Instead of choose random partition, AuditEventKafkaSender chooses fixed partition of the audit_event topic to send audit events. This reduces the number of TCP connections from audit client to Kafka cluster hosting the auditi_event topic.
currentPartitionId is updated if it is in badPartitions set.