| 213 | |
| 214 | #[test] |
| 215 | fn database_id_roundtrip() { |
| 216 | // Non-zero database_id survives to_bytes → from_bytes. |
| 217 | let header = RecordHeader { |
| 218 | magic: WAL_MAGIC, |
| 219 | format_version: WAL_FORMAT_VERSION, |
| 220 | record_type: 1, |
| 221 | lsn: 1, |
| 222 | tenant_id: 42, |
| 223 | vshard_id: 0, |
| 224 | payload_len: 0, |
| 225 | database_id: 7, |
| 226 | reserved: [0u8; 8], |
| 227 | crc32c: 0, |
| 228 | }; |
| 229 | let bytes = header.to_bytes(); |
| 230 | let decoded = RecordHeader::from_bytes(&bytes); |
| 231 | assert_eq!(decoded.database_id, 7); |
| 232 | } |
| 233 | |
| 234 | #[test] |
| 235 | fn pre_tier2_zero_database_id_compat() { |