Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/310591
Change subject: Make DB snapshot commit errors include active methods
......................................................................
Make DB snapshot commit errors include active methods
Change-Id: I59e501528b104e797b36103fa18792f539d92a14
---
M includes/db/Database.php
1 file changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/91/310591/1
diff --git a/includes/db/Database.php b/includes/db/Database.php
index 109dbfe..72f5e2a 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -633,6 +633,25 @@
return $this->mTrxLevel ? $this->mTrxWriteCallers : [];
}
+ protected function pendingWriteAndCallbackCallers() {
+ if ( !$this->mTrxLevel ) {
+ return [];
+ }
+
+ $fnames = $this->mTrxWriteCallers;
+ foreach ( [
+ $this->mTrxIdleCallbacks,
+ $this->mTrxPreCommitCallbacks,
+ $this->mTrxEndCallbacks
+ ] as $callbacks ) {
+ foreach ( $callbacks as $callback ) {
+ $fnames[] = $callback[1];
+ }
+ }
+
+ return $fnames;
+ }
+
public function isOpen() {
return $this->mOpened;
}
@@ -3101,9 +3120,10 @@
public function flushSnapshot( $fname = __METHOD__ ) {
if ( $this->writesOrCallbacksPending() ||
$this->explicitTrxActive() ) {
// This only flushes transactions to clear snapshots,
not to write data
+ $fnames = $this->pendingWriteAndCallbackCallers();
throw new DBUnexpectedError(
$this,
- "$fname: Cannot COMMIT to clear snapshot
because writes are pending."
+ "$fname: Cannot COMMIT to clear snapshot
because writes are pending ($fnames)."
);
}
@@ -3590,9 +3610,10 @@
public function getScopedLockAndFlush( $lockKey, $fname, $timeout ) {
if ( $this->writesOrCallbacksPending() ) {
// This only flushes transactions to clear snapshots,
not to write data
+ $fnames = $this->pendingWriteAndCallbackCallers();
throw new DBUnexpectedError(
$this,
- "$fname: Cannot COMMIT to clear snapshot
because writes are pending."
+ "$fname: Cannot COMMIT to clear snapshot
because writes are pending ($fnames)."
);
}
--
To view, visit https://gerrit.wikimedia.org/r/310591
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59e501528b104e797b36103fa18792f539d92a14
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits