Merge branch 'stable-3.1'

* stable-3.1:
  Add Zuul config
  Set version to 2.16.18-SNAPSHOT
  Set version to 2.16.17
  Schema_151: Attempt to add created_on column if it doesn't exist
  Update documentation links of 'numberOfShards' and 'numberOfReplicas'
  Support 'max_result_window' config for Elasticsearch indexes
  Add Zuul config
  Fix a typo in gr-file-list.js: dynmic -> dynamic
  Support displaying dynamic headers in gr-file-list
  Support displaying dynamic content and summary cells in gr-file-list
  Add headers to gr-file-list
  Add Zuul config
  Document dependency from account deactivator to autoUpdateAccountActiveStatus
  gr-change-view: Compute isParentCurrent
  Introduce NamedFluentLogger
  Update codemirror-editor
  Update git submodules
  Bazel: Fix plugin api javadoc generation
  Update git submodules
  Update git submodules
  Update git submodules
  Update git submodules
  ElasticContainer: Upgrade V6_8 to elasticsearch 6.8.7
  Add new prolog fact to documentation
  Add prolog predicate to determine number of parents

Change-Id: I7c4e21bbf698402def35fdee120caa43ce4f5f8c
This commit is contained in:
David Pursehouse 2020-03-19 13:33:17 +09:00
commit d9aa6b035f
10 changed files with 129 additions and 8 deletions

View File

@ -3142,7 +3142,7 @@ manually.
[[elasticsearch.numberOfShards]]elasticsearch.numberOfShards:: [[elasticsearch.numberOfShards]]elasticsearch.numberOfShards::
+ +
Sets the number of shards to use per index. Refer to the Sets the number of shards to use per index. Refer to the
link:https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-concepts.html#getting-started-shards-and-replicas[ link:https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#_static_index_settings[
Elasticsearch documentation,role=external,window=_blank] for details. Elasticsearch documentation,role=external,window=_blank] for details.
+ +
Defaults to 5 for Elasticsearch versions 5 and 6, and to 1 starting with Elasticsearch 7. Defaults to 5 for Elasticsearch versions 5 and 6, and to 1 starting with Elasticsearch 7.
@ -3150,11 +3150,19 @@ Defaults to 5 for Elasticsearch versions 5 and 6, and to 1 starting with Elastic
[[elasticsearch.numberOfReplicas]]elasticsearch.numberOfReplicas:: [[elasticsearch.numberOfReplicas]]elasticsearch.numberOfReplicas::
+ +
Sets the number of replicas to use per index. Refer to the Sets the number of replicas to use per index. Refer to the
link:https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-concepts.html#getting-started-shards-and-replicas[ link:https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#dynamic-index-settings[
Elasticsearch documentation,role=external,window=_blank] for details. Elasticsearch documentation,role=external,window=_blank] for details.
+ +
Defaults to 1. Defaults to 1.
[[elasticsearch.maxResultWindow]]elasticsearch.maxResultWindow::
+
Sets the maximum value of `from + size` for searches to use per index. Refer to the
link:https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#dynamic-index-settings[
Elasticsearch documentation,role=external,window=_blank] for details.
+
Defaults to 10000.
==== Elasticsearch Security ==== Elasticsearch Security
When security is enabled in Elasticsearch, the username and password must be provided. When security is enabled in Elasticsearch, the username and password must be provided.
@ -5082,6 +5090,10 @@ account deactivations.
The link:#schedule-configuration-interval[interval] for running The link:#schedule-configuration-interval[interval] for running
account deactivations. account deactivations.
Note that the task will only be scheduled if the
link:#autoUpdateAccountActiveStatus[auth.autoUpdateAccountActiveStatus]
is set to true.
link:#schedule-configuration-examples[Schedule examples] can be found link:#schedule-configuration-examples[Schedule examples] can be found
in the link:#schedule-configuration[Schedule Configuration] section. in the link:#schedule-configuration[Schedule Configuration] section.

View File

