485 Commits

Author SHA1 Message Date
Shawn Pearce
4d483da8d2 Merge changes Ia6447e62,Ic09dc032,I7f1ee1d6,I26fd741d,I1f13f4d2
* changes:
  Buck: Rename gwtxml to gwt_xml in gwt_module()
  Buck: Omit default values to gwt_binary() rule
  Buck: Make gwt_module() rule more pythonic
  Buck: Merge deps and compile_deps parameters in gwt_module() rule
  Update Buck and use gwt_binary()
2014-05-19 19:30:04 +00:00
Shawn Pearce
06e069cfcc Update Buck and use gwt_binary()
Migrate gwt build tool chain to built in gwt_binary() rule [1].

[1] https://github.com/facebook/buck/issues/109

Change-Id: I1f13f4d29864bc7e7278f8a2b2e39c882acf44aa
2014-05-19 11:41:31 -07:00
David Pursehouse
5aaf7d1c30 Merge branch 'stable-2.9'
* stable-2.9:
  Link to solved issues from 2.9 release notes
  Reindex: Include exception cause when dying
  Fix the request wrapper for http requests served from plugins
  Fix a possibility to overcome BLOCK permission
  Add asciidoc build back in the Documentation folder
  Change CopyableLabel to hide onKeyUp

Conflicts:
	gerrit-server/src/main/java/com/google/gerrit/server/project/PermissionCollection.java

Change-Id: I1ebcc44873eb12acd80b4a0a98d22a73c69a886c
2014-05-16 10:55:32 +09:00
Dave Borowitz
159ab09922 Reindex: Include exception cause when dying
Change-Id: I2602b2b857a594fb65e5b791bb14f888c95ff4c5
2014-05-16 00:30:43 +00:00
Shawn Pearce
334997292c Update Buck
java_library() now accepts provided_deps argument which replaces
our custom use of java_library2().

This change replaces compile_deps with provided_deps parameter in
gerrit_{plugin,extension} rules. Plugins that are using it must be
updated.

Change-Id: I16d53793da567c958267f91ca203e9cae6c4d02f
2014-05-04 12:54:17 +02:00
Shawn Pearce
c798b4cc20 Merge "Add support for SAP MaxDB" 2014-05-02 17:44:07 +00:00
Ahaan Ugale
3e107f55d7 Allow plugins to replace the WebSession implementation
Plugins can replace the existing implementation with the statement:
DynamicItem.bind(binder(), WebSession.class).to(...);
in a module designated as a "<Gerrit-HttpModule>" in the manifest.

Just the Cache implementation used for web sessions can be changed
by binding to a subclass of the now abstract CacheBasedWebSession
which supplies the Cache in the superclass constructor.

This is a step towards solving web session issues with multi-master.

Change-Id: I255661a62cfcbfe07646cb90005764061d618f3d
2014-05-01 16:06:14 -06:00
David Ostrovsky
abbd20df2a Switch to using new PluginData class
176b801295fbe616689390f8ff4c11b18d1884fc added PluginData class but
missed to switch the code to use the new class.

Change-Id: Iee6665cd4643ad9251e8feadc31894212bd5ee4c
2014-04-30 21:43:37 +02:00
David Ostrovsky
e73ae61339 Apply "type inference for generic instance creation" Java 7 feature
Change-Id: Ia14802c903ca67b9d94dc6038d70b0e9644bc621
2014-04-26 15:27:57 +02:00
Dariusz Luksza
011cfedc61 Expose Jetty JMX extensions
Jetty by default provides set of MBeans that can be registered in JMX.
This patch adds new configuration option called httpd.registerMBeans, by
default set to false, to control this behavior.

Change-Id: I3771ed3bb755240d7d90e9f1f1d7e7f84ff33ce3
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2014-04-25 16:13:11 +02:00
David Ostrovsky
c7095c8450 Acceptance-tests: Fix 'Address already in use' bug
This change fixes ephemeral port assignment for HTTP and SSH daemons.

