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

enhance: timetick interceptor implementation #34238

Conversation

chyezh
Copy link
Contributor

@chyezh chyezh commented Jun 27, 2024

issue: #33285

  • optimize the message package
  • add interceptor package to achieve append operation intercepting.
  • add timetick interceptor to attach timetick properties for message.
  • add timetick background task to send timetick message.

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chyezh
To complete the pull request process, please assign czs007 after the PR has been reviewed.
You can assign the PR to them by writing /assign @czs007 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines. label Jun 27, 2024
@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Jun 27, 2024
@chyezh chyezh force-pushed the feat_streaming_service_timetick_interceptor branch from 1ce0cfb to 429774f Compare June 27, 2024 08:07
const (
ServiceMethodPrefix = "/milvus.proto.log"
InitialTerm = int64(-1)
)

func NewDeliverAll() *DeliverPolicy {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

redundant code here

@chyezh chyezh force-pushed the feat_streaming_service_timetick_interceptor branch from 429774f to fdeada5 Compare June 27, 2024 09:44
@chyezh chyezh force-pushed the feat_streaming_service_timetick_interceptor branch from fdeada5 to 46bbe8c Compare June 27, 2024 11:29
Copy link
Contributor

mergify bot commented Jun 27, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

Signed-off-by: chyezh <chyezh@outlook.com>
@chyezh chyezh force-pushed the feat_streaming_service_timetick_interceptor branch from 46bbe8c to 915c301 Compare June 28, 2024 00:42
Copy link
Contributor

mergify bot commented Jun 28, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@chyezh
Copy link
Contributor Author

chyezh commented Jun 28, 2024

/run-cpu-e2e

Copy link
Contributor

mergify bot commented Jun 28, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 91.04478% with 30 lines in your changes missing coverage. Please review.

Project coverage is 80.87%. Comparing base (d2bc4a5) to head (915c301).
Report is 7 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #34238      +/-   ##
==========================================
- Coverage   84.61%   80.87%   -3.74%     
==========================================
  Files         817     1096     +279     
  Lines      113473   137783   +24310     
==========================================
+ Hits        96013   111438   +15425     
- Misses      13238    22116    +8878     
- Partials     4222     4229       +7     
Files Coverage Δ
internal/streamingnode/server/resource/resource.go 100.00% <100.00%> (ø)
...rnal/streamingnode/server/resource/test_utility.go 100.00% <100.00%> (ø)
...e/server/resource/timestamp/timestamp_allocator.go 100.00% <100.00%> (ø)
...gnode/server/wal/interceptors/chain_interceptor.go 100.00% <100.00%> (ø)
...ode/server/wal/interceptors/timetick/ack/detail.go 100.00% <100.00%> (ø)
pkg/streaming/util/message/properties.go 100.00% <ø> (ø)
pkg/streaming/walimpls/impls/pulsar/scanner.go 84.84% <100.00%> (ø)
...g/streaming/walimpls/impls/walimplstest/builder.go 100.00% <100.00%> (ø)
pkg/streaming/walimpls/test_framework.go 95.34% <100.00%> (-0.21%) ⬇️
pkg/util/syncutil/future.go 100.00% <100.00%> (ø)
... and 11 more

... and 307 files with indirect coverage changes

@@ -0,0 +1,76 @@
package resource
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resource package is used to access the streamingnode global singleton.

@mergify mergify bot added the ci-passed label Jun 28, 2024
for _, opt := range opts {
opt(ta.detail)
}
ta.acknowledged.Store(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

acknowledged should not be true if the error is not nil with ack option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The acknowledgement here is for timetick manager.
All allocated timetick must be acked, Otherwise, the timetick interceptor based on heap got stuck.
The error here need to be handled by outside AckDetail management, but current behaviour is just ignored, and drop the illegal message at scanner side.

}

// Construct time tick message.
msg, err := newTimeTickMsg(impl.ackDetails.LastAllAcknowledgedTimestamp(), impl.sourceID)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here, we could ignore the error acknowledgement, may be skip some timtick sent, but I think it's make no sense.
Just drop the illegal message at scanner side based on timetick rule is best error-handling.

logger.Info("start to sync time tick...")
defer logger.Info("sync time tick stopped")

// Send first timetick message to wal before interceptor is ready.
Copy link
Contributor

@jaime0815 jaime0815 Jul 2, 2024

Choose a reason for hiding this comment

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

Move the following code snippet into a separate method named tryToSyncTimeTickUntilReady.

@jaime0815
Copy link
Contributor

/lgtm

@jaime0815 jaime0815 merged commit 3563136 into milvus-io:master Jul 2, 2024
11 of 12 checks passed
yellow-shine pushed a commit to yellow-shine/milvus that referenced this pull request Jul 2, 2024
issue: milvus-io#33285

- optimize the message package
- add interceptor package to achieve append operation intercepting.
- add timetick interceptor to attach timetick properties for message.
- add timetick background task to send timetick message.

Signed-off-by: chyezh <chyezh@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-passed dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement lgtm size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants