Don't call init reducer in spacetime generate (#4312)

# Description of Changes

Fixes #3492.

# Expected complexity level and risk

1

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

- [ ] <!-- maybe a test you want to do -->
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->
This commit is contained in:
Noa
2026-02-16 17:34:19 -06:00
committed by GitHub
parent 919908fb70
commit fcd9f294e7
+20 -17
View File
@@ -338,8 +338,8 @@ impl HostController {
///
/// This is not necessary during hotswap publishes,
/// as the automigration planner and executor accomplish the same validity checks.
pub async fn check_module_validity(&self, database: Database, program: Program) -> anyhow::Result<Arc<ModuleInfo>> {
Host::try_init_in_memory_to_check(
pub async fn check_module_validity(&self, database: Database, program: Program) -> anyhow::Result<()> {
let (program, launched) = Host::try_init_in_memory_to_check(
&self.runtimes,
self.page_pool.clone(),
database,
@@ -352,7 +352,14 @@ impl HostController {
self.db_cores.take(),
self.bsatn_rlb_pool.clone(),
)
.await
.await?;
let call_result = launched.module_host.init_database(program).await?;
if let Some(call_result) = call_result {
Result::from(call_result)?;
}
Ok(())
}
/// Run a computation on the [`RelationalDB`] of a [`ModuleHost`] managed by
@@ -1012,8 +1019,7 @@ impl Host {
})
}
/// Construct an in-memory instance of `database` running `program`,
/// initialize it, then immediately destroy it.
/// Construct an in-memory instance of `database` running `program`.
///
/// This is used during an initial, fresh publish operation
/// in order to check the `program`'s validity as a module,
@@ -1029,7 +1035,7 @@ impl Host {
program: Program,
core: AllocatedJobCore,
bsatn_rlb_pool: BsatnRowListBuilderPool,
) -> anyhow::Result<Arc<ModuleInfo>> {
) -> anyhow::Result<(Program, LaunchedModule)> {
let (db, _connected_clients) = RelationalDB::open(
database.database_identity,
database.owner_identity,
@@ -1039,7 +1045,7 @@ impl Host {
page_pool,
)?;
let (program, launched) = launch_module(
launch_module(
database,
0,
program,
@@ -1054,14 +1060,7 @@ impl Host {
core,
bsatn_rlb_pool,
)
.await?;
let call_result = launched.module_host.init_database(program).await?;
if let Some(call_result) = call_result {
Result::from(call_result)?;
}
Ok(launched.module_host.info)
.await
}
/// Attempt to replace this [`Host`]'s [`ModuleHost`] with a new one running
@@ -1278,8 +1277,12 @@ pub(crate) async fn extract_schema_with_pools(
};
let core = AllocatedJobCore::default();
let module_info =
Host::try_init_in_memory_to_check(runtimes, page_pool, database, program, core, bsatn_rlb_pool).await?;
// Limit the scope of the launched module just to this block.
let module_info = {
let (_, launched) =
Host::try_init_in_memory_to_check(runtimes, page_pool, database, program, core, bsatn_rlb_pool).await?;
launched.module_host.info
};
// this should always succeed, but sometimes it doesn't
let module_def = match Arc::try_unwrap(module_info) {
Ok(info) => Arc::try_unwrap(info.module_def).unwrap_or_else(|module_def| (*module_def).clone()),