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

use fixed partition instead of random partition in Audit client library #80

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

zzhhhzz
Copy link
Contributor

@zzhhhzz zzhhhzz commented Aug 20, 2020

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.

@zzhhhzz zzhhhzz requested a review from ambud August 20, 2020 07:57
@@ -232,13 +255,13 @@ public void run() {
while (!cancelled.get()) {
try {
refreshPartitionIfNeeded();
resetDefaultPartitionIfNeeded();
Copy link
Contributor

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.

@zzhhhzz zzhhhzz force-pushed the audit-p branch 3 times, most recently from f0f885c to 10feb1a Compare August 20, 2020 19:12
@zzhhhzz
Copy link
Contributor Author

zzhhhzz commented Aug 20, 2020

updated the PR

@zzhhhzz
Copy link
Contributor Author

zzhhhzz commented Aug 21, 2020

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.
@zzhhhzz zzhhhzz changed the title use default partition instead of random partition in Audit client library use fixed partition instead of random partition in Audit client library Aug 21, 2020
@zzhhhzz zzhhhzz requested a review from ambud August 21, 2020 05:10
@ambud ambud merged commit a652caa into pinterest:master Aug 21, 2020
kabochya pushed a commit to kabochya/singer that referenced this pull request Feb 17, 2021
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
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