You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2021/11/02 21:24:30 UTC

[couchdb-documentation] branch main updated: Provide safer command to delete sharding jobs

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

vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git


The following commit(s) were added to refs/heads/main by this push:
     new 0ec943d  Provide safer command to delete sharding jobs
0ec943d is described below

commit 0ec943df8406b7f26e063a596dc2866e91f6009a
Author: Rob Thomas <rt...@clearlyip.com>
AuthorDate: Wed Nov 3 06:58:21 2021 +1000

    Provide safer command to delete sharding jobs
    
    This ensures that people who are blindly copy-pasting commands
    don't accidentally delete running reshard jobs.
    
    Signed-off-by: Rob Thomas <xr...@linux.com>
---
 src/cluster/sharding.rst | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/cluster/sharding.rst b/src/cluster/sharding.rst
index a3075dc..01408d4 100644
--- a/src/cluster/sharding.rst
+++ b/src/cluster/sharding.rst
@@ -717,13 +717,12 @@ good idea to remove already completed jobs. See :ref:`reshard configuration
 section <config/reshard>` for the default value of ``max_jobs`` parameter and
 how to adjust if needed.
 
-For example, if the jobs have completed, to remove all the jobs run:
+For example, to remove all the completed jobs run:
 
 .. code-block:: bash
 
-    $ curl -s $COUCH_URL:5984/_reshard/jobs | jq -r '.jobs[].id' |\
-      while read -r jobid; do\
-          curl -s -XDELETE $COUCH_URL:5984/_reshard/jobs/$jobid\
+    $ for jobid in $(curl -s $COUCH_URL:5984/_reshard/jobs | jq -r '.jobs[] | select (.job_state=="completed") | .id'); do \
+          curl -s -XDELETE $COUCH_URL:5984/_reshard/jobs/$jobid \
       done
 
 Then it's a good idea to see what the db shard map looks like.