Skip to content

Commit f312804

Browse files
committed
{183109183} Fix durable chunk issue
Signed-off-by: Salil Chandra <schandra107@bloomberg.net>
1 parent 036f22c commit f312804

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

db/toblock.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,9 @@ static int do_replay_case(struct ireq *iq, void *fstseqnum, int seqlen,
12181218
* This can incorrectly report NOT_DURABLE but that's sane given that half
12191219
* the cluster is incoherent */
12201220
int is_final = iq->sorese ? iq->sorese->is_final : 0;
1221-
int non_durable_retry = gbl_replicant_retry_on_not_durable && (!is_final || !gbl_ignore_final_non_durable_retry);
1221+
int can_replicant_retry = IQ_HAS_SNAPINFO(iq) && IQ_SNAPINFO(iq)->replicant_is_able_to_retry;
1222+
int non_durable_retry =
1223+
gbl_replicant_retry_on_not_durable && can_replicant_retry && (!is_final || !gbl_ignore_final_non_durable_retry);
12221224
int force_non_durable = non_durable_retry && gbl_debug_force_non_durable;
12231225

12241226
if ((bdb_attr_get(thedb->bdb_attr, BDB_ATTR_DURABLE_LSNS) || non_durable_retry) &&
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Verify non-durable requests behavior against hide_non_durable_rcode
1+
Verify non-durable requests behavior against hide_non_durable_rcode.
2+
Also verifies chunk transactions do not fail with in-transaction disconnect
3+
when non-durable replay forcing is enabled.

tests/final_non_durable_retry.test/runit

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,38 @@ function hide_non_durable_constraint_violation
121121
$CDB2SQL_EXE $CDB2_OPTIONS $DBNAME default "delete from t1 where 1" >/dev/null 2>&1
122122
}
123123

124+
function show_non_durable_chunk_does_not_disconnect
125+
{
126+
hide_non_durable_rcode 0
127+
force_all_non_durable 1
128+
129+
x=$({
130+
echo "set transaction chunk 1"
131+
echo "begin"
132+
for i in $(seq 2001 2050); do
133+
echo "insert into t1 values ($i)"
134+
done
135+
echo "commit"
136+
} | $CDB2SQL_EXE $CDB2_OPTIONS $DBNAME default 2>&1)
137+
138+
echo "$x"
139+
[[ "$x" == *"Database disconnected while in transaction"* ]] && \
140+
failexit "chunk transaction should not disconnect in-transaction"
141+
[[ "$x" != *"[commit] rc 0"* ]] && \
142+
failexit "chunk transaction should finish commit successfully"
143+
144+
hide_non_durable_rcode 0
145+
force_all_non_durable 0
146+
$CDB2SQL_EXE $CDB2_OPTIONS $DBNAME default "delete from t1 where a between 2001 and 2050" >/dev/null 2>&1
147+
}
148+
124149
function run_test
125150
{
126151
hide_non_durable_good_insert
127152
show_non_durable_good_insert
128153
hide_non_durable_constraint_violation
129154
show_non_durable_constraint_violation
155+
show_non_durable_chunk_does_not_disconnect
130156
}
131157

132158
create_table

0 commit comments

Comments
 (0)