Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"sync/atomic"
"time"

"github.com/cockroachdb/errors"
"github.com/cockroachdb/pebble/internal/base"
"github.com/cockroachdb/pebble/internal/invariants"
"github.com/cockroachdb/pebble/internal/metricsutil"
Expand Down Expand Up @@ -327,7 +328,7 @@ func (c *Handle) GetWithReadHandle(
// REQUIRES: value.refs() == 1
func (c *Handle) Set(fileNum base.DiskFileNum, offset uint64, value *Value) {
if n := value.refs(); n != 1 {
panic(fmt.Sprintf("pebble: Value has already been added to the cache: refs=%d", n))
panic(errors.AssertionFailedf("pebble: Value has already been added to the cache: refs=%d", n))
}
k := makeKey(c.id, fileNum, offset)
c.cache.getShard(k).set(k, value, false /*markAccessed*/)
Expand Down
4 changes: 2 additions & 2 deletions internal/cache/read_shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package cache

import (
"context"
"fmt"
"sync"
"time"

"github.com/cockroachdb/errors"
"github.com/cockroachdb/pebble/internal/invariants"
"github.com/cockroachdb/swiss"
)
Expand Down Expand Up @@ -295,7 +295,7 @@ func (e *readEntry) unrefAndTryRemoveFromMap() {

func (e *readEntry) setReadValue(v *Value) {
if n := v.refs(); n != 1 {
panic(fmt.Sprintf("pebble: Value has already been added to the cache: refs=%d", n))
panic(errors.AssertionFailedf("pebble: Value has already been added to the cache: refs=%d", n))
}
concurrentRequesters := false
e.mu.Lock()
Expand Down
3 changes: 2 additions & 1 deletion internal/cache/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"unsafe"

"github.com/cockroachdb/errors"
"github.com/cockroachdb/pebble/internal/buildtags"
"github.com/cockroachdb/pebble/internal/invariants"
"github.com/cockroachdb/pebble/internal/manual"
Expand Down Expand Up @@ -143,7 +144,7 @@ func (v *Value) Release() {
// Free. Do not call Free on a value that has been added to the cache.
func Free(v *Value) {
if n := v.refs(); n > 1 {
panic(fmt.Sprintf("pebble: Value has been added to the cache: refs=%d", n))
panic(errors.AssertionFailedf("pebble: Value has been added to the cache: refs=%d", n))
}
v.Release()
}