Skip to content

PSMDB-1482 add the test with unshardCollection #181

PSMDB-1482 add the test with unshardCollection

PSMDB-1482 add the test with unshardCollection #181

GitHub Actions / JUnit Test Report failed Nov 8, 2024 in 0s

21 tests run, 20 passed, 0 skipped, 1 failed.

Annotations

Check failure on line 87 in pbm-functional/pytest/test_PBM-1355.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_PBM-1355.test_general_PBM_T257[base-physical]

AssertionError: Starting restore 2024-11-08T14:31:06.378750817Z from '2024-11-08T14:30:45Z'.panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb5bca0]

goroutine 1 [running]:
github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List.func1({0xc0004c85f0, 0x45}, {0x120ddc0?, 0xc000522b40?}, {0x0?, 0x0?})
	/percona-backup-mongodb/pbm/storage/fs/fs.go:200 +0x140
path/filepath.walkDir({0xc0004c85f0, 0x45}, {0x120ddc0, 0xc000522b40}, 0xc0000b42f0)
	/usr/local/go/src/path/filepath/path.go:310 +0x50
path/filepath.walkDir({0xc00018e540, 0x3b}, {0x120ddc0, 0xc000522a00}, 0xc0000b42f0)
	/usr/local/go/src/path/filepath/path.go:332 +0x285
path/filepath.walkDir({0xc00018e2c0, 0x34}, {0x120de30, 0xc000044bc0}, 0xc0000b42f0)
	/usr/local/go/src/path/filepath/path.go:332 +0x285
path/filepath.WalkDir({0xc00018e2c0, 0x34}, 0xc0000b42f0)
	/usr/local/go/src/path/filepath/path.go:400 +0x75
github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List(0x0?, {0xc000554270?, 0x0?}, {0x0, 0x0})
	/percona-backup-mongodb/pbm/storage/fs/fs.go:191 +0xcd
github.com/percona/percona-backup-mongodb/pbm/restore.ParsePhysRestoreStatus({0xc0001b10c0, 0x1e}, {0x12109f0, 0xc000044ba0}, {0x120e980, 0xc000137780})
	/percona-backup-mongodb/pbm/restore/storage.go:68 +0x8d
github.com/percona/percona-backup-mongodb/pbm/restore.GetPhysRestoreMeta({0xc0001b10c0, 0x1e}, {0x12109f0, 0xc000044ba0}, {0x120e980, 0xc000137780})
	/percona-backup-mongodb/pbm/restore/storage.go:39 +0x3e8
main.doRestore.func1({0x120dce0, 0xc0004080e0}, {0x1213b18, 0xc0005b0540}, {0xc0001b10c0, 0x1e})
	/percona-backup-mongodb/cmd/pbm/restore.go:493 +0x11c
main.waitForRestoreStatus({0x120dce0, 0xc0004080e0}, {0x1213b18, 0xc0005b0540}, {0xc0001b10c0, 0x1e}, 0xc0000b4f50)
	/percona-backup-mongodb/cmd/pbm/restore.go:556 +0x1d1
main.doRestore({0x120dc38, 0xc0005aee40}, {0x1213b18, 0xc0005b0540}, 0xc00044ea80, 0x0, {0x0, 0x0, 0x0}, {0x0, ...}, ...)
	/percona-backup-mongodb/cmd/pbm/restore.go:499 +0xb90
main.runRestore({0x120dc38, 0xc0005aee40}, {0x1213b18, 0xc0005b0540}, 0xc0000508e0, 0xc00044ea80, {0xc00050ed30, 0xd}, {0xf8ce8c, 0x4})
	/percona-backup-mongodb/cmd/pbm/restore.go:157 +0x699
main.main()
	/percona-backup-mongodb/cmd/pbm/main.go:545 +0xc5b9
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f3be2f16150>
backup_type = 'physical', restore_type = 'base'

    @pytest.mark.timeout(900,func_only=True)
    @pytest.mark.parametrize('backup_type',['logical','physical'])
    @pytest.mark.parametrize('restore_type',['base','pitr'])
    def test_general_PBM_T257(start_cluster,cluster,backup_type,restore_type):
        cluster.check_pbm_status()
        client=pymongo.MongoClient(cluster.connection)
        for i in range(600):
            client['test']['test'].insert_one({"doc":i})
    
        backup=cluster.make_backup(backup_type)
        restart = True if backup_type == 'physical' else False
        if restore_type == 'base':
            pymongo.MongoClient(cluster.connection).drop_database('test')
>           cluster.make_restore(backup,restart_cluster=restart,check_pbm_status=True,make_resync=False)

