| 214 | int gbl_serialize_reads_like_writes = 0; |
| 215 | |
| 216 | static int rese_commit(struct sqlclntstate *clnt, struct sql_thread *thd, |
| 217 | char *tzname, int osqlreq_type, int is_distrib_tran) |
| 218 | { |
| 219 | |
| 220 | int sentops = 0; |
| 221 | int bdberr = 0; |
| 222 | int rc = 0; |
| 223 | int usedb_only = 0; |
| 224 | int force_master = gbl_serialize_reads_like_writes; |
| 225 | |
| 226 | if (gbl_early_verify && !clnt->early_retry && gbl_osql_send_startgen && |
| 227 | clnt->start_gen) { |
| 228 | if (clnt->start_gen != bdb_get_rep_gen(thedb->bdb_env)) |
| 229 | clnt->early_retry = EARLY_ERR_GENCHANGE; |
| 230 | } |
| 231 | if (clnt->selectv_arr) |
| 232 | currangearr_build_hash(clnt->selectv_arr); |
| 233 | if (clnt->selectv_arr && |
| 234 | bdb_osql_serial_check(thedb->bdb_env, clnt->selectv_arr, |
| 235 | &(clnt->selectv_arr->file), |
| 236 | &(clnt->selectv_arr->offset), 0)) { |
| 237 | clnt->osql.xerr.errval = ERR_CONSTR; |
| 238 | errstat_cat_str(&(clnt->osql.xerr), "selectv constraints"); |
| 239 | rc = SQLITE_ABORT; |
| 240 | } else if (clnt->early_retry == EARLY_ERR_VERIFY) { |
| 241 | if (clnt->dbtran.mode == TRANLEVEL_SERIAL) { |
| 242 | clnt->osql.xerr.errval = ERR_NOTSERIAL; |
| 243 | errstat_cat_str(&(clnt->osql.xerr), |
| 244 | "transaction is not serializable"); |
| 245 | } else { |
| 246 | clnt->osql.xerr.errval = ERR_BLOCK_FAILED + ERR_VERIFY; |
| 247 | errstat_cat_str(&(clnt->osql.xerr), |
| 248 | "unable to update record rc = 4"); |
| 249 | } |
| 250 | rc = SQLITE_ABORT; |
| 251 | } else if (clnt->early_retry == EARLY_ERR_SELECTV) { |
| 252 | clnt->osql.xerr.errval = ERR_CONSTR; |
| 253 | errstat_cat_str(&(clnt->osql.xerr), "constraints error, no genid"); |
| 254 | rc = SQLITE_ABORT; |
| 255 | } else if (clnt->early_retry == EARLY_ERR_GENCHANGE) { |
| 256 | clnt->osql.xerr.errval = ERR_BLOCK_FAILED + ERR_VERIFY; |
| 257 | errstat_cat_str(&(clnt->osql.xerr), "verify error on master swing"); |
| 258 | rc = SQLITE_ABORT; |
| 259 | } |
| 260 | if (rc) { |
| 261 | clnt->early_retry = 0; |
| 262 | rc = SQLITE_ABORT; |
| 263 | goto goback; |
| 264 | } |
| 265 | |
| 266 | /* optimization (will catch all transactions with no internal updates */ |
| 267 | if (!force_master && osql_shadtbl_empty(clnt)) { |
| 268 | sql_debug_logf(clnt, __func__, __LINE__, "empty-shadtbl, returning\n"); |
| 269 | return 0; |
| 270 | } |
| 271 | |
| 272 | usedb_only = osql_shadtbl_usedb_only(clnt); |
| 273 |
no test coverage detected