diff --git a/src/box/box.cc b/src/box/box.cc
index 67dd4d6c3aa4d436700112d92ca268e3b2e91c92..dd66285a457b1e6ab58350d158547165d269c044 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -4268,6 +4268,26 @@ box_process_subscribe(struct iostream *io, const struct xrow_header *header)
 	}
 	struct vclock start_vclock;
 	box_localize_vclock(&req.vclock, &start_vclock);
+	/*
+	 * Register the replica with the garbage collector.
+	 * In case some of the replica's WAL files were deleted, it might
+	 * subscribe with a smaller vclock than the master remembers, so
+	 * recreate the gc consumer unconditionally to make sure it holds
+	 * the correct vclock.
+	 */
+	if (!replica->anon) {
+		bool had_gc = false;
+		if (replica->gc != NULL) {
+			gc_consumer_unregister(replica->gc);
+			had_gc = true;
+		}
+		replica->gc = gc_consumer_register(&start_vclock, "replica %s",
+						   tt_uuid_str(&replica->uuid));
+		if (replica->gc == NULL)
+			diag_raise();
+		if (!had_gc)
+			gc_delay_unref();
+	}
 	/*
 	 * Send a response to SUBSCRIBE request, tell
 	 * the replica how many rows we have in stock for it,
diff --git a/src/box/relay.cc b/src/box/relay.cc
index 21a84d537ebfc6c7f6697a41419cf3701bfad6cd..d25e4ce439a5816a7a1fd290d8f6f92ad327e3c8 100644
--- a/src/box/relay.cc
+++ b/src/box/relay.cc
@@ -1115,27 +1115,6 @@ relay_subscribe(struct replica *replica, struct iostream *io, uint64_t sync,
 	assert(replica->anon || replica->id != REPLICA_ID_NIL);
 	struct relay *relay = replica->relay;
 	assert(relay->state != RELAY_FOLLOW);
-	/*
-	 * Register the replica with the garbage collector.
-	 * In case some of the replica's WAL files were deleted, it might
-	 * subscribe with a smaller vclock than the master remembers, so
-	 * recreate the gc consumer unconditionally to make sure it holds
-	 * the correct vclock.
-	 */
-	if (!replica->anon) {
-		bool had_gc = false;
-		if (replica->gc != NULL) {
-			gc_consumer_unregister(replica->gc);
-			had_gc = true;
-		}
-		replica->gc = gc_consumer_register(replica_clock, "replica %s",
-						   tt_uuid_str(&replica->uuid));
-		if (replica->gc == NULL)
-			diag_raise();
-		if (!had_gc)
-			gc_delay_unref();
-	}
-
 	if (replica_version_id < version_id(2, 6, 0) || replica->anon)
 		sent_raft_term = UINT64_MAX;
 	relay_start(relay, io, sync, relay_process_row,