Commit 4ffacfa
Anchor sp_HumanEvents cleanup LIKE to its own session names
The @cleanup = 1 path built a DROP EVENT SESSION list for every row
matching N'%HumanEvents_%'. Two problems:
1. Leading % — unanchored, so N'MyHumanEvents_AppSession' (a user's
own XE session whose name happens to include "HumanEvents")
matched and got dropped.
2. Unescaped _ — LIKE treats _ as a single-character wildcard, so
N'HumanEventsMonitor' (no literal underscore at all) matched via
the trailing % plus the _ wildcard absorbing any one character.
Changed to two anchored patterns with the underscore escaped via a
bracket class, matching exactly what sp_HumanEvents creates:
LIKE N'HumanEvents[_]%'
OR LIKE N'keeper[_]HumanEvents[_]%'
Verified against a synthetic session-name set:
OLD matched 4 of 5 names (3 legitimate + HumanEventsMonitor +
MyHumanEvents_AppSession — 2 collateral-damage matches)
NEW matched exactly the 2 sp_HumanEvents sessions
(HumanEvents_waits_abc123, keeper_HumanEvents_blocking)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent fe8189f commit 4ffacfa
1 file changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4831 | 4831 | | |
4832 | 4832 | | |
4833 | 4833 | | |
4834 | | - | |
| 4834 | + | |
| 4835 | + | |
| 4836 | + | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
| 4848 | + | |
| 4849 | + | |
4835 | 4850 | | |
4836 | 4851 | | |
4837 | 4852 | | |
| |||
4843 | 4858 | | |
4844 | 4859 | | |
4845 | 4860 | | |
4846 | | - | |
| 4861 | + | |
| 4862 | + | |
4847 | 4863 | | |
4848 | 4864 | | |
4849 | 4865 | | |
| |||
4856 | 4872 | | |
4857 | 4873 | | |
4858 | 4874 | | |
4859 | | - | |
| 4875 | + | |
| 4876 | + | |
4860 | 4877 | | |
4861 | 4878 | | |
4862 | 4879 | | |
| |||
0 commit comments