lxd/db/query/retry.go
func IsRetriableError(err error) bool {
	err = errors.Cause(err)

	if err == nil {
		return false
	}
	if err == sqlite3.ErrLocked || err == sqlite3.ErrBusy {
		return true
	}

	if strings.Contains(err.Error(), "database is locked") {
		return true
	}
	if strings.Contains(err.Error(), "bad connection") {
		return true
	}

	// Despite the description this is usually a lost leadership error.
	if strings.Contains(err.Error(), "disk I/O error") {
		return true
	}

	return false
}
func IsRetriableError(err error) bool {
	err = errors.Cause(err)

	if err == nil {
		return false
	}
	if err == sqlite3.ErrLocked || err == sqlite3.ErrBusy {
		return true
	}

	if strings.Contains(err.Error(), "database is locked") {
		return true
	}
	if strings.Contains(err.Error(), "bad connection") {
		return true
	}

	// Despite the description this is usually a lost leadership error.
	if strings.Contains(err.Error(), "disk I/O error") {
		return true
	}

	return false
}
// IsRetriableError returns true if the given error might be transient and the
// interaction can be safely retried.