Page MenuHomePhabricator

Regression: lost the ability to --dump-db-postrun
Closed, ResolvedPublic

Description

There used to be code which help a reference open to the backend database. Parts of this are RAII so destruction makes it impossible to work further with the database.

Probably, this was broken by my refactors. Restore!

See @hashar comments on https://gerrit.wikimedia.org/r/#/c/integration/quibble/+/545309/ :

Broken since a663ad60cdffee3a19bee43c5b4a0bd0bd60f25a / https://gerrit.wikimedia.org/r/#/c/integration/quibble/+/513520/

That breaks notably --dump-db-postrun

INFO:quibble.cmd:<<< Finish: Run tests in mediawiki/core: , in 0.107 s
INFO:backend.MySQL:Dumping database to /home/hashar/workspace/log/mysqldump.sql
Exception ignored in: <function MySQL.__del__ at 0x7fd20f528598>
Traceback (most recent call last):
  File "/home/hashar/projects/integration/quibble/quibble/backend.py", line 294, in __del__
  File "/home/hashar/projects/integration/quibble/quibble/backend.py", line 137, in stop
  File "/home/hashar/projects/integration/quibble/quibble/backend.py", line 278, in dump
NameError: name 'open' is not defined

With python 3.7

Event Timeline

hashar added a subscriber: hashar.

Change 604380 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/quibble@master] Fix database dumping

https://gerrit.wikimedia.org/r/604380

hashar triaged this task as Medium priority.

Somehow now by the time MySQL.__del__ is invoked, the open built-in is already garbage collected. It seems weakref.finalize() is not affected and is the recommended way of handing it.

Change 604380 merged by jenkins-bot:
[integration/quibble@master] Fix database dumping

https://gerrit.wikimedia.org/r/604380

Pending next release of Quibble

hashar changed the task status from Open to Stalled.Aug 19 2020, 5:12 PM

Change 628138 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/quibble@master] Release Quibble 0.0.45

https://gerrit.wikimedia.org/r/628138

Change 628138 merged by jenkins-bot:
[integration/quibble@master] Release Quibble 0.0.45

https://gerrit.wikimedia.org/r/628138

And that has been released with 0.0.45.