Ensure that we flush chunks into permament storage once a full chunk is received
Currently, when using Live Traces and a full chunk is received
we schedule async operation to flush the chunk from Redis
to DB/OS
.
Proposal
Introduce the following barriers into a process:
- When a chunk is received, the persist operation is synchronous
- When a final update is received, all chunks should be marked as persisted, and no longer be allowed to be appended
Outcome
This would improve a live traces resiliency, by:
- Ensuring that all data is persisted
- Ensuring that we can safely and timely archive all data without having Redis to expire them
- Introducing barriers (flush/syncs) into the process
Related code:
def schedule_to_persist
return if data_persisted?
Ci::BuildTraceChunkFlushWorker.perform_async(id)
end
Patching
Additionally, we could consider accepting no more than 3-4 chunks per single PATCH
, and return an accepted offset
for Runner to resent. Runner, already today sends a chunked PATCHes
, but this can be a way to ensure that other
users adhere to this operation as well: limited patching operation.