Current implementation is broken: it assigns a random port in GerritServer,
closes the socket and effectively freeing it for the kernel to recycle to
another thread, and store that port in gerrit.config file for reuse. Some
time later in HTTP and SSH daemons the port number get read from the config
file and the ports are bound.  The problem is, that during this "think time"
another test got the same port assigned and bind attempt is failing with:

  Caused by: java.net.BindException: Address already in use

To rectify it, set port to 0 in gerrit.config for both HTTP and SSH daemons
and let the daemons to do the ephemeral port assignments.  In SSH and HTTP
daemons this special case is recognized and the assigned ports are written
back to gerrit.config to pass to the test harness side.

Change-Id: Ib4971b200d6dc86268674398fe590137ae35b6f3
2014-04-24 08:30:15 +02:00
David Ostrovsky
fe2934efab Acceptance-tests: Fix 'Address already in use' bug
This change fixes ephemeral port assignment for HTTP and SSH daemons.

Current implementation is broken: it assigns a random port in GerritServer,
closes the socket and effectively freeing it for the kernel to recycle to
another thread, and store that port in gerrit.config file for reuse. Some
time later in HTTP and SSH daemons the port number get read from the config
file and the ports are bound.  The problem is, that during this "think time"
another test got the same port assigned and bind attempt is failing with:

  Caused by: java.net.BindException: Address already in use

To rectify it, set port to 0 in gerrit.config for both HTTP and SSH daemons
and let the daemons to do the ephemeral port assignments.  In SSH and HTTP
daemons this special case is recognized and the assigned ports are written
back to gerrit.config to pass to the test harness side.

Change-Id: Ib4971b200d6dc86268674398fe590137ae35b6f3
2014-04-23 12:07:54 +00:00
Bruce Zu
52b7839c2d Fix: Guice creation error in Reindex
Run reindex without '--recheck-mergeable' will get
Guice creation error which say No implementation for
com.google.gerrit.server.change.ChangeKindCache was bound.

Fixed.

