Merge branch 'stable-3.1' into stable-3.2

* stable-3.1:
  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: I3abc67206a6c5a45ee5398153be0874440e9c234
This commit is contained in:
Marco Miller
2020-07-01 13:32:25 -04:00
19 changed files with 171 additions and 62 deletions

View File

@@ -527,9 +527,6 @@ topics, a change can have multiple hashtags, and they are only used for
informational grouping; changes with the same hashtags are not necessarily informational grouping; changes with the same hashtags are not necessarily
submitted together. submitted together.
The hashtag feature is only available when running under
link:note-db.html[NoteDb].
.Set Hashtag on Push .Set Hashtag on Push
---- ----
$ git push origin HEAD:refs/for/master%t=stable-bugfix $ git push origin HEAD:refs/for/master%t=stable-bugfix

View File

@@ -1,9 +1,10 @@
:linkattrs: :linkattrs:
= Gerrit Code Review - NoteDb Backend = Gerrit Code Review - NoteDb Backend
NoteDb is the next generation of Gerrit storage backend, which replaces the NoteDb is the storage backend for code review metadata. It is based on
traditional SQL backend for change, account and group metadata with storing Git, so code reviews are stored together with the code under review.
data in the same repository as code changes. NoteDb replaced the traditional SQL backend for change, account and group
metadata that was used in the 2.x series.
.Advantages .Advantages
- *Simplicity*: All data is stored in one location in the site directory, rather - *Simplicity*: All data is stored in one location in the site directory, rather
@@ -22,33 +23,19 @@ data in the same repository as code changes.
- *New features*: Enables simple federation between Gerrit servers, as well as - *New features*: Enables simple federation between Gerrit servers, as well as
offline code review and interoperation with other tools. 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: For an example NoteDb change, poke around at this one:
---- ----
git fetch https://gerrit.googlesource.com/gerrit refs/changes/70/98070/meta \ git fetch https://gerrit.googlesource.com/gerrit refs/changes/70/98070/meta \
&& git log -p FETCH_HEAD && 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]]
== Migration == Migration

View File

@@ -979,8 +979,6 @@ If the change has no assignee the response is "`204 No Content`".
Returns a list of every user ever assigned to a change, in the order in which Returns a list of every user ever assigned to a change, in the order in which
they were first assigned. they were first assigned.
[NOTE] Past assignees are only available when NoteDb is enabled.
.Request .Request
---- ----
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/past_assignees HTTP/1.0
@@ -2457,8 +2455,6 @@ This allows users to "highlight" changes in their dashboard
Gets the hashtags associated with a change. Gets the hashtags associated with a change.
[NOTE] Hashtags are only available when NoteDb is enabled.
.Request .Request
---- ----
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0 GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/hashtags HTTP/1.0
@@ -2487,8 +2483,6 @@ As response the change's hashtags are returned as a list of strings.
Adds and/or removes hashtags from a change. 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 The hashtags to add or remove must be provided in the request body inside a
link:#hashtags-input[HashtagsInput] entity. link:#hashtags-input[HashtagsInput] entity.
@@ -6018,8 +6012,7 @@ Only set if link:#detailed-labels[detailed labels] are requested.
|`reviewer_updates`|optional| |`reviewer_updates`|optional|
Updates to reviewers set for the change as Updates to reviewers set for the change as
link:#review-update-info[ReviewerUpdateInfo] entities. link:#review-update-info[ReviewerUpdateInfo] entities.
Only set if link:#reviewer-updates[reviewer updates] are requested and Only set if link:#reviewer-updates[reviewer updates] are requested.
if NoteDb is enabled.
|`messages`|optional| |`messages`|optional|
Messages associated with the change as a list of Messages associated with the change as a list of
link:#change-message-info[ChangeMessageInfo] entities. + link:#change-message-info[ChangeMessageInfo] entities. +

View File

@@ -0,0 +1,5 @@
[
{
"url": "http://HOSTNAME:HTTP_PORT1/a/projects/PROJECT/branches/master"
}
]

View File

