Out of range value for column 'deviceVersion'


#1

Observed Behavior:
Updating fresh repo which are clustered fails with mysql schema error.

$ /srv/phabricator/bin/repository update  -- R523
[2018-12-18 12:42:15] EXCEPTION: (AphrontQueryException) #1264: Out of range value for column 'deviceVersion' at row 1 at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:358]
arcanist(head=stable, ref.master=3534d2baca4b, ref.stable=ed5d02ab3ef9), phabricator(head=stable, ref.master=5e3d209c922f, ref.stable=ded024d44e03, custom=23), phutil(head=stable, ref.master=975ed0b40b28, ref.stable=a95adc0ea0f8, custom=1)
  #0 AphrontBaseMySQLDatabaseConnection::throwQueryCodeException(integer, string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:292]
  #1 AphrontBaseMySQLDatabaseConnection::throwQueryException(mysqli) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:188]
  #2 AphrontBaseMySQLDatabaseConnection::executeQuery(PhutilQueryString) called at [<phutil>/src/xsprintf/queryfx.php:8]
  #3 queryfx(AphrontMySQLiDatabaseConnection, string, PhutilQueryString, PhabricatorRepositorySyncEvent, array, array) called at [<phutil>/src/aphront/storage/connection/AphrontDatabaseConnection.php:58]
  #4 AphrontDatabaseConnection::query(string, PhutilQueryString, PhabricatorRepositorySyncEvent, array, array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1107]
  #5 LiskDAO::insertRecordIntoDatabase(string) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:939]
  #6 LiskDAO::insert() called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:908]
  #7 LiskDAO::save() called at [<phabricator>/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php:834]
  #8 DiffusionRepositoryClusterEngine::synchronizeWorkingCopyFromBinding(AlmanacBinding, integer, integer) called at [<phabricator>/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php:726]
  #9 DiffusionRepositoryClusterEngine::synchronizeWorkingCopyFromDevices(array, integer, integer) called at [<phabricator>/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php:220]
  #10 DiffusionRepositoryClusterEngine::synchronizeWorkingCopyBeforeRead() called at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php:116]
  #11 PhabricatorRepositoryPullEngine::pullRepositoryWithLock() called at [<phabricator>/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php:40]
  #12 PhabricatorRepositoryPullEngine::pullRepository() called at [<phabricator>/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php:59]
  #13 PhabricatorRepositoryManagementUpdateWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:457]
  #14 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:349]
  #15 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/repository/manage_repositories.php:22]

Expected Behavior:
daemon is able to get the device version and sync the repo

Phabricator Version:
phabricator 61a5a4811540
phutil a537ba03c994

Reproduction Steps:

  • Create a new repo without commit
  • The syncro fails

I think the error comes from the new database schema introduced in 966db4d38e, particularly the deviceVersion line set the field to “deviceVersion INT UNSIGNED” but in the cluster engine is setting it to -1 when it doesn’t exist,

https://secure.phabricator.com/source/phabricator/browse/stable/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php$191

Reverting it to 0 works as expected

Cheers


#2

(We’re looking into this, and currently believe it’s a real bug that you’ve provided enough information to reproduce.)