Skip to content

[Core] Fire character DB cleanup on DBC client-build change#296

Merged
billy1arm merged 1 commit into
mangosthree:masterfrom
r-log:feature/cleaner-dbc-build-trigger
Jul 4, 2026
Merged

[Core] Fire character DB cleanup on DBC client-build change#296
billy1arm merged 1 commit into
mangosthree:masterfrom
r-log:feature/cleaner-dbc-build-trigger

Conversation

@r-log

@r-log r-log commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

The CharacterDatabaseCleaner (reconciles character_achievement_progress / character_skills / character_spell / character_talent against the DBC stores) is gated on saved_variables.cleaning_flags — which nothing has ever set (schema-default 0, only ever read and reset). So the cleaner has never actually run, on any core.

Orphaned rows only appear when the valid-ID set changes, i.e. when the operator swaps the extracted DBC data for a different client build. This wires the cleaner to fire exactly then:

  • expose the already-read loaded DBC build (GetDBCLoadedBuild(), no new read);
  • on startup compare it against a new saved_variables.last_cleaned_dbc_build;
  • on mismatch set all cleaning flags → run the reconciliation → record the build after success (a crash mid-clean re-runs next boot; manual cleaning_flags UPDATE still works);
  • on match, return before any table scan.

Verified with a live 3-scenario boot matrix (build-change purges planted orphans; match skips the scans; an un-migrated DB warns and still boots).

Schema coordination: requires a paired mangosthree/database migration Rel22_03_003_Add_Last_Cleaned_DBC_Build (adds saved_variables.last_cleaned_dbc_build); this PR bumps CHAR_DB_CONTENT_NR 2→3 to match. The migration SQL is ready — happy to open it against the database repo alongside. The version bump is a content-level change, so it's soft both ways (an un-migrated DB boots with a warning).


This change is Reviewable

CharacterDatabaseCleaner::CleanDatabase() has been dead since import:
it is gated on saved_variables.cleaning_flags, which nothing ever sets
non-zero, so the orphaned-row reconciliation against the DBC stores
never runs.

Orphaned character_achievement_progress / character_skills /
character_spell / character_talent rows only appear when the extracted
DBC data is swapped for another client build. Track that build in the
new saved_variables.last_cleaned_dbc_build column (character DB update
Rel22_03_003) and schedule a full cleanup whenever the build loaded at
startup differs from the recorded one. The build is recorded only after
a completed run, so an interrupted cleanup retries on the next startup,
and manually set cleaning_flags keep working as before.

On databases without the new column the cleaner logs a DB-update notice
and falls back to the legacy flags-only behaviour.
billy1arm pushed a commit to mangosthree/database that referenced this pull request Jul 4, 2026
…#131)

Paired with mangosthree/server#296 (DBC-build-change character DB cleanup). Adds the column the core reads to decide when to run the reconciliation; chains db_version 22/03/002 -> 22/03/003.
@billy1arm billy1arm merged commit bb14b84 into mangosthree:master Jul 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants