ES: Implement online reindex for ElasticSearch

Implement online reindexing for ElasticSearch based on the code for
Lucene online reindex.

Testing scenario:
 1. Start fresh Gerrit site with this patch
 2. Create account
 3. Verify data in ElasticSearch:
   curl http://localhost:9200/gerritaccounts_0004/
   curl http://localhost:9200/gerritaccounts_0004/_search
 4. Stop Gerrit
 5. Cherry pick change I77e1643cd1a7fbef9f4d2fa214823759188e9592
 6. Start Gerrit
 6. Wait for log message:
     Starting online reindex from schema version 4 to 5
 7. Verify state in ElasticSearch:
   curl http://localhost:9200/gerritaccounts_0005/
   curl http://localhost:9200/gerritaccounts_0005/_search

Entry for user account created in step 2 should have "elastic_online"
property with value "reindex work".

Change-Id: I9efcf5735e65b4f2dc2a97914d398f81656fc12a
This commit is contained in:
Dariusz Luksza
2017-04-24 16:34:52 +02:00
parent 23a2ee2eff
commit 74bb6d6184
9 changed files with 323 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ import com.google.gerrit.server.index.IndexCollection;
import com.google.gerrit.server.index.IndexDefinition;
import com.google.gerrit.server.index.IndexDefinition.IndexFactory;
import com.google.gerrit.server.index.OnlineReindexer;
import com.google.gerrit.server.index.ReindexerAlreadyRunningException;
import com.google.gerrit.server.index.Schema;
import com.google.inject.Inject;
import com.google.inject.ProvisionException;