Fulfills a registered peek and cleans up associated state. As part of this we: Send a `PeekResponse` through the peek's response channel. Emit a `CancelPeek` command to instruct replicas to stop spending resources on this peek, and to allow the `ComputeCommandHistory` to reduce away the corresponding `Peek` command. Remove the read hold for this peek, unblocking compaction that might have waited
(&mut self, uuid: Uuid, response: PeekResponse)
| 1989 | /// command. |
| 1990 | /// * Remove the read hold for this peek, unblocking compaction that might have waited on it. |
| 1991 | fn finish_peek(&mut self, uuid: Uuid, response: PeekResponse) { |
| 1992 | let Some(peek) = self.peeks.remove(&uuid) else { |
| 1993 | return; |
| 1994 | }; |
| 1995 | |
| 1996 | // The recipient might not be interested in the peek response anymore, which is fine. |
| 1997 | let _ = peek.peek_response_tx.send(response); |
| 1998 | |
| 1999 | // NOTE: We need to send the `CancelPeek` command _before_ we release the peek's read hold |
| 2000 | // (by dropping it), to avoid the edge case that caused database-issues#4812. |
| 2001 | self.send(ComputeCommand::CancelPeek { uuid }); |
| 2002 | |
| 2003 | drop(peek.read_hold); |
| 2004 | } |
| 2005 | |
| 2006 | /// Handles a response from a replica. Replica IDs are re-used across replica restarts, so we |
| 2007 | /// use the replica epoch to drop stale responses. |
no test coverage detected