[PATCH v3 3/5] wal: rename wal_watcher->events to pending_events

Vladimir Davydov vdavydov.dev at gmail.com
Wed Oct 24 16:43:15 MSK 2018


We will add another event bitmap to wal_watcher. To avoid confusion
between them, let's rename wal_watcher->events.
---
 src/box/wal.c | 10 +++++-----
 src/box/wal.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/box/wal.c b/src/box/wal.c
index d231cc98..b239acd4 100644
--- a/src/box/wal.c
+++ b/src/box/wal.c
@@ -1033,7 +1033,7 @@ wal_watcher_notify(struct wal_watcher *watcher, unsigned events)
 		 * mark the watcher to resend it as soon as it
 		 * returns to WAL so as not to lose any events.
 		 */
-		watcher->events |= events;
+		watcher->pending_events |= events;
 		return;
 	}
 
@@ -1062,13 +1062,13 @@ wal_watcher_notify_complete(struct cmsg *cmsg)
 		return;
 	}
 
-	if (watcher->events != 0) {
+	if (watcher->pending_events != 0) {
 		/*
 		 * Resend the message if we got notified while
 		 * it was en route, see wal_watcher_notify().
 		 */
-		wal_watcher_notify(watcher, watcher->events);
-		watcher->events = 0;
+		wal_watcher_notify(watcher, watcher->pending_events);
+		watcher->pending_events = 0;
 	}
 }
 
@@ -1109,7 +1109,7 @@ wal_set_watcher(struct wal_watcher *watcher, const char *name,
 	watcher->msg.watcher = watcher;
 	watcher->msg.events = 0;
 	watcher->msg.cmsg.route = NULL;
-	watcher->events = 0;
+	watcher->pending_events = 0;
 
 	assert(lengthof(watcher->route) == 2);
 	watcher->route[0] = (struct cmsg_hop)
diff --git a/src/box/wal.h b/src/box/wal.h
index 7371ce93..b7edcd43 100644
--- a/src/box/wal.h
+++ b/src/box/wal.h
@@ -101,7 +101,7 @@ struct wal_watcher {
 	 * It indicates that the message must be resend
 	 * right upon returning to WAL.
 	 */
-	unsigned events;
+	unsigned pending_events;
 };
 
 /**
-- 
2.11.0




More information about the Tarantool-patches mailing list