Skip to content

Commit

Permalink
Add: NFS support for MongoDB Archiver
Browse files Browse the repository at this point in the history
Signed-off-by: sayedppqq <[email protected]>
  • Loading branch information
sayedppqq committed Apr 29, 2024
1 parent 0aa6b37 commit 90b3499
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 39 deletions.
2 changes: 1 addition & 1 deletion cmd/mongo/oplog_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func buildOplogPushRunArgs() (args oplogPushRunArgs, err error) {
return
}

return
return args, err
}

type oplogPushStatsArgs struct {
Expand Down
41 changes: 20 additions & 21 deletions cmd/mongo/oplog_replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package mongo
import (
"context"
"encoding/json"
"os"
"syscall"

"github.com/spf13/cobra"
"github.com/wal-g/tracelog"
"github.com/wal-g/wal-g/internal"
Expand All @@ -16,6 +13,8 @@ import (
"github.com/wal-g/wal-g/internal/databases/mongo/oplog"
"github.com/wal-g/wal-g/internal/databases/mongo/stages"
"github.com/wal-g/wal-g/utility"
"os"
"syscall"
)

const LatestBackupString = "LATEST_BACKUP"
Expand Down Expand Up @@ -91,24 +90,24 @@ func buildOplogReplayRunArgs(cmdargs []string) (args oplogReplayRunArgs, err err
return args, nil
}

func processArg(arg string, downloader *archive.StorageDownloader) (models.Timestamp, error) {
switch arg {
case internal.LatestString:
return downloader.LastKnownArchiveTS()
case LatestBackupString:
lastBackupName, err := downloader.LastBackupName()
if err != nil {
return models.Timestamp{}, err
}
backupMeta, err := downloader.BackupMeta(lastBackupName)
if err != nil {
return models.Timestamp{}, err
}
return models.TimestampFromBson(backupMeta.MongoMeta.BackupLastTS), nil
default:
return models.TimestampFromStr(arg)
}
}
//func processArg(arg string, downloader *archive.StorageDownloader) (models.Timestamp, error) {
// switch arg {
// case internal.LatestString:
// return downloader.LastKnownArchiveTS()
// case LatestBackupString:
// lastBackupName, err := downloader.LastBackupName()
// if err != nil {
// return models.Timestamp{}, err
// }
// backupMeta, err := downloader.BackupMeta(lastBackupName)
// if err != nil {
// return models.Timestamp{}, err
// }
// return models.TimestampFromBson(backupMeta.MongoMeta.BackupLastTS), nil
// default:
// return models.TimestampFromStr(arg)
// }
//}

func runOplogReplay(ctx context.Context, replayArgs oplogReplayRunArgs) error {
tracelog.DebugLogger.Printf("starting replay with arguments: %+v", replayArgs)
Expand Down
4 changes: 2 additions & 2 deletions internal/databases/mysql/binlog_fetch_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func HandleBinlogFetch(folder storage.Folder, backupName string, untilTS string,
tracelog.ErrorLogger.FatalOnError(err)
var startTS, endTS, endBinlogTS time.Time
if skipStartTime {
startTS, endTS, endBinlogTS, err = getEndTimestamps(folder, untilTS, untilBinlogLastModifiedTS)
startTS, endTS, endBinlogTS, err = getEndTimestamps(untilTS, untilBinlogLastModifiedTS)
} else {
startTS, endTS, endBinlogTS, err = getTimestamps(folder, backupName, untilTS, untilBinlogLastModifiedTS)
tracelog.ErrorLogger.FatalOnError(err)
}
tracelog.ErrorLogger.FatalOnError(err)

handler := newIndexHandler(dstDir)

Expand Down
2 changes: 1 addition & 1 deletion internal/databases/mysql/binlog_replay_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func getTimestamps(folder storage.Folder, backupName, untilTS, untilBinlogLastMo
return startTS, endTS, endBinlogTS, nil
}

func getEndTimestamps(folder storage.Folder, untilTS, untilBinlogLastModifiedTS string) (time.Time, time.Time, time.Time, error) {
func getEndTimestamps(untilTS, untilBinlogLastModifiedTS string) (time.Time, time.Time, time.Time, error) {
endTS, err := utility.ParseUntilTS(untilTS)
if err != nil {
return time.Time{}, time.Time{}, time.Time{}, err
Expand Down
13 changes: 0 additions & 13 deletions main/mongo/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion pkg/storages/fs/folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (folder *Folder) Exists(objectRelativePath string) (bool, error) {

func (folder *Folder) GetSubFolder(subFolderRelativePath string) storage.Folder {
sf := NewFolder(folder.rootPath, path.Join(folder.subpath, subFolderRelativePath))
fmt.Println("---------------", sf)
_ = sf.EnsureExists()

// This is something unusual when we cannot be sure that our subfolder exists in FS
Expand Down

0 comments on commit 90b3499

Please sign in to comment.