ovsdb: Get rid of "declare" operation.
authorBen Pfaff <blp@nicira.com>
Tue, 9 Feb 2010 00:03:21 +0000 (16:03 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 9 Feb 2010 00:03:21 +0000 (16:03 -0800)
It's more elegant, and just as easy to implement, if we allow a
"named-uuid" to be a forward reference to a "uuid-name" in a later
"insert" operation.

13 files changed:
lib/ovsdb-data.c
lib/ovsdb-data.h
lib/ovsdb-idl.c
ovsdb/SPECS
ovsdb/condition.c
ovsdb/condition.h
ovsdb/execution.c
ovsdb/mutation.c
ovsdb/mutation.h
ovsdb/row.c
ovsdb/row.h
tests/ovsdb-execution.at
tests/ovsdb-idl.at

index 76d046f..47d1ea7 100644 (file)
@@ -229,14 +229,9 @@ parse_json_pair(const struct json *json,
     return NULL;
 }
 
     return NULL;
 }
 
-static struct ovsdb_error *
-ovsdb_atom_parse_uuid(struct uuid *uuid, const struct json *json,
-                      const struct ovsdb_symbol_table *symtab)
-    WARN_UNUSED_RESULT;
-
-static struct ovsdb_error *
+static struct ovsdb_error * WARN_UNUSED_RESULT
 ovsdb_atom_parse_uuid(struct uuid *uuid, const struct json *json,
 ovsdb_atom_parse_uuid(struct uuid *uuid, const struct json *json,
-                      const struct ovsdb_symbol_table *symtab)
+                      struct ovsdb_symbol_table *symtab)
 {
     struct ovsdb_error *error0;
     const struct json *value;
 {
     struct ovsdb_error *error0;
     const struct json *value;
@@ -254,18 +249,10 @@ ovsdb_atom_parse_uuid(struct uuid *uuid, const struct json *json,
         error1 = unwrap_json(json, "named-uuid", JSON_STRING, &value);
         if (!error1) {
             const char *name = json_string(value);
         error1 = unwrap_json(json, "named-uuid", JSON_STRING, &value);
         if (!error1) {
             const char *name = json_string(value);
-            const struct ovsdb_symbol *symbol;
 
             ovsdb_error_destroy(error0);
 
             ovsdb_error_destroy(error0);
-
-            symbol = ovsdb_symbol_table_get(symtab, name);
-            if (symbol) {
-                *uuid = symbol->uuid;
-                return NULL;
-            } else {
-                return ovsdb_syntax_error(json, NULL,
-                                          "unknown named-uuid \"%s\"", name);
-            }
+            *uuid = ovsdb_symbol_table_insert(symtab, name)->uuid;
+            return NULL;
         }
         ovsdb_error_destroy(error1);
     }
         }
         ovsdb_error_destroy(error1);
     }
@@ -276,7 +263,7 @@ ovsdb_atom_parse_uuid(struct uuid *uuid, const struct json *json,
 static struct ovsdb_error * WARN_UNUSED_RESULT
 ovsdb_atom_from_json__(union ovsdb_atom *atom, enum ovsdb_atomic_type type,
                        const struct json *json,
 static struct ovsdb_error * WARN_UNUSED_RESULT
 ovsdb_atom_from_json__(union ovsdb_atom *atom, enum ovsdb_atomic_type type,
                        const struct json *json,
-                       const struct ovsdb_symbol_table *symtab)
+                       struct ovsdb_symbol_table *symtab)
 {
     switch (type) {
     case OVSDB_TYPE_VOID:
 {
     switch (type) {
     case OVSDB_TYPE_VOID:
@@ -332,7 +319,7 @@ struct ovsdb_error *
 ovsdb_atom_from_json(union ovsdb_atom *atom,
                      const struct ovsdb_base_type *base,
                      const struct json *json,
 ovsdb_atom_from_json(union ovsdb_atom *atom,
                      const struct ovsdb_base_type *base,
                      const struct json *json,
-                     const struct ovsdb_symbol_table *symtab)
+                     struct ovsdb_symbol_table *symtab)
 {
     struct ovsdb_error *error;
 
 {
     struct ovsdb_error *error;
 
@@ -906,7 +893,7 @@ struct ovsdb_error *
 ovsdb_datum_from_json(struct ovsdb_datum *datum,
                       const struct ovsdb_type *type,
                       const struct json *json,
 ovsdb_datum_from_json(struct ovsdb_datum *datum,
                       const struct ovsdb_type *type,
                       const struct json *json,
-                      const struct ovsdb_symbol_table *symtab)
+                      struct ovsdb_symbol_table *symtab)
 {
     struct ovsdb_error *error;
 
 {
     struct ovsdb_error *error;
 
@@ -1527,7 +1514,7 @@ ovsdb_symbol_table_get(const struct ovsdb_symbol_table *symtab,
     return shash_find_data(&symtab->sh, name);
 }
 
     return shash_find_data(&symtab->sh, name);
 }
 
-void
+struct ovsdb_symbol *
 ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name,
                        const struct uuid *uuid, bool used)
 {
 ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name,
                        const struct uuid *uuid, bool used)
 {
@@ -1538,6 +1525,23 @@ ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name,
     symbol->uuid = *uuid;
     symbol->used = used;
     shash_add(&symtab->sh, name, symbol);
     symbol->uuid = *uuid;
     symbol->used = used;
     shash_add(&symtab->sh, name, symbol);
+    return symbol;
+}
+
+struct ovsdb_symbol *
+ovsdb_symbol_table_insert(struct ovsdb_symbol_table *symtab,
+                          const char *name)
+{
+    struct ovsdb_symbol *symbol;
+
+    symbol = ovsdb_symbol_table_get(symtab, name);
+    if (!symbol) {
+        struct uuid uuid;
+
+        uuid_generate(&uuid);
+        symbol = ovsdb_symbol_table_put(symtab, name, &uuid, false);
+    }
+    return symbol;
 }
 \f
 /* Extracts a token from the beginning of 's' and returns a pointer just after
 }
 \f
 /* Extracts a token from the beginning of 's' and returns a pointer just after
index c8e146a..063536b 100644 (file)
@@ -69,7 +69,7 @@ static inline bool ovsdb_atom_equals(const union ovsdb_atom *a,
 struct ovsdb_error *ovsdb_atom_from_json(union ovsdb_atom *,
                                          const struct ovsdb_base_type *,
                                          const struct json *,
 struct ovsdb_error *ovsdb_atom_from_json(union ovsdb_atom *,
                                          const struct ovsdb_base_type *,
                                          const struct json *,
-                                         const struct ovsdb_symbol_table *)
+                                         struct ovsdb_symbol_table *)
     WARN_UNUSED_RESULT;
 struct json *ovsdb_atom_to_json(const union ovsdb_atom *,
                                 enum ovsdb_atomic_type);
     WARN_UNUSED_RESULT;
 struct json *ovsdb_atom_to_json(const union ovsdb_atom *,
                                 enum ovsdb_atomic_type);
@@ -131,7 +131,7 @@ struct ovsdb_error *ovsdb_datum_check_constraints(
 struct ovsdb_error *ovsdb_datum_from_json(struct ovsdb_datum *,
                                           const struct ovsdb_type *,
                                           const struct json *,
 struct ovsdb_error *ovsdb_datum_from_json(struct ovsdb_datum *,
                                           const struct ovsdb_type *,
                                           const struct json *,
-                                          const struct ovsdb_symbol_table *)
+                                          struct ovsdb_symbol_table *)
     WARN_UNUSED_RESULT;
 struct json *ovsdb_datum_to_json(const struct ovsdb_datum *,
                                  const struct ovsdb_type *);
     WARN_UNUSED_RESULT;
 struct json *ovsdb_datum_to_json(const struct ovsdb_datum *,
                                  const struct ovsdb_type *);
@@ -206,8 +206,11 @@ struct ovsdb_symbol_table *ovsdb_symbol_table_create(void);
 void ovsdb_symbol_table_destroy(struct ovsdb_symbol_table *);
 struct ovsdb_symbol *ovsdb_symbol_table_get(const struct ovsdb_symbol_table *,
                                             const char *name);
 void ovsdb_symbol_table_destroy(struct ovsdb_symbol_table *);
 struct ovsdb_symbol *ovsdb_symbol_table_get(const struct ovsdb_symbol_table *,
                                             const char *name);
-void ovsdb_symbol_table_put(struct ovsdb_symbol_table *, const char *name,
-                            const struct uuid *, bool used);
+struct ovsdb_symbol *ovsdb_symbol_table_put(struct ovsdb_symbol_table *,
+                                            const char *name,
+                                            const struct uuid *, bool used);
+struct ovsdb_symbol *ovsdb_symbol_table_insert(struct ovsdb_symbol_table *,
+                                               const char *name);
 \f
 /* Tokenization
  *
 \f
 /* Tokenization
  *
index 53be4ec..96b31aa 100644 (file)
@@ -1103,16 +1103,6 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
                                                     &column->type));
             }
         }
                                                     &column->type));
             }
         }
-        if (row->new && !row->old) {
-            struct json *op;
-
-            op = json_object_create();
-            json_array_add(operations, op);
-            json_object_put_string(op, "op", "declare");
-            json_object_put(op, "uuid-name",
-                            json_string_create_nocopy(
-                                uuid_name_from_uuid(&row->uuid)));
-        }
     }
 
     /* Add updates. */
     }
 
     /* Add updates. */
index c1e3eca..1d55b1b 100644 (file)
@@ -582,13 +582,13 @@ Notation for the Wire Protocol
 <named-uuid>
 
     A 2-element JSON array that represents the UUID of a row inserted
 <named-uuid>
 
     A 2-element JSON array that represents the UUID of a row inserted
-    in a previous "insert" operation within the same transaction.  The
-    first element of the array must be the string "named-uuid" and the
-    second element must be the string specified on this "insert"
-    operation's "uuid-name" or on a preceding "insert" within the same
-    transaction.  For example, if this or a previous "insert"
-    operation specified a "uuid-name" of "myrow", the following
-    <named-uuid> represents the UUID created by that operation:
+    in an "insert" operation within the same transaction.  The first
+    element of the array must be the string "named-uuid" and the
+    second element should be the string specified as the "uuid-name"
+    for an "insert" operation within the same transaction.  For
+    example, if an "insert" operation within this transaction
+    specifies a "uuid-name" of "myrow", the following <named-uuid>
+    represents the UUID created by that operation:
 
         ["named-uuid", "myrow"]
 
 
         ["named-uuid", "myrow"]
 
@@ -773,21 +773,11 @@ Semantics:
 
         - "uuid": 00000000-0000-0000-0000-000000000000
 
 
         - "uuid": 00000000-0000-0000-0000-000000000000
 
-    If "uuid-name" is not supplied, the new row receives a new,
-    randomly generated UUID.
+    The new row receives a new, randomly generated UUID.
 
 
-    If "uuid-name" is supplied, then it is an error if <id> has
-    previously appeared as the "uuid-name" in an "insert" operation.
-
-    If "uuid-name" is supplied and its <id> previously appeared as the
-    "uuid-name" in a "declare" operation, then the new row receives
-    the UUID associated with that "uuid-name".
-
-    If "uuid-name" is supplied and its <id> has not previously
-    appeared as the "uuid-name" in a "declare" operation, then the new
-    row also receives a new, randomly generated UUID.  This UUID is
-    also made available under that name to this operation and later
-    operations within the same transaction.
+    If "uuid-name" is supplied, then it is an error if <id> is not
+    unique among the "uuid-name"s supplied on all the "insert"
+    operations within this transaction.
 
     The UUID for the new row is returned as the "uuid" member of the
     result.
 
     The UUID for the new row is returned as the "uuid" member of the
     result.
@@ -796,7 +786,7 @@ Errors:
 
     "error": "duplicate uuid-name"
 
 
     "error": "duplicate uuid-name"
 
-        The same "uuid-name" appeared on an earlier "insert" operation
+        The same "uuid-name" appears on another "insert" operation
         within this transaction.
 
     "error": "constraint violation"
         within this transaction.
 
     "error": "constraint violation"
@@ -1046,36 +1036,6 @@ Errors:
 
         This operation always fails with this error.
 
 
         This operation always fails with this error.
 
-declare
-.......
-
-Request object members:
-
-    "op": "declare"                    required
-    "uuid-name": <id>                  required
-
-Result object members:
-
-    "uuid": <uuid>
-
-Semantics:
-
-    Predeclares a UUID named <id> that may be referenced in later
-    operations as ["named-uuid", <id>] or (at most once) in an
-    "insert" operation as "uuid-name".
-
-    It is an error if <id> has appeared as the "uuid-name" in a prior
-    "insert" or "declare" operation within this transaction.
-
-    The generated UUID is returned as the "uuid" member of the result.
-
-Errors:
-
-    "error": "duplicate uuid-name"
-
-        The same "uuid-name" appeared on an earlier "insert" or
-        "declare" operation within this transaction.
-
 comment
 .......
 
 comment
 .......
 
index abd7936..59f742c 100644 (file)
@@ -55,7 +55,7 @@ ovsdb_function_to_string(enum ovsdb_function function)
 static WARN_UNUSED_RESULT struct ovsdb_error *
 ovsdb_clause_from_json(const struct ovsdb_table_schema *ts,
                        const struct json *json,
 static WARN_UNUSED_RESULT struct ovsdb_error *
 ovsdb_clause_from_json(const struct ovsdb_table_schema *ts,
                        const struct json *json,
-                       const struct ovsdb_symbol_table *symtab,
+                       struct ovsdb_symbol_table *symtab,
                        struct ovsdb_clause *clause)
 {
     const struct json_array *array;
                        struct ovsdb_clause *clause)
 {
     const struct json_array *array;
@@ -167,7 +167,7 @@ compare_clauses_3way(const void *a_, const void *b_)
 struct ovsdb_error *
 ovsdb_condition_from_json(const struct ovsdb_table_schema *ts,
                           const struct json *json,
 struct ovsdb_error *
 ovsdb_condition_from_json(const struct ovsdb_table_schema *ts,
                           const struct json *json,
-                          const struct ovsdb_symbol_table *symtab,
+                          struct ovsdb_symbol_table *symtab,
                           struct ovsdb_condition *cnd)
 {
     const struct json_array *array = json_array(json);
                           struct ovsdb_condition *cnd)
 {
     const struct json_array *array = json_array(json);
index 8c422b9..4716150 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ struct ovsdb_condition {
 
 struct ovsdb_error *ovsdb_condition_from_json(
     const struct ovsdb_table_schema *,
 
 struct ovsdb_error *ovsdb_condition_from_json(
     const struct ovsdb_table_schema *,
-    const struct json *, const struct ovsdb_symbol_table *,
+    const struct json *, struct ovsdb_symbol_table *,
     struct ovsdb_condition *) WARN_UNUSED_RESULT;
 struct json *ovsdb_condition_to_json(const struct ovsdb_condition *);
 void ovsdb_condition_destroy(struct ovsdb_condition *);
     struct ovsdb_condition *) WARN_UNUSED_RESULT;
 struct json *ovsdb_condition_to_json(const struct ovsdb_condition *);
 void ovsdb_condition_destroy(struct ovsdb_condition *);
index 7cf45f6..0465f03 100644 (file)
@@ -56,7 +56,6 @@ static ovsdb_operation_executor ovsdb_execute_delete;
 static ovsdb_operation_executor ovsdb_execute_wait;
 static ovsdb_operation_executor ovsdb_execute_commit;
 static ovsdb_operation_executor ovsdb_execute_abort;
 static ovsdb_operation_executor ovsdb_execute_wait;
 static ovsdb_operation_executor ovsdb_execute_commit;
 static ovsdb_operation_executor ovsdb_execute_abort;
-static ovsdb_operation_executor ovsdb_execute_declare;
 static ovsdb_operation_executor ovsdb_execute_comment;
 
 static ovsdb_operation_executor *
 static ovsdb_operation_executor ovsdb_execute_comment;
 
 static ovsdb_operation_executor *
@@ -76,7 +75,6 @@ lookup_executor(const char *name)
         { "wait", ovsdb_execute_wait },
         { "commit", ovsdb_execute_commit },
         { "abort", ovsdb_execute_abort },
         { "wait", ovsdb_execute_wait },
         { "commit", ovsdb_execute_commit },
         { "abort", ovsdb_execute_abort },
-        { "declare", ovsdb_execute_declare },
         { "comment", ovsdb_execute_comment },
     };
 
         { "comment", ovsdb_execute_comment },
     };
 
@@ -240,7 +238,7 @@ parse_table(struct ovsdb_execution *x,
 static WARN_UNUSED_RESULT struct ovsdb_error *
 parse_row(struct ovsdb_parser *parser, const char *member,
           const struct ovsdb_table *table,
 static WARN_UNUSED_RESULT struct ovsdb_error *
 parse_row(struct ovsdb_parser *parser, const char *member,
           const struct ovsdb_table *table,
-          const struct ovsdb_symbol_table *symtab,
+          struct ovsdb_symbol_table *symtab,
           struct ovsdb_row **rowp, struct ovsdb_column_set *columns)
 {
     struct ovsdb_error *error;
           struct ovsdb_row **rowp, struct ovsdb_column_set *columns)
 {
     struct ovsdb_error *error;
@@ -285,20 +283,14 @@ ovsdb_execute_insert(struct ovsdb_execution *x, struct ovsdb_parser *parser,
     if (uuid_name) {
         struct ovsdb_symbol *symbol;
 
     if (uuid_name) {
         struct ovsdb_symbol *symbol;
 
-        symbol = ovsdb_symbol_table_get(x->symtab, json_string(uuid_name));
-        if (symbol) {
-            if (symbol->used) {
-                return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
-                                          "This \"uuid-name\" appeared on an "
-                                          "earlier \"insert\" operation.");
-            }
-            row_uuid = symbol->uuid;
-            symbol->used = true;
-        } else {
-            uuid_generate(&row_uuid);
-            ovsdb_symbol_table_put(x->symtab, json_string(uuid_name),
-                                   &row_uuid, true);
+        symbol = ovsdb_symbol_table_insert(x->symtab, json_string(uuid_name));
+        if (symbol->used) {
+            return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
+                                      "This \"uuid-name\" appeared on an "
+                                      "earlier \"insert\" operation.");
         }
         }
+        row_uuid = symbol->uuid;
+        symbol->used = true;
     } else {
         uuid_generate(&row_uuid);
     }
     } else {
         uuid_generate(&row_uuid);
     }
@@ -689,35 +681,6 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
     return error;
 }
 
     return error;
 }
 
-static struct ovsdb_error *
-ovsdb_execute_declare(struct ovsdb_execution *x, struct ovsdb_parser *parser,
-                      struct json *result)
-{
-    const struct json *uuid_name;
-    struct uuid uuid;
-
-    uuid_name = ovsdb_parser_member(parser, "uuid-name", OP_ID);
-    if (!uuid_name) {
-        return NULL;
-    }
-
-    if (ovsdb_symbol_table_get(x->symtab, json_string(uuid_name))) {
-        return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
-                                  "This \"uuid-name\" appeared on an "
-                                  "earlier \"declare\" or \"insert\" "
-                                  "operation.");
-    }
-
-    uuid_generate(&uuid);
-    ovsdb_symbol_table_put(x->symtab, json_string(uuid_name), &uuid, false);
-    json_object_put(result, "uuid",
-                    json_array_create_2(
-                        json_string_create("uuid"),
-                        json_string_create_nocopy(
-                            xasprintf(UUID_FMT, UUID_ARGS(&uuid)))));
-    return NULL;
-}
-
 static struct ovsdb_error *
 ovsdb_execute_comment(struct ovsdb_execution *x, struct ovsdb_parser *parser,
                       struct json *result UNUSED)
 static struct ovsdb_error *
 ovsdb_execute_comment(struct ovsdb_execution *x, struct ovsdb_parser *parser,
                       struct json *result UNUSED)
index 1b42280..bd6986d 100644 (file)
@@ -72,7 +72,7 @@ type_mismatch(const struct ovsdb_mutation *m, const struct json *json)
 static WARN_UNUSED_RESULT struct ovsdb_error *
 ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
                          const struct json *json,
 static WARN_UNUSED_RESULT struct ovsdb_error *
 ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
                          const struct json *json,
-                         const struct ovsdb_symbol_table *symtab,
+                         struct ovsdb_symbol_table *symtab,
                          struct ovsdb_mutation *m)
 {
     const struct json_array *array;
                          struct ovsdb_mutation *m)
 {
     const struct json_array *array;
@@ -164,7 +164,7 @@ ovsdb_mutation_free(struct ovsdb_mutation *m)
 struct ovsdb_error *
 ovsdb_mutation_set_from_json(const struct ovsdb_table_schema *ts,
                              const struct json *json,
 struct ovsdb_error *
 ovsdb_mutation_set_from_json(const struct ovsdb_table_schema *ts,
                              const struct json *json,
-                             const struct ovsdb_symbol_table *symtab,
+                             struct ovsdb_symbol_table *symtab,
                              struct ovsdb_mutation_set *set)
 {
     const struct json_array *array = json_array(json);
                              struct ovsdb_mutation_set *set)
 {
     const struct json_array *array = json_array(json);
index d466e28..57fd965 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ struct ovsdb_mutation_set {
 
 struct ovsdb_error *ovsdb_mutation_set_from_json(
     const struct ovsdb_table_schema *,
 
 struct ovsdb_error *ovsdb_mutation_set_from_json(
     const struct ovsdb_table_schema *,
-    const struct json *, const struct ovsdb_symbol_table *,
+    const struct json *, struct ovsdb_symbol_table *,
     struct ovsdb_mutation_set *) WARN_UNUSED_RESULT;
 struct json *ovsdb_mutation_set_to_json(const struct ovsdb_mutation_set *);
 void ovsdb_mutation_set_destroy(struct ovsdb_mutation_set *);
     struct ovsdb_mutation_set *) WARN_UNUSED_RESULT;
 struct json *ovsdb_mutation_set_to_json(const struct ovsdb_mutation_set *);
 void ovsdb_mutation_set_destroy(struct ovsdb_mutation_set *);
index 52c5ddb..d088ff9 100644 (file)
@@ -160,7 +160,7 @@ ovsdb_row_update_columns(struct ovsdb_row *dst,
 
 struct ovsdb_error *
 ovsdb_row_from_json(struct ovsdb_row *row, const struct json *json,
 
 struct ovsdb_error *
 ovsdb_row_from_json(struct ovsdb_row *row, const struct json *json,
-                    const struct ovsdb_symbol_table *symtab,
+                    struct ovsdb_symbol_table *symtab,
                     struct ovsdb_column_set *included)
 {
     struct ovsdb_table_schema *schema = row->table->schema;
                     struct ovsdb_column_set *included)
 {
     struct ovsdb_table_schema *schema = row->table->schema;
index d468194..302f61a 100644 (file)
@@ -57,7 +57,7 @@ void ovsdb_row_update_columns(struct ovsdb_row *, const struct ovsdb_row *,
 
 struct ovsdb_error *ovsdb_row_from_json(struct ovsdb_row *,
                                         const struct json *,
 
 struct ovsdb_error *ovsdb_row_from_json(struct ovsdb_row *,
                                         const struct json *,
-                                        const struct ovsdb_symbol_table *,
+                                        struct ovsdb_symbol_table *,
                                         struct ovsdb_column_set *included)
     WARN_UNUSED_RESULT;
 struct json *ovsdb_row_to_json(const struct ovsdb_row *,
                                         struct ovsdb_column_set *included)
     WARN_UNUSED_RESULT;
 struct json *ovsdb_row_to_json(const struct ovsdb_row *,
index 334e208..06080f7 100644 (file)
@@ -443,11 +443,7 @@ OVSDB_CHECK_EXECUTION([referential integrity -- simple],
 
 OVSDB_CHECK_EXECUTION([referential integrity -- mutual references],
   [CONSTRAINT_SCHEMA],
 
 OVSDB_CHECK_EXECUTION([referential integrity -- mutual references],
   [CONSTRAINT_SCHEMA],
-  [[[[{"op": "declare",
-       "uuid-name": "row1"},
-      {"op": "declare",
-       "uuid-name": "row2"},
-      {"op": "insert",
+  [[[[{"op": "insert",
        "table": "a",
        "row": {"a": 0,
                "a2b": ["set", [["named-uuid", "row2"]]],
        "table": "a",
        "row": {"a": 0,
                "a2b": ["set", [["named-uuid", "row2"]]],
@@ -481,7 +477,7 @@ OVSDB_CHECK_EXECUTION([referential integrity -- mutual references],
       {"op": "delete",
        "table": "b",
        "where": [["b", "==", 1]]}]]]],
       {"op": "delete",
        "table": "b",
        "where": [["b", "==", 1]]}]]]],
-  [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]
+  [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]
 [{"uuid":["uuid","<2>"]},{"details":"reference to nonexistent row <3>","error":"referential integrity violation"}]
 [{"count":1},{"details":"cannot delete a row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}]
 [{"count":1},{"details":"cannot delete b row <1> because of 1 remaining reference(s)","error":"referential integrity violation"}]
 [{"uuid":["uuid","<2>"]},{"details":"reference to nonexistent row <3>","error":"referential integrity violation"}]
 [{"count":1},{"details":"cannot delete a row <0> because of 1 remaining reference(s)","error":"referential integrity violation"}]
 [{"count":1},{"details":"cannot delete b row <1> because of 1 remaining reference(s)","error":"referential integrity violation"}]
index 552f627..6fc57f3 100644 (file)
@@ -184,11 +184,7 @@ OVSDB_CHECK_IDL([self-linking idl, consistent ops],
        "table": "link1",
        "row": {"i": 0, "k": ["named-uuid", "self"]},
        "uuid-name": "self"}]' \
        "table": "link1",
        "row": {"i": 0, "k": ["named-uuid", "self"]},
        "uuid-name": "self"}]' \
-    '[{"op": "declare",
-       "uuid-name": "row1"},
-      {"op": "declare",
-       "uuid-name": "row2"},
-      {"op": "insert",
+    '[{"op": "insert",
        "table": "link1",
        "row": {"i": 1, "k": ["named-uuid", "row2"]},
        "uuid-name": "row1"},
        "table": "link1",
        "row": {"i": 1, "k": ["named-uuid", "row2"]},
        "uuid-name": "row1"},
@@ -207,7 +203,7 @@ OVSDB_CHECK_IDL([self-linking idl, consistent ops],
   [[000: empty
 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
 002: i=0 k=0 ka=[] l2= uuid=<0>
   [[000: empty
 001: {"error":null,"result":[{"uuid":["uuid","<0>"]}]}
 002: i=0 k=0 ka=[] l2= uuid=<0>
-003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
+003: {"error":null,"result":[{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]}]}
 004: i=0 k=0 ka=[] l2= uuid=<0>
 004: i=1 k=2 ka=[] l2= uuid=<1>
 004: i=2 k=1 ka=[] l2= uuid=<2>
 004: i=0 k=0 ka=[] l2= uuid=<0>
 004: i=1 k=2 ka=[] l2= uuid=<1>
 004: i=2 k=1 ka=[] l2= uuid=<2>