()
| 211 | |
| 212 | #[test] |
| 213 | fn incremental_flush() { |
| 214 | let config = CheckpointConfig { |
| 215 | flush_fraction: 0.10, |
| 216 | tick_interval: Duration::from_millis(0), // No delay for test. |
| 217 | ..Default::default() |
| 218 | }; |
| 219 | let mut coord = CheckpointCoordinator::new(config); |
| 220 | coord.register_engine("sparse"); |
| 221 | coord.register_engine("vector"); |
| 222 | |
| 223 | coord.mark_dirty("sparse", 100); |
| 224 | coord.mark_dirty("vector", 50); |
| 225 | |
| 226 | let plan = coord.tick(); |
| 227 | assert!(!plan.is_empty()); |
| 228 | // Sparse: 10% of 100 = 10 pages. |
| 229 | let sparse_flush = plan.iter().find(|(e, _)| e == "sparse").unwrap().1; |
| 230 | assert_eq!(sparse_flush, 10); |
| 231 | |
| 232 | // Record flush. |
| 233 | coord.record_flush("sparse", sparse_flush); |
| 234 | assert_eq!( |
| 235 | coord |
| 236 | .engines |
| 237 | .iter() |
| 238 | .find(|e| e.engine_name == "sparse") |
| 239 | .unwrap() |
| 240 | .dirty_pages, |
| 241 | 90 |
| 242 | ); |
| 243 | } |
| 244 | |
| 245 | #[test] |
| 246 | fn force_flush_over_threshold() { |
nothing calls this directly
no test coverage detected