@@ -0,0 +1,5 @@
[
{
"url": "http://HOSTNAME:HTTP_PORT/a/projects/PROJECT/branches/master"
}
]

View File

@@ -43,6 +43,6 @@ class ApproveChange extends GerritSimulation {
setUp( setUp(
test.inject( test.inject(
atOnceUsers(1) atOnceUsers(single)
)).protocols(httpProtocol) )).protocols(httpProtocol)
} }

View File

@@ -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)
}

View File

@@ -42,6 +42,6 @@ class CheckProjectsCacheFlushEntries extends CacheFlushSimulation {
setUp( setUp(
test.inject( test.inject(
atOnceUsers(1) atOnceUsers(single)
)).protocols(httpProtocol) )).protocols(httpProtocol)
} }

View File

@@ -39,15 +39,15 @@ class CloneUsingBothProtocols extends GitSimulation {
setUp( setUp(
createProject.test.inject( createProject.test.inject(
nothingFor(stepWaitTime(createProject) seconds), nothingFor(stepWaitTime(createProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
test.inject( test.inject(
nothingFor(stepWaitTime(this) seconds), nothingFor(stepWaitTime(this) seconds),
constantUsersPerSec(1) during (duration seconds) constantUsersPerSec(single) during (duration seconds)
), ),
deleteProject.test.inject( deleteProject.test.inject(
nothingFor(stepWaitTime(deleteProject) + duration seconds), nothingFor(stepWaitTime(deleteProject) + duration seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
).protocols(gitProtocol, httpProtocol) ).protocols(gitProtocol, httpProtocol)
} }

View File

@@ -50,19 +50,19 @@ class CreateChange extends ProjectSimulation {
setUp( setUp(
createProject.test.inject( createProject.test.inject(
nothingFor(stepWaitTime(createProject) seconds), nothingFor(stepWaitTime(createProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
test.inject( test.inject(
nothingFor(stepWaitTime(this) seconds), nothingFor(stepWaitTime(this) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
deleteChange.test.inject( deleteChange.test.inject(
nothingFor(stepWaitTime(deleteChange) seconds), nothingFor(stepWaitTime(deleteChange) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
deleteProject.test.inject( deleteProject.test.inject(
nothingFor(stepWaitTime(deleteProject) seconds), nothingFor(stepWaitTime(deleteProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
).protocols(httpProtocol) ).protocols(httpProtocol)
} }

View File

@@ -32,6 +32,6 @@ class CreateProject extends ProjectSimulation {
setUp( setUp(
test.inject( test.inject(
atOnceUsers(1) atOnceUsers(single)
)).protocols(httpProtocol) )).protocols(httpProtocol)
} }

View File

@@ -43,6 +43,6 @@ class DeleteChange extends GerritSimulation {
setUp( setUp(
test.inject( test.inject(
atOnceUsers(1) atOnceUsers(single)
)).protocols(httpProtocol) )).protocols(httpProtocol)
} }

View File

@@ -32,6 +32,6 @@ class DeleteProject extends ProjectSimulation {
setUp( setUp(
test.inject( test.inject(
atOnceUsers(1) atOnceUsers(single)
)).protocols(httpProtocol) )).protocols(httpProtocol)
} }

View File

@@ -38,23 +38,23 @@ class FlushProjectsCache extends CacheFlushSimulation {
setUp( setUp(
createProject.test.inject( createProject.test.inject(
nothingFor(stepWaitTime(createProject) seconds), nothingFor(stepWaitTime(createProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
getCacheEntriesAfterProject.test.inject( getCacheEntriesAfterProject.test.inject(
nothingFor(stepWaitTime(getCacheEntriesAfterProject) seconds), nothingFor(stepWaitTime(getCacheEntriesAfterProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
flushCache.inject( flushCache.inject(
nothingFor(stepWaitTime(this) seconds), nothingFor(stepWaitTime(this) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
checkCacheEntriesAfterFlush.test.inject( checkCacheEntriesAfterFlush.test.inject(
nothingFor(stepWaitTime(checkCacheEntriesAfterFlush) seconds), nothingFor(stepWaitTime(checkCacheEntriesAfterFlush) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
deleteProject.test.inject( deleteProject.test.inject(
nothingFor(stepWaitTime(deleteProject) seconds), nothingFor(stepWaitTime(deleteProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
).protocols(httpProtocol) ).protocols(httpProtocol)
} }

View File

@@ -30,6 +30,7 @@ class GerritSimulation extends Simulation {
protected val resource: String = s"$pathName.json" protected val resource: String = s"$pathName.json"
protected val body: String = s"$pathName-body.json" protected val body: String = s"$pathName-body.json"
protected val unique: String = name + "-" + this.hashCode() protected val unique: String = name + "-" + this.hashCode()
protected val single = 1
private val powerFactor: Double = replaceProperty("power_factor", 1.0).toDouble private val powerFactor: Double = replaceProperty("power_factor", 1.0).toDouble
protected val SecondsPerWeightUnit: Int = 2 protected val SecondsPerWeightUnit: Int = 2

View File

@@ -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)
}

View File

@@ -40,6 +40,6 @@ class GetProjectsCacheEntries extends CacheFlushSimulation {
setUp( setUp(
test.inject( test.inject(
atOnceUsers(1) atOnceUsers(single)
)).protocols(httpProtocol) )).protocols(httpProtocol)
} }

View File

@@ -43,7 +43,7 @@ class ReplayRecordsFromFeeder extends GitSimulation {
setUp( setUp(
createProject.test.inject( createProject.test.inject(
nothingFor(stepWaitTime(createProject) seconds), nothingFor(stepWaitTime(createProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
test.inject( test.inject(
nothingFor(stepWaitTime(this) seconds), nothingFor(stepWaitTime(this) seconds),
@@ -54,7 +54,7 @@ class ReplayRecordsFromFeeder extends GitSimulation {
), ),
deleteProject.test.inject( deleteProject.test.inject(
nothingFor(maxBeforeDelete seconds), nothingFor(maxBeforeDelete seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
).protocols(gitProtocol, httpProtocol) ).protocols(gitProtocol, httpProtocol)
.maxDuration(maxExecutionTime seconds) .maxDuration(maxExecutionTime seconds)

View File

@@ -24,8 +24,16 @@ import scala.concurrent.duration._
class SubmitChange extends GerritSimulation { class SubmitChange extends GerritSimulation {
private val data: FeederBuilder = jsonFile(resource).convert(keys).queue private val data: FeederBuilder = jsonFile(resource).convert(keys).queue
private val default: String = name 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) .feed(data)
.exec(session => { .exec(session => {
session.set("number", createChange.number) session.set("number", createChange.number)
@@ -33,30 +41,29 @@ class SubmitChange extends GerritSimulation {
.exec(http(unique).post("${url}${number}/submit")) .exec(http(unique).post("${url}${number}/submit"))
private val createProject = new CreateProject(default) private val createProject = new CreateProject(default)
private val createChange = new CreateChange(default)
private val approveChange = new ApproveChange(createChange) private val approveChange = new ApproveChange(createChange)
private val deleteProject = new DeleteProject(default) private val deleteProject = new DeleteProject(default)
setUp( setUp(
createProject.test.inject( createProject.test.inject(
nothingFor(stepWaitTime(createProject) seconds), nothingFor(stepWaitTime(createProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
createChange.test.inject( createChange.test.inject(
nothingFor(stepWaitTime(createChange) seconds), nothingFor(stepWaitTime(createChange) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
approveChange.test.inject( approveChange.test.inject(
nothingFor(stepWaitTime(approveChange) seconds), nothingFor(stepWaitTime(approveChange) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
test.inject( test.inject(
nothingFor(stepWaitTime(this) seconds), nothingFor(stepWaitTime(this) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
deleteProject.test.inject( deleteProject.test.inject(
nothingFor(stepWaitTime(deleteProject) seconds), nothingFor(stepWaitTime(deleteProject) seconds),
atOnceUsers(1) atOnceUsers(single)
), ),
).protocols(httpProtocol) ).protocols(httpProtocol)
} }