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 hard limit for FastSerdeCache #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wxn225
Copy link
Contributor

@wxn225 wxn225 commented Jul 24, 2020

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2020

Codecov Report

Merging #82 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #82   +/-   ##
=========================================
  Coverage     53.52%   53.52%           
  Complexity      275      275           
=========================================
  Files            39       39           
  Lines          1659     1659           
  Branches        206      206           
=========================================
  Hits            888      888           
  Misses          689      689           
  Partials         82       82           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce0f422...36419bd. Read the comment docs.

@volauvent
Copy link
Collaborator

LGMT. Thanks

Copy link
Collaborator

@gaojieliu gaojieliu left a comment

Choose a reason for hiding this comment

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

Left some minor comments, and look good overall.

}
this.generatedSerDesNum.incrementAndGet();
} catch (Exception e) {
LOGGER.error("Fast serdes class generation failed");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we print out the full error stacktrace here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The exceptions are handled in other functions. So a stack trace here may not provide any useful information.

} else if (this.generatedSerDesNum.get() > this.generatedFastSerDesLimit) {
LOGGER.debug("Generated serdes number {}, with fast serdes limit set to {}", this.generatedSerDesNum.get(), this.generatedFastSerDesLimit);
}
this.generatedSerDesNum.incrementAndGet();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Race condition could happen here since the check and update are happening in different places.
I don't think it is a big concern considering the default thread pool size is 2, so in the worst scenario, the total number of the generated classes could be one more than the specified limit.
But it is good to call it out here, and we need to use AtomicInteger here since there is no difference from an Integer according to the actual usage.

@wxn225 wxn225 force-pushed the feature/addLimitForCache branch from 8464663 to 36419bd Compare July 28, 2020 21:20
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