MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / drop

Method drop

nodedb/src/engine/timeseries/columnar_segment/mmap.rs:97–122  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

95
96impl Drop for ColumnMmap {
97 fn drop(&mut self) {
98 let BackingStore::Mmap { ref mmap, ref file } = self.backing else {
99 return;
100 };
101 let len = mmap.len();
102 if len == 0 {
103 return;
104 }
105 let rc = unsafe {
106 libc::posix_fadvise(
107 file.as_raw_fd(),
108 0,
109 len as libc::off_t,
110 libc::POSIX_FADV_DONTNEED,
111 )
112 };
113 if rc == 0 {
114 observability::FADV_DONTNEED_COUNT.fetch_add(1, Ordering::Relaxed);
115 } else {
116 tracing::warn!(
117 path = %self.path.display(),
118 errno = rc,
119 "posix_fadvise(DONTNEED) failed on columnar mmap drop",
120 );
121 }
122 }
123}
124
125/// Advise `MADV_SEQUENTIAL` on a freshly-mapped column region.

Callers

nothing calls this directly

Calls 2

lenMethod · 0.45
as_raw_fdMethod · 0.45

Tested by

no test coverage detected