Skip to content

Commit 6965c28

Browse files
committed
Do not expose internal error codes to client
Signed-off-by: Morgan Douglas <[email protected]> Extend Signed-off-by: Morgan Douglas <[email protected]>
1 parent 63b94af commit 6965c28

File tree

13 files changed

+18
-18
lines changed

13 files changed

+18
-18
lines changed

Diff for: db/osqlcomm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -7547,8 +7547,8 @@ int osql_process_packet(struct ireq *iq, uuid_t uuid, void *trans, char **pmsg,
75477547

75487548
if (rc != 0) {
75497549
if (rc != RC_INTERNAL_RETRY) {
7550-
errstat_cat_strf(&iq->errstat,
7551-
" unable to update record rc = %d", rc);
7550+
errstat_cat_strf(&iq->errstat," unable to update record");
7551+
logmsg(LOGMSG_ERROR, "Failed to update record. Internal error code is %d\n", rc);
75527552
}
75537553
if (gbl_enable_osql_logging)
75547554
logmsg(LOGMSG_DEBUG,

Diff for: db/sqlglue.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5243,7 +5243,7 @@ int sqlite3BtreeCommit(Btree *pBt)
52435243
if (clnt->early_retry == EARLY_ERR_VERIFY) {
52445244
clnt->osql.xerr.errval = ERR_BLOCK_FAILED + ERR_VERIFY;
52455245
errstat_cat_str(&(clnt->osql.xerr),
5246-
"unable to update record rc = 4");
5246+
"unable to update record");
52475247
} else if (clnt->early_retry == EARLY_ERR_SELECTV) {
52485248
clnt->osql.xerr.errval = ERR_CONSTR;
52495249
errstat_cat_str(&(clnt->osql.xerr),

Diff for: db/sqlinterfaces.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ static int do_commitrollback(struct sqlthdstate *thd, struct sqlclntstate *clnt,
21822182
if (clnt->early_retry == EARLY_ERR_VERIFY) {
21832183
clnt->osql.xerr.errval = ERR_BLOCK_FAILED + ERR_VERIFY;
21842184
errstat_cat_str(&(clnt->osql.xerr),
2185-
"unable to update record rc = 4");
2185+
"unable to update record");
21862186
} else if (clnt->early_retry == EARLY_ERR_SELECTV) {
21872187
clnt->osql.xerr.errval = ERR_CONSTR;
21882188
errstat_cat_str(&(clnt->osql.xerr),

Diff for: db/sqloffload.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int rese_commit(struct sqlclntstate *clnt, struct sql_thread *thd,
248248
} else {
249249
clnt->osql.xerr.errval = ERR_BLOCK_FAILED + ERR_VERIFY;
250250
errstat_cat_str(&(clnt->osql.xerr),
251-
"unable to update record rc = 4");
251+
"unable to update record");
252252
}
253253
rc = SQLITE_ABORT;
254254
} else if (clnt->early_retry == EARLY_ERR_SELECTV) {

Diff for: tests/ddl_no_csc2.test/t09_check.expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ constraints
4444
[CREATE TABLE t1(i INT, CHECK (i > (SELECT MAX(i))))] failed with rc 240 malformed database schema (t1) - subqueries prohibited in CHECK constraints
4545
(test='4. Test for updates')
4646
(rows inserted=1)
47-
[UPDATE t1 SET i = 10 WHERE i = 1] failed with rc 403 CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_3DCCE6D2' unable to update record rc = 320
47+
[UPDATE t1 SET i = 10 WHERE i = 1] failed with rc 403 CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_3DCCE6D2' unable to update record
4848
(i=1)
4949
(test='5. Test for some obscure expressions')
5050
[INSERT INTO t1 VALUES(1)] failed with rc 403 CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_50FF6780' unable to add record rc = 320

Diff for: tests/dupewrite.test/t02.req.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[EXEC PROCEDURE test_dupe_insert_3()] failed with rc -3 [n = q:fetch()...]:7: statement must be read-only
1515
[EXEC PROCEDURE test_dupe_update_2()] failed with rc -3 [db:exec(sql):emit()...]:3: statement must be read-only
1616
[EXEC PROCEDURE test_dupe_update_3()] failed with rc -3 [n = q:fetch()...]:7: statement must be read-only
17-
[EXEC PROCEDURE test_dupe_update_4()] failed with rc -8 find old record failed unable to update record rc = 4
17+
[EXEC PROCEDURE test_dupe_update_4()] failed with rc -8 find old record failed unable to update record
1818
[EXEC PROCEDURE test_dupe_delete_2()] failed with rc -3 [db:exec(sql):emit()...]:3: statement must be read-only
1919
[EXEC PROCEDURE test_dupe_delete_3()] failed with rc -3 [n = q:fetch()...]:7: statement must be read-only
2020
[EXEC PROCEDURE test_dupe_delete_4()] failed with rc -8 Table 'dupe4' find old record failed unable to delete genid =XXXXXX rc=4

Diff for: tests/sc_addfield.test/runit

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ do_verify t1
100100

101101
function do_alter_and_update (){
102102
#updates fail (deadlock?):
103-
#[update t1 set c=c+10000 where 1] failed with rc 304 unable to update record rc = 199
103+
#[update t1 set c=c+10000 where 1] failed with rc 304 unable to update record
104104
cdb2sql ${CDB2_OPTIONS} $dbnm default "alter table t1 { `cat t1_1.csc2 ` }"
105105
assertcnt t1 3000
106106
do_verify t1

Diff for: tests/serialstep.test/s14_01.req.exp.alt2

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ done
55
done
66
(rows updated=1)
77
done
8-
[commit] failed with rc 2 find old record failed unable to update record rc = 4
8+
[commit] failed with rc 2 find old record failed unable to update record
99
done

Diff for: tests/serialstep.test/s2_01.req.exp.alt2

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ done
3535
(id=99, name='ytu', age=8, address=NULL, state='DB', zip=NULL)
3636
done
3737
done
38-
[commit] failed with rc 2 find old record failed unable to update record rc = 4
38+
[commit] failed with rc 2 find old record failed unable to update record
3939
done
4040
done
4141
done

Diff for: tests/tools/linearizable/jepsen/src/comdb2/core.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
"Given an error string, identifies whether the error is safely retriable."
187187
[e]
188188
(or (re-find #"not serializable" e)
189-
(re-find #"unable to update record rc = 4" e)
189+
(re-find #"unable to update record" e)
190190
(re-find #"selectv constraints" e)
191191
(re-find #"Maximum number of retries done." e)))
192192

Diff for: tests/upsert.test/t00_upsert.expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
[INSERT INTO t1 VALUES(11)] failed with rc 299 add key constraint duplicate key '$KEY_877B2989' on table 't1' index 0
134134
(rows inserted=1)
135135
(i=11)
136-
[INSERT INTO t1 VALUES(11) ON CONFLICT(i) DO UPDATE SET i = 1] failed with rc 403 CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_A91B9811' unable to update record rc = 320
136+
[INSERT INTO t1 VALUES(11) ON CONFLICT(i) DO UPDATE SET i = 1] failed with rc 403 CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_A91B9811' unable to update record
137137
(i=11)
138138
(rows inserted=0)
139139
(i=12)

Diff for: tests/verify_error.test/t2_01.req.exp

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ done
3030
1 [truncate test2]
3131
done
3232
1 [commit]
33-
[commit] failed with rc 2 find old record failed unable to update record rc = 4
33+
[commit] failed with rc 2 find old record failed unable to update record
3434
done
3535
1 [select * from test1]
3636
(i=1, j=4)
@@ -51,7 +51,7 @@ done
5151
(rows updated=1)
5252
done
5353
1 [commit]
54-
[commit] failed with rc 2 find old record failed unable to update record rc = 4
54+
[commit] failed with rc 2 find old record failed unable to update record
5555
done
5656
1 [select * from test1]
5757
(i=1, j=4)

Diff for: tests/yast.test/check.test

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ do_test check-1.12 {
8585
catchsql {
8686
UPDATE t1 SET x=7 WHERE x==2
8787
}
88-
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_3BE1A9E5' unable to update record rc = 320}}
88+
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_3BE1A9E5' unable to update record}}
8989
do_test check-1.13 {
9090
execsql {
9191
SELECT * FROM t1;
@@ -95,7 +95,7 @@ do_test check-1.14 {
9595
catchsql {
9696
UPDATE t1 SET x=5 WHERE x==2
9797
}
98-
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_3BE1A9E5' unable to update record rc = 320}}
98+
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_3BE1A9E5' unable to update record}}
9999
do_test check-1.15 {
100100
execsql {
101101
SELECT * FROM t1;
@@ -271,7 +271,7 @@ do_test check-4.6 {
271271
catchsql {
272272
UPDATE t4 SET x=0, y=1;
273273
}
274-
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_4026B7C3' unable to update record rc = 320}}
274+
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_4026B7C3' unable to update record}}
275275
do_test check-4.7 {
276276
execsql {
277277
SELECT * FROM t4;
@@ -294,7 +294,7 @@ do_test check-4.9 {
294294
catchsql {
295295
UPDATE t4 SET x=0, y=2;
296296
}
297-
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_4026B7C3' unable to update record rc = 320}}
297+
} {1 {CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_4026B7C3' unable to update record}}
298298
ifcapable vacuum {
299299
do_test check_4.10 {
300300
catchsql {

0 commit comments

Comments
 (0)