You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/11/19 22:32:08 UTC

[GitHub] [lucene] shubhamvishu opened a new pull request, #11954: Remove QueryTimeout#isTimeoutEnabled method and move check to caller

shubhamvishu opened a new pull request, #11954:
URL: https://github.com/apache/lucene/pull/11954

   ### Description
   
   This removes the method `QueryTimeout#isTimeoutEnabled` and moves the responsibility to ensure timeout is not null to the caller. 
   Initially I went with the approach to allow `QueryTimeout` to be null (and removing `#isTimeoutEnabled`) and allow wrapping `TimeLimitingBulkScorer` and `ExitableDirectoryReader` with null timeouts which is equivalent of timeout not enabled as this makes work easy for the caller but giving a thought again it made more sense to only wrap the classes if there is an actual timeout and moving the responsibility to ensure timeout is configured to caller method as mentioned in the issue.
   
   Closes #11914
   
   <!--
   If this is your first contribution to Lucene, please make sure you have reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] shubhamvishu commented on a diff in pull request #11954: Remove QueryTimeout#isTimeoutEnabled method and move check to caller

Posted by GitBox <gi...@apache.org>.
shubhamvishu commented on code in PR #11954:
URL: https://github.com/apache/lucene/pull/11954#discussion_r1029256452


##########
lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java:
##########
@@ -292,7 +296,11 @@ public void testExitablePointValuesIndexReader() throws Exception {
     // Not checking the validity of the result, all we are bothered about in this test is the timing
     // out.
     directoryReader = DirectoryReader.open(directory);
-    exitableDirectoryReader = new ExitableDirectoryReader(directoryReader, disabledQueryTimeout());
+    exitableDirectoryReader = directoryReader;
+    if (disabledQueryTimeout() != null) {

Review Comment:
   Yes, we are not using the `ExitableDirectoryReader` so lets completely remove this code for testing disabled timeout.



##########
lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java:
##########
@@ -784,7 +770,10 @@ protected DirectoryReader doWrapDirectoryReader(DirectoryReader in) throws IOExc
    */
   public static DirectoryReader wrap(DirectoryReader in, QueryTimeout queryTimeout)
       throws IOException {
-    return new ExitableDirectoryReader(in, queryTimeout);
+    if (queryTimeout != null) {

Review Comment:
   Sure, so lets throw an `ExitingReaderException` if queryTimeout is null?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz commented on a diff in pull request #11954: Remove QueryTimeout#isTimeoutEnabled method and move check to caller

Posted by GitBox <gi...@apache.org>.
jpountz commented on code in PR #11954:
URL: https://github.com/apache/lucene/pull/11954#discussion_r1029194303


##########
lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java:
##########
@@ -784,7 +770,10 @@ protected DirectoryReader doWrapDirectoryReader(DirectoryReader in) throws IOExc
    */
   public static DirectoryReader wrap(DirectoryReader in, QueryTimeout queryTimeout)
       throws IOException {
-    return new ExitableDirectoryReader(in, queryTimeout);
+    if (queryTimeout != null) {

Review Comment:
   I don't think it's worth accepting `null` query timeouts. Let's reject `null` queryTimeout objects entirely?



##########
lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java:
##########
@@ -292,7 +296,11 @@ public void testExitablePointValuesIndexReader() throws Exception {
     // Not checking the validity of the result, all we are bothered about in this test is the timing
     // out.
     directoryReader = DirectoryReader.open(directory);
-    exitableDirectoryReader = new ExitableDirectoryReader(directoryReader, disabledQueryTimeout());
+    exitableDirectoryReader = directoryReader;
+    if (disabledQueryTimeout() != null) {

Review Comment:
   It is always null so we should be able to remove this code path?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz commented on a diff in pull request #11954: Remove QueryTimeout#isTimeoutEnabled method and move check to caller

Posted by GitBox <gi...@apache.org>.
jpountz commented on code in PR #11954:
URL: https://github.com/apache/lucene/pull/11954#discussion_r1029300137


##########
lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java:
##########
@@ -784,7 +770,10 @@ protected DirectoryReader doWrapDirectoryReader(DirectoryReader in) throws IOExc
    */
   public static DirectoryReader wrap(DirectoryReader in, QueryTimeout queryTimeout)
       throws IOException {
-    return new ExitableDirectoryReader(in, queryTimeout);
+    if (queryTimeout != null) {

Review Comment:
   I would keep it simple and use `Objects#requireNonNull`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz merged pull request #11954: Remove QueryTimeout#isTimeoutEnabled method and move check to caller

Posted by GitBox <gi...@apache.org>.
jpountz merged PR #11954:
URL: https://github.com/apache/lucene/pull/11954


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] shubhamvishu commented on pull request #11954: Remove QueryTimeout#isTimeoutEnabled method and move check to caller

Posted by GitBox <gi...@apache.org>.
shubhamvishu commented on PR #11954:
URL: https://github.com/apache/lucene/pull/11954#issuecomment-1326530333

   > Add entry in CHANGES.txt
   
   Thanks for reviewing @jpountz 😀 ...... I have added the entry under 9.5.0.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org