Created
November 11, 2022 20:04
-
-
Save nickva/243caf230f7aa3b61f43bbde57063f72 to your computer and use it in GitHub Desktop.
couchdb smoosh doesn't trigger compaction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
URL=http://adm:pass@localhost:15984 | |
DB=${URL}/dbx | |
CFG=${URL}/_node/_local/_config | |
DOC=doc1 | |
TMPFILE=/tmp/couch_largehex | |
DOCSIZE=1000000 | |
http -q delete $DB | |
http -q put $DB q==1 n==1 | |
echo -n '"debug"' | http -q put ${CFG}/smoosh/compaction_log_level X-Couch-Persist:false | |
echo -n '"debug"' | http -q put ${CFG}/couchdb/compaction_log_level X-Couch-Persist:false | |
openssl rand -hex ${DOCSIZE} > ${TMPFILE} | |
REV=$(http put ${DB}/${DOC} data=@${TMPFILE} | jq -r '.rev') | |
rm ${TMPFILE} | |
echo | |
echo "Before delete": | |
http $DB | jq '.sizes' | |
http -q delete ${DB}/${DOC} rev==${REV} | |
echo | |
echo "After delete": | |
http $DB | jq '.sizes' | |
echo "Waiting or smoosh to notice..." | |
sleep 30 | |
echo "Trigger compaction..." | |
http -q post ${DB}/_compact a=b | |
sleep 2 | |
echo "After compaction" | |
http $DB | jq '.sizes' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment