stability: locate the error in cockroach's log
QUESTION
I run benchmark test with sysbench, my sysbench command is
./sysbench --test=./lua/update_index.lua --db-driver=pgsql \
--pgsql-host=10.46.11.138 \
--pgsql-port=16660 \
--pgsql-user=root \
--pgsql-password= \
--pgsql-db=sbtest \
--oltp-tables-count=1 \
--oltp-table-size=10000000 \
--oltp-auto-inc=off \
--max-time=1800 \
--rand-type=uniform \
--report-interval=5 \
--max-requests=0 \
--oltp-dist-type=uniform \
--num-threads=500 run > pg_oltp.txt
when I set --num-threads more than 500, I will meet a error like
ALERT: failed to execute PgSQL query: `UPDATE sbtest SET k=k+1 WHERE id=3829220`:
ALERT: error: ERROR: result is ambiguous (error=retry txn "sql txn implicit" id=49e4a8d3 key=/Table/51/1/3829220/0 rw=true pri=0.03852923 iso=SERIALIZABLE stat=PENDING epo=0 ts=1488946455.696641751,67 orig=1488946455.696641751,65 max=1488946455.698423952,16 wto=false rop=false, pending RPCs=1)
FATAL: failed to execute function `event': (null)
And then the client will cut down the connection.
when I start cockroach cluster, I have set vmodule=replica=4,raft=3,dist_sender=4, but I didn't find any error info about transaction id 49e4a8d3 in cockroach's logs.
any way to loacte this error info?
@tamird Can you do preliminary investigation? I realize the ambiguous result points to Spencer, but he's slammed this week.
@a6802739 what's the configuration of your cluster? how many nodes, where are they running, what versions are they running?
As the issue template requests:
Please supply the header (i.e. the first few lines) of your most recent log file for each node in your cluster. On most unix-based systems running with defaults, this boils down to the output of
grep -F '[config]' cockroach-data/logs/cockroach.INFO
When log files are not available, supply the output of cockroach version and all flags/environment variables passed to cockroach start instead.
This isn't a bug, though it's very confusing and there's no good way to both be pedantic to suit Jepsen testing, but also make things easy for client apps.
@a6802739, the "result is ambiguous" error is a consequence of CockroachDB being unsure of whether a transaction actually succeeded. We don't automatically retry because this could have unexpected, or incorrect consequences. You might end up incrementing the value twice in this case. The reason this can happen is that the original request is sent to what the gateway thinks is the leader replica, but that RPC response might get stuck behind a network partition or simply be subject to very high latency. In the meantime, another replica is elected as leader and the request is redirected and fails with a retry error. Because that original RPC is still pending, we must acknowledge to the client that we don't know if it might have succeeded. Thus, the ambiguous result error.
There was a fix that went in bf20588187ec291aa029e14b372295c46780b18b to make these less likely. @a6802739: does your CockroachDB binary include that commit?
@spencerkimball my CockroachDB binary is beta-2017030223.
About this logic, In the meantime, another replica is elected as leader and the request is redirected and fails with a retry error, I could understand the request will be redirected, but I couldn't understand when the request will retry and how to detect the retry error of this request?
@tamird, cockroach node start parameter is just like:
stores=path=/home/ssd1/CockroachDB/newdb,attrs=ssd path=/home/ssd2/CockroachDB/newdb,attrs=ssd path=/home/ssd3/CockroachDB/newdb,attrs=ssd path=/home/ssd4/CockroachDB/newdb,attrs=ssd path=/home/ssd5/CockroachDB/newdb,attrs=ssd
cache-size=64G
peer-nodes=10.46.121.57:16660,10.46.121.37:16660,10.46.122.15:16660
vmodule=replica=4,raft=3,dist_sender=4
the overall cluster nodes is 8.
@a6802739 apologies for the delay in responding to this.
The commit @spencerkimball mentions is not included in your beta, it was first present in beta-20170309. Could you upgrade to that version and try again?
Separately, assigning @spencerkimball to follow this thread further.
@tamird, we didn't see this error in the newer version.Thanks a lot.
Great! Thanks for testing.