weaviate/weaviate · error
get file info
Error message
get file info
What it means
switchCommitLogs stats the active commit-log file to decide whether it exceeds the size threshold and must be rotated. This wrapper fires when l.currentFile.Stat fails — file deleted underneath the logger, descriptor error, or I/O failure — so rotation cannot be evaluated and the switch aborts.
Source
Thrown at adapters/repos/db/vector/hnsw/commit_logger.go:513
}
func (l *hnswCommitLogger) ResumeAfterBackup(ctx context.Context) error {
// Nothing to do here. The backup invariant ("listed files are immutable
// for the duration of the copy") is upheld by ListFiles excluding the
// active commit log file by path. The active file *does* receive writes
// during a backup, but it is never part of the file set the backup
// machinery copies.
return nil
}
func (l *hnswCommitLogger) switchCommitLogs(force bool) (bool, error) {
l.Lock()
defer l.Unlock()
// Get current file size
info, err := l.currentFile.Stat()
if err != nil {
return false, errors.Wrap(err, "get file info")
}
size := info.Size()
if size <= l.maxSizeIndividual && !force {
return false, nil
}
oldFile := l.currentFile
oldWriter := l.currentWriter
oldFileName := l.currentFileName
// Flush and fsync the current file so its bytes are durable before we stop
// appending to it. The old file is deliberately NOT closed yet: every step
// below can fail (ENOSPC/EIO), and l.currentFile must never be left pointing
// at a dead fd. While the old file stays open and assigned, a failure here
// just aborts the rotation and writes continue against it.
if err := oldWriter.Flush(); err != nil {
return true, errors.Wrap(err, "flush commit log")View on GitHub (pinned to 75aa4b6d11)
Solutions
- Check the wrapped error: the active commit-log file may have been removed externally
- Verify no external cleanup deletes WAL files while the shard is open; retry the switch
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at adapters/repos/db/vector/hnsw/commit_logger.go:513 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/a270cf76347b8dc5.
Report an issue: GitHub.