-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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: Keep blocks referenced by newer metas #13614
fix: Keep blocks referenced by newer metas #13614
Conversation
@@ -52,7 +52,7 @@ func (p *processor) processTasks(ctx context.Context, tasks []Task) error { | |||
return nil | |||
} | |||
|
|||
func (p *processor) processTasksForDay(ctx context.Context, tenant string, day config.DayTime, tasks []Task) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Go Lint CI was complaining so I fixed these here even though they are unrelated to the PR
5d75907
to
696f798
Compare
696f798
to
6b0da35
Compare
// Blocks are sorted within a meta, so we can find it with binary search | ||
for _, meta := range metas { | ||
// Search for the first block whose bound is >= than the target block min bound. | ||
i := sort.Search(len(meta.Blocks), func(i int) bool { | ||
return meta.Blocks[i].Cmp(uint64(block.Bounds.Max)) <= v1.Overlap | ||
}) | ||
|
||
if i < len(meta.Blocks) && meta.Blocks[i] == block { | ||
return true | ||
} | ||
} | ||
|
||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how many blocks are usually in a meta? it could be faster to just do a for loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d leave the bin search:
- If there are many blocks --> works better
- If there are not that many, I don’t think there will be much difference moreover provided this is not on a critical path and is actually done after all the build process is done (or during the planning)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-13614-to-k212 origin/k212
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 784e7d562fedec7134c8ed4e2cee8ccb7049e271 When the conflicts are resolved, stage and commit the changes:
If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-13614-to-k212
# Create the PR body template
PR_BODY=$(gh pr view 13614 --json body --template 'Backport 784e7d562fedec7134c8ed4e2cee8ccb7049e271 from #13614{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title 'chore: [k212] fix: Keep blocks referenced by newer metas' --body-file - --label 'size/L' --label 'type/bug' --label 'feature/blooms' --label 'backport' --base k212 --milestone k212 --web Or, if you don't have the GitHub CLI installed (we recommend you install it!): # Push the branch to GitHub:
git push --set-upstream origin backport-13614-to-k212
# Create a pull request where the `base` branch is `k212` and the `compare`/`head` branch is `backport-13614-to-k212`.
# Remove the local backport branch
git switch main
git branch -D backport-13614-to-k212 |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-13614-to-k211 origin/k211
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 784e7d562fedec7134c8ed4e2cee8ccb7049e271 When the conflicts are resolved, stage and commit the changes:
If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-13614-to-k211
# Create the PR body template
PR_BODY=$(gh pr view 13614 --json body --template 'Backport 784e7d562fedec7134c8ed4e2cee8ccb7049e271 from #13614{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title 'chore: [k211] fix: Keep blocks referenced by newer metas' --body-file - --label 'size/L' --label 'type/bug' --label 'feature/blooms' --label 'backport' --base k211 --milestone k211 --web Or, if you don't have the GitHub CLI installed (we recommend you install it!): # Push the branch to GitHub:
git push --set-upstream origin backport-13614-to-k211
# Create a pull request where the `base` branch is `k211` and the `compare`/`head` branch is `backport-13614-to-k211`.
# Remove the local backport branch
git switch main
git branch -D backport-13614-to-k211 |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-13614-to-k212 origin/k212
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 784e7d562fedec7134c8ed4e2cee8ccb7049e271 When the conflicts are resolved, stage and commit the changes:
If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-13614-to-k212
# Create the PR body template
PR_BODY=$(gh pr view 13614 --json body --template 'Backport 784e7d562fedec7134c8ed4e2cee8ccb7049e271 from #13614{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title 'chore: [k212] fix: Keep blocks referenced by newer metas' --body-file - --label 'size/L' --label 'type/bug' --label 'feature/blooms' --label 'backport' --base k212 --milestone k212 --web Or, if you don't have the GitHub CLI installed (we recommend you install it!): # Push the branch to GitHub:
git push --set-upstream origin backport-13614-to-k212
# Create a pull request where the `base` branch is `k212` and the `compare`/`head` branch is `backport-13614-to-k212`.
# Remove the local backport branch
git switch main
git branch -D backport-13614-to-k212 |
(cherry picked from commit 784e7d5)
What this PR does / why we need it:
This PR prevents the planner from deleting blocks from a outdated meta that is still referenced by an up to date meta.
Which issue(s) this PR fixes:
Fixes #13612
Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR