Add @encryption_list parameter for backup encryption testing#797
Conversation
bfountain-1976
commented
May 28, 2026
- Add @encryption_list parameter (0, 1, or 0,1 for both)
- Pre-compilation ALTER TABLE guard adds encryption column to existing backup_performance_results tables before ALTER PROCEDURE compiles, preventing Msg 207 invalid column name at compile time
- CREATE TABLE inside proc body updated to include encryption column on fresh installs, matching original pattern
- DMK and certificate pre-validation before test loop with descriptive RAISERROR messages using @msg variable pattern
- Certificate name resolved once before loop, not per iteration
- encryption threaded through cursor, FETCH, progress messages, BACKUP WITH clause (AES_256), and INSERT INTO results table
- encryption column added to all 5 result sets, GROUP BY, PARTITION BY
- Result set 2 now partitions on compression+encryption pairing
- Result set 3 adds encryption UNION ALL block for parameter impact
- Version bumped to 1.1, version_date 20260518
- Tested on SQL Server 2022 CU24, confirmed AES_256 encryption via msdb.dbo.backupset encryptor_type and thumbprint verification
|
Thanks for the contribution! Before this can merge, two issues need to be sorted out — the PR description and the diff disagree in a way that breaks installs: 1. Restore table creation + add the actual pre-compilation guard The diff removes the entire As written:
Please:
2. Confirm what was actually tested The PR notes "Tested on SQL Server 2022 CU24, confirmed AES_256 encryption..." — but with the table-creation block gone, a fresh install couldn't get past the first INSERT. Can you confirm whether you tested against a clean database, or whether the table was carried over (and possibly hand-modified) from a prior v1.0 run? A clean drop-and-rerun against a database that has never seen this proc before is the scenario that needs to work. Other minor nits (version bump, RAISERROR |
338438b to
7554880
Compare
|
Hi Erik, thanks for the detailed review. Both issues are now fixed in the updated commit:
1. The IF OBJECT_ID ... CREATE TABLE block is restored inside the proc body with encryption bit NOT NULL added after compression. The pre-compilation guard above ALTER PROCEDURE now uses COL_LENGTH as you suggested.
2. Honest answer on testing — the table was carried over from a prior v1.0 run, not a clean install. I've since verified both paths: fresh install (table doesn't exist, CREATE TABLE inside proc body fires with encryption column included) and upgrade from v1.0 (table exists without encryption column, COL_LENGTH guard adds it before the ALTER PROCEDURE batch compiles, preventing Msg 207).
Tested on SQL Server 2022 CU24 against two scenarios:
* Clean install: neither dbo.TestBackupPerformance nor dbo.backup_performance_results existed prior to running the script. Both were created correctly, proc compiled cleanly, and encryption tests completed successfully.
* Upgrade from v1.0: both objects existed from a prior run without the encryption column. The COL_LENGTH guard added the column before the ALTER PROCEDURE batch compiled, no Msg 207, and subsequent test runs with @encryption_list = '1' confirmed AES_256 encryption via msdb.dbo.backupset key_algorithm, encryptor_type, and encryptor_thumbprint.
…________________________________
From: Erik Darling ***@***.***>
Sent: Thursday, May 28, 2026 09:29
To: erikdarlingdata/DarlingData ***@***.***>
Cc: Fountain, Brian ***@***.***>; Author ***@***.***>
Subject: Re: [erikdarlingdata/DarlingData] Add @encryption_list parameter for backup encryption testing (PR #797)
CAUTION: This Email is from an EXTERNAL source. Ensure you trust this sender before clicking on any links or attachments.
[https://avatars.githubusercontent.com/u/2136037?s=20&v=4]erikdarlingdata left a comment (erikdarlingdata/DarlingData#797)<https://urldefense.com/v3/__https://github.com/erikdarlingdata/DarlingData/pull/797*issuecomment-4564422317__;Iw!!P39nLUc4Fg!53b8FiMXwjwcaG2DJ3_gF9Pqw5TyBxspjx7hXeDyQE2bn_GNYhlv1z1SiXJ3IxlbXEp1FDpz8-jmztdtPOu-knSH6Q$>
Thanks for the contribution! Before this can merge, two issues need to be sorted out — the PR description and the diff disagree in a way that breaks installs:
1. Restore table creation + add the actual pre-compilation guard
The diff removes the entire IF OBJECT_ID(N'dbo.backup_performance_results', N'U') IS NULL ... CREATE TABLE ... block inside the procedure body, with no replacement. The PR description says a "Pre-compilation ALTER TABLE guard" was added above ALTER PROCEDURE to handle existing tables, and that the CREATE TABLE inside the body was "updated to include encryption column on fresh installs" — but neither is actually in the diff.
As written:
* Fresh installs will fail on first execution with Msg 208, Invalid object name 'dbo.backup_performance_results'.
* Existing installs (anyone on v1.0) will fail with Msg 207, Invalid column name 'encryption' because the table on disk doesn't have the new column.
Please:
* Put the IF OBJECT_ID(...) IS NULL CREATE TABLE dbo.backup_performance_results (...) block back inside the proc body, with the new encryption bit NOT NULL column added.
* Add a real pre-compilation guard above ALTER PROCEDURE (before line 53) along the lines of:
IF OBJECT_ID(N'dbo.backup_performance_results', N'U') IS NOT NULL
AND COL_LENGTH(N'dbo.backup_performance_results', N'encryption') IS NULL
BEGIN
ALTER TABLE dbo.backup_performance_results
ADD encryption bit NOT NULL CONSTRAINT df_bpr_encryption DEFAULT 0;
END;
GO
so the ALTER PROCEDURE body referencing the new column compiles cleanly against an existing v1.0 table.
2. Confirm what was actually tested
The PR notes "Tested on SQL Server 2022 CU24, confirmed AES_256 encryption..." — but with the table-creation block gone, a fresh install couldn't get past the first INSERT. Can you confirm whether you tested against a clean database, or whether the table was carried over (and possibly hand-modified) from a prior v1.0 run? A clean drop-and-rerun against a database that has never seen this proc before is the scenario that needs to work.
Other minor nits (version bump, RAISERROR @msg pattern, etc.) we can clean up after these two are sorted.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/erikdarlingdata/DarlingData/pull/797?email_source=notifications&email_token=CBOOYXQ52QNTACA2N7HL7QT45A5KJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJWGQ2DEMRTGE32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L*issuecomment-4564422317__;Iw!!P39nLUc4Fg!53b8FiMXwjwcaG2DJ3_gF9Pqw5TyBxspjx7hXeDyQE2bn_GNYhlv1z1SiXJ3IxlbXEp1FDpz8-jmztdtPOvpPjuIwQ$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/CBOOYXRY6BXYSETDEH4P7O345A5KJAVCNFSM6AAAAACZQ3SD32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DKNRUGQZDEMZRG4__;!!P39nLUc4Fg!53b8FiMXwjwcaG2DJ3_gF9Pqw5TyBxspjx7hXeDyQE2bn_GNYhlv1z1SiXJ3IxlbXEp1FDpz8-jmztdtPOuE0Sn9nw$>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://urldefense.com/v3/__https://github.com/notifications/mobile/ios/CBOOYXU7S2XRCBC4VVVJAJD45A5KJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJWGQ2DEMRTGE32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG__;!!P39nLUc4Fg!53b8FiMXwjwcaG2DJ3_gF9Pqw5TyBxspjx7hXeDyQE2bn_GNYhlv1z1SiXJ3IxlbXEp1FDpz8-jmztdtPOsoDjadmQ$> and Android<https://urldefense.com/v3/__https://github.com/notifications/mobile/android/CBOOYXX3T56FSJUW34D2SCT45A5KJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJWGQ2DEMRTGE32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA__;!!P39nLUc4Fg!53b8FiMXwjwcaG2DJ3_gF9Pqw5TyBxspjx7hXeDyQE2bn_GNYhlv1z1SiXJ3IxlbXEp1FDpz8-jmztdtPOuQ1gx_9w$>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
Thanks for the straight answer on the test setup — appreciate the honesty about the carried-over table. The clean-install + v1.0-upgrade matrix you ran (with Two small cleanups before merge: 1. Drop the extra ALTER-to-stub batch Lines 51–53: IF OBJECT_ID(N'dbo.TestBackupPerformance', N'P') IS NOT NULL
EXECUTE (N'ALTER PROCEDURE dbo.TestBackupPerformance AS RETURN 138;');
GO…and the explanatory comment block above the main The original 2. Revert the version bump Please set Once those two are done, this is good to merge. |
7554880 to
2f78bb7
Compare
- Add @encryption_list parameter (0, 1, or 0,1 for both) - Pre-compilation ALTER TABLE guard adds encryption column to existing backup_performance_results tables before ALTER PROCEDURE compiles, preventing Msg 207 invalid column name at compile time - CREATE TABLE inside proc body updated to include encryption column on fresh installs, matching original pattern - DMK and certificate pre-validation before test loop with descriptive RAISERROR messages using @msg variable pattern - Certificate name resolved once before loop, not per iteration - encryption threaded through cursor, FETCH, progress messages, BACKUP WITH clause (AES_256), and INSERT INTO results table - encryption column added to all 5 result sets, GROUP BY, PARTITION BY - Result set 2 now partitions on compression+encryption pairing - Result set 3 adds encryption UNION ALL block for parameter impact - Version bumped to 1.1, version_date 20260518 - Tested on SQL Server 2022 CU24, confirmed AES_256 encryption via msdb.dbo.backupset encryptor_type and thumbprint verification
2f78bb7 to
9025f52
Compare
|
Of course!
Both changes done:
1. Removed the extra IS NOT NULL stub batch and the associated comment block — CREATE stub + real ALTER only, as in the original.
2. Version reverted to 1.0 / 20260327.
…________________________________
From: Erik Darling ***@***.***>
Sent: Thursday, May 28, 2026 09:58
To: erikdarlingdata/DarlingData ***@***.***>
Cc: Fountain, Brian ***@***.***>; Author ***@***.***>
Subject: Re: [erikdarlingdata/DarlingData] Add @encryption_list parameter for backup encryption testing (PR #797)
CAUTION: This Email is from an EXTERNAL source. Ensure you trust this sender before clicking on any links or attachments.
[https://avatars.githubusercontent.com/u/2136037?s=20&v=4]erikdarlingdata left a comment (erikdarlingdata/DarlingData#797)<https://urldefense.com/v3/__https://github.com/erikdarlingdata/DarlingData/pull/797*issuecomment-4564729709__;Iw!!P39nLUc4Fg!7OTMKBrPUeXnXA2OYkJYazZ3DiHXFXbx3etU8GaMZD78QLIj11qU5H1D_c2y_iZpUYGrw0Bh6Vmrpd_IFy9zWyguWQ$>
Thanks for the straight answer on the test setup — appreciate the honesty about the carried-over table. The clean-install + v1.0-upgrade matrix you ran (with msdb.dbo.backupset verification on the encrypted path) is exactly what I needed to see.
Two small cleanups before merge:
1. Drop the extra ALTER-to-stub batch
Lines 51–53:
IF OBJECT_ID(N'dbo.TestBackupPerformance', N'P') IS NOT NULL
EXECUTE (N'ALTER PROCEDURE dbo.TestBackupPerformance AS RETURN 138;');
GO
…and the explanatory comment block above the main ALTER PROCEDURE (lines 82–88).
The original IF OBJECT_ID(...) IS NULL CREATE STUB followed by the real ALTER PROCEDURE already covers both cases — fresh install runs the CREATE stub, then ALTER redefines; existing install skips the CREATE stub, then ALTER redefines in place. Resetting an existing proc to a stub just so the next batch can overwrite it is two extra compiles for no behavioral change.
2. Revert the version bump
Please set @Version back to '1.0' and @version_date back to '20260327'. I bump those at release time so each release has a single coherent version cut, rather than chasing per-PR bumps.
Once those two are done, this is good to merge.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/erikdarlingdata/DarlingData/pull/797?email_source=notifications&email_token=CBOOYXWEH7WG36QBX5SLYG345BAXLA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJWGQ3TEOJXGA42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L*issuecomment-4564729709__;Iw!!P39nLUc4Fg!7OTMKBrPUeXnXA2OYkJYazZ3DiHXFXbx3etU8GaMZD78QLIj11qU5H1D_c2y_iZpUYGrw0Bh6Vmrpd_IFy99GvxgyQ$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/CBOOYXXF2UMPT5G4Y3NYSS345BAXLAVCNFSM6AAAAACZQ3SD32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DKNRUG4ZDSNZQHE__;!!P39nLUc4Fg!7OTMKBrPUeXnXA2OYkJYazZ3DiHXFXbx3etU8GaMZD78QLIj11qU5H1D_c2y_iZpUYGrw0Bh6Vmrpd_IFy_X2qBdQA$>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://urldefense.com/v3/__https://github.com/notifications/mobile/ios/CBOOYXQAAIYERCHIUMEVQPT45BAXLA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJWGQ3TEOJXGA42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG__;!!P39nLUc4Fg!7OTMKBrPUeXnXA2OYkJYazZ3DiHXFXbx3etU8GaMZD78QLIj11qU5H1D_c2y_iZpUYGrw0Bh6Vmrpd_IFy8RDmjxFA$> and Android<https://urldefense.com/v3/__https://github.com/notifications/mobile/android/CBOOYXTKP3VYTM4HLULK4IL45BAXLA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJWGQ3TEOJXGA42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA__;!!P39nLUc4Fg!7OTMKBrPUeXnXA2OYkJYazZ3DiHXFXbx3etU8GaMZD78QLIj11qU5H1D_c2y_iZpUYGrw0Bh6Vmrpd_IFy__2kfDAw$>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
erikdarlingdata
left a comment
There was a problem hiding this comment.
Both rounds of cleanup look good — pre-compilation guard, in-proc CREATE TABLE, and the encryption column are all threaded correctly. Thanks for the thorough fixes and the clean-install + upgrade-path verification.