Change-Id: I89118ce699e91b82f26da772fd252e4f29645dc0
2014-04-15 13:03:06 +08:00
Dave Borowitz
8f92cb9b2b Extract a non-caching ChangeKindCache implementation for tests
Change-Id: I061e1eb96d167750af8b7fa533d6f8f5722bfc8f
2014-04-14 12:12:53 -07:00
Stefan Lay
3e8dee2861 Add support for SAP MaxDB
SAP MaxDB (http://maxdb.sap.com/) is now supported as a database.

Depends-On: I9385bafe481152ce0c1471f2a7f89b1db5abac80
Change-Id: Iae2ad25a3db3a1069b80cf5733c92882da86e404
2014-04-11 16:43:16 +02:00
David Pursehouse
df2227555a Merge branch 'stable-2.9'
* stable-2.9:
  SideBySide2: Show [ and ] shortcut keys in nav arrow tooltips
  Always auto confirm adding reviewers for set-reviewers SSH command
  Improve wording of 'parents' field description in CommitInfo
  Fix 'parents' field name of CommitInfo in REST documentation
  Implement pagination in project list screen
  Add option 'S' to projects REST API to support query offset
  Fix: Failure of acceptance tests.
  Fix link behaviour inconsistencies in change info panel
  Remove message box when editing topic of change
  Update cookbook plugin to latest revision
  Update Gerrit 2.9 release notes with info about 2.8.x series
  Update GWT version to 2.6.0 in debug launcher
  Do not refresh project list if filter did not change
  Fix inconsistent behavior of diff view when viewing binary files
  Update cookbook plugin to latest revision
  Correct Javadoc of RestReadView in extension API
  Emit ref-updated event when editing project access via web UI
  Fix ChangeListener auto-registered implementations
  Fix: The email notification of review comments gets stuck.
  Fix memory leak of SubIndex.NrtFuture objects
  Use consistent grammatical tense in command descriptions
  Make skip bar more user friendly
  Bump version to 2.8.4 in plugin API and archetypes
  Helper script to update API version in plugin archetype pom files
  Serialize GWT dbg and opt compiles
  Bump GERRIT_VERSION to 2.8.4
  Update the mysql documentation concerning charsets
  By default don't allow admins to create new branches by push
  Disable commitWithin when running Reindex
  Emit ref-updated event when editing project access via web UI
  SideBySide2: Fix syntax highlighting for shell files
  ChangeScreen2: Respect comment visibility strategy
  Don't add "Patch File" download link for merge commits

Conflicts:
	gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.java
	gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.properties
	gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java

Change-Id: I3f2cb9a9f98e2c39d98fae47b0407bdf4ab8e4f4
2014-04-10 18:55:32 +09:00
David Pursehouse
511a35bb6c Merge branch 'stable-2.8' into stable-2.9
* stable-2.8:
  Emit ref-updated event when editing project access via web UI
  Fix ChangeListener auto-registered implementations
  Fix: The email notification of review comments gets stuck.
  Use consistent grammatical tense in command descriptions
  Make skip bar more user friendly
  Bump version to 2.8.4 in plugin API and archetypes
  Helper script to update API version in plugin archetype pom files
  Serialize GWT dbg and opt compiles
  Bump GERRIT_VERSION to 2.8.4
  Update the mysql documentation concerning charsets
  By default don't allow admins to create new branches by push
  Disable commitWithin when running Reindex
  Emit ref-updated event when editing project access via web UI
  SideBySide2: Fix syntax highlighting for shell files
  ChangeScreen2: Respect comment visibility strategy
  Don't add "Patch File" download link for merge commits

The change 'ChangeScreen2: Respect comment visibility strategy' [1]
is dropped intentionally, see [2].

[1] https://gerrit-review.googlesource.com/55081
[2] https://gerrit-review.googlesource.com/#/c/55536/3/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java

Conflicts:
	Documentation/config-gerrit.txt
	VERSION
	gerrit-gwtui/BUCK
	gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java
	gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java
	gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java
	gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.java
	gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/project/ChangeProjectAccess.java
	gerrit-plugin-archetype/pom.xml
	gerrit-plugin-gwt-archetype/pom.xml
	gerrit-plugin-gwtui/pom.xml
	gerrit-plugin-js-archetype/pom.xml
	gerrit-server/src/main/java/com/google/gerrit/server/change/EmailReviewComments.java
	gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
	gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListMembersCommand.java

Change-Id: I16c848cb385080fd25555c983a3030e0f1cc560b
2014-04-09 10:41:52 +00:00
Dave Borowitz
e987bad63a Merge branch stable-2.9
* stable-2.9
  Split mergeability checks by priority
  Refactor MergeabilityChecker to use a builder pattern

Change-Id: Ibf2e6d86158e72728a2bebdd5f285dc15fbb5228
2014-03-27 15:32:21 -07:00
Dave Borowitz
6ea964a0a1 Split mergeability checks by priority
When a project config is updated or a change is merged, all open
changes on an entire project or branch need to be rechecked for
mergeability. For projects or branches with lots of open changes,
this can flood the queue with potentially slow checks. This will
block simpler cases, such as checking mergeability of a single change
during ReceiveCommits.

Define a new Priority enum on the MergeabilityChecksExecutor so we
can split the queue based on priority, allowing smaller, interactive
changes such as pushes to not wait for the entire queued backlog.

Change-Id: I57f9eb33dbbcd8a560adfe4458ce48d7b0817957
2014-03-27 15:08:24 -07:00
Shawn Pearce
905f219f80 Merge branch 'stable-2.9'
* stable-2.9:
  Set http queue size to max integer when maxQueued 0 is provided
  Include only current votes into change message when removing a reviewer
  Revert "== GERRIT" in documentation.
2014-03-27 09:31:43 -07:00
David Ostrovsky
14fe8bc093 Set http queue size to max integer when maxQueued 0 is provided
In 8e78797190ddb9e04f93190bae86fe3956f08b3d, in migration change from
Jetty 8 to Jetty 9 one special case was missing: maxQueued = 0. By
mapping this value to max capacity of the queue without extra check
for the 0 value makes Jetty fail to start with IllegalArgumentException
when httpd.minThreads (default 5) smaller then maxQueued.

Rectify it by assigning Integer.MAX_VALUE to maxQueued when 0 was set.
Adjust the documenatation to reflect this change.

Change-Id: I686cf75a0bd0af16983e52ba22e7957a65cbb5b9
2014-03-27 01:02:07 +00:00
Bruce Zu
af058e6dd3 Disable commitWithin when running Reindex
Disable the 'commitWithin' from within Reindex by overriding
the configuration with '-1'. Treat negative values as the
original behavior, auto-flushing but not auto-committing, which
is the least safe but the most efficient for reindexing the
entire site. 

Change-Id: Ifdba797bee871d2a3d8928810a6304bacb850c8c
2014-03-26 18:05:10 +00:00
Edwin Kempin
2bf5eddb63 Add All-Users project to store meta data for all users
This change adds a migration that creates an All-Users project for
storing meta data for all users. With this change no data is stored in
this repository yet, but future changes will e.g. store user
preferences in this repository by creating a ref per user.

Change-Id: Ib1ba5e4c2fb7a2f8e49d3bcf994c99d9e911475c
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-03-25 22:27:27 +01:00
Edwin Kempin
01ed657015 Fix Guice bindings in reindex
Commit 218c6b69c288096630f5e17eec95689ea927b510 broke the reindex
program.

Change-Id: I91d4e3dceed5702fa928131c927a07ef9e1528c1
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-03-24 19:10:26 +01:00
Dariusz Luksza
5632a81aba Extract reusable parts from InitUtil
Moves reusable parts of InitUtil to FileUtil class in gerrit-common

Change-Id: Ia24a34028ec27d98cd7927d97822eb218c5719a8
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2014-03-24 17:04:35 +00:00
Dariusz Luksza
10cec6f11c Move Die exception to gerrit-common
This will allow to use the class in other places than just in PGM.

Change-Id: I007fb9686762b86c66fb34c4bbc44d775cd509d8
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2014-03-24 16:59:32 +00:00
Luca Milanesio
8a20298199 Allow external log4j.properties to use HttpLogLayout
When using an external custom log4j.properties using the 
-Dlog4j.configuration option, you may need to keep the 
ability to log HTTP activity using the Gerrit HttpLogLayout.

Change-Id: Ibd4b36736fa0f716c346d41f5586f8e66a5d1431
2014-03-02 17:58:13 +00:00
Saša Živkov
794c0cd9f6 Merge "Fix unreleased stream resources" 2014-02-25 10:02:07 +00:00
Edwin Kempin
fa94af156c Fix unreleased stream resources
Some streams were not properly closed.

1. ProtoGen:
The OutputStream returned by lock.getOutputStream() was not closed in
case the instantiation of OutputStreamWriter failed with an
IOException.

2. InitUtil:
The InputStream was never closed. IO.readWholeStream(...) says that it
is the responsibility of the caller to close the stream.

3. Libraries:
The InputStream was not closed in case the instantiation of
InputStreamReader failed with an IOException.

4. JythonShell:
The InputStream was never closed.

5. LogFileCompressor:
The FileOuputStream was not closed in case the instantiation of
GZIPOutputStream failed with an IOException.

6. Version:
The InputStream was not closed in case the instantiation of
InputStreamReader failed with an IOException.

7. PrologCompiler:
The FileOutputStream was not closed in case the instantiation of
JarOutputStream failed with an IOException.

8. EncryptedContactStore:
The FileInputStream was not closed in case
PGPUtil.getDecoderStream(in) failed with an IOException.

9. HttpContactStoreConnection:
The OutputStream was not closed in case out.write(body) failed with an
IOException.

Change-Id: I05e10ab67b2daaf85b9324a13c8c8daf510545f7
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-02-25 10:33:50 +01:00
Edwin Kempin
d20a20ce94 Don't always close URLClassLoaders in InitPluginStepsLoader
Similar like it is done by commit 6a88c2fcb8c0f66d9c077a7aedd907c0b49caecf
the URLClassLoader should not be closed since closing it means that it can
no longer be used to load new classes or resources that are defined by this
loader.

This partially reverts commit 21e277760e472a3043d0059ecb9a172eb1a01310.

Change-Id: I57952fbf7a94eff9563fb205b42d86545fc3ff8a
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-02-25 08:10:07 +00:00
Dave Borowitz
6a88c2fcb8 Don't always close URLClassLoaders
The documentation[1] says:
"Closes this URLClassLoader, so that it can no longer be used to load
new classes or resources that are defined by this loader."

This was incorrectly converted to try-with-resources in [2].

The purpose of this method is to add URLs to the existing ClassLoader
so they can be used in the future, so closing it immediately is
counterproductive, and indeed was causing NoClassDefFoundErrors when
trying to start Gerrit.

[1] http://docs.oracle.com/javase/7/docs/api/java/net/URLClassLoader.html#close()
[2] Iead344269bc0b985b2cd2176f15a764e6a0abb70

Change-Id: I322b665a164e1783ca872ba7dcafdc9ad09e139a
2014-02-24 11:12:26 -08:00
David Pursehouse
21e277760e Use Java 7 try-with-resources in InitPluginStepsLoader
The try-with-resources statement ensures that the created resources
are always closed.  Thus we can remove the suppression of Eclipse's
warnings about unclosed resources.

Change-Id: Ib20620d35e2b18fd061f6b1ea4d97eb9a00003bc
2014-02-25 00:10:57 +09:00
David Pursehouse
0ca4e9302c Use Java 7 style exception handling in IoUtil
- The try-with-resources statement ensures that the URLClassReader
  is always closed, and allows to remove the suppression of Eclipse's
  warning about an unclosed resource.

- Catching multiple exception types in the same block reduces the
  amount of duplicated code.

Change-Id: Iead344269bc0b985b2cd2176f15a764e6a0abb70
2014-02-24 23:59:21 +09:00
Edwin Kempin
f63789bf6f Merge "Control which plugins will be auto installed on auto init" 2014-02-24 10:28:57 +00:00
Edwin Kempin
1edb6604dd Merge "Install all packaged plugins automatically on auto site init" 2014-02-24 10:28:35 +00:00
Saša Živkov
9f058b37bc Control which plugins will be auto installed on auto init
Use the system property 'gerrit.install_plugins' to control which
of the packaged plugins will be installed during auto site init
in a servlet container.

When 'gerrit.install_plugins' property is not defined then all packaged
plugins will be installed. If it is present then it is parsed as a
comma separated list of plugin names to install. Defining an empty
string as the property value means that no plugin will be installed.

Change-Id: I52881c9677bc9cc1e51c46c2c2ce4558c79b9a3e
2014-02-24 11:11:04 +01:00
Edwin Kempin
65d06e4f34 Merge "Fix init from WebAppInitializer when using -Dgerrit.site_path" 2014-02-21 12:26:09 +00:00
Saša Živkov
e2a1e7ef34 Install all packaged plugins automatically on auto site init
When Gerrit is deployed in a servlet container and the system property
'gerrit.init' is defined then, besides the automatic site
initialization, also all packaged plugins (under WEB-INF/plugins) will
be installed.

Change-Id: Ia1e50d88ba63e96fc70717f854c87c7409f0c618
2014-02-21 13:24:09 +01:00
Saša Živkov
e90d6e81d3 Fix init from WebAppInitializer when using -Dgerrit.site_path
This fix is mostly useful for those developers who want to deploy/test
Gerrit in Tomcat, use the embedded H2 database and have automatic init
on deployment.

The init of a new site on startup (from WebAppInitializer) was failing
when the site was provided via the -Dgerrit.site_path property because
we assumed that the database initialization has to be skipped always
when running in a servlet container. However, this is only true for
the case when using the -Dgerrit.init_path. When Gerrit site is provided
via -Dgerrit.site_path then we have to perform database initialization.

Change-Id: Id577f391cd888bd71ec8502e8ad2f621cbc3fd80
2014-02-21 13:24:03 +01:00
Shawn Pearce
863e987e6a Merge "Remove unused constructor" 2014-02-17 23:18:26 +00:00
Shawn Pearce
4d42596868 Merge changes Iac79af54,Ief41eccc,Iae52ade9,I0bd9eabb,I2ef5b9e1
* changes:
  Solr index requires SolrCloud rather than plain Solr
  Handle exceptions during reindexing
  InitIndex: Allow user to configure the Solr index URL
  Solr index URL should be configured under the main "index" section
  Improve information message about rebuilding the index
2014-02-13 17:02:23 +00:00
Saša Živkov
dfc4e932e2 Remove unused constructor
Change-Id: Idc113534b034069d3f92aae074677ebac31a722c
2014-02-13 11:21:50 +01:00
David Pursehouse
d36f7cdc79 Merge "Refactor the way of binding ssh commands" 2014-02-12 09:04:41 +00:00
Shawn Pearce
929879fb93 Replace Guava Longs.compare with Java 7 Long.compare
As compare is now available as part of the runtime, just use the
standard function.

Change-Id: I7b2eb2587800a6549263ede90339adeab8c946a5
2014-02-11 15:59:23 -08:00
Dave Borowitz
b43baf2159 Move bindings now required by ChangeData into Reindex
Broken by I1bd2c931, but fortunately already available in the
MergeabilityModule so just a matter of moving them around.

Change-Id: I68c43d861b3d6d49c4e5e2d933c64dfa0a182be2
2014-02-11 06:57:40 -08:00
David Ostrovsky
83ea0403b1 Acceptance tests: Disable HTTPD per class or method annotation
If HTTPD not used in tests, it doesn't make much sense to enable it.

Using @NoHttpd on class or method it is now possible to disable HTTP
entirely and is another small step making slow tests fast.

With maturity of plugin API, more and more tests are going to move
to plugin API driven tests from REST driven tests.

Benchmark shows, that doing REST vs. plugin API comparisson:

  @Test
  public void rest() throws Exception {
    String changeId = createChange().getChangeId();
    for (int i = 0; i < 1000; i++) {
      getRESTChange(changeId, ALL);
    }
  }

  @Test
  public void api() throws Exception {
    String changeId = createChange().getChangeId();
    for (int i = 0; i < 1000; i++) {
      getPluginAPIChange(changeId, ALL);
    }
  }

make on my machine ca. 2 sec. for plugin API vs. 10 sec. for REST:
The whole Servlet/HTTP stack and Gson serialization
and deserialization is out if the picture for API driven tests.

Change-Id: If60170f06f466765d9602450043a1629a344d7ce
2014-02-07 18:11:17 -08:00
David Pursehouse
6ab111e94f Handle exceptions during reindexing
If an exception is thrown from within the change indexer, the reindex
program shows a stack trace.  In the case of an error when using the
Solr index, it does not exit and continues running, while showing debug
messages "Got ping response for sessionid", but not doing anything
else.

Catch exceptions in the indexer and exit with a fatal error message.

Change-Id: Ief41eccc0d3fe9c5592782b51afa66c0c3150886
2014-02-06 16:54:48 +09:00
David Pursehouse
da82877813 InitIndex: Allow user to configure the Solr index URL
If the index URL is not configured, running the `reindex`
program fails with:

  java.lang.IllegalStateException: index.url must be supplied

Add a step in the initialisation to allow the user to provide
the URL.  Set the default value to "localhost:9983".

Change-Id: Iae52ade99dd5e17a0688f090cd3f3aea3b676682
2014-02-06 16:54:37 +09:00
David Pursehouse
331dd5f199 Improve information message about rebuilding the index
When initialising Gerrit into an existing workspace, the index
should be "rebuilt", not "built".  Change the message accordingly.

Also add a new line at the beginning of the message to make it
stand out from the other information that is being output.  This
is consistent with other warnings such as the warning about
bouncycastle not being bundled.

Change-Id: I2ef5b9e141097da70fafd9dcf266988e9d6aaa27
2014-02-06 14:05:00 +09:00
Dave Borowitz
fc9d9628cd Remove excessive injection stack from InitIndex
All this class needs to do is mark an empty index as ready. Factor out
a small static method to do this work.

Change-Id: Id0bcef9cb7e5a6879288ed4716ea45fb6539f07c
2014-02-05 17:00:54 -08:00