[ovs-dev] [PATCH] ovsdb: Use previous snapshot size as an additional factor for compaction.

Justin Pettit jpettit at ovn.org
Fri Apr 1 00:28:45 UTC 2016


> On Mar 31, 2016, at 1:01 PM, Ben Pfaff <blp at ovn.org> wrote:
> 
> @@ -582,10 +598,13 @@ ovsdb_file_commit(struct ovsdb_replica *replica,
>     /* If it has been at least COMPACT_MIN_MSEC ms since the last time we
>      * compacted (or at least COMPACT_RETRY_MSEC ms since the last time we
>      * tried), and if there are at least 100 transactions in the database, and
> -     * if the database is at least 10 MB, then compact the database. */
> +     * if the database is at least 10 MB, and the database is at least 4x the
> +     * size of the previous snapshot, then compact the database. */
> +    off_t log_size = ovsdb_log_get_offset(file->log);
>     if (time_msec() >= file->next_compact
>         && file->n_transactions >= 100
> -        && ovsdb_log_get_offset(file->log) >= 10 * 1024 * 1024)
> +        && log_size >= 10 * 1024 * 1024
> +        && log_size / 4 >= file->snapshot_size)

I think #define's are always nice instead of magic numbers, but it looks like there's some precedence here.

Acked-by: Justin Pettit <jpettit at ovn.org>

--Justin





More information about the dev mailing list