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

Bug fix: reset primary key count to 0 when table is deleted #12169

Merged
merged 1 commit into from Dec 19, 2023

Conversation

KKcorps
Copy link
Contributor

@KKcorps KKcorps commented Dec 18, 2023

We made change in the Table deletion flow to not remove segments from the upsert metadata manager and directly close it to save time.

However, due to this change, we run into a metric mismatch issue, where the primary key count still shows up as the last updated one instead of 0 or NULL in dashboards.

The fix is to set this metric to 0 explicitly when the metadata manager is closed.

This can be verified in the following way:

  1. Download prometheus javagent https://repo.maven.apache.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.20.0/jmx_prometheus_javaagent-0.20.0.jar

  2. Run UpsertQuickstart with the following VM options -ea -javaagent:jmx_prometheus_javaagent-0.20.0.jar=9021:$PINOT_GIT_DIR/docker/images/pinot/etc/jmx_prometheus_javaagent/configs/server.yml

  3. Run jconsole and connect to quickstart VM

  4. Check the metric "org.apache.pinot.common.metrics":type="ServerMetrics",name="pinot.server.upsertPrimaryKeysCount.upsertMeetupRsvp_REALTIME.0"

  5. Delete the table and check the metric again.

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (aa834f4) 61.63% compared to head (89e4c5c) 61.61%.
Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12169      +/-   ##
============================================
- Coverage     61.63%   61.61%   -0.02%     
  Complexity     1152     1152              
============================================
  Files          2407     2407              
  Lines        130888   130915      +27     
  Branches      20220    20225       +5     
============================================
- Hits          80670    80662       -8     
- Misses        44336    44367      +31     
- Partials       5882     5886       +4     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (ø)
integration <0.01% <0.00%> (ø)
integration1 <0.01% <0.00%> (ø)
integration2 0.00% <0.00%> (ø)
java-11 61.58% <100.00%> (+0.02%) ⬆️
java-21 61.48% <100.00%> (-0.03%) ⬇️
skip-bytebuffers-false 61.60% <100.00%> (-0.02%) ⬇️
skip-bytebuffers-true 61.46% <100.00%> (-0.01%) ⬇️
temurin 61.61% <100.00%> (-0.02%) ⬇️
unittests 61.60% <100.00%> (-0.02%) ⬇️
unittests1 46.66% <0.00%> (-0.01%) ⬇️
unittests2 27.68% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +775 to +779
_serverMetrics.setValueOfPartitionGauge(_tableNameWithType, _partitionId, ServerGauge.UPSERT_PRIMARY_KEYS_COUNT,
0L);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we do this during stop() instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we want to finish all operations then reset the gauge, so here should be the right place

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest adding some comments explaining why we reset the gauge here

Comment on lines +775 to +779
_serverMetrics.setValueOfPartitionGauge(_tableNameWithType, _partitionId, ServerGauge.UPSERT_PRIMARY_KEYS_COUNT,
0L);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest adding some comments explaining why we reset the gauge here

@KKcorps KKcorps merged commit f0b78b4 into apache:master Dec 19, 2023
19 checks passed
saurabhd336 pushed a commit to saurabhd336/pinot that referenced this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants