nickva commented on code in PR #5651:
URL: https://github.com/apache/couchdb/pull/5651#discussion_r2344889349


##########
src/dreyfus/src/dreyfus_rpc.erl:
##########
@@ -44,31 +47,36 @@ call(Fun, DbName, DDoc, IndexName, QueryArgs0) ->
         stale = Stale
     } = QueryArgs,
     {_LastSeq, MinSeq} = calculate_seqs(Db, Stale),
-    case dreyfus_index:design_doc_to_index(DDoc, IndexName) of
-        {ok, Index} ->
-            case dreyfus_index_manager:get_index(DbName, Index) of
-                {ok, Pid} ->
-                    case dreyfus_index:await(Pid, MinSeq) of
-                        {ok, IndexPid, _Seq} ->
-                            Result = dreyfus_index:Fun(IndexPid, QueryArgs),
-                            rexi:reply(Result);
-                        % obsolete clauses, remove after upgrade
-                        ok ->
-                            Result = dreyfus_index:Fun(Pid, QueryArgs),
-                            rexi:reply(Result);
-                        {ok, _Seq} ->
-                            Result = dreyfus_index:Fun(Pid, QueryArgs),
-                            rexi:reply(Result);
-                        Error ->
-                            rexi:reply(Error)
-                    end;
-                Error ->
-                    rexi:reply(Error)
-            end;
+    maybe
+        {ok, Index} ?= dreyfus_index:design_doc_to_index(DDoc, IndexName),
+        {ok, Pid} ?= dreyfus_index_manager:get_index(DbName, Index),
+        try
+            rexi:reply(index_call(Fun, Pid, MinSeq, QueryArgs))
+        catch
+            exit:{noproc, _} ->
+                couch_log:error("Got NOPROC, re-trying", []),
+                %% try one more time to handle the case when Clouseau's LRU
+                %% closed the index in the middle of our call
+                case dreyfus_index_manager:reopen_index(DbName, Index) of
+                    {ok, Pid} ->

Review Comment:
   I think this will always fail as it will match the Pid with the previous 
(now dead pid) from `{ok, Pid} ?= dreyfus_index_manager:get_index(DbName, 
Index)` further above?



-- 
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: notifications-unsubscr...@couchdb.apache.org

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

Reply via email to