-
Notifications
You must be signed in to change notification settings - Fork 602
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
[Livy 899] The state of interactive session is always idle when using thrift protocol. #377
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #377 +/- ##
=============================================
- Coverage 65.58% 28.61% -36.98%
+ Complexity 952 379 -573
=============================================
Files 103 103
Lines 6044 6057 +13
Branches 911 912 +1
=============================================
- Hits 3964 1733 -2231
- Misses 1536 3977 +2441
+ Partials 544 347 -197
... and 82 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. 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.
I am not sure about the change, as this does not involve only the thriftserver module, but all interactive sessions. If the problem involves all interactive sessions, then it is ok, otherwise the fix is probably not the correct one. Can you check if the same issue affects all interactive jobs? If so, I think we can go ahead with this PR, but I would recommend a different reviewer more familiar with the code in rsc, otherwise, the fix needs to be done only on the thriftserver part and we need more investigation to understand why normal interactive sessions do not have the issue while thriftserver has. Thanks.
import java.util.List; | ||
import java.util.Properties; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.*; |
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.
please avoid importing everything, just add what we need
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.
+1
@@ -192,6 +192,27 @@ public void testThriftSession() throws Exception { | |||
waitFor(new UnregisterSessionJob(s3)); | |||
} | |||
|
|||
@Test | |||
public void testSessionState() throws Exception { | |||
|
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.
please remove unneeded blank line
@@ -214,7 +235,7 @@ private SqlJob newSqlJob(String session, String stId, String statement) { | |||
*/ | |||
private Exception expectError(Job<?> job, String expected) throws TimeoutException { | |||
try { | |||
livy.submit(job).get(10, TimeUnit.SECONDS); | |||
livy.submit(job).get(10, SECONDS); |
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.
these are unneeded changes, please avoid them and use TimeUnit.SECONDS
in the added code as well
@@ -192,6 +192,27 @@ public void testThriftSession() throws Exception { | |||
waitFor(new UnregisterSessionJob(s3)); | |||
} | |||
|
|||
@Test | |||
public void testSessionState() throws Exception { |
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.
why are we testing the RSCDriver in thriftserver? All changes are outside the thriftserver, so the UTs should be in rsc as well. This will also avoid adding dependencies to the thriftserver module.
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.
Because I need to verify that the state is correct at the end.
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.
at the end of what? Here we are not going through the thriftserver, so this test should be moved to rsc
broadcast(new ReplState(SessionState.Busy$.MODULE$.state())); | ||
} | ||
|
||
public void idleIfActiveJobsEmpty(){ |
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.
public void idleIfActiveJobsEmpty(){
-> public void idleIfActiveJobsEmpty() {
import java.util.concurrent.TimeoutException; | ||
import static java.util.concurrent.TimeUnit.*; |
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.
ditto
The same issue doesn't affect interactive jobs which created by REST API. The is because the handle functions are different in the driver. The REST API uses |
This fix is causing many changes. The I think a better place for the fix would be |
sorry for the late reply. I have migrated the changes to SqlJob, can you @mgaido91 review the code again? |
What changes were proposed in this pull request?
ReplState
to theRSCClient
inRSCDriver
or the session state is always idle when using thrift protocol.testSessionState
inThriftSessionTest
to verify that the state change is as expected.https://issues.apache.org/jira/browse/LIVY-899
How was this patch tested?
This patch is tested by unit tests. The the state change is recorded in
replStateChangedHistoryInTest
when testing.