mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
backup metadata are written in separate file (#560)
Signed-off-by: Alexander Marshalov <_@marshalov.org>
This commit is contained in:
parent
7b15834cbe
commit
3b2dc2b098
2 changed files with 8 additions and 1 deletions
|
@ -79,6 +79,10 @@ func (b *Backup) Run() error {
|
||||||
if err := storeMetadata(src, dst); err != nil {
|
if err := storeMetadata(src, dst); err != nil {
|
||||||
return fmt.Errorf("cannot store backup metadata: %w", err)
|
return fmt.Errorf("cannot store backup metadata: %w", err)
|
||||||
}
|
}
|
||||||
|
if err := dst.CreateFile(fscommon.BackupCompleteFilename, []byte{}); err != nil {
|
||||||
|
return fmt.Errorf("cannot create `backup complete` file at %s: %w", dst, err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +103,7 @@ func storeMetadata(src *fslocal.FS, dst common.RemoteFS) error {
|
||||||
return fmt.Errorf("cannot marshal metadata: %w", err)
|
return fmt.Errorf("cannot marshal metadata: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := dst.CreateFile(fscommon.BackupCompleteFilename, metadata); err != nil {
|
if err := dst.CreateFile(fscommon.BackupMetadataFilename, metadata); err != nil {
|
||||||
return fmt.Errorf("cannot create `backup complete` file at %s: %w", dst, err)
|
return fmt.Errorf("cannot create `backup complete` file at %s: %w", dst, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,3 +235,6 @@ func IgnorePath(path string) bool {
|
||||||
|
|
||||||
// BackupCompleteFilename is a filename, which is created in the destination fs when backup is complete.
|
// BackupCompleteFilename is a filename, which is created in the destination fs when backup is complete.
|
||||||
const BackupCompleteFilename = "backup_complete.ignore"
|
const BackupCompleteFilename = "backup_complete.ignore"
|
||||||
|
|
||||||
|
// BackupMetadataFilename is a filename, which contains metadata for the backup.
|
||||||
|
const BackupMetadataFilename = "backup_metadata.ignore"
|
||||||
|
|
Loading…
Reference in a new issue