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

Added TimeoutPoller to have one thread for timers #842

Merged
merged 15 commits into from Nov 23, 2018
Merged

Conversation

shayaantx
Copy link
Contributor

@shayaantx shayaantx commented Oct 20, 2018

As discussed in other pr, modified the TimeoutTimer to not be a unlimited thread pool, instead its one thread that lets TDS commands register/deregister with it, when a timeout is configured, and that thread will timeout the command if necessary. Included test cases.

Updated to include bulk copy functionality.

I literally formatted every single piece of code I touched, it seems much of IO buffer doesn't match the linked formatter, https://github.com/Microsoft/mssql-jdbc/blob/dev/mssql-jdbc_formatter.xml

@codecov-io
Copy link

codecov-io commented Oct 20, 2018

Codecov Report

Merging #842 into dev will decrease coverage by 0.29%.
The diff coverage is 85.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##                dev     #842     +/-   ##
===========================================
- Coverage     48.98%   48.68%   -0.3%     
+ Complexity     2821     2813      -8     
===========================================
  Files           116      118      +2     
  Lines         27877    27863     -14     
  Branches       4650     4637     -13     
===========================================
- Hits          13655    13566     -89     
+ Misses        12104    12101      -3     
- Partials       2118     2196     +78
Flag Coverage Δ Complexity Δ
#JDBC42 48.1% <85.33%> (-0.09%) 2759 <14> (+9)
#JDBC43 48.66% <85.33%> (-0.26%) 2813 <14> (-3)
Impacted Files Coverage Δ Complexity Δ
...a/com/microsoft/sqlserver/jdbc/TimeoutCommand.java 100% <100%> (ø) 5 <5> (?)
...in/java/com/microsoft/sqlserver/jdbc/IOBuffer.java 55.74% <77.77%> (-2.51%) 0 <0> (ø)
...va/com/microsoft/sqlserver/jdbc/TimeoutPoller.java 83.78% <83.78%> (ø) 9 <9> (?)
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 52.46% <90%> (-0.27%) 263 <0> (ø)
...m/microsoft/sqlserver/jdbc/SQLServerException.java 77.44% <0%> (-1.51%) 31% <0%> (-2%)
...om/microsoft/sqlserver/jdbc/ReaderInputStream.java 43.95% <0%> (-1.1%) 15% <0%> (ø)
...c/main/java/com/microsoft/sqlserver/jdbc/Util.java 60.99% <0%> (-1.08%) 89% <0%> (-4%)
...n/java/com/microsoft/sqlserver/jdbc/tdsparser.java 68.1% <0%> (-0.87%) 0% <0%> (ø)
...ncurrentlinkedhashmap/ConcurrentLinkedHashMap.java 38.14% <0%> (-0.65%) 42% <0%> (-1%)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d01e90a...77a2fa3. Read the comment docs.

@shayaantx
Copy link
Contributor Author

@ulvii @cheenamalhotra

@shayaantx
Copy link
Contributor Author

ok sorry, now the formatting should be correct, eclipse kept reverting the formatter I was using on my vm.....

@rene-ye rene-ye added this to the 7.1.2 milestone Oct 25, 2018
@ulvii
Copy link
Contributor

ulvii commented Oct 26, 2018

Please add the license header to the new files.

 /*
  * Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made
  * available under the terms of the MIT License. See the LICENSE file in the project root for more information.
  */

@cheenamalhotra cheenamalhotra removed this from the 7.1.2 milestone Oct 26, 2018
@shayaantx
Copy link
Contributor Author

@ulvii anything other changes required? please let me know

@shayaantx
Copy link
Contributor Author

@ulvii @cheenamalhotra anything I missed?

@ulvii
Copy link
Contributor

ulvii commented Nov 14, 2018

Hi @shayaantx ,
The review is mostly done and we are targeting to merge the PR for the next preview release. Please stay tuned, as there might still be review comments depending on the results of internal testing.
Thank you for patience.

@shayaantx
Copy link
Contributor Author

@ulvii no problem, just let me know, thanks

@peterbae
Copy link
Contributor

Other than that one comment I made, this PR looks good to me.

@cheenamalhotra cheenamalhotra added this to the 7.1.3 milestone Nov 20, 2018
@cheenamalhotra cheenamalhotra added this to Under Peer Review in MSSQL JDBC Nov 21, 2018
@ulvii ulvii merged commit 46a5107 into microsoft:dev Nov 23, 2018
MSSQL JDBC automation moved this from Under Peer Review to Closed/Merged PRs Nov 23, 2018
@ulvii ulvii changed the title TimeoutTimer to TimeoutPoller performance enhancement Added TimeoutPoller to have one thread for timers Nov 23, 2018
shayaantx added a commit to shayaantx/mssql-jdbc that referenced this pull request Dec 19, 2018
…ng timeouts and infinite polling checking for timeouts

Specifically in microsoft#842, I introduced a single thread to replace the infinite timeout thread pool. However the thread lives forever, so this change seeks to fix that. Also the interrupt logic before/after my change can block timeout threads. So this change also addresses that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
MSSQL JDBC
  
Closed/Merged PRs
Development

Successfully merging this pull request may close these issues.

None yet

6 participants