Skip to content

Conversation

@senthil-ram
Copy link
Contributor

@senthil-ram senthil-ram commented Jul 19, 2019

setDDMode disable enable disable - would not disable DD sometimes. setDDMode does not set the moveKeysLockWriteKey which can cause the above.

After takeMoveKeysLock notes down the moveKeysLockOwnerKey and the moveKeysLockWriteKey value, it monitors the above two in pollMoveKeysLock and checks if anything is changed, but setDDMode was not setting the moveKeysLockWriteKey and so a sequence like disable, enable and disable would not really disable DD unless the intermediate enable had a change in the moveKeysLockOwnerKey.

This will fix the issue #1865 .

After takeMoveKeysLock notes down the owner and the
moveKeysLockWriteKey value, it monitors the above two in
pollMoveKeysLock and checks if anything is changed, but
setDDMode was not setting the moveKeysLockWriteKey and
so a sequence like disable, enable and disable would not
really disable DD.
@dongxinEric
Copy link
Contributor

This PR and the one from Jingyu(#1849) both indicate that moveKeysLockWriteKey should always be muted if the lock ownership changed. Does it make sense to provided a method like changeMoveKeysLockOwner which encapsulates these two operations? Otherwise, we have to enforce this(most likely by reviewing the changes) manually.

@senthil-ram
Copy link
Contributor Author

This PR and the one from Jingyu(#1849) both indicate that moveKeysLockWriteKey should always be muted if the lock ownership changed. Does it make sense to provided a method like changeMoveKeysLockOwner which encapsulates these two operations? Otherwise, we have to enforce this(most likely by reviewing the changes) manually.

There is already an encapsulation like checkMoveKeysLock, also very few places touch these set of keys. I think more importantly what is lacking is a good test in the simulator, snapv2 (PR: #1733) will use this feature and test it as a result it.

wrMyOwner << dataDistributionModeLock;
tr.set( moveKeysLockOwnerKey, wrMyOwner.toValue() );
}
BinaryWriter wrMyOwner(Unversioned());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the moveKeysLockWriteKey, but why remove the !mode check?

Copy link
Contributor Author

@senthil-ram senthil-ram Jul 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the check is an optimization to avoid writing the ownerKeys while enabling DD mode. I felt an optimization without big value given the rarity of how many times we do this operation - so i thought simplification has more value than optimization here.

I think in the future I would add an assert that says that the ownerKey is still same as dataDistributionModeLock and then avoid writing the ownerKey again. (because between disable and enable, my understanding is that no one can change the ownership).

I am fine with putting the !mode check back too for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sense, I verified that the data distributor will re-take the lock after it has been re-enabled so I agree it should not change anything

@etschannen etschannen merged commit 83f4b8e into apple:master Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants