ReceiveCommits: Fix set comparison to avoid no-op group updates
Group equality should be using set equality, but we were accidentally comparing a Set with a List, always returning false. This resulted in a no-op group update every time a previously-seen change was walked during ReceiveCommits pushing a new change. This led to all sorts of flaky test failures under notedb, since the last updated timestamp of an earlier change that was not updated might be moved forward ahead of a later change. Tests expected the newest change to have the most recent timestamp (Thanks to Edwin for tracking down the cause of this flakiness!) Fix this by being a little more explicit about types. Add a regression test to GetRelatedIT asserting that the change is unmodified when a child change is pushed. We use ETag as it does the right thing depending on whether notedb is enabled, either using the rowVersion column or the latest meta commit SHA-1 as appropriate. Change-Id: I3c5ef4287cf5fbef733f0bb01bfe3857522c5d0a
This commit is contained in:
@@ -2448,7 +2448,7 @@ public class ReceiveCommits {
|
||||
if (groups == null) {
|
||||
return false;
|
||||
}
|
||||
} else if (Sets.newHashSet(oldGroups).equals(groups)) {
|
||||
} else if (sameGroups(oldGroups, groups)) {
|
||||
return false;
|
||||
}
|
||||
psUtil.setGroups(ctx.getDb(), ctx.getUpdate(psId), ps, groups);
|
||||
@@ -2459,6 +2459,10 @@ public class ReceiveCommits {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean sameGroups(List<String> a, List<String> b) {
|
||||
return Sets.newHashSet(a).equals(Sets.newHashSet(b));
|
||||
}
|
||||
|
||||
CheckedFuture<Void, RestApiException> updateGroups() {
|
||||
final Thread caller = Thread.currentThread();
|
||||
ListenableFuture<Void> future = changeUpdateExector.submit(
|
||||
|
||||
Reference in New Issue
Block a user