Skip to content

Create new Chunk which shares the internal storage of the previous Ch…#14393

Closed
normanmaurer wants to merge 1 commit into4.2from
chunk_queue
Closed

Create new Chunk which shares the internal storage of the previous Ch…#14393
normanmaurer wants to merge 1 commit into4.2from
chunk_queue

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

…unk when queue for reuse

Motivation:

We need to ensure we never end up with a race / inconsistency related to the reference count when a Chunk is queued to be reused. Previous to this commit we never correctly set the reference count when we could not queue it.

Modifications:

Create a new Chunk and so ensure we never end up with inconsistent state / races in terms of reference count

Result:

More correct code

…unk when queue for reuse

Motivation:

We need to ensure we never end up with a race / inconsistency related to the reference count when a Chunk is queued to be reused. Previous to this commit we never correctly set the reference count when we could not queue it.

Modifications:

Create a new Chunk and so ensure we never end up with inconsistent state / races in terms of reference count

Result:

More correct code
if (!mag.trySetNextInLine(chunk)) {
if (!parent.offerToQueue(chunk)) {
// The central queue is full. Drop the chunk which will also release the delegate.
chunk.release();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might this not be recursive and come back to here, but in the chunk we just created?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah you are right ... maybe let's just do what I had in the other PR before

@normanmaurer normanmaurer deleted the chunk_queue branch December 14, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants