mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Update comments for methods that require a lock
Signed-off-by: Lukasz Mierzwa <l.mierzwa@gmail.com>
This commit is contained in:
parent
a1740cd2e7
commit
e3728122b2
|
@ -1368,6 +1368,7 @@ func (db *DB) CompactOOOHead(ctx context.Context) error {
|
||||||
// Callback for testing.
|
// Callback for testing.
|
||||||
var compactOOOHeadTestingCallback func()
|
var compactOOOHeadTestingCallback func()
|
||||||
|
|
||||||
|
// The db.cmtx mutex should be held before calling this method.
|
||||||
func (db *DB) compactOOOHead(ctx context.Context) error {
|
func (db *DB) compactOOOHead(ctx context.Context) error {
|
||||||
if !db.oooWasEnabled.Load() {
|
if !db.oooWasEnabled.Load() {
|
||||||
return nil
|
return nil
|
||||||
|
@ -1422,6 +1423,7 @@ func (db *DB) compactOOOHead(ctx context.Context) error {
|
||||||
|
|
||||||
// compactOOO creates a new block per possible block range in the compactor's directory from the OOO Head given.
|
// compactOOO creates a new block per possible block range in the compactor's directory from the OOO Head given.
|
||||||
// Each ULID in the result corresponds to a block in a unique time range.
|
// Each ULID in the result corresponds to a block in a unique time range.
|
||||||
|
// The db.cmtx mutex should be held before calling this method.
|
||||||
func (db *DB) compactOOO(dest string, oooHead *OOOCompactionHead) (_ []ulid.ULID, err error) {
|
func (db *DB) compactOOO(dest string, oooHead *OOOCompactionHead) (_ []ulid.ULID, err error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
|
@ -1466,7 +1468,7 @@ func (db *DB) compactOOO(dest string, oooHead *OOOCompactionHead) (_ []ulid.ULID
|
||||||
}
|
}
|
||||||
|
|
||||||
// compactHead compacts the given RangeHead.
|
// compactHead compacts the given RangeHead.
|
||||||
// The compaction mutex should be held before calling this method.
|
// The db.cmtx should be held before calling this method.
|
||||||
func (db *DB) compactHead(head *RangeHead) error {
|
func (db *DB) compactHead(head *RangeHead) error {
|
||||||
uids, err := db.compactor.Write(db.dir, head, head.MinTime(), head.BlockMaxTime(), nil)
|
uids, err := db.compactor.Write(db.dir, head, head.MinTime(), head.BlockMaxTime(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1492,7 +1494,7 @@ func (db *DB) compactHead(head *RangeHead) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// compactBlocks compacts all the eligible on-disk blocks.
|
// compactBlocks compacts all the eligible on-disk blocks.
|
||||||
// The compaction mutex should be held before calling this method.
|
// The db.cmtx should be held before calling this method.
|
||||||
func (db *DB) compactBlocks() (err error) {
|
func (db *DB) compactBlocks() (err error) {
|
||||||
// Check for compactions of multiple blocks.
|
// Check for compactions of multiple blocks.
|
||||||
for {
|
for {
|
||||||
|
@ -1549,6 +1551,7 @@ func getBlock(allBlocks []*Block, id ulid.ULID) (*Block, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload reloads blocks and truncates the head and its WAL.
|
// reload reloads blocks and truncates the head and its WAL.
|
||||||
|
// The db.cmtx mutex should be held before calling this method.
|
||||||
func (db *DB) reload() error {
|
func (db *DB) reload() error {
|
||||||
if err := db.reloadBlocks(); err != nil {
|
if err := db.reloadBlocks(); err != nil {
|
||||||
return fmt.Errorf("reloadBlocks: %w", err)
|
return fmt.Errorf("reloadBlocks: %w", err)
|
||||||
|
@ -1565,6 +1568,7 @@ func (db *DB) reload() error {
|
||||||
|
|
||||||
// reloadBlocks reloads blocks without touching head.
|
// reloadBlocks reloads blocks without touching head.
|
||||||
// Blocks that are obsolete due to replacement or retention will be deleted.
|
// Blocks that are obsolete due to replacement or retention will be deleted.
|
||||||
|
// The db.cmtx mutex should be held before calling this method.
|
||||||
func (db *DB) reloadBlocks() (err error) {
|
func (db *DB) reloadBlocks() (err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue