Skip to content

Commit

Permalink
Always load pre_upd blobs for triggers.
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Ponomarenko <mponomarenko@bloomberg.net>
  • Loading branch information
mponomar committed Oct 26, 2023
1 parent fb38a3f commit 4025179
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions db/comdb2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3653,6 +3653,7 @@ extern int gbl_throttle_txn_chunks_msec;
extern int gbl_sql_release_locks_on_slow_reader;
extern int gbl_fail_client_write_lock;
extern int gbl_server_admin_mode;
extern int gbl_always_load_preupd_blobs;

void csc2_free_all(void);

Expand Down
4 changes: 4 additions & 0 deletions db/db_tunables.h
Original file line number Diff line number Diff line change
Expand Up @@ -2468,4 +2468,8 @@ REGISTER_TUNABLE("noleader_retry_poll_ms",
NULL, NULL, NULL);
REGISTER_TUNABLE("cdb2api_policy_override", "Use this policy override with cdb2api. (Default: none)",
TUNABLE_STRING, &gbl_cdb2api_policy_override, 0, NULL, NULL, NULL, NULL);

REGISTER_TUNABLE("always_load_preupd_blobs", "For update triggers, always load pre-update blob values. (Default: on)",
TUNABLE_BOOLEAN, &gbl_always_load_preupd_blobs, 0, NULL, NULL, NULL, NULL);

#endif /* _DB_TUNABLES_H */
6 changes: 4 additions & 2 deletions db/record.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void free_cached_idx(uint8_t * *cached_idx);
int gbl_max_wr_rows_per_txn = 0;
int gbl_max_cascaded_rows_per_txn = 0;
uint32_t gbl_max_time_per_txn_ms = 0;
int gbl_always_load_preupd_blobs = 1;

static inline int is_event_from_sc(int flags)
{
Expand Down Expand Up @@ -1111,8 +1112,9 @@ int upd_record(struct ireq *iq, void *trans, void *primkey, int rrn,
* If required, remember the old blobs ready for the update trigger.
* Handle deadlock correctly.
*/
if (!(flags & RECFLAGS_NO_TRIGGERS) &&
javasp_trans_care_about(iq->jsph, JAVASP_TRANS_LISTEN_SAVE_BLOBS_UPD)) {
if (!(flags & RECFLAGS_NO_TRIGGERS) && (gbl_always_load_preupd_blobs || javasp_trans_care_about(iq->jsph, JAVASP_TRANS_LISTEN_SAVE_BLOBS_UPD))) {
// translistener.c always packs pre, even if the config didn't request it.
// Always load old blobs.
rc = save_old_blobs(iq, trans, ".ONDISK", old_dta, rrn, vgenid,
&oldblobs);
if (rc != 0) {
Expand Down
1 change: 1 addition & 0 deletions tests/tunables.test/t00_all_tunables.expected
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
(name='allow_user_schema', description='Enable to allow per-user schemas. (Default: off)', type='BOOLEAN', value='OFF', read_only='Y')
(name='already_aborted_trace', description='Print trace when dd_abort skips an 'already-aborted' locker', type='BOOLEAN', value='OFF', read_only='N')
(name='alternate_verify_fail', description='alternate_verify_fail', type='BOOLEAN', value='OFF', read_only='N')
(name='always_load_preupd_blobs.', description='For update triggers, always load pre-update blob values. (Default: on)', type='BOOLEAN', value='ON', read_only='N')
(name='always_send_cnonce', description='Always send cnonce to master. (Default: on)', type='BOOLEAN', value='ON', read_only='N')
(name='analyze_comp_threads', description='Number of thread to use when generating samples for computing index statistics. (Default: 10)', type='INTEGER', value='10', read_only='Y')
(name='analyze_comp_threshold', description='Index file size above which we'll do sampling, rather than scan the entire index. (Default: 104857600)', type='INTEGER', value='104857600', read_only='Y')
Expand Down

0 comments on commit 4025179

Please sign in to comment.