@@ -1368,6 +1368,7 @@ func (db *DB) CompactOOOHead(ctx context.Context) error {
13681368// Callback for testing.
13691369var compactOOOHeadTestingCallback func ()
13701370
1371+ // The db.cmtx mutex should be held before calling this method.
13711372func (db * DB ) compactOOOHead (ctx context.Context ) error {
13721373 if ! db .oooWasEnabled .Load () {
13731374 return nil
@@ -1422,6 +1423,7 @@ func (db *DB) compactOOOHead(ctx context.Context) error {
14221423
14231424// compactOOO creates a new block per possible block range in the compactor's directory from the OOO Head given.
14241425// Each ULID in the result corresponds to a block in a unique time range.
1426+ // The db.cmtx mutex should be held before calling this method.
14251427func (db * DB ) compactOOO (dest string , oooHead * OOOCompactionHead ) (_ []ulid.ULID , err error ) {
14261428 start := time .Now ()
14271429
@@ -1466,7 +1468,7 @@ func (db *DB) compactOOO(dest string, oooHead *OOOCompactionHead) (_ []ulid.ULID
14661468}
14671469
14681470// compactHead compacts the given RangeHead.
1469- // The compaction mutex should be held before calling this method.
1471+ // The db.cmtx should be held before calling this method.
14701472func (db * DB ) compactHead (head * RangeHead ) error {
14711473 uids , err := db .compactor .Write (db .dir , head , head .MinTime (), head .BlockMaxTime (), nil )
14721474 if err != nil {
@@ -1492,7 +1494,7 @@ func (db *DB) compactHead(head *RangeHead) error {
14921494}
14931495
14941496// compactBlocks compacts all the eligible on-disk blocks.
1495- // The compaction mutex should be held before calling this method.
1497+ // The db.cmtx should be held before calling this method.
14961498func (db * DB ) compactBlocks () (err error ) {
14971499 // Check for compactions of multiple blocks.
14981500 for {
@@ -1549,6 +1551,7 @@ func getBlock(allBlocks []*Block, id ulid.ULID) (*Block, bool) {
15491551}
15501552
15511553// reload reloads blocks and truncates the head and its WAL.
1554+ // The db.cmtx mutex should be held before calling this method.
15521555func (db * DB ) reload () error {
15531556 if err := db .reloadBlocks (); err != nil {
15541557 return fmt .Errorf ("reloadBlocks: %w" , err )
@@ -1565,6 +1568,7 @@ func (db *DB) reload() error {
15651568
15661569// reloadBlocks reloads blocks without touching head.
15671570// Blocks that are obsolete due to replacement or retention will be deleted.
1571+ // The db.cmtx mutex should be held before calling this method.
15681572func (db * DB ) reloadBlocks () (err error ) {
15691573 defer func () {
15701574 if err != nil {
0 commit comments