pub fn need_gc(&self, safe_point: u64, ratio_threshold: f64) -> bool {
        // Always GC.
        if ratio_threshold < 1.0 {
            return true;
        }

        let props = match self.get_mvcc_properties(safe_point) {
            Some(v) => v,
            None => return true,
        };

        // No data older than safe_point to GC.
        if props.min_ts > safe_point {
            return false;
        }

        // Note: Since the properties are file-based, it can be false positive.
        // For example, multiple files can have a different version of the same row.

        // A lot of MVCC versions to GC.
        if props.num_versions as f64 > props.num_rows as f64 * ratio_threshold {
            return true;
        }
        // A lot of non-effective MVCC versions to GC.
        if props.num_versions as f64 > props.num_puts as f64 * ratio_threshold {
            return true;
        }

        // A lot of MVCC versions of a single row to GC.
        props.max_row_versions > GC_MAX_ROW_VERSIONS_THRESHOLD
    }
// Returns true if it needs gc.
// This is for optimization purpose, does not mean to be accurate.
Returns true if it needs gc.
This is for optimization purpose, does not mean to be accurate.
Returns true if it needs gc . This is for optimization purpose does not mean to be accurate .
pub fn need_gc(&self, safe_point: u64, ratio_threshold: f64) -> bool {
        // Always GC.
        if ratio_threshold < 1.0 {
            return true;
        }
        let props = match self.get_mvcc_properties(safe_point) {
            Some(v) => v,
            None => return true,
        };
        // No data older than safe_point to GC.
        if props.min_ts > safe_point {
            return false;
        }
        // Note: Since the properties are file-based, it can be false positive.
        // For example, multiple files can have a different version of the same row.
        // A lot of MVCC versions to GC.
        if props.num_versions as f64 > props.num_rows as f64 * ratio_threshold {
            return true;
        }
        // A lot of non-effective MVCC versions to GC.
        if props.num_versions as f64 > props.num_puts as f64 * ratio_threshold {
            return true;
        }
        // A lot of MVCC versions of a single row to GC.
        props.max_row_versions > GC_MAX_ROW_VERSIONS_THRESHOLD
    }
pub fn need_gc ( & self , safe_point : u64 , ratio_threshold : f64 ) -> bool { // Always GC. if ratio_threshold < 1.0 { return true ; } let props = match self . get_mvcc_properties ( safe_point ) { Some ( v ) => v , None => return true , } ; // No data older than safe_point to GC. if props . min_ts > safe_point { return false ; } // Note: Since the properties are file-based, it can be false positive. // For example, multiple files can have a different version of the same row. // A lot of MVCC versions to GC. if props . num_versions as f64 > props . num_rows as f64 * ratio_threshold { return true ; } // A lot of non-effective MVCC versions to GC. if props . num_versions as f64 > props . num_puts as f64 * ratio_threshold { return true ; } // A lot of MVCC versions of a single row to GC. props . max_row_versions > GC_MAX_ROW_VERSIONS_THRESHOLD }
Returns true if it needs gc.
Returns true if it needs gc .
&self
safe_point
u64
ratio_threshold
f64
&self
safe_point
u64
ratio_threshold
f64