test_PBM-1355.py:87: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <cluster.Cluster object at 0x7f3be2f16150>, name = '2024-11-08T14:30:45Z'
kwargs = {'check_pbm_status': True, 'make_resync': False, 'restart_cluster': True}
client = MongoClient(host=['mongos:27017'], document_class=dict, tz_aware=False, connect=True)
result = CommandResult(backend=<testinfra.backend.docker.DockerBackend object at 0x7f3be46edc50>, exit_status=2, command=b'time...na-backup-mongodb/cmd/pbm/restore.go:157 +0x699\nmain.main()\n\t/percona-backup-mongodb/cmd/pbm/main.go:545 +0xc5b9\n')
n = <testinfra.host.Host docker://rscfg01>, timeout = 240, error = ''
host = 'rscfg03', container = <Container: 6ce804b3430e>

    def make_restore(self, name, **kwargs):
        if self.layout == "sharded":
            client = pymongo.MongoClient(self.connection)
            result = client.admin.command("balancerStop")
            client.close()
            Cluster.log("Stopping balancer: " + str(result))
            self.stop_mongos()
        self.stop_arbiters()
        n = testinfra.get_host("docker://" + self.pbm_cli)
        timeout = time.time() + 60
    
        while True:
            if not self.get_status()['running']:
                break
            if time.time() > timeout:
                assert False, "Cannot start restore, another operation running"
            time.sleep(1)
        Cluster.log("Restore started")
        timeout=kwargs.get('timeout', 240)
        result = n.run('timeout ' + str(timeout) + ' pbm restore ' + name + ' --wait')
    
        if result.rc == 0:
            Cluster.log(result.stdout)
        else:
            # try to catch possible failures if timeout exceeded
            error=''
            for host in self.mongod_hosts:
                try:
                    container = docker.from_env().containers.get(host)
                    get_logs = container.exec_run(
                        'cat /var/lib/mongo/pbm.restore.log', stderr=False)
                    if get_logs.exit_code == 0:
                        Cluster.log(
                            "!!!!Possible failure on {}, file pbm.restore.log was found:".format(host))
                        logs = get_logs.output.decode('utf-8')
                        Cluster.log(logs)
                        if '"s":"F"' in logs:
                            error = logs
                except docker.errors.APIError:
                    pass
            if error:
                assert False, result.stdout + result.stderr + "\n" + error
            else:
>               assert False, result.stdout + result.stderr
E               AssertionError: Starting restore 2024-11-08T14:31:06.378750817Z from '2024-11-08T14:30:45Z'.panic: runtime error: invalid memory address or nil pointer dereference
E               [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb5bca0]
E               
E               goroutine 1 [running]:
E               github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List.func1({0xc0004c85f0, 0x45}, {0x120ddc0?, 0xc000522b40?}, {0x0?, 0x0?})
E               	/percona-backup-mongodb/pbm/storage/fs/fs.go:200 +0x140
E               path/filepath.walkDir({0xc0004c85f0, 0x45}, {0x120ddc0, 0xc000522b40}, 0xc0000b42f0)
E               	/usr/local/go/src/path/filepath/path.go:310 +0x50
E               path/filepath.walkDir({0xc00018e540, 0x3b}, {0x120ddc0, 0xc000522a00}, 0xc0000b42f0)
E               	/usr/local/go/src/path/filepath/path.go:332 +0x285
E               path/filepath.walkDir({0xc00018e2c0, 0x34}, {0x120de30, 0xc000044bc0}, 0xc0000b42f0)
E               	/usr/local/go/src/path/filepath/path.go:332 +0x285
E               path/filepath.WalkDir({0xc00018e2c0, 0x34}, 0xc0000b42f0)
E               	/usr/local/go/src/path/filepath/path.go:400 +0x75
E               github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List(0x0?, {0xc000554270?, 0x0?}, {0x0, 0x0})
E               	/percona-backup-mongodb/pbm/storage/fs/fs.go:191 +0xcd
E               github.com/percona/percona-backup-mongodb/pbm/restore.ParsePhysRestoreStatus({0xc0001b10c0, 0x1e}, {0x12109f0, 0xc000044ba0}, {0x120e980, 0xc000137780})
E               	/percona-backup-mongodb/pbm/restore/storage.go:68 +0x8d
E               github.com/percona/percona-backup-mongodb/pbm/restore.GetPhysRestoreMeta({0xc0001b10c0, 0x1e}, {0x12109f0, 0xc000044ba0}, {0x120e980, 0xc000137780})
E               	/percona-backup-mongodb/pbm/restore/storage.go:39 +0x3e8
E               main.doRestore.func1({0x120dce0, 0xc0004080e0}, {0x1213b18, 0xc0005b0540}, {0xc0001b10c0, 0x1e})
E               	/percona-backup-mongodb/cmd/pbm/restore.go:493 +0x11c
E               main.waitForRestoreStatus({0x120dce0, 0xc0004080e0}, {0x1213b18, 0xc0005b0540}, {0xc0001b10c0, 0x1e}, 0xc0000b4f50)
E               	/percona-backup-mongodb/cmd/pbm/restore.go:556 +0x1d1
E               main.doRestore({0x120dc38, 0xc0005aee40}, {0x1213b18, 0xc0005b0540}, 0xc00044ea80, 0x0, {0x0, 0x0, 0x0}, {0x0, ...}, ...)
E               	/percona-backup-mongodb/cmd/pbm/restore.go:499 +0xb90
E               main.runRestore({0x120dc38, 0xc0005aee40}, {0x1213b18, 0xc0005b0540}, 0xc0000508e0, 0xc00044ea80, {0xc00050ed30, 0xd}, {0xf8ce8c, 0x4})
E               	/percona-backup-mongodb/cmd/pbm/restore.go:157 +0x699
E               main.main()
E               	/percona-backup-mongodb/cmd/pbm/main.go:545 +0xc5b9

cluster.py:464: AssertionError