From 88942565730a0f7e9abed2b26c00d1bae1392d7d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 12 Feb 2010 11:13:24 -0800 Subject: [PATCH] ovsdb: Fix commit to disk of rows added to a table with all-default values. --- ovsdb/file.c | 2 +- tests/ovsdb-execution.at | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ovsdb/file.c b/ovsdb/file.c index 716ea89c..31086af8 100644 --- a/ovsdb/file.c +++ b/ovsdb/file.c @@ -254,7 +254,7 @@ ovsdb_file_replica_change_cb(const struct ovsdb_row *old, } else { struct shash_node *node; - row = NULL; + row = old ? NULL : json_object_create(); SHASH_FOR_EACH (node, &new->table->schema->columns) { const struct ovsdb_column *column = node->data; const struct ovsdb_type *type = &column->type; diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at index ca155a1e..ed28b2a9 100644 --- a/tests/ovsdb-execution.at +++ b/tests/ovsdb-execution.at @@ -51,6 +51,22 @@ m4_define([OVSDB_CHECK_EXECUTION], AT_CLEANUP]) m4_define([EXECUTION_EXAMPLES], [ +dnl At one point the "commit" code ignored new rows with all-default values, +dnl so this checks for that problem. +OVSDB_CHECK_EXECUTION([insert default row, query table], + [ORDINAL_SCHEMA], + [[[["ordinals", + {"op": "insert", + "table": "ordinals", + "row": {}}]]], + [[["ordinals", + {"op": "select", + "table": "ordinals", + "where": []}]]]], + [[[{"uuid":["uuid","<0>"]}] +[{"rows":[{"_uuid":["uuid","<0>"],"_version":["uuid","<1>"],"name":"","number":0}]}] +]]) + OVSDB_CHECK_EXECUTION([insert row, query table], [ORDINAL_SCHEMA], [[[["ordinals", -- 2.30.2