Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshot read: Read 1 record exactly rather than 1 chunk at least per barrier #14077

Closed
kwannoel opened this issue Dec 20, 2023 · 3 comments · Fixed by #14544
Closed

snapshot read: Read 1 record exactly rather than 1 chunk at least per barrier #14077

kwannoel opened this issue Dec 20, 2023 · 3 comments · Fixed by #14544

Comments

@kwannoel
Copy link
Contributor

kwannoel commented Dec 20, 2023

However, yesterday we suddenly realized this will cause problems: it forces every barrier must have more than 256 rows, which could cause barrier pile-up in some bad cases (such as when there is huge amplification in downstream MV)

For each barrier, we currently enforce to read 1 chunk at least. That could have issues when there's huge amplification.
So we enforce to read 1 row exactly instead, if no rows read before we recieved the barrier.

credit: @fuyufjh and @st1page

@github-actions github-actions bot added this to the release-1.6 milestone Dec 20, 2023
@kwannoel kwannoel self-assigned this Dec 20, 2023
@kwannoel kwannoel changed the title snapshot read: Read 1 record at least rather than 1 chunk at least per barrier snapshot read: Read 1 record exactly rather than 1 chunk at least per barrier Dec 20, 2023
@StrikeW
Copy link
Contributor

StrikeW commented Dec 20, 2023

For each barrier, we currently enforce to read 1 chunk at least.

IIRC, the background is to skip the tombstone in storage, right?

@BugenZhao
Copy link
Member

We spend a lot of time skipping tombstones when creating the iterator, but in the end, we are only going to read one line. This was quite wasteful and inefficient to me. 😕

@kwannoel
Copy link
Contributor Author

kwannoel commented Dec 21, 2023

We spend a lot of time skipping tombstones when creating the iterator, but in the end, we are only going to read one line. This was quite wasteful and inefficient to me. 😕

The dominant cost in that scenario is skipping tombstones. Even though we only read 1 row, in the next epoch, since we already skipped the tombstones, we don't need to skip them again. So it will be pretty fast to read the next CHUNK_SIZE - 1 rows.

It's a worth while trade off IMO so we can deal with amplification cases.

In normal cases (little or no tombstone) we won't encounter it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment