[#1691] metabase: Move cheaper conditions to the front in ListWithCursor()
All checks were successful
DCO action / DCO (pull_request) Successful in 49s
Vulncheck / Vulncheck (pull_request) Successful in 1m16s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m22s
Build / Build Components (pull_request) Successful in 3m31s
Tests and linters / Tests with -race (pull_request) Successful in 7m12s
Tests and linters / Tests (pull_request) Successful in 10m32s
Tests and linters / Lint (pull_request) Successful in 10m37s
Tests and linters / Run gofumpt (pull_request) Successful in 10m26s
Tests and linters / Staticcheck (pull_request) Successful in 10m33s
Tests and linters / gopls check (pull_request) Successful in 4m38s

`objectLocked` call is expensive, it does IO. We may omit it if object
is not expired.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2025-03-20 15:28:14 +03:00
parent a49f0717b3
commit 8a5bff3587
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg

View file

@ -251,7 +251,7 @@ func selectNFromBucket(bkt *bbolt.Bucket, // main bucket
}
expEpoch, hasExpEpoch := hasExpirationEpoch(&o)
if !objectLocked(bkt.Tx(), cnt, obj) && hasExpEpoch && expEpoch < currEpoch {
if hasExpEpoch && expEpoch < currEpoch && !objectLocked(bkt.Tx(), cnt, obj) {
continue
}