Fix deadlock when a sequence of long-ish strings appear in the input (bug #101) #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background: we have FIFO queues between the thread that parses the input into cells, and the threads for each column that parse those cells into data.
Each FIFO queue is in turn composed of a "control queue" and a "data queue". The control queue indicates what kind of data cell was pushed onto the data queue (there are two choices: either a short-ish string, packed with other strings into a block, or a longer string in its own byte[] array).
Importantly, because our flow control is based on limiting the number of data queue blocks outstanding (per
DenseStorageConstants.MAX_UNOBSERVED_BLOCKS
), we want to flush the control queue every time we fill a block on the data queue, so the consumer has a chance to consume the data. If we did not do this, in some cases the data queue would run too far ahead, the flow control be invoked to block the writer, but the reader would also be blocked because it is still waiting on control queue notifications, which haven't arrived because the latest control queue block isn't full and hasn't been flushed yet.See #101