Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.8.0 #1068

Merged
merged 72 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
82fef20
PBM-1211: Multi-endpoint feature (#1034)
boris-ilijic Oct 17, 2024
489a24b
PMM-13426: close connections on failure (#1039)
idoqo Oct 23, 2024
90ce2aa
[PBM-1405] dump v2 (#1035)
defbin Oct 23, 2024
3d16717
PBM-1366: continue after dropping a collection
defbin Oct 15, 2024
53c6b3c
PBM-1358: support selective backup and restore with configshard (#1037)
defbin Oct 29, 2024
2a6b65b
PBM-1421: Enable `mongorestore` for cloning collection (#1040)
boris-ilijic Oct 30, 2024
0223fb0
PBM-1414 Set Number of Parallel Collections to 1 by default
radoslawszulgo Oct 30, 2024
824d8b1
Remove unused runtime import
radoslawszulgo Oct 30, 2024
8d47d0b
revert change and adjust numInsertionWorkersDefault to from 10 to 1
radoslawszulgo Oct 31, 2024
10ba619
PBM-1417: allow multi-database selective backup (#1038)
defbin Oct 31, 2024
5e8e2db
PBM-1347: save restore meta with error if retore fails before start (…
defbin Nov 5, 2024
6d394c4
PBM-1398: check applyOps to exclude namespace
defbin Sep 25, 2024
ecb9f2c
PBM-1398: handle renameCollection and convertToCapped commands
defbin Oct 23, 2024
f7c8ecf
Add an option to pass numInsertionWorkersPerCol from command line and…
radoslawszulgo Nov 6, 2024
10205ab
Fix warnings and long code lines
radoslawszulgo Nov 6, 2024
3faa9b8
fix formatting pbm/restore/logical.go
radoslawszulgo Nov 6, 2024
fafc6f5
fix formatting pbm/snapshot/restore.go
radoslawszulgo Nov 6, 2024
99697e9
PBM-887: add diagnostic command (#1043)
defbin Nov 6, 2024
95a3454
Apply suggestions from code review
radoslawszulgo Nov 6, 2024
179c819
Update pbm/restore/logical.go
defbin Nov 7, 2024
9be489f
PKG-262 hetzner: retry downloading GO binary for 3 times
vorsel Nov 7, 2024
3968353
Merge pull request #1045 from vorsel/dev
vorsel Nov 8, 2024
79478b1
CI Remove PSMDB 5.0 and add 8.0, temporary use images from perconalab…
olexandr-havryliak Nov 12, 2024
f7f370c
PBM-1422: Adjust Oplog and PITR to support cloned collection (#1046)
boris-ilijic Nov 14, 2024
7c1a426
update CODEOWNERS (#1049)
defbin Nov 14, 2024
13291ca
print "command not found"
defbin Nov 13, 2024
8d704a9
PBM-1442: skip backup/restore metafile if no such
defbin Nov 13, 2024
d859b9e
PBM-1442: clear storage config in backup meta
defbin Nov 13, 2024
274ce1e
PBM-1443: add error message about reporting for physical restore
defbin Nov 13, 2024
4f62e0c
add success message
defbin Nov 13, 2024
10e393a
add server version and fcv to report
defbin Nov 14, 2024
cb16a2e
print logs as string messages
defbin Nov 14, 2024
a5eff08
add --archive option to diagnostic command
defbin Nov 14, 2024
ca44dca
use opid or name value as prefix
defbin Nov 14, 2024
46e9ba2
fix panic if no command
defbin Nov 14, 2024
319eeac
include backup meta for restore command
defbin Nov 14, 2024
e7ce3dd
PBM-1448. Fix tests, use perconalab to have the latest PSMDB images, …
sandraromanchenko Nov 18, 2024
e467be4
Add pbm-agent's flags and env vars for logger
boris-ilijic Nov 26, 2024
dc96c35
Expand logger with new options: path, level, json
boris-ilijic Nov 26, 2024
e6ebd85
Print out log settings on startup
boris-ilijic Nov 26, 2024
ad71f83
PBM-1414 add unit test and add some small refactor for easier trouble…
radoslawszulgo Nov 27, 2024
08cfa64
Merge pull request #1052 from percona/PBM-1226-logpath-opt-no-cfg
boris-ilijic Nov 27, 2024
ae4af05
Merge remote-tracking branch 'origin/PBM-1414-set-new-default-for-num…
radoslawszulgo Nov 27, 2024
1d1b7ea
simplify test struct and set proper default for oplog replay
radoslawszulgo Nov 27, 2024
8eea8c8
Apply suggestions from code review
radoslawszulgo Nov 27, 2024
e2dfda2
Support cloning create/drop commands from oplog
boris-ilijic Nov 27, 2024
9d29213
Merge pull request #1053 from percona/PBM-1414-set-new-default-for-nu…
radoslawszulgo Nov 28, 2024
8683365
Simplify is op for cloning check
boris-ilijic Nov 28, 2024
665e9bf
Merge remote-tracking branch 'origin/dev'
boris-ilijic Nov 28, 2024
13e9cbf
Update README.md
radoslawszulgo Nov 28, 2024
33a7d7a
Merge pull request #1055 from percona/radoslawszulgo-patch-1
radoslawszulgo Nov 28, 2024
cbdd0fd
CI. Upload results to codecov
sandraromanchenko Nov 28, 2024
44b7141
Merge pull request #1054 from percona/PBM-1444-cloning-ddl-ops
boris-ilijic Nov 28, 2024
0f91b29
Merge branch 'dev' into codecov
sandraromanchenko Nov 28, 2024
854560c
PKG-251 add AL2023
EvgeniyPatlan Dec 1, 2024
6686ee8
PBM. Add possibility to build with coverage profiling
sandraromanchenko Dec 2, 2024
a89b64b
PBM-1414 fix reading the NumParallelCollections configuration
radoslawszulgo Dec 3, 2024
88ff5c3
Apply suggestions from code review
radoslawszulgo Dec 3, 2024
0b5a7e1
Merge pull request #1056 from percona/codecov
radoslawszulgo Dec 4, 2024
d320b1b
Merge branch 'dev' into PBM-1414-change-default-ins-workers-fix
sandraromanchenko Dec 4, 2024
d459d2c
CI. Send report to codecov for dev branch (#1059)
sandraromanchenko Dec 4, 2024
81a4475
Merge pull request #1058 from percona/PBM-1414-change-default-ins-wor…
radoslawszulgo Dec 4, 2024
1a0100d
PBM-1414 revert the default for numInsertionWorkers to 10
radoslawszulgo Dec 4, 2024
070843b
Merge pull request #1060 from percona/PBM-1414-revert-numInsertionWor…
radoslawszulgo Dec 4, 2024
cb26f75
Merge pull request #1057 from percona/PKG-251
EvgeniyPatlan Dec 5, 2024
c0da3a0
PBM-1426: Sporadic failures on physical restore with PITR (#1061)
boris-ilijic Dec 6, 2024
d6bacd7
PBM. Bump version (#1062)
sandraromanchenko Dec 6, 2024
14760dd
PBM-1460: Connection error isn't written to PBM log despite log-path …
boris-ilijic Dec 9, 2024
564ba8e
CI. Increase time for running tests (#1067)
sandraromanchenko Dec 9, 2024
294173f
PBM-1459: PBM ignores index removal during selective PITR restore wit…
boris-ilijic Dec 9, 2024
077372c
PBM-1447. Unset LD_PRELOAD on physical restore to prevent PSMDB 8.0 f…
sandraromanchenko Dec 9, 2024
15b51a8
Bump golang.org/x/crypto to v0.31.0 (#1069)
boris-ilijic Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 120
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
psmdb: ["5.0", "6.0", "7.0"]
psmdb: ["6.0", "7.0", "8.0"]
test: [logical, physical, incremental, external]
env:
PBM_BRANCH: ${{ github.event.inputs.pbm_branch || 'main' }}
Expand All @@ -49,7 +49,7 @@ jobs:

- name: Setup environment with PSMDB ${{ matrix.psmdb }} for PBM PR/branch ${{ github.event.pull_request.title || env.PR_NUMBER || env.PBM_BRANCH }}
run: |
PSMDB=percona/percona-server-mongodb:${{ matrix.psmdb }} docker compose build
PSMDB=perconalab/percona-server-mongodb:${{ matrix.psmdb }} docker compose build
docker compose up -d
working-directory: psmdb-testing/pbm-functional/pytest

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'codecov'

on:
push:
branches:
- dev

jobs:
go-test:
name: runner / go-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: test
run: go test -v ./... -covermode=atomic -coverprofile=cover.out

- name: upload coverage report
uses: codecov/codecov-action@v4
with:
file: cover.out
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 8 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ jobs:
with:
go-version: "1.22"
- name: test
run: go test -v ./...
run: go test -v ./... -covermode=atomic -coverprofile=cover.out

- name: upload coverage report
uses: codecov/codecov-action@v4
with:
file: cover.out
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

shellcheck:
name: runner / shellcheck
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @defbin @boris-ilijic
* @boris-ilijic @veceraj
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,20 @@ install-stest-static:
$(ENVS_STATIC) go install -ldflags="$(LDFLAGS_STATIC)" $(BUILD_FLAGS) ./cmd/pbm-speed-test
install-static-entrypoint:
$(ENVS_STATIC) go install -ldflags="$(LDFLAGS_STATIC)" $(BUILD_FLAGS) ./cmd/pbm-agent-entrypoint

# BUILD WITH COVERAGE PROFILING
build-cover: build-pbm-cover build-agent-cover build-stest-cover
build-pbm-cover:
$(ENVS) go build -cover -ldflags="$(LDFLAGS)" $(BUILD_FLAGS) -o ./bin/pbm ./cmd/pbm
build-agent-cover:
$(ENVS) go build -cover -ldflags="$(LDFLAGS)" $(BUILD_FLAGS) -o ./bin/pbm-agent ./cmd/pbm-agent
build-stest-cover:
$(ENVS) go build -cover -ldflags="$(LDFLAGS)" $(BUILD_FLAGS) -o ./bin/pbm-speed-test ./cmd/pbm-speed-test

install-cover: install-pbm-cover install-agent-cover install-stest-cover
install-pbm-cover:
$(ENVS) go install -cover -ldflags="$(LDFLAGS)" $(BUILD_FLAGS) ./cmd/pbm
install-agent-cover:
$(ENVS) go install -cover -ldflags="$(LDFLAGS)" $(BUILD_FLAGS) ./cmd/pbm-agent
install-stest-cover:
$(ENVS) go install -cover -ldflags="$(LDFLAGS)" $(BUILD_FLAGS) ./cmd/pbm-speed-test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Percona Backup for MongoDB
[![Go Report Card](https://goreportcard.com/badge/github.com/percona/percona-backup-mongodb)](https://goreportcard.com/report/github.com/percona/percona-backup-mongodb) [![codecov](https://codecov.io/gh/percona/percona-backup-mongodb/branch/master/graph/badge.svg?token=TiuOmTfp2p)](https://codecov.io/gh/percona/percona-backup-mongodb) [![CLA assistant](https://cla-assistant.percona.com/readme/badge/percona/percona-backup-mongodb)](https://cla-assistant.percona.com/percona/percona-backup-mongodb)
[![Go Report Card](https://goreportcard.com/badge/github.com/percona/percona-backup-mongodb)](https://goreportcard.com/report/github.com/percona/percona-backup-mongodb) [![CLA assistant](https://cla-assistant.percona.com/readme/badge/percona/percona-backup-mongodb)](https://cla-assistant.percona.com/percona/percona-backup-mongodb)

![PBM logo](backup-mongo.jpeg)

Expand Down
2 changes: 1 addition & 1 deletion cmd/pbm-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (a *Agent) storStatus(
return topo.SubsysStatus{OK: true}
}

stg, err := util.GetStorage(ctx, a.leadConn, log)
stg, err := util.GetStorage(ctx, a.leadConn, a.brief.Me, log)
if err != nil {
return topo.SubsysStatus{Err: fmt.Sprintf("unable to get storage: %v", err)}
}
Expand Down
23 changes: 11 additions & 12 deletions cmd/pbm-agent/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/percona/percona-backup-mongodb/pbm/backup"
"github.com/percona/percona-backup-mongodb/pbm/config"
"github.com/percona/percona-backup-mongodb/pbm/connect"
"github.com/percona/percona-backup-mongodb/pbm/ctrl"
"github.com/percona/percona-backup-mongodb/pbm/errors"
"github.com/percona/percona-backup-mongodb/pbm/lock"
Expand Down Expand Up @@ -97,7 +96,7 @@ func (a *Agent) Delete(ctx context.Context, d *ctrl.DeleteBackupCmd, opid ctrl.O
}

l.Info("deleting backups older than %v", t)
err = backup.DeleteBackupBefore(ctx, a.leadConn, t, bcpType)
err = backup.DeleteBackupBefore(ctx, a.leadConn, t, bcpType, nodeInfo.Me)
if err != nil {
l.Error("deleting: %v", err)
return
Expand All @@ -107,7 +106,7 @@ func (a *Agent) Delete(ctx context.Context, d *ctrl.DeleteBackupCmd, opid ctrl.O
ctx := log.SetLogEventToContext(ctx, l)

l.Info("deleting backup")
err := backup.DeleteBackup(ctx, a.leadConn, d.Backup)
err := backup.DeleteBackup(ctx, a.leadConn, d.Backup, nodeInfo.Me)
if err != nil {
l.Error("deleting: %v", err)
return
Expand Down Expand Up @@ -188,7 +187,7 @@ func (a *Agent) DeletePITR(ctx context.Context, d *ctrl.DeletePITRCmd, opid ctrl

ts := primitive.Timestamp{T: uint32(t.Unix())}
l.Info("deleting pitr chunks older than %v", t)
err = deletePITRImpl(ctx, a.leadConn, ts)
err = a.deletePITRImpl(ctx, ts)
if err != nil {
l.Error("deleting: %v", err)
return
Expand Down Expand Up @@ -260,7 +259,7 @@ func (a *Agent) Cleanup(ctx context.Context, d *ctrl.CleanupCmd, opid ctrl.OPID,
l.Error("get config: %v", err)
}

stg, err := util.StorageFromConfig(&cfg.Storage, l)
stg, err := util.StorageFromConfig(&cfg.Storage, a.brief.Me, l)
if err != nil {
l.Error("get storage: " + err.Error())
}
Expand Down Expand Up @@ -298,16 +297,16 @@ func (a *Agent) Cleanup(ctx context.Context, d *ctrl.CleanupCmd, opid ctrl.OPID,
l.Error(err.Error())
}

err = resync.Resync(ctx, a.leadConn, &cfg.Storage)
err = resync.Resync(ctx, a.leadConn, &cfg.Storage, a.brief.Me)
if err != nil {
l.Error("storage resync: " + err.Error())
}
}

func deletePITRImpl(ctx context.Context, conn connect.Client, ts primitive.Timestamp) error {
func (a *Agent) deletePITRImpl(ctx context.Context, ts primitive.Timestamp) error {
l := log.LogEventFromContext(ctx)

r, err := backup.MakeCleanupInfo(ctx, conn, ts)
r, err := backup.MakeCleanupInfo(ctx, a.leadConn, ts)
if err != nil {
return errors.Wrap(err, "get pitr chunks")
}
Expand All @@ -316,15 +315,15 @@ func deletePITRImpl(ctx context.Context, conn connect.Client, ts primitive.Times
return nil
}

stg, err := util.GetStorage(ctx, conn, l)
stg, err := util.GetStorage(ctx, a.leadConn, a.brief.Me, l)
if err != nil {
return errors.Wrap(err, "get storage")
}

return deleteChunks(ctx, conn, stg, r.Chunks)
return a.deleteChunks(ctx, stg, r.Chunks)
}

func deleteChunks(ctx context.Context, m connect.Client, stg storage.Storage, chunks []oplog.OplogChunk) error {
func (a *Agent) deleteChunks(ctx context.Context, stg storage.Storage, chunks []oplog.OplogChunk) error {
l := log.LogEventFromContext(ctx)

for _, chnk := range chunks {
Expand All @@ -333,7 +332,7 @@ func deleteChunks(ctx context.Context, m connect.Client, stg storage.Storage, ch
return errors.Wrapf(err, "delete pitr chunk '%s' (%v) from storage", chnk.FName, chnk)
}

_, err = m.PITRChunksCollection().DeleteOne(
_, err = a.leadConn.PITRChunksCollection().DeleteOne(
ctx,
bson.D{
{"rs", chnk.RS},
Expand Down
59 changes: 46 additions & 13 deletions cmd/pbm-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ func main() {
versionFormat = versionCmd.Flag("format", "Output format <json or \"\">").
Default("").
String()

logPath = pbmCmd.Flag("log-path", "Path to file").
Envar("LOG_PATH").
Default("/dev/stderr").
String()
logJSON = pbmCmd.Flag("log-json", "Enable JSON output").
Envar("LOG_JSON").
Bool()
logLevel = pbmCmd.Flag(
"log-level",
"Minimal log level based on severity level: D, I, W, E or F, low to high. Choosing one includes higher levels too.").
Envar("LOG_LEVEL").
Default(log.D).
Enum(log.D, log.I, log.W, log.E, log.F)
)

cmd, err := pbmCmd.DefaultEnvars().Parse(os.Args[1:])
Expand All @@ -74,19 +88,26 @@ func main() {

hidecreds()

fmt.Print(perconaSquadNotice)
logOpts := &log.Opts{
LogPath: *logPath,
LogLevel: *logLevel,
LogJSON: *logJSON,
}
l := log.NewWithOpts(nil, "", "", logOpts).NewDefaultEvent()

err = runAgent(url, *dumpConns)
stdlog.Println("Exit:", err)
err = runAgent(url, *dumpConns, logOpts)
if err != nil {
l.Error("Exit: %v", err)
os.Exit(1)
}
l.Info("Exit: <nil>")
}

func runAgent(mongoURI string, dumpConns int) error {
mtLog.SetDateFormat(log.LogTimeFormat)
mtLog.SetVerbosity(&options.Verbosity{VLevel: mtLog.DebugLow})

func runAgent(
mongoURI string,
dumpConns int,
logOpts *log.Opts,
) error {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
defer cancel()

Expand All @@ -95,16 +116,33 @@ func runAgent(mongoURI string, dumpConns int) error {
return errors.Wrap(err, "connect to PBM")
}

err = setupNewDB(ctx, leadConn)
if err != nil {
return errors.Wrap(err, "setup pbm collections")
}

agent, err := newAgent(ctx, leadConn, mongoURI, dumpConns)
if err != nil {
return errors.Wrap(err, "connect to the node")
}

logger := log.New(agent.leadConn.LogCollection(), agent.brief.SetName, agent.brief.Me)
logger := log.NewWithOpts(
agent.leadConn,
agent.brief.SetName,
agent.brief.Me,
logOpts)
defer logger.Close()

ctx = log.SetLoggerToContext(ctx, logger)

mtLog.SetDateFormat(log.LogTimeFormat)
mtLog.SetVerbosity(&options.Verbosity{VLevel: mtLog.DebugLow})
mtLog.SetWriter(logger)

logger.Printf(perconaSquadNotice)
logger.Printf("log options: log-path=%s, log-level:%s, log-json:%t",
logOpts.LogPath, logOpts.LogLevel, logOpts.LogJSON)

canRunSlicer := true
if err := agent.CanStart(ctx); err != nil {
if errors.Is(err, ErrArbiterNode) || errors.Is(err, ErrDelayedNode) {
Expand All @@ -114,11 +152,6 @@ func runAgent(mongoURI string, dumpConns int) error {
}
}

err = setupNewDB(ctx, agent.leadConn)
if err != nil {
return errors.Wrap(err, "setup pbm collections")
}

agent.showIncompatibilityWarning(ctx)

if canRunSlicer {
Expand Down
2 changes: 1 addition & 1 deletion cmd/pbm-agent/oplog.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (a *Agent) OplogReplay(ctx context.Context, r *ctrl.ReplayCmd, opID ctrl.OP
}

l.Info("oplog replay started")
rr := restore.New(a.leadConn, a.nodeConn, a.brief, cfg, r.RSMap, 0)
rr := restore.New(a.leadConn, a.nodeConn, a.brief, cfg, r.RSMap, 0, 1)
err = rr.ReplayOplog(ctx, r, opID, l)
if err != nil {
if errors.Is(err, restore.ErrNoDataForShard) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/pbm-agent/pitr.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (a *Agent) pitr(ctx context.Context) error {
}
}()

stg, err := util.StorageFromConfig(&cfg.Storage, l)
stg, err := util.StorageFromConfig(&cfg.Storage, a.brief.Me, l)
if err != nil {
if err := lck.Release(); err != nil {
l.Error("release lock: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/pbm-agent/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (a *Agent) handleAddConfigProfile(
return
}

stg, err := util.StorageFromConfig(&cmd.Storage, log.LogEventFromContext(ctx))
stg, err := util.StorageFromConfig(&cmd.Storage, a.brief.Me, log.LogEventFromContext(ctx))
if err != nil {
err = errors.Wrap(err, "storage from config")
return
Expand Down
Loading
Loading