Page MenuHomePhabricator

D19059.id45691.diff
No OneTemporary

D19059.id45691.diff

diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php
--- a/src/applications/conpherence/editor/ConpherenceEditor.php
+++ b/src/applications/conpherence/editor/ConpherenceEditor.php
@@ -99,24 +99,6 @@
return pht('%s created this room.', $author);
}
- /**
- * We really only need a read lock if we have a comment. In that case, we
- * must update the messagesCount field on the conpherence and
- * seenMessagesCount(s) for the participant(s).
- */
- protected function shouldReadLock(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- $lock = false;
- switch ($xaction->getTransactionType()) {
- case PhabricatorTransactions::TYPE_COMMENT:
- $lock = true;
- break;
- }
-
- return $lock;
- }
protected function applyBuiltinInternalTransaction(
PhabricatorLiskDAO $object,
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -924,23 +924,11 @@
if ($object->getID()) {
$this->buildOldRecipientLists($object, $xactions);
- foreach ($xactions as $xaction) {
-
- // If any of the transactions require a read lock, hold one and
- // reload the object. We need to do this fairly early so that the
- // call to `adjustTransactionValues()` (which populates old values)
- // is based on the synchronized state of the object, which may differ
- // from the state when it was originally loaded.
-
- if ($this->shouldReadLock($object, $xaction)) {
- $object->openTransaction();
- $object->beginReadLocking();
- $transaction_open = true;
- $read_locking = true;
- $object->reload();
- break;
- }
- }
+ $object->openTransaction();
+ $object->beginReadLocking();
+ $transaction_open = true;
+ $read_locking = true;
+ $object->reload();
}
if ($this->shouldApplyInitialEffects($object, $xactions)) {
@@ -1319,46 +1307,6 @@
return $xactions;
}
-
- /**
- * Determine if the editor should hold a read lock on the object while
- * applying a transaction.
- *
- * If the editor does not hold a lock, two editors may read an object at the
- * same time, then apply their changes without any synchronization. For most
- * transactions, this does not matter much. However, it is important for some
- * transactions. For example, if an object has a transaction count on it, both
- * editors may read the object with `count = 23`, then independently update it
- * and save the object with `count = 24` twice. This will produce the wrong
- * state: the object really has 25 transactions, but the count is only 24.
- *
- * Generally, transactions fall into one of four buckets:
- *
- * - Append operations: Actions like adding a comment to an object purely
- * add information to its state, and do not depend on the current object
- * state in any way. These transactions never need to hold locks.
- * - Overwrite operations: Actions like changing the title or description
- * of an object replace the current value with a new value, so the end
- * state is consistent without a lock. We currently do not lock these
- * transactions, although we may in the future.
- * - Edge operations: Edge and subscription operations have internal
- * synchronization which limits the damage race conditions can cause.
- * We do not currently lock these transactions, although we may in the
- * future.
- * - Update operations: Actions like incrementing a count on an object.
- * These operations generally should use locks, unless it is not
- * important that the state remain consistent in the presence of races.
- *
- * @param PhabricatorLiskDAO Object being updated.
- * @param PhabricatorApplicationTransaction Transaction being applied.
- * @return bool True to synchronize the edit with a lock.
- */
- protected function shouldReadLock(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
- return false;
- }
-
private function loadHandles(array $xactions) {
$phids = array();
foreach ($xactions as $key => $xaction) {

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 2:44 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7575297
Default Alt Text
D19059.id45691.diff (4 KB)

Event Timeline