Skip to content

PBM-1455: oplog restore tests with tc #1213

PBM-1455: oplog restore tests with tc

PBM-1455: oplog restore tests with tc #1213

GitHub Actions / JUnit Test Report failed Dec 23, 2024 in 0s

23 tests run, 22 passed, 0 skipped, 1 failed.

Annotations

Check failure on line 126 in psmdb-testing/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_remap_PBM_T265[physical]

AssertionError: Starting restore 2024-12-23T14:22:14.609039651Z from '2024-12-23T14:21:01Z'..........................Started physical restore.
Waiting to finish.........................................................panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb42041]

goroutine 1 [running]:
github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List.func1({0xc00048d810, 0x4a}, {0x1525190?, 0xc0004b86c0?}, {0x0?, 0x0?})
	/percona-backup-mongodb/pbm/storage/fs/fs.go:200 +0x1a1
path/filepath.walkDir({0xc00048d810, 0x4a}, {0x1525190, 0xc0004b86c0}, 0xc0007382f8)
	/usr/local/go/src/path/filepath/path.go:443 +0x50
path/filepath.walkDir({0xc000640a00, 0x3e}, {0x1525190, 0xc0004b8280}, 0xc0007382f8)
	/usr/local/go/src/path/filepath/path.go:465 +0x285
path/filepath.walkDir({0xc000640880, 0x34}, {0x1525200, 0xc000665ad0}, 0xc0007382f8)
	/usr/local/go/src/path/filepath/path.go:465 +0x285
path/filepath.WalkDir({0xc000640880, 0x34}, 0xc0007382f8)
	/usr/local/go/src/path/filepath/path.go:533 +0x7b
github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List(0xc000738b60?, {0xc0007d0450?, 0xc000738b00?}, {0x0, 0x0})
	/percona-backup-mongodb/pbm/storage/fs/fs.go:191 +0xf4
github.com/percona/percona-backup-mongodb/pbm/restore.ParsePhysRestoreStatus({0xc00003f000, 0x1e}, {0x1527ef0, 0xc00011b4a0}, {0x1525ca0, 0xc000213a00})
	/percona-backup-mongodb/pbm/restore/storage.go:68 +0xb4
github.com/percona/percona-backup-mongodb/pbm/restore.GetPhysRestoreMeta({0xc00003f000, 0x1e}, {0x1527ef0, 0xc00011b4a0}, {0x1525ca0, 0xc000213a00})
	/percona-backup-mongodb/pbm/restore/storage.go:39 +0x4af
main.waitRestore.func1({0x151cae0?, 0xc000064028?}, {0xc000738e28?, 0x1?}, {0xc00003f000?, 0x10?})
	/percona-backup-mongodb/cmd/pbm/restore.go:240 +0x3e
main.waitRestore({0x1525008, 0xc000139650}, {0x152a738, 0xc00011a6c0}, 0xc00055ea00, {0xc0001332e0, 0x10}, {0xf87bc8, 0x4}, 0x0)
	/percona-backup-mongodb/cmd/pbm/restore.go:251 +0x4c9
main.runRestore({0x1525008, 0xc000139650}, {0x152a738, 0xc00011a6c0}, 0xc000468ce0, 0xc000000c00, {0xc0001332e0, 0x10}, {0xf87bf8, 0x4})
	/percona-backup-mongodb/cmd/pbm/restore.go:193 +0xf5b
main.main()
	/percona-backup-mongodb/cmd/pbm/main.go:551 +0xcccd
Raw output
start_cluster = True, cluster = <cluster.Cluster object at 0x7f7d8977dd10>
newcluster = <cluster.Cluster object at 0x7f7d89783dd0>
backup_type = 'physical'

    @pytest.mark.timeout(900,func_only=True)
    @pytest.mark.parametrize('backup_type',['logical','physical'])
    def test_remap_PBM_T265(start_cluster,cluster,newcluster,backup_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)
        backup = backup + ' --replset-remapping="newrs1=rs1,newrscfg=rscfg"'
        cluster.destroy()
    
        newcluster.create()
        client=pymongo.MongoClient(newcluster.connection)
        Cluster.log(client.admin.command({'transitionFromDedicatedConfigServer': 1}))
        newcluster.setup_pbm()
        result = newcluster.exec_pbm_cli("config --set storage.type=filesystem --set storage.filesystem.path=/backups --set backup.compression=none")
        assert result.rc == 0
        newcluster.make_resync()
    
        restart = True if backup_type == 'physical' else False
