bookingcom / nanotube

High-performance router for Graphite.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prevent data loss when target connection drops and buffer is flushed.

grzkv opened this issue · comments

Consider the following scenario when sending to host A while using a buffer:

  1. Some records are sent to the target host A. A connection is opened, and records go through it.
  2. No records arrive to be sent to the target host A for a couple of minutes.
  3. A considers it a good strategy to close the connection, and it does.
  4. A single record arrives to be sent to A. It is placed in the buffer.
  5. We try to flush the buffer, and fail with something like "broken pipe".
  6. The record is lost.

The code is here:

err := h.W.Flush()