@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use "null", not "-1", as a local "no version" marker when performing intracluster repository sync

Summary:
Ref T13242. See <https://discourse.phabricator-community.org/t/out-of-range-value-for-column-deviceversion/2218>.

The synchronization log column is `uint32?` and `-1` doesn't go into that column.

Since we're only using `-1` for convenience to cheat through `$max_version > $this_version` checks, use `null` instead and make the checks more explicit.

Test Plan: Reproducing this is a bit tricky and I cheated fairly heavily to force the code down this pathway without actually building a multi-device cluster, but I did reproduce the original exception, apply the patch, and observe that it fixed things.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13242

Differential Revision: https://secure.phabricator.com/D20047

+5 -4
+5 -4
src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
··· 188 188 if ($this_version) { 189 189 $this_version = (int)$this_version->getRepositoryVersion(); 190 190 } else { 191 - $this_version = -1; 191 + $this_version = null; 192 192 } 193 193 194 194 if ($versions) { ··· 197 197 // leader, we want to fetch from a leader and then update our version. 198 198 199 199 $max_version = (int)max(mpull($versions, 'getRepositoryVersion')); 200 - if ($max_version > $this_version) { 200 + if (($this_version === null) || ($max_version > $this_version)) { 201 201 if ($repository->isHosted()) { 202 202 $fetchable = array(); 203 203 foreach ($versions as $version) { ··· 205 205 $fetchable[] = $version->getDevicePHID(); 206 206 } 207 207 } 208 + 208 209 209 210 $this->synchronizeWorkingCopyFromDevices( 210 211 $fetchable, ··· 445 446 if ($this_version) { 446 447 $this_version = (int)$this_version->getRepositoryVersion(); 447 448 } else { 448 - $this_version = -1; 449 + $this_version = null; 449 450 } 450 451 451 - if ($new_version > $this_version) { 452 + if (($this_version === null) || ($new_version > $this_version)) { 452 453 PhabricatorRepositoryWorkingCopyVersion::updateVersion( 453 454 $repository_phid, 454 455 $device_phid,