Append a `SurrogateBind` record. Emitted by `SurrogateAssigner::assign` immediately after the catalog two-table txn that writes `_system.surrogate_pk{,_rev}`, so the binding survives a crash before the next hwm checkpoint. The record is durably persisted before `assign` returns. `vshard_id` is `0` — surrogate bindings are node-global metadata.
(
&self,
surrogate: u32,
collection: &str,
pk_bytes: &[u8],
)
| 217 | /// record is durably persisted before `assign` returns. |
| 218 | /// `vshard_id` is `0` — surrogate bindings are node-global metadata. |
| 219 | pub fn append_surrogate_bind( |
| 220 | &self, |
| 221 | surrogate: u32, |
| 222 | collection: &str, |
| 223 | pk_bytes: &[u8], |
| 224 | ) -> crate::Result<Lsn> { |
| 225 | let payload = |
| 226 | nodedb_wal::record::SurrogateBindPayload::new(surrogate, collection, pk_bytes.to_vec()) |
| 227 | .to_bytes() |
| 228 | .map_err(crate::Error::Wal)?; |
| 229 | self.append_record( |
| 230 | RecordType::SurrogateBind, |
| 231 | TenantId::new(0), |
| 232 | VShardId::new(0), |
| 233 | DatabaseId::DEFAULT, |
| 234 | &payload, |
| 235 | ) |
| 236 | } |
| 237 | |
| 238 | /// Append a `CalvinApplied` record after a Calvin executor successfully |
| 239 | /// commits a `MetaOp::CalvinExecute` batch. |
no test coverage detected