You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2025/05/31 02:47:38 UTC

(couchdb) branch catch-nodedown-in-ddoc-cache created (now df2a3390b)

This is an automated email from the ASF dual-hosted git repository.

jiahuili430 pushed a change to branch catch-nodedown-in-ddoc-cache
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at df2a3390b Fix `function_clause` in `ddoc_cache`

This branch includes the following new commits:

     new df2a3390b Fix `function_clause` in `ddoc_cache`

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(couchdb) 01/01: Fix `function_clause` in `ddoc_cache`

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jiahuili430 pushed a commit to branch catch-nodedown-in-ddoc-cache
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit df2a3390b388ff4276135294aff283c93b7ab62b
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Fri May 30 21:42:08 2025 -0500

    Fix `function_clause` in `ddoc_cache`
    
    Error log:
    ```
    exit value:#012{
      {function_clause, [
        {
          lists, flatmap_1,
          [#Fun<ddoc_cache_entry_validation_funs.0.82671214>, {nodedown, <<"progress not possible">>}],
          [{file, "lists.erl"}, {line, 1578}]
        },
        {
          ddoc_cache_entry_validation_funs, recover, 1,
          [{file, "src/ddoc_cache_entry_validation_funs.erl"}, {line, 30}]
        },
        {
          couch_db, '-load_validation_funs/1-fun-0-', 1,
          [{file, "src/couch_db.erl"}, {line, 972}]
        }
      ]}
    }#012
    ```
---
 .../src/ddoc_cache_entry_validation_funs.erl       | 25 +++++++++++++---------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/ddoc_cache/src/ddoc_cache_entry_validation_funs.erl b/src/ddoc_cache/src/ddoc_cache_entry_validation_funs.erl
index 54f5c673f..86d45a5a2 100644
--- a/src/ddoc_cache/src/ddoc_cache_entry_validation_funs.erl
+++ b/src/ddoc_cache/src/ddoc_cache_entry_validation_funs.erl
@@ -27,16 +27,21 @@ ddocid(_) ->
 
 recover(DbName) ->
     {ok, DDocs} = fabric:design_docs(mem3:dbname(DbName)),
-    Funs = lists:flatmap(
-        fun(DDoc) ->
-            case couch_doc:get_validate_doc_fun(DbName, DDoc) of
-                nil -> [];
-                Fun -> [Fun]
-            end
-        end,
-        DDocs
-    ),
-    {ok, Funs}.
+    case is_list(DDocs) of
+        true ->
+            Funs = lists:flatmap(
+                fun(DDoc) ->
+                    case couch_doc:get_validate_doc_fun(DbName, DDoc) of
+                        nil -> [];
+                        Fun -> [Fun]
+                    end
+                end,
+                DDocs
+            ),
+            {ok, Funs};
+        false ->
+            throw({error, DDocs})
+    end.
 
 insert(_, _) ->
     ok.