(
config: &WalWriterConfig,
path: &Path,
)
| 79 | } |
| 80 | |
| 81 | fn open_dwb_for( |
| 82 | config: &WalWriterConfig, |
| 83 | path: &Path, |
| 84 | ) -> Option<crate::double_write::DoubleWriteBuffer> { |
| 85 | let mode = resolve_dwb_mode(config); |
| 86 | if mode == DwbMode::Off { |
| 87 | return None; |
| 88 | } |
| 89 | let dwb_path = path.with_extension("dwb"); |
| 90 | match crate::double_write::DoubleWriteBuffer::open(&dwb_path, mode) { |
| 91 | Ok(d) => Some(d), |
| 92 | Err(e) => { |
| 93 | tracing::warn!( |
| 94 | path = %dwb_path.display(), |
| 95 | error = %e, |
| 96 | mode = ?mode, |
| 97 | "failed to open DWB — torn-write protection disabled for this writer" |
| 98 | ); |
| 99 | None |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | /// Append-only WAL writer. |
| 105 | pub struct WalWriter { |
no test coverage detected