Add AzerothCore cluster service integration#37
Conversation
Add the shared protobuf, generated runtime code, events, GUID helpers, auth identity helpers, and configuration contracts used by clustered gateway, registry, group, guild, matchmaking, and sidecar flows. Tests, local tooling, and broad documentation are intentionally excluded from this upstream-focused scope.
Wire service discovery, map readiness, stale-safe health and metrics observers, degraded game-server health handling, gateway-scoped cleanup, and shared GUID allocation support. Registry and health code now distinguish world-loop degraded state from process or transport death while preserving live map ownership.
Keep world-loop degraded game servers registered for ownership and existing lookups, but mark them as non-admitting so new player placement skips them. Clear the drain state on successful health recovery and fall back to healthy all-map nodes when an assigned owner is degraded.
Route gateway sessions through cluster-aware worldserver selection, native transport handoff, bounded retry/backoff, cross-service event listeners, and client-facing packet rendering for social, group, guild, guild bank, LFG, battleground, arena, mail, channel, and player-state flows.
Extend character, chat, and mail services for clustered realm identity, Real ID/account lookups, channel membership and moderation, crossrealm whisper policy, online-state broadcasts, and arena-team persistence used by gateway routing.
Add clustered group authority for realm-scoped membership, native LFG materialized groups, member-state freshness, latest-state catch-up, receiver-aware fanout, offline cleanup, debug tracing, and persistent group identity support.
Add realm-scoped guild service routing, charter offer/sign/query/signature handling, native petition persistence, guild cache lifecycle, gateway-facing events, and debug logging for same-realm clustered guild workflows.
Add guildserver-owned same-realm guild bank item, money, tab, log, text, split, merge, withdraw-limit, rollback, and idempotency helpers backed by direct MySQL transactions and guidserver item allocation.
Extend matchmaking and mysqlreverseproxy for crossrealm LFG proposal materialization, persistent instance routes, battleground owner placement, arena-team persistence and rated-result handling, character-state listeners, and route-aware SQL interception.
Extend the libsidecar C ABI and Go bridge with grouped member-state events, guild and LFG RPCs, arena-team and item APIs, monitoring/readiness behavior, config loading, and consumer handlers required by the clustered AzerothCore integration.
Add auth and character database migrations for Real ID friends, crossrealm group identity, LFG route persistence, stable petition IDs, and guild bank idempotency/locking changes required by clustered services.
walkline
left a comment
There was a problem hiding this comment.
Thanks for the PR! I will review it in several sessions. This is the first one.
| @@ -0,0 +1,66 @@ | |||
| SET @tc9_has_petition_id := ( | |||
| @@ -0,0 +1 @@ | |||
| DROP TABLE IF EXISTS `tc9_guild_bank_lock`; | |||
| B = fixedLittleEndianBytes(s._B, 32) | ||
| g = bigIntToBytesLittleEndian(_g) | ||
| N = fixedLittleEndianBytes(bigIntToBytesLittleEndian(_N), 32) | ||
| _s = fixedLittleEndianBytes(s._s, 32) |
There was a problem hiding this comment.
Wondering what was wrong with previous SRP implementation?
| if err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
I would prefer to explicitly show the error rather than hide the issue.
|
|
||
| func (s *AuthSession) write(writer io.Writer, v ...interface{}) error { | ||
| var err error | ||
| packet := new(bytes.Buffer) |
There was a problem hiding this comment.
Hm, why are we using an additional buffer instead of writing directly to the writer?
| authDB, err := sql.Open("mysql", conf.AuthDBConnection) | ||
| if err != nil { | ||
| log.Fatal().Err(err).Msg("can't connect to auth db") | ||
| } | ||
| defer authDB.Close() | ||
| configureDBConn(authDB) |
There was a problem hiding this comment.
Hm, I don't know if we want the auth DB in charserver. I understand that it's required for Real ID, but I don't see this feature as super important. Maybe we could make it optional and hide it behind config?
| account_id_low INT UNSIGNED NOT NULL, | ||
| account_id_high INT UNSIGNED NOT NULL, |
There was a problem hiding this comment.
What is low and high id? Why its required here?
|
|
||
| team := ArenaTeamDetails{} | ||
| err = db.QueryRowContext(ctx, ` | ||
| SELECT arenaTeamId, name, captainGuid, type, rating, weekGames, weekWins, seasonGames, seasonWins, `+"`rank`"+`, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor |
There was a problem hiding this comment.
Can we use prepared statements in this repo, like we do in other places?
|
|
||
| lockName := fmt.Sprintf("tc9_arena_team_create:%d", request.RealmID) | ||
| var locked int | ||
| if err := db.QueryRowContext(ctx, "SELECT GET_LOCK(?, 5)", lockName).Scan(&locked); err != nil { |
There was a problem hiding this comment.
Let's avoid locking when possible. I assume it's there to make sure we don't create the same team twice. I'm not sure if that's even possible, but theoretically, if it is, then it's probably better to add a uniqueness constraint to the name field, for example. Then I think we can remove this lock.
This replaces the previous draft PR split (#27-#36).
Those drafts were opened from stacked branches while targeting
master, which made the GitHub diffs misleading: each PR included earlier slices and a lot of unrelated-looking overlap. This PR intentionally presents the current ToCloud9 side of the AzerothCore cluster integration as one honest review surface instead of pretending the stacked branches are independent.What this adds
Review notes
The implementation is large because the pieces share protobuf contracts, generated clients, gateway listeners, service events, sidecar calls, and database state. Splitting this into independent PRs against
masteris not currently truthful unless the earlier foundation PRs are merged first and later PRs retarget those merged bases.The main intention here is to give a correct review target for the current integration state. If you prefer a sequential merge plan, the safe order is roughly:
That sequence should be created as a real stacked series only after each base exists in the upstream repository or in an agreed upstream integration branch.
Validation
Run on the cleaned branch:
All three passed locally.