Skip to content

feat(client): add call timeout to log stream appender#474

Merged
ijsong merged 1 commit intomainfrom
lsa_call_timeout
Jun 16, 2023
Merged

feat(client): add call timeout to log stream appender#474
ijsong merged 1 commit intomainfrom
lsa_call_timeout

Conversation

@ijsong
Copy link
Copy Markdown
Member

@ijsong ijsong commented Jun 12, 2023

What this PR does

This PR adds a call timeout to the log stream appender. It helps the log stream appender not to be
blocked. LogStreamAppender can be blocked at the following points:

  • (a) Waiting for the pipeline to have room
  • (b) Flow-controlled when calling RPC
  • (c) Stucked server
  • (d) Slow callback
+------+            +-------------------------+            +--------+
|      |            |    LogStreamAppender    |            |        |
|      |            |                         |            |        |
|      |            |  (a)----------------(b) |            |        |
|      +--AppendBatch--->| pipeline queue |--gRPC request->|        |
| User |            |    +----------------+   |            |        |
| code |            |                         |            | Varlog |
|      |            |    +----------------+   |            |        |
|      |            |    |    callback    |   |            |        |
|      |<--Callback-+----|   processing   |<-gRPC response-+        |
|      |            |  (c)   goroutine    (d) |            |        |
|      |            |    +----------------+   |            |        |
+------+            +-------------------------+            +--------+

When a user configures call timeout by using pkg/varlog.WithCallTimeout, the
pkg/varlog.(LogStreamAppender).AppendBatch or its callback function can return ErrCallTimeout when
above situations.

@ijsong
Copy link
Copy Markdown
Member Author

ijsong commented Jun 12, 2023

@ijsong ijsong self-assigned this Jun 12, 2023
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 12, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.17 ⚠️

Comparison is base (77b8de8) 62.65% compared to head (6f916d4) 62.49%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@                    Coverage Diff                    @@
##           lsa_close_in_callback     #474      +/-   ##
=========================================================
- Coverage                  62.65%   62.49%   -0.17%     
=========================================================
  Files                        133      133              
  Lines                      18372    18415      +43     
=========================================================
- Hits                       11511    11508       -3     
- Misses                      6291     6340      +49     
+ Partials                     570      567       -3     
Impacted Files Coverage Δ
pkg/varlog/config.go 47.76% <0.00%> (-3.04%) ⬇️
pkg/varlog/log_stream_appender.go 0.00% <0.00%> (ø)

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

This PR adds a call timeout to the log stream appender. It helps the log stream appender not to be
blocked. LogStreamAppender can be blocked at the following points:

- (a) Waiting for the pipeline to have room
- (b) Flow-controlled when calling RPC
- (c) Stucked server
- (d) Slow callback

```
+------+            +-------------------------+            +--------+
|      |            |    LogStreamAppender    |            |        |
|      |            |                         |            |        |
|      |            |  (a)----------------(b) |            |        |
|      +--AppendBatch--->| pipeline queue |--gRPC request->|        |
| User |            |    +----------------+   |            |        |
| code |            |                         |            | Varlog |
|      |            |    +----------------+   |            |        |
|      |            |    |    callback    |   |            |        |
|      |<--Callback-+----|   processing   |<-gRPC response-+        |
|      |            |  (c)   goroutine    (d) |            |        |
|      |            |    +----------------+   |            |        |
+------+            +-------------------------+            +--------+
```

When a user configures call timeout by using `pkg/varlog.WithCallTimeout`, the
`pkg/varlog.(LogStreamAppender).AppendBatch` or its callback function can return ErrCallTimeout when
above situations.
Copy link
Copy Markdown
Member

@hungryjang hungryjang left a comment

Choose a reason for hiding this comment

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

simple & light! good!

@ijsong
Copy link
Copy Markdown
Member Author

ijsong commented Jun 16, 2023

@ijsong started a stack merge that includes this pull request via Graphite.

Base automatically changed from lsa_close_in_callback to main June 16, 2023 11:35
@ijsong ijsong merged commit 6db401a into main Jun 16, 2023
@ijsong
Copy link
Copy Markdown
Member Author

ijsong commented Jun 16, 2023

@ijsong merged this pull request with Graphite.

@ijsong ijsong deleted the lsa_call_timeout branch June 16, 2023 11:35
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.

3 participants