Delete SQL index support
Require the secondary index to be enabled in Gerrit 2.9. Unless configured differently, Lucene is used for the secondary index. Change-Id: I3d2d804170835d69ffbfef586ddc3873ea3cd1c8
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.reviewdb.server;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
@@ -42,14 +41,6 @@ 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;
|
||||
|
||||
@Deprecated
|
||||
@Query("WHERE owner = ? AND open = false ORDER BY lastUpdatedOn")
|
||||
ResultSet<Change> byOwnerClosedAll(Account.Id id) throws OrmException;
|
||||
|
||||
@Query("WHERE dest = ? AND status = '" + Change.STATUS_SUBMITTED
|
||||
+ "' ORDER BY lastUpdatedOn")
|
||||
ResultSet<Change> submitted(Branch.NameKey dest) throws OrmException;
|
||||
@@ -57,65 +48,17 @@ 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;
|
||||
|
||||
@Query("WHERE open = true AND dest.projectName = ?")
|
||||
ResultSet<Change> byProjectOpenAll(Project.NameKey p) throws OrmException;
|
||||
|
||||
@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,
|
||||
int limit) throws OrmException;
|
||||
|
||||
@Query("WHERE open = true AND dest.projectName = ? AND sortKey < ?"
|
||||
+ " ORDER BY sortKey DESC LIMIT ?")
|
||||
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,
|
||||
String sortKey, int limit) throws OrmException;
|
||||
|
||||
@Query
|
||||
ResultSet<Change> all() throws OrmException;
|
||||
}
|
||||
|
||||
@@ -38,14 +38,4 @@ public interface PatchSetApprovalAccess extends
|
||||
@Query("WHERE key.patchSetId = ? AND key.accountId = ?")
|
||||
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;
|
||||
|
||||
@Deprecated
|
||||
@Query("WHERE changeOpen = false AND key.accountId = ? ORDER BY changeSortKey")
|
||||
ResultSet<PatchSetApproval> closedByUserAll(Account.Id account)
|
||||
throws OrmException;
|
||||
}
|
||||
|
||||
@@ -28,9 +28,4 @@ public interface TrackingIdAccess extends Access<TrackingId, TrackingId.Key> {
|
||||
|
||||
@Query("WHERE key.changeId = ?")
|
||||
ResultSet<TrackingId> byChange(Change.Id change) throws OrmException;
|
||||
|
||||
@Deprecated
|
||||
@Query("WHERE key.trackingKey = ?")
|
||||
ResultSet<TrackingId> byTrackingId(TrackingId.Id trackingId)
|
||||
throws OrmException;
|
||||
}
|
||||
|
||||
@@ -69,23 +69,11 @@ ON account_project_watches (project_name);
|
||||
|
||||
-- *********************************************************************
|
||||
-- ChangeAccess
|
||||
-- covers: byOwnerOpen
|
||||
CREATE INDEX changes_byOwnerOpen
|
||||
ON changes (open, owner_account_id, created_on, change_id);
|
||||
|
||||
-- covers: byOwnerClosed
|
||||
CREATE INDEX changes_byOwnerClosed
|
||||
ON changes (open, owner_account_id, last_updated_on);
|
||||
|
||||
-- covers: submitted, allSubmitted
|
||||
CREATE INDEX changes_submitted
|
||||
ON changes (status, dest_project_name, dest_branch_name, last_updated_on);
|
||||
|
||||
-- covers: allOpenPrev, allOpenNext
|
||||
CREATE INDEX changes_allOpen
|
||||
ON changes (open, sort_key);
|
||||
|
||||
-- covers: byProjectOpenPrev, byProjectOpenNext
|
||||
-- covers: byProjectOpenAll
|
||||
CREATE INDEX changes_byProjectOpen
|
||||
ON changes (open, dest_project_name, sort_key);
|
||||
|
||||
@@ -93,30 +81,10 @@ ON changes (open, dest_project_name, sort_key);
|
||||
CREATE INDEX changes_byProject
|
||||
ON changes (dest_project_name);
|
||||
|
||||
-- covers: allClosedPrev, allClosedNext
|
||||
CREATE INDEX changes_allClosed
|
||||
ON changes (open, status, sort_key);
|
||||
|
||||
-- covers: byBranchClosedPrev, byBranchClosedNext
|
||||
CREATE INDEX changes_byBranchClosed
|
||||
ON changes (status, dest_project_name, dest_branch_name, sort_key);
|
||||
|
||||
CREATE INDEX changes_key
|
||||
ON changes (change_key);
|
||||
|
||||
|
||||
-- *********************************************************************
|
||||
-- PatchSetApprovalAccess
|
||||
-- @PrimaryKey covers: byPatchSet, byPatchSetUser
|
||||
-- covers: openByUser
|
||||
CREATE INDEX patch_set_approvals_openByUser
|
||||
ON patch_set_approvals (change_open, account_id);
|
||||
|
||||
-- covers: closedByUser
|
||||
CREATE INDEX patch_set_approvals_closedByU
|
||||
ON patch_set_approvals (change_open, account_id, change_sort_key);
|
||||
|
||||
|
||||
-- *********************************************************************
|
||||
-- ChangeMessageAccess
|
||||
-- @PrimaryKey covers: byChange
|
||||
|
||||
@@ -117,63 +117,24 @@ ON account_project_watches (project_name);
|
||||
|
||||
-- *********************************************************************
|
||||
-- ChangeAccess
|
||||
-- covers: byOwnerOpen
|
||||
CREATE INDEX changes_byOwnerOpen
|
||||
ON changes (owner_account_id, created_on, change_id)
|
||||
WHERE open = 'Y';
|
||||
|
||||
-- covers: byOwnerClosed
|
||||
CREATE INDEX changes_byOwnerClosed
|
||||
ON changes (owner_account_id, last_updated_on)
|
||||
WHERE open = 'N';
|
||||
|
||||
-- covers: submitted, allSubmitted
|
||||
CREATE INDEX changes_submitted
|
||||
ON changes (dest_project_name, dest_branch_name, last_updated_on)
|
||||
WHERE status = 's';
|
||||
|
||||
-- covers: allOpenPrev, allOpenNext
|
||||
CREATE INDEX changes_allOpen
|
||||
ON changes (sort_key)
|
||||
WHERE open = 'Y';
|
||||
|
||||
-- covers: byProjectOpenPrev, byProjectOpenNext
|
||||
-- covers: byProjectOpenAll
|
||||
CREATE INDEX changes_byProjectOpen
|
||||
ON changes (dest_project_name, sort_key)
|
||||
WHERE open = 'Y';
|
||||
|
||||
-- covers: allClosedPrev, allClosedNext
|
||||
CREATE INDEX changes_allClosed
|
||||
ON changes (status, sort_key)
|
||||
WHERE open = 'N';
|
||||
|
||||
-- covers: byProject
|
||||
CREATE INDEX changes_byProject
|
||||
ON changes (dest_project_name);
|
||||
|
||||
-- covers: byBranchClosedPrev, byBranchClosedNext
|
||||
CREATE INDEX changes_byBranchClosed
|
||||
ON changes (status, dest_project_name, dest_branch_name, sort_key)
|
||||
WHERE open = 'N';
|
||||
|
||||
CREATE INDEX changes_key
|
||||
ON changes (change_key);
|
||||
|
||||
|
||||
-- *********************************************************************
|
||||
-- PatchSetApprovalAccess
|
||||
-- @PrimaryKey covers: byPatchSet, byPatchSetUser
|
||||
-- covers: openByUser
|
||||
CREATE INDEX patch_set_approvals_openByUser
|
||||
ON patch_set_approvals (account_id)
|
||||
WHERE change_open = 'Y';
|
||||
|
||||
-- covers: closedByUser
|
||||
CREATE INDEX patch_set_approvals_closedByU
|
||||
ON patch_set_approvals (account_id, change_sort_key)
|
||||
WHERE change_open = 'N';
|
||||
|
||||
|
||||
-- *********************************************************************
|
||||
-- ChangeMessageAccess
|
||||
-- @PrimaryKey covers: byChange
|
||||
|
||||
Reference in New Issue
Block a user