Page MenuHomePhabricator

Upgrade fails due to unexpected column `isLocked`
Closed, ResolvedPublic

Description

Trying to upgrade from rPb154b07f0e9e1cc8 to rP5b31a17c96e02b2655702 fails with:

$ ./bin/storage upgrade
Before running storage upgrades, you should take down the Phabricator web
interface and stop any running Phabricator daemons (you can disable this
warning with --force).

    Are you ready to continue? [y/N] y

Applying patch 'phabricator:20131121.repocredentials.2.mig.php'...
Examining repository PT...
...no credentials set.
Examining repository PUP...
...will migrate.
Examining repository BCI...
...will migrate.
Examining repository IOS...
...will migrate.
Creating: Migrated Repository Credential (PUP)...
[2014-05-13 11:42:42] EXCEPTION: (AphrontQuerySchemaException) #1054: Unknown column 'isLocked' in 'field list' at [/opt/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:308]
  #0 AphrontMySQLDatabaseConnectionBase::throwQueryCodeException(1054, Unknown column 'isLocked' in 'field list') called at [/opt/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:278]
  #1 AphrontMySQLDatabaseConnectionBase::throwQueryException(Object mysqli) called at [/opt/libphutil/src/aphront/storage/connection/mysql/AphrontMySQLDatabaseConnectionBase.php:184]
  #2 AphrontMySQLDatabaseConnectionBase::executeRawQuery(INSERT INTO `passphrase_credential` (`name`, `credentialType`, `providesType`, `viewPolicy`, `editPolicy`, `description`, `username`, `secretID`, `isDestroyed`, `isLocked`, `phid`, `dateCreated`, `dateModified`) VALUES ('Migrated Repository Credential (PUP)', 'ssh-key-file', 'provides/ssh-key-file', 'admin', 'admin', '', 'git', '3', '0', '0', 'PHID-CDTL-jos5ypvqjhczro6n5yni', '1399974162', '1399974162')) called at [/opt/libphutil/src/xsprintf/queryfx.php:9]
  #3 queryfx(Object AphrontMySQLiDatabaseConnection, %Q INTO %T (%LC) VALUES (%Q), INSERT, passphrase_credential, Array of size 13 starting with: { 0 => name }, 'Migrated Repository Credential (PUP)', 'ssh-key-file', 'provides/ssh-key-file', 'admin', 'admin', '', 'git', '3', '0', '0', 'PHID-CDTL-jos5ypvqjhczro6n5yni', '1399974162', '1399974162')
  #4 call_user_func_array(queryfx, Array of size 6 starting with: { 0 => Object AphrontMySQLiDatabaseConnection }) called at [/opt/libphutil/src/aphront/storage/connection/AphrontDatabaseConnection.php:28]
  #5 AphrontDatabaseConnection::query(%Q INTO %T (%LC) VALUES (%Q), INSERT, passphrase_credential, Array of size 13 starting with: { 0 => name }, 'Migrated Repository Credential (PUP)', 'ssh-key-file', 'provides/ssh-key-file', 'admin', 'admin', '', 'git', '3', '0', '0', 'PHID-CDTL-jos5ypvqjhczro6n5yni', '1399974162', '1399974162') called at [/opt/phabricator/src/infrastructure/storage/lisk/LiskDAO.php:1282]
  #6 LiskDAO::insertRecordIntoDatabase(INSERT) called at [/opt/phabricator/src/infrastructure/storage/lisk/LiskDAO.php:1129]
  #7 LiskDAO::insert() called at [/opt/phabricator/src/infrastructure/storage/lisk/LiskDAO.php:1098]
  #8 LiskDAO::save() called at [/opt/phabricator/resources/sql/patches/20131121.repocredentials.2.mig.php:90]
  #9 require_once(/opt/phabricator/resources/sql/patches/20131121.repocredentials.2.mig.php) called at [/opt/phabricator/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:196]
  #10 PhabricatorStorageManagementAPI::applyPatchPHP(/opt/phabricator/resources/sql/patches/20131121.repocredentials.2.mig.php) called at [/opt/phabricator/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:171]
  #11 PhabricatorStorageManagementAPI::applyPatch(Object PhabricatorStoragePatch) called at [/opt/phabricator/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php:168]
  #12 PhabricatorStorageManagementUpgradeWorkflow::execute(Object PhutilArgumentParser) called at [/opt/libphutil/src/parser/argument/PhutilArgumentParser.php:396]
  #13 PhutilArgumentParser::parseWorkflowsFull(Array of size 7 starting with: { PhabricatorStorageManagementDatabasesWorkflow => Object PhabricatorStorageManagementDatabasesWorkflow }) called at [/opt/libphutil/src/parser/argument/PhutilArgumentParser.php:292]
  #14 PhutilArgumentParser::parseWorkflows(Array of size 7 starting with: { PhabricatorStorageManagementDatabasesWorkflow => Object PhabricatorStorageManagementDatabasesWorkflow }) called at [/opt/phabricator/scripts/sql/manage_storage.php:115]
PHP Fatal error:  Uncaught exception 'Exception' with message 'Process exited with an open transaction! The transaction will be implicitly rolled back. Calls to openTransaction() must always be paired with a call to saveTransaction() or killTransaction().' in /opt/libphutil/src/aphront/storage/connection/AphrontDatabaseTransactionState.php:71
Stack trace:
#0 [internal function]: AphrontDatabaseTransactionState->__destruct()
#1 {main}
  thrown in /opt/libphutil/src/aphront/storage/connection/AphrontDatabaseTransactionState.php on line 71

Fatal error: Uncaught exception 'Exception' with message 'Process exited with an open transaction! The transaction will be implicitly rolled back. Calls to openTransaction() must always be paired with a call to saveTransaction() or killTransaction().' in /opt/libphutil/src/aphront/storage/connection/AphrontDatabaseTransactionState.php:71
Stack trace:
#0 [internal function]: AphrontDatabaseTransactionState->__destruct()
#1 {main}
  thrown in /opt/libphutil/src/aphront/storage/connection/AphrontDatabaseTransactionState.php on line 71

Note that it tries to apply the phabricator:20131121.repocredentials.2.mig.php patch first - as seen above, as well as in:

$ ./bin/storage upgrade --dryrun | head -n 1
DRYRUN: Would apply patch 'phabricator:20131121.repocredentials.2.mig.php'.

However, the only references to isLocked seem to be in a later patch

$ grep -r isLocked *
resources/sql/autopatches/20140501.passphraselockcredential.sql:  ADD COLUMN isLocked BOOL NOT NULL;
src/applications/passphrase/storage/PassphraseCredential.php:  protected $isLocked = 0;

Event Timeline

gera raised the priority of this task from to Needs Triage.
gera updated the task description. (Show Details)
gera added a subscriber: gera.
epriestley triaged this task as High priority.

I think D9101 should fix this, can you try that and confirm it resolves the problem?

You can apply it locally with arc patch D9101 in phabricator/, or grab the raw diff here:

https://secure.phabricator.com/D9101?download=true