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

Multi-cursor components: queue slice #2996

Merged
merged 6 commits into from
Jun 28, 2022

Conversation

yycptt
Copy link
Member

@yycptt yycptt commented Jun 14, 2022

What changed?

  • Add history queue slice definition and related methods
  • Queue slice is built on top of queue scope and iterator. It's responsible for loading and tracking all tasks within its scope. It can also shrink its scope (range) upon request.

Why?

  • Building blocks for multi-cursor queue

How did you test it?

  • Unit test

Potential risks

  • N/A, not used

Is hotfix candidate?

  • No

@yycptt yycptt requested a review from wxing1292 June 14, 2022 20:52
@yycptt yycptt requested a review from a team as a code owner June 14, 2022 20:52
service/history/queues/slice.go Show resolved Hide resolved
service/history/queues/slice.go Outdated Show resolved Hide resolved
service/history/queues/slice.go Show resolved Hide resolved
service/history/queues/slice.go Outdated Show resolved Hide resolved
service/history/queues/slice.go Show resolved Hide resolved

for idx, iterator := range iterators[:len(iterators)-1] {
nextIterator := iterators[idx+1]
if iterator.Range().ExclusiveMax.CompareTo(nextIterator.Range().InclusiveMin) >= 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be > 0 instead of >= 0?

Copy link
Member Author

@yycptt yycptt Jun 28, 2022

Choose a reason for hiding this comment

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

Since iterator doesn't have predicate, two iterators should be merged together if one's max equals the other's min. As iterator.CanMerge() returns true in this case, I think the check should panic when we found they're not merged together. I can update the panic message to be more specific.

@yycptt yycptt merged commit 3354e35 into temporalio:master Jun 28, 2022
@yycptt yycptt deleted the multi-cursor-slice branch June 28, 2022 04:43
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