Skip to content

Commit

Permalink
fix: minor bugs and tweak log rotation history to 14 days
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed May 5, 2024
1 parent b6c258c commit ad9a770
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backrest.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
defer oplog.Close()

// Create rotating log storage
logStore := rotatinglog.NewRotatingLog(path.Join(config.DataDir(), "rotatinglogs"), 30) // 30 days of logs
logStore := rotatinglog.NewRotatingLog(path.Join(config.DataDir(), "rotatinglogs"), 14) // 14 days of logs
if err != nil {
zap.S().Fatalf("error creating rotating log storage: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/oplog/oplog.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (o *OpLog) Scan(onIncomplete func(op *v1.Operation)) error {
if lastValidated := sysBucket.Get([]byte("last_validated")); lastValidated != nil {
c.Seek(lastValidated)
}
for k, v := c.Next(); k != nil; k, v = c.Next() {
for k, v := c.Prev(); k != nil; k, v = c.Next() {
op := &v1.Operation{}
if err := proto.Unmarshal(v, op); err != nil {
zap.L().Error("error unmarshalling operation, there may be corruption in the oplog", zap.Error(err))
Expand Down
4 changes: 2 additions & 2 deletions internal/orchestrator/tasks/taskforget.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ func useLegacyCompatMode(oplog *oplog.OpLog, planID string) (bool, error) {
}
delete(instanceIDs, "")
if len(instanceIDs) > 1 {
zap.L().Warn("found mixed instance IDs in indexed snapshots, forcing forget to use new behavior (e.g. --tags including instance ID) despite the presence of legacy (e.g. untagged) snapshots.")
zap.L().Warn("found mixed instance IDs in indexed snapshots, overriding legacy forget behavior to include instance ID tags. This may result in unexpected behavior -- please inspect the tags on your snapshots.")
return false, nil
}
zap.L().Warn("found legacy snapshots without instance ID, forget will use legacy behavior e.g. --tags not including instance ID")
zap.L().Warn("found legacy snapshots without instance ID, recommending legacy forget behavior.")
return true, nil
}
2 changes: 1 addition & 1 deletion internal/protoutil/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func ValidateOperation(op *v1.Operation) error {
return errors.New("operation.plan_id is required")
}
if op.InstanceId == "" {
zap.L().Warn("operation.instance_id should typically be set", zap.Any("operation", op))
zap.L().Warn("operation.instance_id should typically be set")
}
if op.SnapshotId != "" {
if err := restic.ValidateSnapshotId(op.SnapshotId); err != nil {
Expand Down

0 comments on commit ad9a770

Please sign in to comment.