Page MenuHomePhabricator

D20175.id.diff
No OneTemporary

D20175.id.diff

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 @@
+<?php
+
+// See T6615. We're about to change the nullability on the "dataID" column,
+// but it may have a UNIQUE KEY on it. Make sure we get rid of this key first
+// so we don't run into trouble.
+
+// There's no "IF EXISTS" modifier for "ALTER TABLE" so run this as a PHP patch
+// instead of an SQL patch.
+
+$table = new PhabricatorWorkerActiveTask();
+$conn = $table->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'),
),

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 22, 10:13 AM (3 h, 11 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7178775
Default Alt Text
D20175.id.diff (3 KB)

Event Timeline