@ -40,10 +40,13 @@ class ElasticConfiguration {
static final String KEY_SERVER = "server"; static final String KEY_SERVER = "server";
static final String KEY_NUMBER_OF_SHARDS = "numberOfShards"; static final String KEY_NUMBER_OF_SHARDS = "numberOfShards";
static final String KEY_NUMBER_OF_REPLICAS = "numberOfReplicas"; static final String KEY_NUMBER_OF_REPLICAS = "numberOfReplicas";
static final String KEY_MAX_RESULT_WINDOW = "maxResultWindow";
static final String DEFAULT_PORT = "9200"; static final String DEFAULT_PORT = "9200";
static final String DEFAULT_USERNAME = "elastic"; static final String DEFAULT_USERNAME = "elastic";
static final int DEFAULT_NUMBER_OF_SHARDS = 0; static final int DEFAULT_NUMBER_OF_SHARDS = 0;
static final int DEFAULT_NUMBER_OF_REPLICAS = 1; static final int DEFAULT_NUMBER_OF_REPLICAS = 1;
static final int DEFAULT_MAX_RESULT_WINDOW = 10000;
private final Config cfg; private final Config cfg;
private final List<HttpHost> hosts; private final List<HttpHost> hosts;
@ -52,6 +55,7 @@ class ElasticConfiguration {
final String password; final String password;
final int numberOfShards; final int numberOfShards;
final int numberOfReplicas; final int numberOfReplicas;
final int maxResultWindow;
final String prefix; final String prefix;
@Inject @Inject
@ -68,6 +72,8 @@ class ElasticConfiguration {
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_SHARDS, DEFAULT_NUMBER_OF_SHARDS); cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_SHARDS, DEFAULT_NUMBER_OF_SHARDS);
this.numberOfReplicas = this.numberOfReplicas =
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_REPLICAS, DEFAULT_NUMBER_OF_REPLICAS); cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_REPLICAS, DEFAULT_NUMBER_OF_REPLICAS);
this.maxResultWindow =
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_MAX_RESULT_WINDOW, DEFAULT_MAX_RESULT_WINDOW);
this.hosts = new ArrayList<>(); this.hosts = new ArrayList<>();
for (String server : cfg.getStringList(SECTION_ELASTICSEARCH, null, KEY_SERVER)) { for (String server : cfg.getStringList(SECTION_ELASTICSEARCH, null, KEY_SERVER)) {
try { try {

View File

@ -35,6 +35,7 @@ class ElasticSetting {
properties.analysis = fields.build(); properties.analysis = fields.build();
properties.numberOfShards = config.getNumberOfShards(adapter); properties.numberOfShards = config.getNumberOfShards(adapter);
properties.numberOfReplicas = config.numberOfReplicas; properties.numberOfReplicas = config.numberOfReplicas;
properties.maxResultWindow = config.maxResultWindow;
return properties; return properties;
} }
@ -75,6 +76,7 @@ class ElasticSetting {
Map<String, FieldProperties> analysis; Map<String, FieldProperties> analysis;
Integer numberOfShards; Integer numberOfShards;
Integer numberOfReplicas; Integer numberOfReplicas;
Integer maxResultWindow;
} }
static class FieldProperties { static class FieldProperties {

View File

@ -57,10 +57,14 @@ public class AccountDeactivator implements Runnable {
@Override @Override
public void start() { public void start() {
if (!supportAutomaticAccountActivityUpdate) { if (schedule.isPresent()) {
return; if (supportAutomaticAccountActivityUpdate) {
queue.scheduleAtFixedRate(deactivator, schedule.get());
} else {
logger.atWarning().log(
"Not scheduling AccountDeactivator because auth.autoUpdateAccountActiveStatus is false");
}
} }
schedule.ifPresent(s -> queue.scheduleAtFixedRate(deactivator, s));
} }
@Override @Override

View File

@ -8,6 +8,7 @@ java_library(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//lib:gson", "//lib:gson",
"//lib/flogger:api",
"//lib/log:log4j", "//lib/log:log4j",
], ],
) )

View File

@ -0,0 +1,84 @@
// 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.util.logging;
import com.google.common.flogger.AbstractLogger;
import com.google.common.flogger.LogContext;
import com.google.common.flogger.LoggingApi;
import com.google.common.flogger.backend.LoggerBackend;
import com.google.common.flogger.backend.Platform;
import com.google.common.flogger.parser.DefaultPrintfMessageParser;
import com.google.common.flogger.parser.MessageParser;
import java.util.logging.Level;
/**
* FluentLogger.forEnclosingClass() searches for caller class name and passes it as String to
* constructor FluentLogger.FluentLogger(LoggerBackend) (which is package protected).
*
* <p>This allows to create NamedFluentLogger with given name so that dedicated configuration can be
* specified by a custom appender in the log4j.properties file. An example of this is the logger
* used by the replication queue in the replication plugin, and gerrit's Garbage Collection log.
*/
public class NamedFluentLogger extends AbstractLogger<NamedFluentLogger.Api> {
/** Copied from FluentLogger */
public interface Api extends LoggingApi<Api> {}
/** Copied from FluentLogger */
private static final class NoOp extends LoggingApi.NoOp<Api> implements Api {}
private static final NoOp NO_OP = new NoOp();
public static NamedFluentLogger forName(String name) {
return new NamedFluentLogger(Platform.getBackend(name));
}
private NamedFluentLogger(LoggerBackend backend) {
super(backend);
}
@Override
public Api at(Level level) {
boolean isLoggable = isLoggable(level);
boolean isForced = Platform.shouldForceLogging(getName(), level, isLoggable);
return (isLoggable || isForced) ? new Context(level, isForced) : NO_OP;
}
/** Copied from FluentLogger */
private final class Context extends LogContext<NamedFluentLogger, Api> implements Api {
private Context(Level level, boolean isForced) {
super(level, isForced);
}
@Override
protected NamedFluentLogger getLogger() {
return NamedFluentLogger.this;
}
@Override
protected Api api() {
return this;
}
@Override
protected Api noOp() {
return NO_OP;
}
@Override
protected MessageParser getMessageParser() {
return DefaultPrintfMessageParser.getInstance();
}
}
}

View File

@ -53,7 +53,7 @@ public class ElasticContainer extends ElasticsearchContainer {
case V6_7: case V6_7:
return "blacktop/elasticsearch:6.7.2"; return "blacktop/elasticsearch:6.7.2";
case V6_8: case V6_8:
return "blacktop/elasticsearch:6.8.6"; return "blacktop/elasticsearch:6.8.7";
case V7_0: case V7_0:
return "blacktop/elasticsearch:7.0.1"; return "blacktop/elasticsearch:7.0.1";
case V7_1: case V7_1:

View File

@ -54,6 +54,7 @@ EXPORTS = [
"//java/com/google/gerrit/server/util/time", "//java/com/google/gerrit/server/util/time",
"//java/com/google/gerrit/util/cli", "//java/com/google/gerrit/util/cli",
"//java/com/google/gerrit/util/http", "//java/com/google/gerrit/util/http",
"//java/com/google/gerrit/util/logging",
"//lib/antlr:java-runtime", "//lib/antlr:java-runtime",
"//lib/auto:auto-value-annotations", "//lib/auto:auto-value-annotations",
"//lib/commons:compress", "//lib/commons:compress",

View File

@ -343,7 +343,10 @@ class GrChangeView extends mixinBehaviors( [
value: false, value: false,
observer: '_updateToggleContainerClass', observer: '_updateToggleContainerClass',
}, },
_parentIsCurrent: Boolean, _parentIsCurrent: {
type: Boolean,
computed: '_isParentCurrent(_currentRevisionActions)',
},
_submitEnabled: { _submitEnabled: {
type: Boolean, type: Boolean,
computed: '_isSubmitEnabled(_currentRevisionActions)', computed: '_isSubmitEnabled(_currentRevisionActions)',
@ -1577,6 +1580,14 @@ class GrChangeView extends mixinBehaviors( [
revisionActions.submit.enabled); revisionActions.submit.enabled);
} }
_isParentCurrent(revisionActions) {
if (revisionActions && revisionActions.rebase) {
return !revisionActions.rebase.enabled;
} else {
return true;
}
}
_getEdit() { _getEdit() {
return this.$.restAPI.getChangeEdit(this._changeNum, true); return this.$.restAPI.getChangeEdit(this._changeNum, true);
} }

View File

@ -32,7 +32,7 @@ def _impl(ctx):
"export TZ", "export TZ",
"rm -rf %s" % source, "rm -rf %s" % source,
"mkdir %s" % source, "mkdir %s" % source,
" && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars.to_list()]), " && ".join(["unzip -qoud %s %s" % (source, j.path) for j in source_jars.to_list()]),
"rm -rf %s" % dir, "rm -rf %s" % dir,
"mkdir %s" % dir, "mkdir %s" % dir,
" ".join([ " ".join([