weaviate/weaviate · error

failed to unregister commitlog compaction from maintenance c

Error message

failed to unregister commitlog compaction from maintenance cycle

What it means

Same shutdown path as the switch-callback unregister, but for the commitlog-compaction (maintainLogs) callback. Failure means periodic compaction scheduling could not be cancelled, so Shutdown cannot guarantee the commit log is immutable afterwards and returns an error.

Source

Thrown at adapters/repos/db/vector/hnsw/commit_logger.go:431

func (l *hnswCommitLogger) Reset() error {
	l.Lock()
	defer l.Unlock()

	return l.walWriter.WriteResetIndex()
}

// Shutdown waits for ongoing maintenance processes to stop, then cancels their
// scheduling. The caller can be sure that state on disk is immutable after
// calling Shutdown().
func (l *hnswCommitLogger) Shutdown(ctx context.Context) error {
	if l.switchLogsCallbackCtrl != nil {
		if err := l.switchLogsCallbackCtrl.Unregister(ctx); err != nil {
			return errors.Wrap(err, "failed to unregister commitlog switch from maintenance cycle")
		}
	}
	if l.maintainLogsCallbackCtrl != nil {
		if err := l.maintainLogsCallbackCtrl.Unregister(ctx); err != nil {
			return errors.Wrap(err, "failed to unregister commitlog compaction from maintenance cycle")
		}
	}
	return nil
}

func (l *hnswCommitLogger) RootPath() string {
	return l.rootPath
}

// ActiveFilePath returns the absolute path of the file the writer would
// append to right now. It is captured under l.Mutex, so it can never
// disagree with whatever a concurrent AddNode / switch sees.
//
// The backup path (hnsw.ListFiles) uses this to exclude the active file by
// identity. We can't rely on "the active file is empty after
// PrepareForBackup" because PrepareForBackup releases this mutex before
// returning, and writers (re-armed by the queue's deferred Resume) can
// land an AddNode + Flush against the new file before ListFiles enumerates

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Inspect the wrapped Unregister error; retry shutdown with a longer context
  2. Check for stuck maintenance goroutines preventing unregistration
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at adapters/repos/db/vector/hnsw/commit_logger.go:431 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/5270492ae2ac4440. Report an issue: GitHub.