Skip to content

Conversation

@korlov42
Copy link
Contributor

@korlov42 korlov42 commented Nov 2, 2023

Thank you for submitting the pull request.

To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:

The Review Checklist

  • Formal criteria: TC status, codestyle, mandatory documentation. Also make sure to complete the following:
    - There is a single JIRA ticket related to the pull request.
    - The web-link to the pull request is attached to the JIRA ticket.
    - The JIRA ticket has the Patch Available state.
    - The description of the JIRA ticket explains WHAT was made, WHY and HOW.
    - The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • Design: new code conforms with the design principles of the components it is added to.
  • Patch quality: patch cannot be split into smaller pieces, its size must be reasonable.
  • Code quality: code is clean and readable, necessary developer documentation is added if needed.
  • Tests code quality: test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.

Notes

*/
public IgniteSqlImpl(QueryProcessor qryProc, IgniteTransactions transactions) {
public IgniteSqlImpl(
String nodeName,
Copy link
Member

@AMashenkov AMashenkov Nov 3, 2023

Choose a reason for hiding this comment

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

I don't like the idea to pass node name to components just to create thread pool.
Also, with this approach, we can't use spy on thread factory in test to verify the component stops correctly.

WDYT, if we will have NodeThreadFactory and pass the factory to components, instead of nodeName?
Feel free keeping changes as is, we always can fix this in another ticket.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it make sense to have shared scheduler thead and reuse it here.

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 was thinking about using a common scheduler, but we don't have common pools yet

@Override
public SessionBuilder sessionBuilder() {
return new SessionBuilderImpl(qryProc, transactions, new HashMap<>());
return new SessionBuilderImpl(sessions, qryProc, transactions, new HashMap<>());
Copy link
Member

@AMashenkov AMashenkov Nov 3, 2023

Choose a reason for hiding this comment

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

You pass sessions collection to SessionBuilderImpl, which leaks to the user side.
SessionBuilderImpl has no locks/flags that prevents putting data into collections, when node is stopping. After executor will be stopped, noone will cleanup the collection.

Maybe, we can pass a callback method reference (e.g. onSessionCreate()) and do all stuff in the method, but outside the builder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now it's guarded with busyLock

- close all sessions on stop of the facade
- guard modification of `sessions` with busy lock
- add tests
public Iterable<T> currentPage() {
requireResultSet();

expirationTracker.touch();
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could move both touch of tracker into requireResultSet() - WDYT?

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 would prefer not to. requireResultSet does exactly what you expect it to do by looking at its name. Touch of the expiration tracker will be a side effect. We may move it inside, but then we need to come up with a proper name like ensureResultSetAwailableAndTouchExpirationTracker

@korlov42 korlov42 requested a review from AMashenkov November 3, 2023 15:05
assertThat(session.expired(), is(true));
}

@RepeatedTest(10)
Copy link
Contributor

Choose a reason for hiding this comment

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

What reason to run it few times?
If it really required then let's add some comment about the reason

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no reason, replaced with regular test


return new IgniteSqlImpl("test", queryProcessor, mock(IgniteTransactions.class));
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Suggested 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.

done

.idleTimeout(idleTimeout, TimeUnit.MILLISECONDS)
.build();
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Suggested 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.

done

- remove param `session` from `executePlan`
- add empty line to the end of hew files
# Conflicts:
#	modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItBuildIndexOneNodeTest.java
@korlov42 korlov42 merged commit 41ef23d into apache:main Nov 6, 2023
@korlov42 korlov42 deleted the ignite-20780 branch November 6, 2023 11:36
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.

4 participants