-
Notifications
You must be signed in to change notification settings - Fork 3
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: consume data by batch #57
Conversation
69a124a
to
91d8ac6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Sotatek-HuyLe3a . Few comments otherwise looks good to me.
Cursor currentCursor = cursorService.getCursor().orElse(null); | ||
if (currentCursor != null && currentCursor.getSlot() > slotHeight) { | ||
log.info("Delete cursors with slot greater than {}", slotHeight); | ||
cursorStorage.deleteBySlotGreaterThan(eventPublisherId, slotHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sotatek-HuyLe3a I think we can use CursorService.rollbackTo(slot) method here instead of directly accessing CursorStorage.
long slotHeight = blockRepository.getSlotHeight().orElse(0L); | ||
|
||
if (slotHeight == 0) { | ||
if (!syncAutoStart) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sotatek-HuyLe3a Yaci Store should automatically start this if autoSync is true. Do we need to handle it separately here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @satran004 , My intention is to start the Yaci Store service if syncStart is false, however, my current approach will make the autoSync property meaningless. I will fix it.
91d8ac6
to
08f29aa
Compare
@Sotatek-HuyLe3a Few more questions.
|
However, since we can start BlockSync when we are close to the tip, and I think there's no need to set the batch size value to 1, we can add one more condition: 2.If we process a batch and encounter a failure, the data will be rolled back, except for the data in the cursor table, and we handled this issue when ledger-sync restart. Each time there is a restart, Yaci Store publishes a rollback event to the last block as a way to clean the data and I think this does not have any impact on batch processing. |
Thanks @Sotatek-HuyLe3a
Makes sense. Can you please change the code accordingly? Then we can merge this PR. Thanks |
#55