mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-14 01:35:31 +00:00
fix: minor bugs and tweak log rotation history to 14 days
This commit is contained in:
@@ -76,7 +76,7 @@ func main() {
|
|||||||
defer oplog.Close()
|
defer oplog.Close()
|
||||||
|
|
||||||
// Create rotating log storage
|
// 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 {
|
if err != nil {
|
||||||
zap.S().Fatalf("error creating rotating log storage: %v", err)
|
zap.S().Fatalf("error creating rotating log storage: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func (o *OpLog) Scan(onIncomplete func(op *v1.Operation)) error {
|
|||||||
if lastValidated := sysBucket.Get([]byte("last_validated")); lastValidated != nil {
|
if lastValidated := sysBucket.Get([]byte("last_validated")); lastValidated != nil {
|
||||||
c.Seek(lastValidated)
|
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{}
|
op := &v1.Operation{}
|
||||||
if err := proto.Unmarshal(v, op); err != nil {
|
if err := proto.Unmarshal(v, op); err != nil {
|
||||||
zap.L().Error("error unmarshalling operation, there may be corruption in the oplog", zap.Error(err))
|
zap.L().Error("error unmarshalling operation, there may be corruption in the oplog", zap.Error(err))
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ func useLegacyCompatMode(oplog *oplog.OpLog, planID string) (bool, error) {
|
|||||||
}
|
}
|
||||||
delete(instanceIDs, "")
|
delete(instanceIDs, "")
|
||||||
if len(instanceIDs) > 1 {
|
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
|
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
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func ValidateOperation(op *v1.Operation) error {
|
|||||||
return errors.New("operation.plan_id is required")
|
return errors.New("operation.plan_id is required")
|
||||||
}
|
}
|
||||||
if op.InstanceId == "" {
|
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 op.SnapshotId != "" {
|
||||||
if err := restic.ValidateSnapshotId(op.SnapshotId); err != nil {
|
if err := restic.ValidateSnapshotId(op.SnapshotId); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user