>       newcluster.make_restore(backup,restart_cluster=restart,check_pbm_status=True,make_resync=False)

test_PBM-1355.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <cluster.Cluster object at 0x7f7d89783dd0>
name = '2024-12-23T14:21:01Z --replset-remapping="newrs1=rs1,newrscfg=rscfg"'
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 0x7f7d89759990>, exit_status=2, command=b'time...na-backup-mongodb/cmd/pbm/restore.go:193 +0xf5b\nmain.main()\n\t/percona-backup-mongodb/cmd/pbm/main.go:551 +0xcccd\n')
n = <testinfra.host.Host docker://newrscfg01>, timeout = 240, error = ''
host = 'newrscfg03', container = <Container: 712864c36c77>

    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-12-23T14:22:14.609039651Z from '2024-12-23T14:21:01Z'..........................Started physical restore.
E               Waiting to finish.........................................................panic: runtime error: invalid memory address or nil pointer dereference
E               [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb42041]
E               
E               goroutine 1 [running]:
E               github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List.func1({0xc00048d810, 0x4a}, {0x1525190?, 0xc0004b86c0?}, {0x0?, 0x0?})
E               	/percona-backup-mongodb/pbm/storage/fs/fs.go:200 +0x1a1
E               path/filepath.walkDir({0xc00048d810, 0x4a}, {0x1525190, 0xc0004b86c0}, 0xc0007382f8)
E               	/usr/local/go/src/path/filepath/path.go:443 +0x50
E               path/filepath.walkDir({0xc000640a00, 0x3e}, {0x1525190, 0xc0004b8280}, 0xc0007382f8)
E               	/usr/local/go/src/path/filepath/path.go:465 +0x285
E               path/filepath.walkDir({0xc000640880, 0x34}, {0x1525200, 0xc000665ad0}, 0xc0007382f8)
E               	/usr/local/go/src/path/filepath/path.go:465 +0x285
E               path/filepath.WalkDir({0xc000640880, 0x34}, 0xc0007382f8)
E               	/usr/local/go/src/path/filepath/path.go:533 +0x7b
E               github.com/percona/percona-backup-mongodb/pbm/storage/fs.(*FS).List(0xc000738b60?, {0xc0007d0450?, 0xc000738b00?}, {0x0, 0x0})
E               	/percona-backup-mongodb/pbm/storage/fs/fs.go:191 +0xf4
E               github.com/percona/percona-backup-mongodb/pbm/restore.ParsePhysRestoreStatus({0xc00003f000, 0x1e}, {0x1527ef0, 0xc00011b4a0}, {0x1525ca0, 0xc000213a00})
E               	/percona-backup-mongodb/pbm/restore/storage.go:68 +0xb4
E               github.com/percona/percona-backup-mongodb/pbm/restore.GetPhysRestoreMeta({0xc00003f000, 0x1e}, {0x1527ef0, 0xc00011b4a0}, {0x1525ca0, 0xc000213a00})
E               	/percona-backup-mongodb/pbm/restore/storage.go:39 +0x4af
E               main.waitRestore.func1({0x151cae0?, 0xc000064028?}, {0xc000738e28?, 0x1?}, {0xc00003f000?, 0x10?})
E               	/percona-backup-mongodb/cmd/pbm/restore.go:240 +0x3e
E               main.waitRestore({0x1525008, 0xc000139650}, {0x152a738, 0xc00011a6c0}, 0xc00055ea00, {0xc0001332e0, 0x10}, {0xf87bc8, 0x4}, 0x0)
E               	/percona-backup-mongodb/cmd/pbm/restore.go:251 +0x4c9
E               main.runRestore({0x1525008, 0xc000139650}, {0x152a738, 0xc00011a6c0}, 0xc000468ce0, 0xc000000c00, {0xc0001332e0, 0x10}, {0xf87bf8, 0x4})
E               	/percona-backup-mongodb/cmd/pbm/restore.go:193 +0xf5b
E               main.main()
E               	/percona-backup-mongodb/cmd/pbm/main.go:551 +0xcccd

cluster.py:467: AssertionError