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

feat(client): add PeekLogStream to the client #240

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Nov 24, 2022

What this PR does

This patch adds a new API called PeekLogStream to the client. The PeekLogStream returns sequence
numbers at the first and last log entries. Users using LogStreamMetadata or LogStreamReplicaMetadata
to fetch the sequence numbers should use PeekLogStream.

PeekLogStream has the benefits over the ogStreamMetadata or LogStreamReplicaMetadata.

  • It does not send users useless and complex information about log stream replicas.
  • It prevents users from getting too detailed information about log stream replicas.
  • It takes accounts for the status of log stream replicas; thus, it returns more accurate first and last
    log sequence numbers of the log stream.

Which issue(s) this PR resolves

Resolves #239

@ijsong ijsong force-pushed the add-peeklogstream branch 2 times, most recently from d9aa6f9 to a775133 Compare November 24, 2022 08:07
@ijsong ijsong self-assigned this Nov 24, 2022
@ijsong ijsong force-pushed the add-peeklogstream branch 2 times, most recently from ab1bb44 to d977774 Compare November 24, 2022 10:04
@ijsong ijsong marked this pull request as ready for review November 24, 2022 10:53
@ijsong ijsong requested a review from hungryjang as a code owner November 24, 2022 10:53
case varlogpb.LogStreamStatusRunning, varlogpb.LogStreamStatusSealed:
mu.Lock()
defer mu.Unlock()
if first.LLSN < lsrmd.LocalLowWatermark.LLSN {
Copy link
Member

Choose a reason for hiding this comment

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

Does it means highest LocalLowWatermark?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is. Since the trim operation removes from the front of log entries, PeekLogStream takes the largest one.

This patch adds a new API called PeekLogStream to the client. The PeekLogStream returns sequence
numbers at the first and last log entries. Users using LogStreamMetadata or LogStreamReplicaMetadata
to fetch the sequence numbers should use PeekLogStream.

PeekLogStream has the benefits over the ogStreamMetadata or LogStreamReplicaMetadata.

- It does not send users useless and complex information about log stream replicas.
- It prevents users from getting too detailed information about log stream replicas.
- It takes accounts for the status of log stream replicas; thus, it returns more accurate first and
  last log sequence numbers of the log stream.

Resolves kakao#239
@ijsong ijsong force-pushed the add-peeklogstream branch from d977774 to e872677 Compare December 6, 2022 01:13
@ijsong ijsong merged commit 0baead8 into kakao:main Dec 6, 2022
ijsong added a commit to ijsong/varlog that referenced this pull request Dec 7, 2022
This patch adds missing mock files updated by kakao#240 and kakao#242.
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.

client: implement API to get sequence numbers of the first and last log entries for the specific log stream
2 participants