Skip to content

Conversation

@peterbroadhurst
Copy link
Contributor

Next step on #493

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
startupOffsetRetryAttempts: config.GetInt(config.OrchestratorStartupAttempts),
dispatchers: make(map[fftypes.MessageType]*dispatcher),
shoulderTap: make(chan bool, 1),
newMessages: make(chan int64, readPageSize),
Copy link
Contributor Author

@peterbroadhurst peterbroadhurst Feb 8, 2022

Choose a reason for hiding this comment

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

Seemed arbitrary that we had a page size here, as we have a dedicated goroutine reading from it

// Make sure we only rewind backwards - as we might get multiple shoulder taps
// for different message sequences during a single poll cycle.
if bm.rewindTo < 0 || rewindTo < bm.rewindTo {
previousRewind := bm.rewindTo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just to allow logging

return ls, err
}

func (ag *aggregator) extractBatchMessagePin(batch *fftypes.Batch, requiredIndex int64) (totalBatchPins int64, msg *fftypes.Message, msgBaseIndex int64) {
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 re-write of this logic, is the main thing here.

We trigger from the pin - which references the batch and the index, but we need two other bits of information:


// Extract the message from the batch - where the index is of a topic within a message
var msg *fftypes.Message
var i int64 = -1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the case of pin.Index == 0 this logic was broken. msg and msgBaseIndex were incorrect.

@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2022

Codecov Report

Merging #499 (8bd5fd3) into main (82f55af) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #499   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          267       267           
  Lines        15257     15264    +7     
=========================================
+ Hits         15257     15264    +7     
Impacted Files Coverage Δ
internal/batch/batch_manager.go 100.00% <100.00%> (ø)
internal/broadcast/message.go 100.00% <100.00%> (ø)
internal/events/aggregator.go 100.00% <100.00%> (ø)
internal/events/aggregator_batch_state.go 100.00% <100.00%> (ø)
internal/privatemessaging/message.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82f55af...8bd5fd3. Read the comment docs.

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst
Copy link
Contributor Author

This whole thing as I'm chipping away at it, feels like I'm just coming to the big re-work needed in #421 (comment) from the other end.

I'm thinking I will just go full steam for that and deal with the consequences.

@peterbroadhurst
Copy link
Contributor Author

Closing this out - in favor of the full rework.

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.

2 participants