diff --git a/resources/sql/autopatches/20190215.daemons.01.dropdataid.php b/resources/sql/autopatches/20190215.daemons.01.dropdataid.php new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20190215.daemons.01.dropdataid.php @@ -0,0 +1,21 @@ +establishConnection('w'); + +try { + queryfx( + $conn, + 'ALTER TABLE %R DROP KEY %T', + $table, + 'dataID'); +} catch (AphrontQueryException $ex) { + // Ignore. +} diff --git a/resources/sql/autopatches/20190215.daemons.02.nulldataid.sql b/resources/sql/autopatches/20190215.daemons.02.nulldataid.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20190215.daemons.02.nulldataid.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_worker.worker_activetask + CHANGE dataID dataID INT UNSIGNED NOT NULL; diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php @@ -14,35 +14,21 @@ self::CONFIG_IDS => self::IDS_COUNTER, self::CONFIG_TIMESTAMPS => false, self::CONFIG_KEY_SCHEMA => array( - 'dataID' => array( - 'columns' => array('dataID'), - 'unique' => true, - ), 'taskClass' => array( 'columns' => array('taskClass'), ), 'leaseExpires' => array( 'columns' => array('leaseExpires'), ), - 'leaseOwner' => array( - 'columns' => array('leaseOwner(16)'), - ), 'key_failuretime' => array( 'columns' => array('failureTime'), ), - 'leaseOwner_2' => array( + 'key_owner' => array( 'columns' => array('leaseOwner', 'priority', 'id'), ), ) + $parent[self::CONFIG_KEY_SCHEMA], ); - $config[self::CONFIG_COLUMN_SCHEMA] = array( - // T6203/NULLABILITY - // This isn't nullable in the archive table, so at a minimum these - // should be the same. - 'dataID' => 'uint32?', - ) + $parent[self::CONFIG_COLUMN_SCHEMA]; - return $config + $parent; } @@ -74,7 +60,7 @@ $this->failureCount = 0; } - if ($is_new && ($this->getData() !== null)) { + if ($is_new) { $data = new PhabricatorWorkerTaskData(); $data->setData($this->getData()); $data->save(); diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php @@ -28,9 +28,6 @@ 'dateCreated' => array( 'columns' => array('dateCreated'), ), - 'leaseOwner' => array( - 'columns' => array('leaseOwner', 'priority', 'id'), - ), 'key_modified' => array( 'columns' => array('dateModified'), ),