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

IGNITE-17894 Implement RAFT snapshot streaming receiver #1233

Merged
merged 26 commits into from Oct 27, 2022

Conversation

tkalkirill
Copy link
Contributor

Copy link
Contributor

@SammyVimes SammyVimes left a comment

Choose a reason for hiding this comment

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

LGTM!

}

return loadSnapshotMeta(snapshotSender)
.thenCompose(unused1 -> loadSnapshotMvData(snapshotSender, executor))
Copy link
Contributor

Choose a reason for hiding this comment

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

Would these compositions look nicer with methods references? You wouldn't need to make names like "unused1" in that case, just move it to parameters list with the same name everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But this would be a useless argument, why do this? Maybe I didn't understand you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Both options looks weird, so it's up to you to decide.
Maybe you should use thenRun, it has no unused argument.
Another thing I noticed is that you always pass executor as argument into methods like "loadSnapshotMvData". Can't it be a field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll leave it as is.
thenRun does not return the future, but I need it so that the cancel works correctly with an interrupt.
I can even not use the field, it seems to me that it's a little clearer that we will execute the task in another thread.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right, I forgot about it

Copy link
Contributor

Choose a reason for hiding this comment

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

I can even not use the field

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it is in IncomingSnapshotCopier#partitionSnapshotStorage#incomingSnapshotsExecutor

public void start() {
Executor executor = partitionSnapshotStorage.getIncomingSnapshotsExecutor();

LOG.info("Copier is started for the partition: " + partId());
Copy link
Contributor

Choose a reason for hiding this comment

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

First of all, what's the common pattern of passing arguments? I feel like it's using {}.
Second, I would prefer this one to be wrapped into a "if (infoEnabled)" section. But I'm not sure that we actually have this as a rule. I would really love it if it was a rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected the format, do we need if (infoEnabled) if there is a check inside?

Copy link
Contributor

Choose a reason for hiding this comment

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

I vividly remember this topic being discussed a long time ago. The point is that the call without check creates a vararg array argument. It doesn't affect anything in most cases, but sometimes it may become a problem. I didn't invent this, this is how we used to write logs in Ignite 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you, but we don't have rules for 3.0 yet, maybe we should discuss it and add it to the code style rules.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we should

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then, after discussion, a new approach should be applied everywhere.

@tkalkirill tkalkirill merged commit 9391417 into apache:main Oct 27, 2022
@tkalkirill tkalkirill deleted the ignite-17894 branch October 27, 2022 12:36
Flaugh24 pushed a commit to unisonteam/ignite-3 that referenced this pull request Nov 4, 2022
lowka pushed a commit to gridgain/apache-ignite-3 that referenced this pull request Mar 18, 2023
lowka pushed a commit to gridgain/apache-ignite-3 that referenced this pull request Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants