Merge branch 'stable-3.2'

* stable-3.2:
  Update git submodules
  Update git submodules
  Update git submodules
  Update documentation: NoteDb is the only storage format in 3.x
  Update git submodules
  Add max query timeout setting for h2 dialect
  Update git submodules
  Update git submodules
  e2e-tests: Replace value of 1 with reused constant
  e2e-tests: Add CheckMasterBranchReplica1 scenarios

Change-Id: Ie1c40c20528a23a84a343f04b543fb9ec60ff5c4
diff --git a/Documentation/intro-user.txt b/Documentation/intro-user.txt
index b91adbb..2483ba3 100644
--- a/Documentation/intro-user.txt
+++ b/Documentation/intro-user.txt
@@ -527,9 +527,6 @@
 informational grouping; changes with the same hashtags are not necessarily
 submitted together.
 
-The hashtag feature is only available when running under
-link:note-db.html[NoteDb].
-
 .Set Hashtag on Push
 ----
   $ git push origin HEAD:refs/for/master%t=stable-bugfix
diff --git a/Documentation/note-db.txt b/Documentation/note-db.txt
index 89758a0..a13cbfb 100644
--- a/Documentation/note-db.txt
+++ b/Documentation/note-db.txt
@@ -1,9 +1,10 @@
 :linkattrs:
 = Gerrit Code Review - NoteDb Backend
 
-NoteDb is the next generation of Gerrit storage backend, which replaces the
-traditional SQL backend for change, account and group metadata with storing
-data in the same repository as code changes.
+NoteDb is the storage backend for code review metadata. It is based on
+Git, so code reviews are stored together with the code under review.
+NoteDb replaced the traditional SQL backend for change, account and group
+metadata that was used in the 2.x series.
 
 .Advantages
 - *Simplicity*: All data is stored in one location in the site directory, rather
@@ -22,33 +23,19 @@
 - *New features*: Enables simple federation between Gerrit servers, as well as
   offline code review and interoperation with other tools.
 
-== Current Status
-
-- Storing change metadata is fully implemented in the 2.15 release, and is the
-  default for new sites.
-- Admins may use an link:#offline-migration[offline] or
-  link:#online-migration[online] tool to migrate change data in an existing
-  site from ReviewDb.
-- Storing link:config-accounts.html[account data] is fully implemented in the
-  2.15 release. Account data is migrated automatically during the upgrade
-  process by running `gerrit.war init`.
-- Storing link:config-groups.html[group metadata] is fully implemented
-  in the 2.16 release. Group data is migrated automatically during
-  the upgrade process by running `gerrit.war init`
-- Account, group and change metadata on the servers behind `googlesource.com` is fully
-  migrated to NoteDb. In other words, if you use
-  link:https://gerrit-review.googlesource.com/[gerrit-review,role=external,window=_blank], you're already
-  using NoteDb.
-- NoteDb is the only database format supported by Gerrit 3.0. The change data
-  migration tools are only included in Gerrit 2.15 and 2.16; they are not
-  available in 3.0.
-
 For an example NoteDb change, poke around at this one:
 ----
   git fetch https://gerrit.googlesource.com/gerrit refs/changes/70/98070/meta \
       && git log -p FETCH_HEAD
 ----
 
+== Current Status
+
+NoteDb is the only database format supported by Gerrit 3.0+. The
+change data migration tools are only included in Gerrit 2.16; they are
+not available in 3.0, so any upgrade from Gerrit 2.x to 3.x must go through
+2.16 to effect the NoteDb upgrade.
+
 [[migration]]
 == Migration
 
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index b483db8..25d6518 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -1009,8 +1009,6 @@
 Returns a list of every user ever assigned to a change, in the order in which
 they were first assigned.
 
-[NOTE] Past assignees are only available when NoteDb is enabled.
-
 .Request
 ----
   GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
@@ -2497,8 +2495,6 @@
 
 Gets the hashtags associated with a change.
 
-[NOTE] Hashtags are only available when NoteDb is enabled.
-
 .Request
 ----
   GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
@@ -2527,8 +2523,6 @@
 
 Adds and/or removes hashtags from a change.
 
-[NOTE] Hashtags are only available when NoteDb is enabled.
-
 The hashtags to add or remove must be provided in the request body inside a
 link:#hashtags-input[HashtagsInput] entity.
 
@@ -6291,8 +6285,7 @@
 |`reviewer_updates`|optional|
 Updates to reviewers set for the change as
 link:#review-update-info[ReviewerUpdateInfo] entities.
-Only set if link:#reviewer-updates[reviewer updates] are requested and
-if NoteDb is enabled.
+Only set if link:#reviewer-updates[reviewer updates] are requested.
 |`messages`|optional|
 Messages associated with the change as a list of
 link:#change-message-info[ChangeMessageInfo] entities. +
diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CheckMasterBranchReplica1.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CheckMasterBranchReplica1.json
new file mode 100644
index 0000000..54c54f8
--- /dev/null
+++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CheckMasterBranchReplica1.json
@@ -0,0 +1,5 @@
+[
+  {
+    "url": "http://HOSTNAME:HTTP_PORT1/a/projects/PROJECT/branches/master"
+  }
+]
diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/GetMasterBranchRevision.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/GetMasterBranchRevision.json
new file mode 100644
index 0000000..2b8809a
--- /dev/null
+++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/GetMasterBranchRevision.json
@@ -0,0 +1,5 @@
+[
+  {
+    "url": "http://HOSTNAME:HTTP_PORT/a/projects/PROJECT/branches/master"
+  }
+]
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala
index fe46bd6..e808d0d 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala
@@ -43,6 +43,6 @@
 
   setUp(
     test.inject(
-      atOnceUsers(1)
+      atOnceUsers(single)
     )).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckMasterBranchReplica1.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckMasterBranchReplica1.scala
new file mode 100644
index 0000000..96269f2
--- /dev/null
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckMasterBranchReplica1.scala
@@ -0,0 +1,73 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.scenarios
+
+import com.typesafe.config.ConfigFactory
+import io.gatling.core.Predef._
+import io.gatling.core.feeder.FeederBuilder
+import io.gatling.core.structure.ScenarioBuilder
+import io.gatling.http.Predef._
+
+import scala.concurrent.duration._
+
+class CheckMasterBranchReplica1 extends ProjectSimulation {
+  private val data: FeederBuilder = jsonFile(resource).convert(keys).queue
+
+  override def replaceOverride(in: String): String = {
+    val next = replaceProperty("http_port1", 8081, in)
+    super.replaceOverride(next)
+  }
+
+  private val httpForReplica = http.basicAuth(
+    conf.httpConfiguration.userName,
+    ConfigFactory.load().getString("http.password_replica"))
+
+  private val createChange = new CreateChange
+  private val approveChange = new ApproveChange(createChange)
+  private val submitChange = new SubmitChange(createChange)
+  private val getBranch = new GetMasterBranchRevision
+
+  private val test: ScenarioBuilder = scenario(unique)
+      .feed(data)
+      .exec(session => {
+        session.set(getBranch.revisionKey, getBranch.revision.get)
+      })
+      .exec(http(unique).get("${url}")
+          .check(regex(getBranch.revisionPattern)
+              .is(session => session(getBranch.revisionKey).as[String])))
+
+  setUp(
+    createChange.test.inject(
+      nothingFor(stepWaitTime(createChange) seconds),
+      atOnceUsers(single)
+    ),
+    approveChange.test.inject(
+      nothingFor(stepWaitTime(approveChange) seconds),
+      atOnceUsers(single)
+    ),
+    submitChange.test.inject(
+      nothingFor(stepWaitTime(submitChange) seconds),
+      atOnceUsers(single)
+    ),
+    getBranch.test.inject(
+      nothingFor(stepWaitTime(getBranch) seconds),
+      atOnceUsers(single)
+    ),
+    test.inject(
+      nothingFor(stepWaitTime(this) seconds),
+      atOnceUsers(single)
+    ).protocols(httpForReplica),
+  ).protocols(httpProtocol)
+}
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckProjectsCacheFlushEntries.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckProjectsCacheFlushEntries.scala
index 2424209..f1966b3 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckProjectsCacheFlushEntries.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CheckProjectsCacheFlushEntries.scala
@@ -42,6 +42,6 @@
 
   setUp(
     test.inject(
-      atOnceUsers(1)
+      atOnceUsers(single)
     )).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CloneUsingBothProtocols.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CloneUsingBothProtocols.scala
