jenkins-bot has submitted this change and it was merged.

Change subject: Rename --rebuild to --startOver
......................................................................


Rename --rebuild to --startOver

--rebuild was confusing because it wasn't the kind of reindex we ever
wanted to run in production.  --startOver carries the right connotations
for what it actually does: it is useful when trying to get the thing
working for the first time but it removes all the data that exists so
shouldn't be used if you don't want a substantial interruption in
service.

Bug: 56164
Change-Id: I6aede782e6a3da5b729d6ea8cd82411fed319837
---
M README
M maintenance/updateOneSearchIndexConfig.php
2 files changed, 18 insertions(+), 14 deletions(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README b/README
index d59164e..7af33ba 100644
--- a/README
+++ b/README
@@ -95,7 +95,7 @@
 If you must do (1) you have three options:
 A.  Blow away the search index and rebuild it from scratch.  Marginally faster 
and uses less disk space on
 in elasticsearch but empties the index entirely and rebuilds it so search will 
be down for a while:
- php updateSearchIndexConfig.php --rebuild
+ php updateSearchIndexConfig.php --startOver
  php forceSearchIndex.php --forceUpdate
 
 B.  Build a copy of the index, reindex to it, and then force a full reindex 
from source documents.  Uses
diff --git a/maintenance/updateOneSearchIndexConfig.php 
b/maintenance/updateOneSearchIndexConfig.php
index 7f589b7..dc332b9 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -27,7 +27,12 @@
  * Update the elasticsearch configuration for this index.
  */
 class UpdateOneSearchIndexConfig extends Maintenance {
-       private $indexType, $rebuild, $closeOk;
+       private $indexType;
+
+       // Are we going to blow the index away and start from scratch?
+       private $startOver;
+
+       private $closeOk;
 
        // Is the index currently closed?
        private $closed = false;
@@ -73,8 +78,8 @@
         * @param $maintenance Maintenance
         */
        public static function addSharedOptions( $maintenance ) {
-               $maintenance->addOption( 'rebuild', 'Blow away the identified 
index and rebuild it from ' .
-                       'scratch.' );
+               $maintenance->addOption( 'startOver', 'Blow away the identified 
index and rebuild it with ' .
+                       'no data.' );
                $maintenance->addOption( 'forceOpen', "Open the index but do 
nothing else.  Use this if " .
                        "you've stuck the index closed and need it to start 
working right now." );
                $maintenance->addOption( 'closeOk', "Allow the script to close 
the index if decides it has " .
@@ -118,7 +123,7 @@
                                $this->reindex();
                                return;
                        }
-                       $this->rebuild = $this->getOption( 'rebuild', false );
+                       $this->startOver = $this->getOption( 'startOver', false 
);
                        $this->closeOk = $this->getOption( 'closeOk', false );
                        $this->indexIdentifier = 
$this->pickIndexIdentifierFromOption( $this->getOption( 'indexIdentifier', 
'current' ) );
                        $this->reindexAndRemoveOk = $this->getOption( 
'reindexAndRemoveOk', false );
@@ -150,8 +155,8 @@
        }
 
        private function validateIndex() {
-               if ( $this->rebuild ) {
-                       $this->output( $this->indent . "Rebuilding index..." );
+               if ( $this->startOver ) {
+                       $this->output( $this->indent . "Blowing away index to 
start over..." );
                        $this->createIndex( true );
                        $this->output( "ok\n" );
                        return;
@@ -177,7 +182,7 @@
                        $this->output( "is $actualShardCount but should be " . 
$this->getShardCount() . "...cannot correct!\n" );
                        $this->error(
                                "Number of shards is incorrect and cannot be 
changed without a rebuild. You can solve this\n" .
-                               "problem by running this program again with 
either --rebuild or --reindexAndRemoveOk.  Make\n" .
+                               "problem by running this program again with 
either --startOver or --reindexAndRemoveOk.  Make\n" .
                                "sure you understand the consequences of either 
choice..  This script will now continue to\n" .
                                "validate everything else." );
                        $this->returnCode = 1;
@@ -309,14 +314,14 @@
                $status = CirrusSearchConnection::getClient()->getStatus();
                if ( $status->indexExists( $specificAliasName ) ) {
                        $this->output( "is an index..." );
-                       if ( $this->rebuild ) {
+                       if ( $this->startOver ) {
                                CirrusSearchConnection::getClient()->getIndex( 
$specificAliasName )->delete();
                                $this->output( "index removed..." );
                        } else {
                                $this->output( "cannot correct!\n" );
                                $this->error(
                                        "There is currently an index with the 
name of the alias.  Rerun this\n" .
-                                       "script with --rebuild and it'll remove 
the index and continue.\n" );
+                                       "script with --startOver and it'll 
remove the index and continue.\n" );
                                $this->returnCode = 1;
                                return;
                        }
@@ -407,14 +412,14 @@
                $status = CirrusSearchConnection::getClient()->getStatus();
                if ( $status->indexExists( $allAliasName ) ) {
                        $this->output( "is an index..." );
-                       if ( $this->rebuild ) {
+                       if ( $this->startOver ) {
                                CirrusSearchConnection::getClient()->getIndex( 
$allAliasName )->delete();
                                $this->output( "index removed..." );
                        } else {
                                $this->output( "cannot correct!\n" );
                                $this->error(
                                        "There is currently an index with the 
name of the alias.  Rerun this\n" .
-                                       "script with --rebuild and it'll remove 
the index and continue.\n" );
+                                       "script with --startOver and it'll 
remove the index and continue.\n" );
                                $this->returnCode = 1;
                                return;
                        }
@@ -456,8 +461,7 @@
        }
 
        /**
-        * Rebuild the index by pulling everything out of it and putting it 
back in.  This should be faster than
-        * reparsing everything.
+        * Dump everything from the live index into the one being worked on.
         */
        private function reindex() {
                $settings = $this->getIndex()->getSettings();

-- 
To view, visit https://gerrit.wikimedia.org/r/91896
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6aede782e6a3da5b729d6ea8cd82411fed319837
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to