@@ -100,14 +100,14 @@ pub struct ModuleHostWithBootstrap {
100100/// The handle owns any wait state needed to prove that the database has a
101101/// durable `st_module` row.
102102pub struct BootstrapCompletion {
103- program_hash : Hash ,
103+ bootstrap_generation : u64 ,
104104 status : ProgramBootstrap ,
105105}
106106
107107/// Has the module been bootstrapped from the controldb?
108108///
109109/// Once we have inserted into `st_module`, bootstrapping is no longer necessary,
110- /// and the initial program bytes can be dropped fromt the controldb.
110+ /// and the initial program bytes can be dropped from the controldb.
111111enum ProgramBootstrap {
112112 /// The module's program bytes have already been written to `st_module`
113113 Durable ,
@@ -119,32 +119,32 @@ enum ProgramBootstrap {
119119}
120120
121121impl BootstrapCompletion {
122- fn durable ( program_hash : Hash ) -> Self {
122+ fn durable ( bootstrap_generation : u64 ) -> Self {
123123 Self {
124- program_hash ,
124+ bootstrap_generation ,
125125 status : ProgramBootstrap :: Durable ,
126126 }
127127 }
128128
129- fn pending ( program_hash : Hash , tx_offset : TransactionOffset , durable_offset : Option < DurableOffset > ) -> Self {
129+ fn pending ( bootstrap_generation : u64 , tx_offset : TransactionOffset , durable_offset : Option < DurableOffset > ) -> Self {
130130 Self {
131- program_hash ,
131+ bootstrap_generation ,
132132 status : ProgramBootstrap :: Pending {
133133 tx_offset,
134134 durable_offset,
135135 } ,
136136 }
137137 }
138138
139- pub fn program_hash ( & self ) -> Hash {
140- self . program_hash
139+ pub fn bootstrap_generation ( & self ) -> u64 {
140+ self . bootstrap_generation
141141 }
142142
143143 /// Wait until it is safe to complete program bootstrap in controldb.
144144 /// That is, wait until the initial `st_module` insert becomes durable.
145- pub async fn wait ( self ) -> anyhow:: Result < Hash > {
145+ pub async fn wait ( self ) -> anyhow:: Result < ( ) > {
146146 match self . status {
147- ProgramBootstrap :: Durable => Ok ( self . program_hash ) ,
147+ ProgramBootstrap :: Durable => Ok ( ( ) ) ,
148148 ProgramBootstrap :: Pending {
149149 tx_offset,
150150 durable_offset,
@@ -160,7 +160,7 @@ impl BootstrapCompletion {
160160 . context ( "failed waiting for initialized program to become durable" ) ?;
161161 }
162162
163- Ok ( self . program_hash )
163+ Ok ( ( ) )
164164 }
165165 }
166166 }
@@ -1132,7 +1132,8 @@ impl Host {
11321132 ( program, true )
11331133 }
11341134 } ;
1135- let mut bootstrap_completion = Some ( BootstrapCompletion :: durable ( program. hash ) ) ;
1135+ let bootstrap_generation = database. bootstrap_generation ;
1136+ let mut bootstrap_completion = Some ( BootstrapCompletion :: durable ( bootstrap_generation) ) ;
11361137
11371138 let relational_db = Arc :: new ( db) ;
11381139 let ( program, launched) = match HostType :: from ( program. kind ) {
@@ -1222,13 +1223,12 @@ impl Host {
12221223 } ;
12231224
12241225 if program_needs_init {
1225- let program_hash = program. hash ;
12261226 let InitDatabaseResult { reducer, tx_offset } = launched. module_host . init_database ( program) . await ?;
12271227 if let Some ( call_result) = reducer {
12281228 Result :: from ( call_result) ?;
12291229 }
12301230 bootstrap_completion = Some ( BootstrapCompletion :: pending (
1231- program_hash ,
1231+ bootstrap_generation ,
12321232 tx_offset,
12331233 launched. module_host . durable_tx_offset ( ) ,
12341234 ) ) ;
@@ -1540,6 +1540,7 @@ pub(crate) async fn extract_schema_with_pools(
15401540 owner_identity,
15411541 host_type,
15421542 initial_program : program. hash ,
1543+ bootstrap_generation : 0 ,
15431544 } ;
15441545
15451546 let core = AllocatedJobCore :: default ( ) ;
0 commit comments