Shard refs/draft-comments/* by change instead of account ID

The motivation is the same as in Ib81d462: scanning the whole
refs/draft-comments/* space (with grows without bound) when reindexing
a change is potentially too slow.

Instead of refs/draft-comments/<sharded account>/<change>, use
refs/draft-comments/<sharded change>/<account>. This is mostly
straightforward, since there are relatively few places that scan
multiple refs; most callers just use the helper method in RefNames.

Change-Id: I063e2c496751f637d968c89c1501743074fb9025
This commit is contained in:
Dave Borowitz
2016-05-02 17:44:07 -04:00
committed by Edwin Kempin
parent dba0801601
commit 66c76c9d4a
13 changed files with 114 additions and 66 deletions

View File

@@ -1878,7 +1878,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(repo.exactRef(changeMetaRef(c.getId()))).isNotNull();
String draftRef = refsDraftComments(otherUser.getAccountId(), c.getId());
String draftRef = refsDraftComments(c.getId(), otherUser.getAccountId());
assertThat(exactRefAllUsers(draftRef)).isNull();
}
@@ -1900,7 +1900,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.putComment(draft);
update.commit();
String draftRef = refsDraftComments(otherUser.getAccountId(), c.getId());
String draftRef = refsDraftComments(c.getId(), otherUser.getAccountId());
ObjectId old = exactRefAllUsers(draftRef);
assertThat(old).isNotNull();
@@ -2074,7 +2074,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.putComment(comment2);
update.commit();
String refName = refsDraftComments(otherUserId, c.getId());
String refName = refsDraftComments(c.getId(), otherUserId);
ObjectId oldDraftId = exactRefAllUsers(refName);
update = newUpdate(c, otherUser);