Page MenuHomePhabricator

Discrepancy between 'bin/storage databases' and 'bin/storage destroy'
Closed, InvalidPublic

Description

Originally filed on GitHub/phacility/phabricator/#795

Running:

  • phacility/arcanist@1a3afa4
  • phacility/libphutil@cab51ef
  • phacility/phabricator@c3913f5
  • MariaDB 5.5.40
  • PHP 5.4.16

Executing bin/storage databases doesn't list the DB phabricator_timeline, but when running bin/storage destroy it tries to DROP this DB and then fails like this:

Dropping database 'phabricator_slowvote'...
Dropping database 'phabricator_timeline'...
[2015-01-26 19:12:19] EXCEPTION: (AphrontAccessDeniedQueryException) #1044: Access denied for user 'phabricator_base'@'localhost' to database 'phabricator_timeline' at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:301]
  #0 AphrontBaseMySQLDatabaseConnection::throwQueryCodeException(integer, string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:275]
  #1 AphrontBaseMySQLDatabaseConnection::throwQueryException(mysqli) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:181]
  #2 AphrontBaseMySQLDatabaseConnection::executeRawQuery(string) called at [<phutil>/src/xsprintf/queryfx.php:6]
  #3 queryfx(AphrontMySQLiDatabaseConnection, string, string) called at [<phabricator>/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDestroyWorkflow.php:70]
  #4 PhabricatorStorageManagementDestroyWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:396]
  #5 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:292]
  #6 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/sql/manage_storage.php:171]

Event Timeline

eliaspro raised the priority of this task from to Needs Triage.
eliaspro updated the task description. (Show Details)
eliaspro added a project: Database.
eliaspro added a subscriber: eliaspro.
epriestley claimed this task.
epriestley added a subscriber: epriestley.

bin/storage databases does not list phabricator_timeline because it is no longer an active database. It was removed by D5744.

bin/storage destroy attempts to destroy all databases in the phabricator_ namespace (or other configured namespace), including databases which we no longer access but which might still exist for some reason.

Specifically, bin/storage databases lists active databases while bin/storage destroy destroys all databases beginning with phabricator_, so this behavior is expected.

If you upgraded normally, this database should have been destroyed about 18 months ago, in July 2013. I'm not sure why it wasn't; there may be some kind of user or permission problem. We haven't seen other users reporting this issue, so I suspect it's specific to your environment.

To work around this issue, you can manually drop this database as a privileged user.

This happens on a completely fresh install.
All I did was:

  • Manually create all DBs listed by bin/storage databases
  • Run bin/storage upgrade to make sure all DBs/tables are populated
  • Run bin/storage destroy with the effect described in the initial report

Forgot to re-open with my previous comment.

Is it possible you created all the DBs listed in bin/storage databases of an old version of Phabricator?

If it's not listed in bin/storage databases, and you created all of the databases manually from that list, what's your theory on how it came to exist?

I can not reproduce this. A fresh install does not list phabricator_timeline in storage databases, and does not try to drop phabricator_timeline in storage destroy.

We can't reproduce this.

With a fresh install on Ubuntu 15.04 I am able to reproduce this. When I ran ./bin/storage upgrade it gave me that error.