diff options
author | Saša Živkov <sasa.zivkov@sap.com> | 2018-04-18 12:20:15 +0200 |
---|---|---|
committer | Nguyen Tuan Khang Phan <nguyen.tuan.khang.phan@ericsson.com> | 2020-02-14 14:16:21 -0500 |
commit | 8b5547da463789631721a23919d0270c95ca8f50 (patch) | |
tree | c155cc5477a72698a5a411c6a3b2b8f99937f442 /src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java | |
parent | 3248582915e897c0d568160465a2ca905f38df3e (diff) |
Don't lose ref-updated events on plugin restart
When a ref-updated event is received, persist the event in the directory
defined by the replication.eventsDirectory. When the updated ref is
replicated deleted the persisted event.
If replication queue is non-empty and plugin gets stopped, ref updates
will not be replicated and, therefore, the persisted events will not get
deleted. When the plugin starts it will schedule replication for all
persisted events and delete them.
This change provides two benefits:
* no ref-updated events are lost on plugin restart
* eliminate need for the replicateOnStartup=true setting which schedules
replication of all refs for all projects and typically creates a humongous
replication queue on every plugin restart.
Change-Id: Ieacd084fabe703333241ffda11c8b6c78cced37a
(cherry picked from commit bdaea910694dd5a3474dbc051b298aaee9d77950)
Diffstat (limited to 'src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java')
-rw-r--r-- | src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java index 193af1e..cf6715e 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java @@ -32,12 +32,15 @@ public class ReplicationStateTest { private ReplicationState replicationState; private PushResultProcessing pushResultProcessingMock; + private EventsStorage eventsStorage; @Before public void setUp() throws Exception { pushResultProcessingMock = createNiceMock(PushResultProcessing.class); replay(pushResultProcessingMock); - replicationState = new ReplicationState(pushResultProcessingMock); + eventsStorage = createNiceMock(EventsStorage.class); + replay(eventsStorage); + replicationState = new ReplicationState(eventsStorage, pushResultProcessingMock); } @Test |