Skip to content

Remove Batch Id Cleanup Job SQL script and update changelog files#725

Open
ericnagel wants to merge 1 commit intomainfrom
en/APP-404-batch-id-cleanup-job
Open

Remove Batch Id Cleanup Job SQL script and update changelog files#725
ericnagel wants to merge 1 commit intomainfrom
en/APP-404-batch-id-cleanup-job

Conversation

@ericnagel
Copy link
Copy Markdown
Contributor

Description

  • Removed the msdb onboarding changeset from db.msdb.changelog-16.1.yaml:1
  • Added the missing RDB_modern table changeset before the cleanup procedure in db.rdb_modern.changelog-16.1.yaml:2819
  • The batch ID cleanup SQL Agent job is no longer created during onboarding because 1007-create_batch_id_cleanup_job-001.sql was deleted and its msdb changelog entry was removed.
  • The existing table script for nrt_delete_job_log is now included in the RDB_modern changelog before sp_batch_id_cleanup_postprocessing, so the procedure's dependency is deployed with the release.
  • I set that new table changeset to splitStatements: false so Liquibase preserves the SQL file's IF ... BEGIN ... END block and seed insert as one batch.

Related Issue

APP-404: Update scripts for batch ID cleanup job

Additional Notes

Before:

SELECT name
FROM msdb.dbo.sysjobs
WHERE name = 'BatchIdCleanup';

Returned 1 result.

SELECT OBJECT_ID('dbo.nrt_delete_job_log') AS nrt_delete_job_log_id,
       OBJECT_ID('dbo.sp_batch_id_cleanup_postprocessing') AS proc_id;

Returned NULL / 715278124

SELECT TOP 5 RUN_ID, RUN_START_DTTM, RUN_END_DTTM, RUN_STATUS
FROM dbo.nrt_delete_job_log
ORDER BY RUN_ID DESC;

Failed (the table did not exist)

After:

SELECT name
FROM msdb.dbo.sysjobs
WHERE name = 'BatchIdCleanup';

Returned 0 results ✔

SELECT OBJECT_ID('dbo.nrt_delete_job_log') AS nrt_delete_job_log_id,
       OBJECT_ID('dbo.sp_batch_id_cleanup_postprocessing') AS proc_id;

Returned 715278124 / 731278181 ✔

Then:

SELECT TOP 5 RUN_ID, RUN_START_DTTM, RUN_END_DTTM, RUN_STATUS
FROM dbo.nrt_delete_job_log
ORDER BY RUN_ID DESC;

Returned

RUN_ID RUN_START_DTTM RUN_END_DTTM RUN_STATUS
1 2026-03-30 14:31:58.943 2026-03-30 14:31:58.943 Initial

Execute the stored procedure:

EXEC dbo.sp_batch_id_cleanup_postprocessing @debug = 1;

Finally verify a successful log row was written:

RUN_ID RUN_START_DTTM RUN_END_DTTM RUN_STATUS
2 2026-03-30 14:35:37.033 2026-03-30 14:35:37.247 Success
1 2026-03-30 14:31:58.943 2026-03-30 14:31:58.943 Initial

Checklist

  • I have ensured that the pull request is of a manageable size, allowing it to be reviewed within a single session.
  • I have reviewed my changes to ensure they are clear, concise, and well-documented.
  • I have updated the documentation, if applicable.
  • I have added or updated test cases to cover my changes, if applicable.

@ericnagel ericnagel requested a review from a team as a code owner March 30, 2026 15:13
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.

1 participant