diff mbox series

[ovs-dev,1/4] ovsdb-cs: Fix ignoring of the last id from the initial monitor reply.

Message ID 20211219140941.2279071-2-i.maximets@ovn.org
State Accepted
Commit 3a05c63702a58c0e1482d6ba83099c8443cb89cd
Headers show
Series ovsdb: Bug fixes + Relay txn history and performance. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Ilya Maximets Dec. 19, 2021, 2:09 p.m. UTC
Current code doesn't use the last id received in the monitor reply.
That may result in re-downloading the database content if the
re-connection happened after receiving the initial monitor reply,
but before receiving any other database updates.

Fixes: 1c337c43ac1c ("ovsdb-idl: Break into two layers.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 lib/ovsdb-cs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mike Pattrick Jan. 7, 2022, 8:01 p.m. UTC | #1
Hello Ilya,

LGTM!

Acked-by: Mike Pattrick <mkp@redhat.com>


On Sun, 2021-12-19 at 15:09 +0100, Ilya Maximets wrote:
> Current code doesn't use the last id received in the monitor reply.
> That may result in re-downloading the database content if the
> re-connection happened after receiving the initial monitor reply,
> but before receiving any other database updates.
> 
> Fixes: 1c337c43ac1c ("ovsdb-idl: Break into two layers.")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>  lib/ovsdb-cs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c
> index fcb6fe1b3..2d2b77026 100644
> --- a/lib/ovsdb-cs.c
> +++ b/lib/ovsdb-cs.c
> @@ -1539,12 +1539,11 @@ ovsdb_cs_db_parse_monitor_reply(struct
> ovsdb_cs_db *db,
>      const struct json *table_updates;
>      bool clear;
>      if (version == 3) {
> -        struct uuid last_id;
>          if (result->type != JSON_ARRAY || result->array.n != 3
>              || (result->array.elems[0]->type != JSON_TRUE &&
>                  result->array.elems[0]->type != JSON_FALSE)
>              || result->array.elems[1]->type != JSON_STRING
> -            || !uuid_from_string(&last_id,
> +            || !uuid_from_string(&db->last_id,
>                                   json_string(result-
> >array.elems[1]))) {
>              struct ovsdb_error *error = ovsdb_syntax_error(
>                  result, NULL, "bad monitor_cond_since reply
> format");
Han Zhou Jan. 25, 2022, 1:27 a.m. UTC | #2
On Sun, Dec 19, 2021 at 6:09 AM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> Current code doesn't use the last id received in the monitor reply.
> That may result in re-downloading the database content if the
> re-connection happened after receiving the initial monitor reply,
> but before receiving any other database updates.
>
> Fixes: 1c337c43ac1c ("ovsdb-idl: Break into two layers.")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>  lib/ovsdb-cs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c
> index fcb6fe1b3..2d2b77026 100644
> --- a/lib/ovsdb-cs.c
> +++ b/lib/ovsdb-cs.c
> @@ -1539,12 +1539,11 @@ ovsdb_cs_db_parse_monitor_reply(struct
ovsdb_cs_db *db,
>      const struct json *table_updates;
>      bool clear;
>      if (version == 3) {
> -        struct uuid last_id;
>          if (result->type != JSON_ARRAY || result->array.n != 3
>              || (result->array.elems[0]->type != JSON_TRUE &&
>                  result->array.elems[0]->type != JSON_FALSE)
>              || result->array.elems[1]->type != JSON_STRING
> -            || !uuid_from_string(&last_id,
> +            || !uuid_from_string(&db->last_id,
>                                   json_string(result->array.elems[1]))) {
>              struct ovsdb_error *error = ovsdb_syntax_error(
>                  result, NULL, "bad monitor_cond_since reply format");
> --
> 2.31.1
>

Thanks Ilya.
Acked-by: Han Zhou <hzhou@ovn.org>
Ilya Maximets Jan. 31, 2022, 10:36 p.m. UTC | #3
On 1/25/22 02:27, Han Zhou wrote:
> 
> 
> On Sun, Dec 19, 2021 at 6:09 AM Ilya Maximets <i.maximets@ovn.org <mailto:i.maximets@ovn.org>> wrote:
>>
>> Current code doesn't use the last id received in the monitor reply.
>> That may result in re-downloading the database content if the
>> re-connection happened after receiving the initial monitor reply,
>> but before receiving any other database updates.
>>
>> Fixes: 1c337c43ac1c ("ovsdb-idl: Break into two layers.")
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org <mailto:i.maximets@ovn.org>>
>> ---
>>  lib/ovsdb-cs.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c
>> index fcb6fe1b3..2d2b77026 100644
>> --- a/lib/ovsdb-cs.c
>> +++ b/lib/ovsdb-cs.c
>> @@ -1539,12 +1539,11 @@ ovsdb_cs_db_parse_monitor_reply(struct ovsdb_cs_db *db,
>>      const struct json *table_updates;
>>      bool clear;
>>      if (version == 3) {
>> -        struct uuid last_id;
>>          if (result->type != JSON_ARRAY || result->array.n != 3
>>              || (result->array.elems[0]->type != JSON_TRUE &&
>>                  result->array.elems[0]->type != JSON_FALSE)
>>              || result->array.elems[1]->type != JSON_STRING
>> -            || !uuid_from_string(&last_id,
>> +            || !uuid_from_string(&db->last_id,
>>                                   json_string(result->array.elems[1]))) {
>>              struct ovsdb_error *error = ovsdb_syntax_error(
>>                  result, NULL, "bad monitor_cond_since reply format");
>> --
>> 2.31.1
>>
> 
> Thanks Ilya.
> Acked-by: Han Zhou <hzhou@ovn.org <mailto:hzhou@ovn.org>>

Thanks, Han and Mike!  Applied and backported down to 2.15.

Bets regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c
index fcb6fe1b3..2d2b77026 100644
--- a/lib/ovsdb-cs.c
+++ b/lib/ovsdb-cs.c
@@ -1539,12 +1539,11 @@  ovsdb_cs_db_parse_monitor_reply(struct ovsdb_cs_db *db,
     const struct json *table_updates;
     bool clear;
     if (version == 3) {
-        struct uuid last_id;
         if (result->type != JSON_ARRAY || result->array.n != 3
             || (result->array.elems[0]->type != JSON_TRUE &&
                 result->array.elems[0]->type != JSON_FALSE)
             || result->array.elems[1]->type != JSON_STRING
-            || !uuid_from_string(&last_id,
+            || !uuid_from_string(&db->last_id,
                                  json_string(result->array.elems[1]))) {
             struct ovsdb_error *error = ovsdb_syntax_error(
                 result, NULL, "bad monitor_cond_since reply format");