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

rnewson pushed a commit to branch nouveau-ken
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b58a68aa382f5a7689ee47802d0551e9d436157e
Author: Robert Newson <[email protected]>
AuthorDate: Thu Mar 26 08:16:35 2026 +0000

    restore nouveau_index_updater:outdated
    
    Used by ken...
---
 src/nouveau/src/nouveau_index_updater.erl | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/nouveau/src/nouveau_index_updater.erl 
b/src/nouveau/src/nouveau_index_updater.erl
index 5b58d1e4c..38e284a95 100644
--- a/src/nouveau/src/nouveau_index_updater.erl
+++ b/src/nouveau/src/nouveau_index_updater.erl
@@ -18,7 +18,7 @@
 -include("nouveau.hrl").
 
 %% public api
--export([get_db_info/1]).
+-export([outdated/1, get_db_info/1]).
 
 %% callbacks
 -export([update/1]).
@@ -47,6 +47,21 @@
     batch
 }).
 
+outdated(#index{} = Index) ->
+    {ok, Db} = couch_db:open_int(Index#index.dbname, []),
+    try
+        case open_or_create_index(Db, Index) of
+            {ok, #{} = Info} ->
+                #{<<"update_seq">> := IndexUpdateSeq, <<"purge_seq">> := 
IndexPurgeSeq} = Info,
+                {DbUpdateSeq, DbPurgeSeq} = get_db_info(Db),
+                DbUpdateSeq > IndexUpdateSeq orelse DbPurgeSeq > IndexPurgeSeq;
+            {error, Reason} ->
+                {error, Reason}
+        end
+    after
+        couch_db:close(Db)
+    end.
+
 update(#index{} = Index) ->
     {ok, Db} = couch_db:open_int(Index#index.dbname, []),
     try
@@ -219,12 +234,14 @@ open_or_create_index(Db, #index{} = Index) ->
 get_db_info(#index{} = Index) ->
     {ok, Db} = couch_db:open_int(Index#index.dbname, []),
     try
-        UpdateSeq = couch_db:get_update_seq(Db),
-        PurgeSeq = couch_db:get_purge_seq(Db),
-        {UpdateSeq, PurgeSeq}
+        get_db_info(Db)
     after
         couch_db:close(Db)
-    end.
+    end;
+get_db_info(Db) ->
+    UpdateSeq = couch_db:get_update_seq(Db),
+    PurgeSeq = couch_db:get_purge_seq(Db),
+    {UpdateSeq, PurgeSeq}.
 
 index_definition(#index{} = Index, InitialPurgeSeq) ->
     #{

Reply via email to