feat: live updates move every server onto a new build without a restart

With new binaries in place, master moves everything onto them while the
server keeps running (the dashboard's Live update, /liveupdate or SIGUSR2 to
master):

- database migrations of the new build first; a failure stops there
- UGC finishes the jobs it is running (queued rows stay pending), auth
  restarts, chat hands its teams to master for the next chat server; master
  starts the new processes and retries ones that don't come back
- once the new chat server is up (CHAT_SERVER_READY) every world connects at
  once and sends its players again (LoginSessionNotify resync, no login logged)
- every world instance is replaced with an instance migration: public worlds
  and private ones (same password) at once, properties after the old instance
  saved and froze the property (MIGRATE_PREPARE: no building, claiming or
  saving there any more), activity zones and character select once their
  players left or after a wait; empty instances just stop, zones in
  prestart_worlds get a new one first
- the dashboard restarts last and picks the status up again

Players land where they stood (position carried in CarriedPlayerState, also on
properties and Moon Base). Draining instances get no new players
(InstanceMigration::AcceptsNewPlayers) and show as "Moving players" in the
world list. The order lives in LiveUpdateMachine.h without master state and is
unit tested; master's glue is LiveUpdateCoordinator. Master itself is not
replaced. Message IDs are appended only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-28 15:01:05 -05:00
parent bfc45dc662
commit 109a936798
47 changed files with 3213 additions and 59 deletions

View File

@@ -4,6 +4,7 @@
#include <functional>
#include "master/InstanceMigration.h"
#include "master/LiveUpdate.h"
#include "RakNetTypes.h"
#include "dCommonVars.h"
@@ -28,6 +29,12 @@ namespace WorldMigration {
// MIGRATE_PLAYER_STATE from master: a player on their way here
void StoreCarriedState(const CarriedPlayerState& state);
// MIGRATE_PREPARE from master (live update of a property): wait for builders, save the property and freeze it
void HandlePrepare(const MigratePrepare& prepare);
// The player entity of someone moved here was just made: put them where they stood (properties don't save it)
void ApplyCarriedPosition(Entity* player);
// Every world frame
void Update(float deltaTime);
@@ -59,6 +66,12 @@ namespace WorldMigration {
// /mergeinstance [target instance, 0 for the best fit] [warn seconds] [seamless]
void MergeInstanceCommand(Entity* entity, const SystemAddress& sysAddr, const std::string args);
// /liveupdate [start [warn seconds] | cancel | status]: a live update of the whole server (docs/LiveUpdate.md)
void LiveUpdateCommand(Entity* entity, const SystemAddress& sysAddr, const std::string args);
// LIVE_UPDATE_STATUS from master: tell the GM who asked, if they are here
void HandleLiveUpdateStatus(const LiveUpdateStatus& status);
}
#endif //!__WORLDMIGRATION__H__