Message ID | 20171208001240.25829-7-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | OVSDB log enhancements | expand |
> On Dec 7, 2017, at 4:12 PM, Ben Pfaff <blp@ovn.org> wrote: > > Clients are intended to use the OVSDB log code by reading zero or more > records and then writing zero or more records, but not reading after any > write has occurred. Until now, ovsdb_log_read() has signaled the latter > behavior as an error. Upcoming changes to OVSDB are going to make it an > expected behavior in some cases, so this commit changes it so that it > just becomes an empty read. > > Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org> --Justin
On Fri, Dec 22, 2017 at 08:13:39PM -0800, Justin Pettit wrote: > > > On Dec 7, 2017, at 4:12 PM, Ben Pfaff <blp@ovn.org> wrote: > > > > Clients are intended to use the OVSDB log code by reading zero or more > > records and then writing zero or more records, but not reading after any > > write has occurred. Until now, ovsdb_log_read() has signaled the latter > > behavior as an error. Upcoming changes to OVSDB are going to make it an > > expected behavior in some cases, so this commit changes it so that it > > just becomes an empty read. > > > > Signed-off-by: Ben Pfaff <blp@ovn.org> > > Acked-by: Justin Pettit <jpettit@ovn.org> Applied to master, thanks!
diff --git a/ovsdb/log.c b/ovsdb/log.c index f95075034b3d..6a1a4484ad34 100644 --- a/ovsdb/log.c +++ b/ovsdb/log.c @@ -296,7 +296,7 @@ ovsdb_log_read(struct ovsdb_log *file, struct json **jsonp) if (file->read_error) { return ovsdb_error_clone(file->read_error); } else if (file->mode == OVSDB_LOG_WRITE) { - return OVSDB_BUG("reading file in write mode"); + return NULL; } if (!fgets(header, sizeof header, file->stream)) {
Clients are intended to use the OVSDB log code by reading zero or more records and then writing zero or more records, but not reading after any write has occurred. Until now, ovsdb_log_read() has signaled the latter behavior as an error. Upcoming changes to OVSDB are going to make it an expected behavior in some cases, so this commit changes it so that it just becomes an empty read. Signed-off-by: Ben Pfaff <blp@ovn.org> --- ovsdb/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)