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

lib/storage: pre-create timeseries before indexDB rotation #4652

Merged
merged 6 commits into from Jul 22, 2023
Merged

Conversation

f41gh7
Copy link
Contributor

@f41gh7 f41gh7 commented Jul 17, 2023

during an hour before indexDB rotation start creating records at the next indexDB it must improve performance during switch for the next indexDB and remove ingestion issues. Since there is no need for creation new index records for timeseries already ingested into current indexDB #4563

@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Patch coverage: 62.04% and project coverage change: +1.10 🎉

Comparison is base (866b150) 60.97% compared to head (d72bbd3) 62.07%.

❗ Current head d72bbd3 differs from pull request most recent head 3a3647e. Consider uploading reports for the commit 3a3647e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4652      +/-   ##
==========================================
+ Coverage   60.97%   62.07%   +1.10%     
==========================================
  Files         385      374      -11     
  Lines       71760    69450    -2310     
==========================================
- Hits        43755    43112     -643     
+ Misses      25604    24064    -1540     
+ Partials     2401     2274     -127     
Impacted Files Coverage Δ
lib/storage/storage.go 70.41% <60.30%> (-1.38%) ⬇️
lib/storage/index_db.go 73.07% <100.00%> (+0.06%) ⬆️

... and 41 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

during an hour before indexDB rotation start creating records at the next indexDB
it must improve performance during switch for the next indexDB and remove ingestion issues.
Since there is no need for creation new index records for timeseries already ingested into current indexDB
#4563
@f41gh7 f41gh7 marked this pull request as ready for review July 18, 2023 15:13
@f41gh7 f41gh7 requested review from hagen1778 and valyala July 18, 2023 15:13
- Document the change at docs/CHAGNELOG.md
- Move back various caches from indexDB to Storage. This makes the change less intrusive.
  The dateMetricIDCache now takes into account indexDB generation, so it stores (date, metricID)
  entries for both the current and the next indexDB.
- Consolidate the code responsible for idbNext pre-filling into prefillNextIndexDB() function.
  This improves code readability and maintainability a bit.
- Rewrite and simplify the code responsible for calculating the next retention timestamp.
  Add various tests for corner cases of this code.
- Remove indexdb pre-filling from RegisterMetricNames() function, since this function is rarely called.
  It is OK to add indexdb entries on demand in this function. This simplifies the code.

Updates #1401
@valyala valyala merged commit 544fba6 into master Jul 22, 2023
3 checks passed
@valyala valyala deleted the gh-4563 branch July 22, 2023 22:20
@valyala
Copy link
Collaborator

valyala commented Jul 22, 2023

@f41gh7 , thanks for the pull request!

valyala added a commit that referenced this pull request Jul 22, 2023
* lib/storage: pre-create timeseries before indexDB rotation
during an hour before indexDB rotation start creating records at the next indexDB
it must improve performance during switch for the next indexDB and remove ingestion issues.
Since there is no need for creation new index records for timeseries already ingested into current indexDB
#4563

* lib/storage: further work on indexdb rotation optimization

- Document the change at docs/CHAGNELOG.md
- Move back various caches from indexDB to Storage. This makes the change less intrusive.
  The dateMetricIDCache now takes into account indexDB generation, so it stores (date, metricID)
  entries for both the current and the next indexDB.
- Consolidate the code responsible for idbNext pre-filling into prefillNextIndexDB() function.
  This improves code readability and maintainability a bit.
- Rewrite and simplify the code responsible for calculating the next retention timestamp.
  Add various tests for corner cases of this code.
- Remove indexdb pre-filling from RegisterMetricNames() function, since this function is rarely called.
  It is OK to add indexdb entries on demand in this function. This simplifies the code.

Updates #1401

* docs/CHANGELOG.md: refer to #4563

---------

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
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.

None yet

2 participants