You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2025/05/02 15:22:08 UTC
(couchdb) branch auto-delete-3 updated (f9643ce8d -> 76e2c7bae)
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a change to branch auto-delete-3
in repository https://gitbox.apache.org/repos/asf/couchdb.git
discard f9643ce8d extend testing
new 76e2c7bae extend testing
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (f9643ce8d)
\
N -- N -- N refs/heads/auto-delete-3 (76e2c7bae)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
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.
Summary of changes:
Makefile | 2 +-
configure | 1 +
configure.ps1 | 1 +
dev/run | 1 +
.../couchdb/nouveau/NouveauApplicationConfiguration.java | 2 +-
rel/nouveau.yaml | 2 +-
src/fabric/src/fabric_drop_seq.erl | 6 ++++++
test/elixir/test/drop_seq_test.exs | 14 ++++++++------
8 files changed, 20 insertions(+), 9 deletions(-)
(couchdb) 01/01: extend testing
Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch auto-delete-3
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 76e2c7baeab10bbe9d5caa9be55bd770de9914fd
Author: Robert Newson <rn...@apache.org>
AuthorDate: Fri May 2 12:58:43 2025 +0100
extend testing
---
Makefile | 2 +-
configure | 1 +
configure.ps1 | 1 +
dev/run | 1 +
.../nouveau/NouveauApplicationConfiguration.java | 2 +-
rel/nouveau.yaml | 2 +-
src/fabric/src/fabric_drop_seq.erl | 6 +
test/elixir/test/config/nouveau.elixir | 3 +
test/elixir/test/config/search.elixir | 3 +
test/elixir/test/config/suite.elixir | 3 +-
test/elixir/test/drop_seq_test.exs | 150 +++++++++++++++++----
11 files changed, 141 insertions(+), 33 deletions(-)
diff --git a/Makefile b/Makefile
index 8b1df51e6..df2163d54 100644
--- a/Makefile
+++ b/Makefile
@@ -575,5 +575,5 @@ nouveau-test-elixir: couch nouveau
ifeq ($(with_nouveau), true)
@dev/run "$(TEST_OPTS)" -n 1 -q -a adm:pass --with-nouveau \
--locald-config test/config/test-config.ini \
- --no-eval 'mix test --trace --include test/elixir/test/config/nouveau.elixir'
+ --no-eval 'mix test --trace --include test/elixir/test/config/nouveau.elixir $(EXUNIT_OPTS)'
endif
diff --git a/configure b/configure
index 70350a07b..80b8921c3 100755
--- a/configure
+++ b/configure
@@ -373,6 +373,7 @@ cat > rel/couchdb.config << EOF
{data_dir, "./data"}.
{view_index_dir, "./data"}.
{nouveau_index_dir, "./data/nouveau"}.
+{nouveau_commit_interval, 30}.
{nouveau_url, "http://127.0.0.1:5987"}.
{nouveau_port, 5987}.
{nouveau_admin_port, 5988}.
diff --git a/configure.ps1 b/configure.ps1
index faf3669ec..ca0c417dd 100644
--- a/configure.ps1
+++ b/configure.ps1
@@ -194,6 +194,7 @@ $CouchDBConfig = @"
{data_dir, "./data"}.
{view_index_dir, "./data"}.
{nouveau_index_dir, "./data/nouveau"}.
+{nouveau_commit_interval, 30}.
{nouveau_url, "http://127.0.0.1:5987"}.
{nouveau_port, 5987}.
{nouveau_admin_port, 5988}.
diff --git a/dev/run b/dev/run
index 85ea9622d..fc070a035 100755
--- a/dev/run
+++ b/dev/run
@@ -424,6 +424,7 @@ def generate_nouveau_config(ctx):
config = {
"nouveau_index_dir": os.path.join(ctx["devdir"], "lib", "nouveau"),
+ "nouveau_commit_interval": 5,
"nouveau_port": 5987,
"nouveau_admin_port": 5988,
}
diff --git a/nouveau/src/main/java/org/apache/couchdb/nouveau/NouveauApplicationConfiguration.java b/nouveau/src/main/java/org/apache/couchdb/nouveau/NouveauApplicationConfiguration.java
index dce6fe6da..67eed38af 100644
--- a/nouveau/src/main/java/org/apache/couchdb/nouveau/NouveauApplicationConfiguration.java
+++ b/nouveau/src/main/java/org/apache/couchdb/nouveau/NouveauApplicationConfiguration.java
@@ -24,7 +24,7 @@ public class NouveauApplicationConfiguration extends Configuration {
@Min(10)
private int maxIndexesOpen = 10;
- @Min(10)
+ @Min(5)
private int commitIntervalSeconds = 10;
@Min(30)
diff --git a/rel/nouveau.yaml b/rel/nouveau.yaml
index 40837f12c..55dd192fa 100644
--- a/rel/nouveau.yaml
+++ b/rel/nouveau.yaml
@@ -1,5 +1,5 @@
maxIndexesOpen: 3000
-commitIntervalSeconds: 30
+commitIntervalSeconds: {{nouveau_commit_interval}}
idleSeconds: 60
rootDir: {{nouveau_index_dir}}
diff --git a/src/fabric/src/fabric_drop_seq.erl b/src/fabric/src/fabric_drop_seq.erl
index 73cb0bb16..2ecfe6441 100644
--- a/src/fabric/src/fabric_drop_seq.erl
+++ b/src/fabric/src/fabric_drop_seq.erl
@@ -367,6 +367,12 @@ update_peer_checkpoint_doc(DbName, Subtype, Source, PeerId, UpdateSeq) when
{_, UpdateRef} = spawn_monitor(fun() ->
case fabric:update_doc(mem3:dbname(DbName), NewDoc1, [?ADMIN_CTX]) of
{ok, _} ->
+ couch_log:notice(
+ "updated peer checkpoint for db:~s, subtype:~s, source:~s, peer_id:~s, update_seq:~s",
+ [
+ DbName, Subtype, Source, PeerId, UpdateSeq
+ ]
+ ),
ok;
{error, Reason} ->
throw({checkpoint_commit_failure, Reason})
diff --git a/test/elixir/test/config/nouveau.elixir b/test/elixir/test/config/nouveau.elixir
index 02157e2ca..14c22b24f 100644
--- a/test/elixir/test/config/nouveau.elixir
+++ b/test/elixir/test/config/nouveau.elixir
@@ -1,4 +1,7 @@
%{
+ "DropSeqTest": [
+ "peer checkpoint - nouveau"
+ ],
"NouveauTest": [
"user-agent header is forbidden",
"search analyze",
diff --git a/test/elixir/test/config/search.elixir b/test/elixir/test/config/search.elixir
index b49b8d762..438a8bd2c 100644
--- a/test/elixir/test/config/search.elixir
+++ b/test/elixir/test/config/search.elixir
@@ -1,4 +1,7 @@
%{
+ "DropSeqTest": [
+ "peer checkpoint - search"
+ ],
"PartitionSearchTest": [
"Cannot do global query with partition view",
"Cannot do partition query with global search ddoc",
diff --git a/test/elixir/test/config/suite.elixir b/test/elixir/test/config/suite.elixir
index b3e36f7ae..c7638b7a6 100644
--- a/test/elixir/test/config/suite.elixir
+++ b/test/elixir/test/config/suite.elixir
@@ -212,7 +212,8 @@
"design doc path with slash in db name"
],
"DropSeqTest": [
- "dropped document vanishes after compaction"
+ "peer checkpoint - mrview",
+ "peer checkpoint - custom"
],
"ErlangViewsTest": [
"Erlang map function",
diff --git a/test/elixir/test/drop_seq_test.exs b/test/elixir/test/drop_seq_test.exs
index 9dbb1c3f8..daa7e4f0a 100644
--- a/test/elixir/test/drop_seq_test.exs
+++ b/test/elixir/test/drop_seq_test.exs
@@ -4,22 +4,106 @@ defmodule DropSeqTest do
@moduletag :drop_seq
@tag :with_db
- test "dropped document vanishes after compaction", context do
+ test "peer checkpoint - mrview", context do
db_name = context[:db_name]
ddoc_id = "_design/foo"
- doc_id = "testdoc"
- # create something that will maintain a peer checkpoint
- resp = Couch.put("/#{db_name}/#{ddoc_id}", body: %{
- views: %{
- bar: %{
- map: "function(doc) { emit(); }"
+ create_checkpoint_fn = fn ->
+ resp = Couch.put("/#{db_name}/#{ddoc_id}", body: %{
+ views: %{
+ bar: %{
+ map: "function(doc) {}"
+ }
}
- }
- })
- assert resp.status_code == 201
+ })
+ assert resp.status_code == 201
+ end
+
+ update_checkpoint_fn = fn ->
+ assert Couch.get("/#{db_name}/#{ddoc_id}/_view/bar").status_code == 200
+ end
+
+ checkpoint_test_helper(context[:db_name], create_checkpoint_fn, update_checkpoint_fn)
+ end
+
+ @tag :with_db
+ test "peer checkpoint - search", context do
+ db_name = context[:db_name]
+ ddoc_id = "_design/foo"
+
+ create_checkpoint_fn = fn ->
+ resp = Couch.put("/#{db_name}/#{ddoc_id}", body: %{
+ indexes: %{
+ bar: %{
+ index: "function(doc) {}"
+ }
+ }
+ })
+ assert resp.status_code == 201
+ end
+
+ update_checkpoint_fn = fn ->
+ assert Couch.get("/#{db_name}/#{ddoc_id}/_search/bar?q=*:*").status_code == 200
+ end
+
+ checkpoint_test_helper(context[:db_name], create_checkpoint_fn, update_checkpoint_fn)
+ end
+
+ @tag :with_db
+ test "peer checkpoint - nouveau", context do
+ db_name = context[:db_name]
+ ddoc_id = "_design/foo"
+
+ create_checkpoint_fn = fn ->
+ resp = Couch.put("/#{db_name}/#{ddoc_id}", body: %{
+ nouveau: %{
+ bar: %{
+ index: "function(doc) {}"
+ }
+ }
+ })
+ assert resp.status_code == 201
+ end
+
+ update_checkpoint_fn = fn ->
+ # need to add a new document to force nouveau update to run each time
+ # as we only advance the peer checkpoint when JVM-side nouveau has committed
+ # the index
+ assert Couch.post("/#{db_name}", body: %{}).status_code == 201
+ assert Couch.get("/#{db_name}/#{ddoc_id}/_nouveau/bar?q=*:*").status_code == 200
+ end
+
+ checkpoint_test_helper(context[:db_name], create_checkpoint_fn, update_checkpoint_fn)
+ end
+
+ @tag :with_db
+ test "peer checkpoint - custom", context do
+ db_name = context[:db_name]
+ peer_checkpoint_id = "_local/peer-checkpoint-foo"
+
+ update_checkpoint_fn = fn ->
+ resp = Couch.get("/#{db_name}")
+ assert resp.status_code == 200
+ update_seq = resp.body["update_seq"]
+
+ resp = Couch.put("/#{db_name}/#{peer_checkpoint_id}", body: %{
+ update_seq: update_seq
+ })
+ assert resp.status_code == 201
+ end
- # create a document document
+ checkpoint_test_helper(context[:db_name], update_checkpoint_fn, update_checkpoint_fn)
+ end
+
+ defp checkpoint_test_helper(db_name, create_checkpoint_fn, update_checkpoint_fn) do
+ doc_id = "testdoc"
+
+ drop_seq = update_drop_seq(db_name)
+
+ # create something that will create a peer checkpoint
+ create_checkpoint_fn.()
+
+ # create a document
resp = Couch.put("/#{db_name}/#{doc_id}", body: %{})
assert resp.status_code == 201
rev = resp.body["rev"]
@@ -28,27 +112,13 @@ defmodule DropSeqTest do
resp = Couch.delete("/#{db_name}/#{doc_id}?rev=#{rev}")
assert resp.status_code == 200
- # update view and its peer checkpoint
- assert Couch.get("/#{db_name}/#{ddoc_id}/_view/bar").status_code == 200
-
- # update drop seq
- resp = Couch.post("/#{db_name}/_update_drop_seq")
- retry_until(
- fn ->
- resp = Couch.post("/#{db_name}/_update_drop_seq")
- assert resp.status_code == 201
- map_size(resp.body["results"]) == 1
- end,
- 200,
- 10_000
- )
+ # wait for drop seq to change
+ wait_for_drop_seq_change(db_name, drop_seq, update_checkpoint_fn)
# confirm deleted doc is still in _changes response
resp = Couch.get("/#{db_name}/_changes")
assert resp.status_code == 200
- assert length(resp.body["results"]) == 2
- assert Enum.at(resp.body["results"], 1)["id"] == doc_id
- assert Enum.at(resp.body["results"], 1)["deleted"]
+ assert Enum.member?(get_ids(resp), doc_id)
# compact
compact(db_name)
@@ -56,8 +126,30 @@ defmodule DropSeqTest do
# confirm deleted doc is not in _changes response
resp = Couch.get("/#{db_name}/_changes")
assert resp.status_code == 200
- assert length(resp.body["results"]) == 1 # just the ddoc left.
+ assert !Enum.member?(get_ids(resp), doc_id)
+ end
+
+ defp wait_for_drop_seq_change(db_name, previous_drop_seq, update_checkpoint_fn) do
+ retry_until(
+ fn ->
+ update_checkpoint_fn.()
+ new_drop_seq = update_drop_seq(db_name)
+ new_drop_seq != previous_drop_seq
+ end,
+ 200,
+ 10_000
+ )
+ end
+
+ defp update_drop_seq(db_name) do
+ resp = Couch.post("/#{db_name}/_update_drop_seq")
+ assert resp.status_code == 201
+ resp.body["results"]
+ end
+ defp get_ids(resp) do
+ %{:body => %{"results" => results}} = resp
+ Enum.map(results, fn result -> result["id"] end)
end
end