index c70c393..9f01e9f 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CloneUsingBothProtocols.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CloneUsingBothProtocols.scala
@@ -39,15 +39,15 @@
   setUp(
     createProject.test.inject(
       nothingFor(stepWaitTime(createProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     test.inject(
       nothingFor(stepWaitTime(this) seconds),
-      constantUsersPerSec(1) during (duration seconds)
+      constantUsersPerSec(single) during (duration seconds)
     ),
     deleteProject.test.inject(
       nothingFor(stepWaitTime(deleteProject) + duration seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
   ).protocols(gitProtocol, httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala
index c7fb8ed..ce37777 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala
@@ -50,19 +50,19 @@
   setUp(
     createProject.test.inject(
       nothingFor(stepWaitTime(createProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     test.inject(
       nothingFor(stepWaitTime(this) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     deleteChange.test.inject(
       nothingFor(stepWaitTime(deleteChange) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     deleteProject.test.inject(
       nothingFor(stepWaitTime(deleteProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
   ).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateProject.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateProject.scala
index 3d5e677..d631292 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateProject.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateProject.scala
@@ -32,6 +32,6 @@
 
   setUp(
     test.inject(
-      atOnceUsers(1)
+      atOnceUsers(single)
     )).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala
index aa6fe0d..5a06ff7 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala
@@ -43,6 +43,6 @@
 
   setUp(
     test.inject(
-      atOnceUsers(1)
+      atOnceUsers(single)
     )).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteProject.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteProject.scala
index 983ac0b..2007eba 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteProject.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteProject.scala
@@ -32,6 +32,6 @@
 
   setUp(
     test.inject(
-      atOnceUsers(1)
+      atOnceUsers(single)
     )).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/FlushProjectsCache.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/FlushProjectsCache.scala
index 94f4ae3..3dd8493 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/FlushProjectsCache.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/FlushProjectsCache.scala
@@ -38,23 +38,23 @@
   setUp(
     createProject.test.inject(
       nothingFor(stepWaitTime(createProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     getCacheEntriesAfterProject.test.inject(
       nothingFor(stepWaitTime(getCacheEntriesAfterProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     flushCache.inject(
       nothingFor(stepWaitTime(this) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     checkCacheEntriesAfterFlush.test.inject(
       nothingFor(stepWaitTime(checkCacheEntriesAfterFlush) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     deleteProject.test.inject(
       nothingFor(stepWaitTime(deleteProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
   ).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala
index 5d6176d..fc68f97 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala
@@ -30,6 +30,7 @@
   protected val resource: String = s"$pathName.json"
   protected val body: String = s"$pathName-body.json"
   protected val unique: String = name + "-" + this.hashCode()
+  protected val single = 1
 
   private val powerFactor: Double = replaceProperty("power_factor", 1.0).toDouble
   protected val SecondsPerWeightUnit: Int = 2
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetMasterBranchRevision.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetMasterBranchRevision.scala
new file mode 100644
index 0000000..4ceba60
--- /dev/null
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetMasterBranchRevision.scala
@@ -0,0 +1,41 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.scenarios
+
+import io.gatling.core.Predef._
+import io.gatling.core.feeder.FeederBuilder
+import io.gatling.core.structure.ScenarioBuilder
+import io.gatling.http.Predef._
+
+class GetMasterBranchRevision extends ProjectSimulation {
+  private val data: FeederBuilder = jsonFile(resource).convert(keys).queue
+  var revision: Option[String] = None
+  val revisionKey = "revision"
+  val revisionPattern: String = "\"" + revisionKey + "\": \"(.+)\""
+
+  val test: ScenarioBuilder = scenario(unique)
+      .feed(data)
+      .exec(http(unique).get("${url}")
+          .check(regex(revisionPattern).saveAs(revisionKey)))
+      .exec(session => {
+        revision = Some(session(revisionKey).as[String])
+        session
+      })
+
+  setUp(
+    test.inject(
+      atOnceUsers(single)
+    )).protocols(httpProtocol)
+}
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetProjectsCacheEntries.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetProjectsCacheEntries.scala
index 27e3f19..e73559e 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetProjectsCacheEntries.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GetProjectsCacheEntries.scala
@@ -40,6 +40,6 @@
 
   setUp(
     test.inject(
-      atOnceUsers(1)
+      atOnceUsers(single)
     )).protocols(httpProtocol)
 }
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ReplayRecordsFromFeeder.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ReplayRecordsFromFeeder.scala
index e5b41b3..1af2dc5 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ReplayRecordsFromFeeder.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ReplayRecordsFromFeeder.scala
@@ -43,7 +43,7 @@
   setUp(
     createProject.test.inject(
       nothingFor(stepWaitTime(createProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     test.inject(
       nothingFor(stepWaitTime(this) seconds),
@@ -54,7 +54,7 @@
     ),
     deleteProject.test.inject(
       nothingFor(maxBeforeDelete seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
   ).protocols(gitProtocol, httpProtocol)
       .maxDuration(maxExecutionTime seconds)
diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala
index 2f67274..48f9fa8 100644
--- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala
+++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala
@@ -24,8 +24,16 @@
 class SubmitChange extends GerritSimulation {
   private val data: FeederBuilder = jsonFile(resource).convert(keys).queue
   private val default: String = name
+  private var createChange = new CreateChange(default)
 
-  private val test: ScenarioBuilder = scenario(unique)
+  override def relativeRuntimeWeight = 10
+
+  def this(createChange: CreateChange) {
+    this()
+    this.createChange = createChange
+  }
+
+  val test: ScenarioBuilder = scenario(unique)
       .feed(data)
       .exec(session => {
         session.set("number", createChange.number)
@@ -33,30 +41,29 @@
       .exec(http(unique).post("${url}${number}/submit"))
 
   private val createProject = new CreateProject(default)
-  private val createChange = new CreateChange(default)
   private val approveChange = new ApproveChange(createChange)
   private val deleteProject = new DeleteProject(default)
 
   setUp(
     createProject.test.inject(
       nothingFor(stepWaitTime(createProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     createChange.test.inject(
       nothingFor(stepWaitTime(createChange) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     approveChange.test.inject(
       nothingFor(stepWaitTime(approveChange) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     test.inject(
       nothingFor(stepWaitTime(this) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
     deleteProject.test.inject(
       nothingFor(stepWaitTime(deleteProject) seconds),
-      atOnceUsers(1)
+      atOnceUsers(single)
     ),
   ).protocols(httpProtocol)
 }