Deprecate database indexes used only by SqlRewriterImpl

These methods are only invoked by SqlRewriterImpl. A server relying
on secondary indexing does not need these indexes to be present in
the database. Mark the methods deprecated to discourage new uses.

Change-Id: Ia9eea39a994abc20e2c9735b6a98c028a86bbc53
This commit is contained in:
Shawn Pearce
2013-10-07 13:02:40 -07:00
parent 523253177b
commit ec09b49092
3 changed files with 30 additions and 8 deletions

View File

@@ -42,12 +42,11 @@ public interface ChangeAccess extends Access<Change, Change.Id> {
@Query("WHERE dest.projectName = ?")
ResultSet<Change> byProject(Project.NameKey p) throws OrmException;
@Deprecated
@Query("WHERE owner = ? AND open = true ORDER BY createdOn, changeId")
ResultSet<Change> byOwnerOpen(Account.Id id) throws OrmException;
@Query("WHERE owner = ? AND open = false ORDER BY lastUpdatedOn DESC LIMIT 5")
ResultSet<Change> byOwnerClosed(Account.Id id) throws OrmException;
@Deprecated
@Query("WHERE owner = ? AND open = false ORDER BY lastUpdatedOn")
ResultSet<Change> byOwnerClosedAll(Account.Id id) throws OrmException;
@@ -58,9 +57,11 @@ public interface ChangeAccess extends Access<Change, Change.Id> {
@Query("WHERE status = '" + Change.STATUS_SUBMITTED + "'")
ResultSet<Change> allSubmitted() throws OrmException;
@Deprecated
@Query("WHERE open = true AND sortKey > ? ORDER BY sortKey LIMIT ?")
ResultSet<Change> allOpenPrev(String sortKey, int limit) throws OrmException;
@Deprecated
@Query("WHERE open = true AND sortKey < ? ORDER BY sortKey DESC LIMIT ?")
ResultSet<Change> allOpenNext(String sortKey, int limit) throws OrmException;
@@ -70,6 +71,7 @@ public interface ChangeAccess extends Access<Change, Change.Id> {
@Query("WHERE open = true AND dest = ?")
ResultSet<Change> byBranchOpenAll(Branch.NameKey p) throws OrmException;
@Deprecated
@Query("WHERE open = true AND dest.projectName = ? AND sortKey > ?"
+ " ORDER BY sortKey LIMIT ?")
ResultSet<Change> byProjectOpenPrev(Project.NameKey p, String sortKey,
@@ -80,29 +82,35 @@ public interface ChangeAccess extends Access<Change, Change.Id> {
ResultSet<Change> byProjectOpenNext(Project.NameKey p, String sortKey,
int limit) throws OrmException;
@Deprecated
@Query("WHERE open = false AND status = ? AND dest.projectName = ? AND sortKey > ?"
+ " ORDER BY sortKey LIMIT ?")
ResultSet<Change> byProjectClosedPrev(char status, Project.NameKey p,
String sortKey, int limit) throws OrmException;
@Deprecated
@Query("WHERE open = false AND status = ? AND dest.projectName = ? AND sortKey < ?"
+ " ORDER BY sortKey DESC LIMIT ?")
ResultSet<Change> byProjectClosedNext(char status, Project.NameKey p,
String sortKey, int limit) throws OrmException;
@Deprecated
@Query("WHERE open = false AND status = ? AND sortKey > ? ORDER BY sortKey LIMIT ?")
ResultSet<Change> allClosedPrev(char status, String sortKey, int limit)
throws OrmException;
@Deprecated
@Query("WHERE open = false AND status = ? AND sortKey < ? ORDER BY sortKey DESC LIMIT ?")
ResultSet<Change> allClosedNext(char status, String sortKey, int limit)
throws OrmException;
@Deprecated
@Query("WHERE open = false AND status = ? AND dest = ? AND sortKey > ?"
+ " ORDER BY sortKey LIMIT ?")
ResultSet<Change> byBranchClosedPrev(char status, Branch.NameKey p,
String sortKey, int limit) throws OrmException;
@Deprecated
@Query("WHERE open = false AND status = ? AND dest = ? AND sortKey < ?"
+ " ORDER BY sortKey DESC LIMIT ?")
ResultSet<Change> byBranchClosedNext(char status, Branch.NameKey p,

View File

@@ -39,15 +39,12 @@ public interface PatchSetApprovalAccess extends
ResultSet<PatchSetApproval> byPatchSetUser(PatchSet.Id patchSet,
Account.Id account) throws OrmException;
@Deprecated
@Query("WHERE changeOpen = true AND key.accountId = ?")
ResultSet<PatchSetApproval> openByUser(Account.Id account)
throws OrmException;
@Query("WHERE changeOpen = false AND key.accountId = ?"
+ " ORDER BY changeSortKey DESC LIMIT 10")
ResultSet<PatchSetApproval> closedByUser(Account.Id account)
throws OrmException;
@Deprecated
@Query("WHERE changeOpen = false AND key.accountId = ? ORDER BY changeSortKey")
ResultSet<PatchSetApproval> closedByUserAll(Account.Id account)
throws OrmException;

View File

@@ -81,6 +81,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.After s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(40000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -105,6 +106,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.Before s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(40000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -128,6 +130,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.After s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(500, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -170,6 +173,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.After s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(40000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -192,6 +196,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.Before s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(40000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -214,6 +219,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.After s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(40000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -236,6 +242,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.Before s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(40000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -257,6 +264,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.After s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(2000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -275,6 +283,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
@Named("S") final SortKeyPredicate.Before s,
@Named("L") final IntPredicate<ChangeData> l) {
return new PaginatedSource(2000, s.getValue(), l.intValue()) {
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -298,6 +307,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r20_byMergedPrev", s, l);
}
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -322,6 +332,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r20_byMergedNext", s, l);
}
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -346,6 +357,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r20_byAbandonedPrev", s, l);
}
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -370,6 +382,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r20_byAbandonedNext", s, l);
}
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a, String key, int limit)
throws OrmException {
@@ -409,6 +422,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r25_byOwnerOpen", o);
}
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a) throws OrmException {
return a.byOwnerOpen(o.getAccountId());
@@ -430,6 +444,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r25_byOwnerClosed", o);
}
@SuppressWarnings("deprecation")
@Override
ResultSet<Change> scan(ChangeAccess a) throws OrmException {
return a.byOwnerClosedAll(o.getAccountId());
@@ -457,6 +472,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r30_byReviewerOpen", r);
}
@SuppressWarnings("deprecation")
@Override
public ResultSet<ChangeData> read() throws OrmException {
return ChangeDataResultSet.patchSetApproval(dbProvider.get()
@@ -490,6 +506,7 @@ public class SqlRewriterImpl extends BasicChangeRewrites
init("r30_byReviewerClosed", r);
}
@SuppressWarnings("deprecation")
@Override
public ResultSet<ChangeData> read() throws OrmException {
return ChangeDataResultSet.patchSetApproval(dbProvider.get()