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

Fix thread safety issue in consistency pipeline #775

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jbrooks-stripe
Copy link
Collaborator

@jbrooks-stripe jbrooks-stripe commented Jun 15, 2024

Summary

This changes things such that a new instance of the AvroCodec is used instead of re-using the same one across requests.

Why / Goal

To log feature values for the consistency pipeline, we use AvroCodec to encode and hash keys, but the Avro encoding here is not thread safe.

Test Plan

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested

Checklist

  • Documentation update

Reviewers

@jbrooks-stripe jbrooks-stripe marked this pull request as ready for review June 15, 2024 22:34
@jbrooks-stripe jbrooks-stripe force-pushed the jbrooks-consistency-thread-safety branch from eb19af5 to d24a7b6 Compare June 20, 2024 14:39
@@ -310,6 +308,12 @@ class Fetcher(val kvStore: KVStore,
val loggingTry: Try[Unit] = joinCodecTry.map(codec => {
val metaData = codec.conf.join.metaData
val samplePercent = if (metaData.isSetSamplePercent) metaData.getSamplePercent else 0

// Exit early if sample percent is 0
if (samplePercent == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

thank you.

Copy link
Collaborator

@pengyu-hou pengyu-hou left a comment

Choose a reason for hiding this comment

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

LGTM

@hzding621
Copy link
Collaborator

Ah missed this, I will fix it in #857!

hzding621 pushed a commit that referenced this pull request Oct 5, 2024
@pengyu-hou
Copy link
Collaborator

Ah missed this, I will fix it in #857!

Thanks @hzding621. We can close this PR after yours is merged.

hzding621 added a commit that referenced this pull request Oct 7, 2024
* make logging codec thread safe

* cherry-pick #775

---------

Co-authored-by: Haozhen Ding <[email protected]>
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.

4 participants