| 318 | |
| 319 | #[test] |
| 320 | fn uring_write_and_read_roundtrip() { |
| 321 | let dir = tempfile::tempdir().unwrap(); |
| 322 | let path = dir.path().join("uring.wal"); |
| 323 | |
| 324 | { |
| 325 | let mut writer = UringWriter::open_without_direct_io(&path).unwrap(); |
| 326 | writer |
| 327 | .append(RecordType::Put as u32, 1, 0, 0, b"hello-uring") |
| 328 | .unwrap(); |
| 329 | writer |
| 330 | .append(RecordType::Put as u32, 2, 1, 0, b"world-uring") |
| 331 | .unwrap(); |
| 332 | writer.submit_and_sync().unwrap(); |
| 333 | } |
| 334 | |
| 335 | let reader = WalReader::open(&path).unwrap(); |
| 336 | let records: Vec<_> = reader |
| 337 | .records() |
| 338 | .collect::<crate::error::Result<_>>() |
| 339 | .unwrap(); |
| 340 | assert_eq!(records.len(), 2); |
| 341 | assert_eq!(records[0].payload, b"hello-uring"); |
| 342 | assert_eq!(records[1].payload, b"world-uring"); |
| 343 | assert_eq!(records[0].header.lsn, 1); |
| 344 | assert_eq!(records[1].header.lsn, 2); |
| 345 | } |
| 346 | |
| 347 | #[test] |
| 348 | fn uring_group_commit_many_records() { |