Keep track of Lucene and index schema versions
Like SchemaVersionCheck, use a LifecycleManager to check the schema versions on startup. We need to check both: - The on-disk format of the Lucene index. We specify the current version manually in LuceneChangeIndex, since Lucene itself doesn't store a version in the directory. (CheckIndex claims to be able to detect an out-of-date index file format, but it seems buggy.) - The version of the ChangeField schema, which indicates the semantics of the various fields. Persist both of these versions in a simple config file, index/gerrit_index.config. If the check fails, inform the user they need to reindex. Rewrite Reindex to delete all the files in the Lucene directory, not just the documents. Change-Id: Ib82b8aab21c819db3625cd9984262a40135e0894
This commit is contained in:
@@ -36,6 +36,9 @@ import java.util.Map;
|
||||
* Used to generate a schema for index implementations that require one.
|
||||
*/
|
||||
public class ChangeField {
|
||||
/** Increment whenever making schema changes. */
|
||||
public static final int SCHEMA_VERSION = 1;
|
||||
|
||||
/** Legacy change ID. */
|
||||
public static final FieldDef<ChangeData, Integer> CHANGE_ID =
|
||||
new FieldDef.Single<ChangeData, Integer>(ChangeQueryBuilder.FIELD_CHANGE,
|
||||
|
||||
Reference in New Issue
Block a user