Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions mysql-test/suite/innodb/r/purge_pessimistic.result
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,21 @@ col1
DROP TABLE t2;
SET @@GLOBAL.debug_dbug = @old_debug_dbug;
SET DEBUG_SYNC='RESET';
#
# MDEV-39706 Assertion `!thd || !coordinator_thd' failed
#
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect con1,localhost,root,,;
UPDATE t1 set f1= f1 + 1;
DELETE FROM t1;
connection default;
disconnect con1;
COMMIT;
SET @old_view_update= @@global.innodb_trx_purge_view_update_only_debug;
SET @@GLOBAL.innodb_trx_purge_view_update_only_debug=1;
SET STATEMENT max_statement_time=0.1 FOR SET GLOBAL innodb_max_purge_lag_wait=1;
SET @@GLOBAL.innodb_trx_purge_view_update_only_debug=@old_view_update;
InnoDB 0 transactions not purged
DROP TABLE t1;
21 changes: 21 additions & 0 deletions mysql-test/suite/innodb/t/purge_pessimistic.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,24 @@ DROP TABLE t2;

SET @@GLOBAL.debug_dbug = @old_debug_dbug;
SET DEBUG_SYNC='RESET';

--echo #
--echo # MDEV-39706 Assertion `!thd || !coordinator_thd' failed
--echo #
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
START TRANSACTION WITH CONSISTENT SNAPSHOT;

connect(con1,localhost,root,,);
UPDATE t1 set f1= f1 + 1;
DELETE FROM t1;

connection default;
disconnect con1;
COMMIT;
SET @old_view_update= @@global.innodb_trx_purge_view_update_only_debug;
SET @@GLOBAL.innodb_trx_purge_view_update_only_debug=1;
SET STATEMENT max_statement_time=0.1 FOR SET GLOBAL innodb_max_purge_lag_wait=1;
SET @@GLOBAL.innodb_trx_purge_view_update_only_debug=@old_view_update;
--source include/wait_all_purged.inc
DROP TABLE t1;
8 changes: 8 additions & 0 deletions storage/innobase/include/trx0purge.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,14 @@ class purge_sys_t

/** Reset the state of a purge_worker_task at the end of a batch */
inline void reset_worker_thd(THD *thd) const noexcept;

#ifdef UNIV_DEBUG
int reset_coordinator() noexcept
{
coordinator_thd= nullptr;
return 0;
}
#endif /* UNIV_DEBUG */
Comment on lines +510 to +516

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and adherence to standard C++ style conventions (such as the Google C++ Style Guide), binary operators like the assignment operator = should have spaces on both sides.

#ifdef UNIV_DEBUG
  void set_coordinator_thd(THD *thd) noexcept
  {
    coordinator_thd = thd;
  }
#endif /* UNIV_DEBUG */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, this rather reasonable piece of advice conflicts with our CODING_STANDARDS.md.

Comment thread
Thirunarayanan marked this conversation as resolved.
};

/** The global data structure coordinating a purge */
Expand Down
5 changes: 4 additions & 1 deletion storage/innobase/trx/trx0purge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,10 @@ TRANSACTIONAL_TARGET ulint trx_purge(ulint n_tasks, ulint history_size)

purge_sys.clone_oldest_view(thd);

ut_d(if (srv_purge_view_update_only_debug) return 0);
#ifdef UNIV_DEBUG
if (srv_purge_view_update_only_debug)
return purge_sys.reset_coordinator();
#endif /* UNIV_DEBUG */

/* Fetch the UNDO recs that need to be purged. */
ulint n_work= 0;
Expand Down