Skip to content

Conversation

@jacek-lewandowski
Copy link
Contributor

No description provided.

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 left a comment

Choose a reason for hiding this comment

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

Left some comments, primarily questions actually. Need to look at it more tomorrow. Seems like there are few things going on and I do not want to change any behavior

Copy link
Contributor

Choose a reason for hiding this comment

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

How about some Javadoc?

Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we add some logging in case no update has happened?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why this was switched to trace?

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 revert

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 actually I considered this message as temporary situation - when the messaging version is eventually known, the schema is either pulled or it is logged that the messaging version is incompatible (at debug level)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I mentioned in the previous version but for completeness - I think this TO DO deserves to be documented actually

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, but where do you want it to be documented? I think we should rather fix it

Copy link
Contributor

Choose a reason for hiding this comment

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

Then in a follow up ticket in order to be fixed and add the number in this comment? WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you decide to move it up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have to think a bit about this TO DO

Copy link
Contributor

Choose a reason for hiding this comment

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

Still trying to understand why it's needed, but for sure a quick attempt at removing it breaks the tests.

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 Aug 30, 2022

Choose a reason for hiding this comment

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

The same logic is in pullComplete.
Seems to me we markReceived before we deal with requestQueue in maybePullSchema, I am still not sure why though.... looking again into that

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it hasn't necessarily marked are received, has it? It's only marked as received if it's equals to the local schema, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, reading back that is right but then it is confusing why in those cases we add to the requestQueue which seems to be a queue of endpoints from which we are going to fetch.... do we need still to fetch? :-)

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 Aug 30, 2022

Choose a reason for hiding this comment

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

At that point we do not remove the endpoint from the queue, we seem to remove it next time we call maybePullSchema and we iterate the queue. Not sure why that approach was taken really and not just not adding it at all in case we markReceived... I will experiment

Copy link
Contributor

Choose a reason for hiding this comment

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

So we add it to requestQueue because we might need to fetch it, unless it has been marked as received. I guess the simplified version would be adding the endpoint to the request queue only if hasn't been marked, something like:

VersionInfo info = versionInfo.computeIfAbsent(version, VersionInfo::new);
info.endpoints.add(endpoint);
logger.trace("Added endpoint {} to schema {}: {}", endpoint, info.version, info);

if (Objects.equals(schemaVersion.get(), version))
{
    info.markReceived();
    logger.trace("Schema {} from {} has been marked as received because it is equal the local schema", version, endpoint);
}
else
{
    info.requestQueue.addFirst(endpoint);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that was my point but I have to test if it can have some other side effects that we might miss...

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 Aug 30, 2022

Choose a reason for hiding this comment

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

At least the MigrationCoordinatorTest and SchemaTest (both in-jvm and unit tests) pass for me locally with this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly, that was what I've commented - "...given we've just marked this schema version as received..." :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: endpoints

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 left a comment

Choose a reason for hiding this comment

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

Left some small comments, I want to do one more pass and check further the MigrationCoordinatorTest as I just skimmed through it. I want to be sure I didn't miss anything. I also want to look further in 4.0. Not an area of the code that I have a lot of experience

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 Aug 29, 2022

Choose a reason for hiding this comment

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

I think we need to make it print the SCHEMA_PULL_INTERVAL as it is mutable, not always 1 minute necessarily anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

immediately

Comment on lines 493 to 510
Copy link
Contributor

Choose a reason for hiding this comment

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

This one too
Not that I am super opinionated but it just feels like it can improve readability that way

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be split in a few lines as it becomes too long

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 will, but with the current formatting rules I can see no way to format it nicely

Copy link
Contributor

Choose a reason for hiding this comment

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

This line can also be split in a few lines so we don't have to scroll right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

again, the formatting rules does not allow for make it nicely to my knowledge

Copy link
Contributor

Choose a reason for hiding this comment

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

This line also seems too long

Comment on lines 35 to 36
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused imports

Copy link
Contributor

Choose a reason for hiding this comment

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

Unused import

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a brief JavaDoc line saying what the property does.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably we should include the unit in the name, like in SCHEMA_PULL_INTERVAL_MS.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} catch (RuntimeException ex) {
}
catch (RuntimeException ex)
{

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: unused import

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* As long as the certain version is advertised by some node, it is being tracked. As long as a version is tracked,
* As long as a certain version is advertised by some node, it is being tracked. As long as a version is tracked,

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it should be waitQueueSize?

Suggested change
", waitQueue=" + waitQueue.getWaiting() +
", waitQueueSize=" + waitQueue.getWaiting() +

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!clearCompletion.await(StorageService.SCHEMA_DELAY_MILLIS, TimeUnit.MILLISECONDS)) {
if (!clearCompletion.await(StorageService.SCHEMA_DELAY_MILLIS, TimeUnit.MILLISECONDS))
{

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should either add some description to the @return tag or remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, and btw. I suppose the more adequate names for those methods now would be reset -> sync, clear -> refresh

@jacek-lewandowski
Copy link
Contributor Author

Thank you for thorough review, I've applied your suggestions

Copy link
Contributor

@ekaterinadimitrova2 ekaterinadimitrova2 Sep 12, 2022

Choose a reason for hiding this comment

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

typo: syncs

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use the names here probably tbl_one or so.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably change this name to checkTablesPropagated or something

Copy link
Contributor

Choose a reason for hiding this comment

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

a definition

Patch by Jacek Lewandowski, reviewed by Andrés de la Peña and Ekaterina Dimitrova for CASSANDRA-17819
@jacek-lewandowski
Copy link
Contributor Author

Merged to cassandra-4.1 in d8bbeb9

@jacek-lewandowski jacek-lewandowski deleted the CASSANDRA-17819-2 branch September 16, 2022 08:05
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