> On Dec 31, 2017, at 9:16 PM, Ben Pfaff <[email protected]> wrote:
>
> +void
> +ovsdb_file_destroy(struct ovsdb_file *file)
> {
> ovsdb_log_close(file->log);
> free(file->file_name);
> free(file);
> }
Generally, we handle the case where a null value is passed in. It might be
nice to provide the same protection.
> @@ -865,17 +866,16 @@ ovsdb_txn_commit_(struct ovsdb_txn *txn, bool durable)
> }
>
> /* Send the commit to each replica. */
> - LIST_FOR_EACH (replica, node, &txn->db->replicas) {
> - error = (replica->class->commit)(replica, txn, durable);
> + if (txn->db->file) {
> + error = ovsdb_file_commit(txn->db->file, txn, durable);
> if (error) {
> ovsdb_txn_abort(txn);
> return error;
> }
> }
> + LIST_FOR_EACH (replica, node, &txn->db->replicas) {
> + replica->class->commit(replica, txn, durable);
> + }
I think the comment about committing to each replica should be moved to this
block, and a new one should be written about writing to the log.
> diff --git a/ovsdb/ovsdb.h b/ovsdb/ovsdb.h
> index 89bbfa2512fa..06cd3a72e49e 100644
> --- a/ovsdb/ovsdb.h
> +++ b/ovsdb/ovsdb.h
> @@ -56,6 +56,7 @@ bool ovsdb_schema_equal(const struct ovsdb_schema *,
> /* Database. */
> struct ovsdb {
> struct ovsdb_schema *schema;
> + struct ovsdb_file *file; /* If nonnull, log for transactions. */
> struct ovs_list replicas; /* Contains "struct ovsdb_replica"s. */
> struct shash tables; /* Contains "struct ovsdb_table *"s. */
The word "file" is kind of generic. What about something like "log_file" to
make it clearer when it's referenced elsewhere?
Acked-by: Justin Pettit <[email protected]>
--Justin
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev