Skip to content

Conversation

@andreasjordan
Copy link
Collaborator

Type of Change

  • Bug fix (non-breaking change, fixes # )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (Invoke-ManualPester)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

Best fix would be fix the import of dbatools inside of the runspaces.

This is just a workaround.

The diff is maybe difficult to read as I fixed the indentation as well.

@potatoqualitee
Copy link
Member

hell yeah, excited about improvements to the encryption suite

@potatoqualitee
Copy link
Member

on the agenda, just a bit to review

@andreasjordan
Copy link
Collaborator Author

Maybe you find a way to import dbatools inside of the runspace so that the custom methods like ".Query()" are imported correctly. Then we would have a blueprint for that kind of parallelism. That would be even better than my fix.

I forgot to take a screenshot of the error messages. But you just need to run this part of the test:

            $parallelBackupPath = "$($TestConfig.Temp)\$CommandName-Parallel-$(Get-Random)"
            $null = New-Item -Path $parallelBackupPath -ItemType Directory
            $parallelTestDatabases = @()
            1..3 | ForEach-Object {
                $parallelTestDatabases += New-DbaDatabase -SqlInstance $TestConfig.instance2
            }


            $passwd = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
            $splatParallelEncryption = @{
                SqlInstance             = $TestConfig.instance2
                Database                = $parallelTestDatabases.Name
                MasterKeySecurePassword = $passwd
                BackupSecurePassword    = $passwd
                BackupPath              = $parallelBackupPath
                Parallel                = $true
            }
            $results = Start-DbaDbEncryption @splatParallelEncryption

@andreasjordan
Copy link
Collaborator Author

You don't even need multiple databases, should also work with just one. Only use the -Parallelswitch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants