-
Notifications
You must be signed in to change notification settings - Fork 136
IGNITE-20780 Sql. Move session expiration to IgniteSqlImpl #2785
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
Conversation
| */ | ||
| public IgniteSqlImpl(QueryProcessor qryProc, IgniteTransactions transactions) { | ||
| public IgniteSqlImpl( | ||
| String nodeName, |
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.
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.
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.
Maybe it make sense to have shared scheduler thead and reuse it 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.
I was thinking about using a common scheduler, but we don't have common pools yet
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/IgniteSqlImpl.java
Show resolved
Hide resolved
| @Override | ||
| public SessionBuilder sessionBuilder() { | ||
| return new SessionBuilderImpl(qryProc, transactions, new HashMap<>()); | ||
| return new SessionBuilderImpl(sessions, qryProc, transactions, new HashMap<>()); |
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.
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?
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.
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(); |
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.
maybe we could move both touch of tracker into requireResultSet() - WDYT?
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.
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
| assertThat(session.expired(), is(true)); | ||
| } | ||
|
|
||
| @RepeatedTest(10) |
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.
What reason to run it few times?
If it really required then let's add some comment about the reason
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.
no reason, replaced with regular test
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java
Show resolved
Hide resolved
|
|
||
| return new IgniteSqlImpl("test", queryProcessor, mock(IgniteTransactions.class)); | ||
| } | ||
| } No newline at end of file |
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.
| } | |
| } | |
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.
done
| .idleTimeout(idleTimeout, TimeUnit.MILLISECONDS) | ||
| .build(); | ||
| } | ||
| } No newline at end of file |
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.
| } | |
| } | |
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.
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
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
- 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.
Notes