Merge branch 'stable-3.1'
* stable-3.1: Update web-component-tester to 6.5.1 Add support for Elasticsearch version 7.6.* Error Prone: Enable and fix ClassCanBeStatic Write upload-pack metrics to sshd log Fix error when try assign on getter with existing property Change-Id: Iddbdd868686e9fe5eca0175a7faec57f70173c0c
This commit is contained in:
commit
33c6b3d1ff
@ -31,7 +31,8 @@ public enum ElasticVersion {
|
||||
V7_2("7.2.*"),
|
||||
V7_3("7.3.*"),
|
||||
V7_4("7.4.*"),
|
||||
V7_5("7.5.*");
|
||||
V7_5("7.5.*"),
|
||||
V7_6("7.6.*");
|
||||
|
||||
private final String version;
|
||||
private final Pattern pattern;
|
||||
|
@ -80,7 +80,7 @@ public abstract class BaseCommand implements Command {
|
||||
protected OutputStream out;
|
||||
protected OutputStream err;
|
||||
|
||||
private ExitCallback exit;
|
||||
protected ExitCallback exit;
|
||||
|
||||
@Inject protected CurrentUser user;
|
||||
|
||||
@ -88,7 +88,7 @@ public abstract class BaseCommand implements Command {
|
||||
|
||||
@Inject private CmdLineParser.Factory cmdLineParserFactory;
|
||||
|
||||
@Inject private RequestCleanup cleanup;
|
||||
@Inject protected RequestCleanup cleanup;
|
||||
|
||||
@Inject @CommandExecutor private ScheduledThreadPoolExecutor executor;
|
||||
|
||||
|
@ -187,7 +187,7 @@ class CommandFactoryProvider implements Provider<CommandFactory>, LifecycleListe
|
||||
@Override
|
||||
public void onExit(int rc, String exitMessage) {
|
||||
exit.onExit(translateExit(rc), exitMessage);
|
||||
log(rc);
|
||||
log(rc, exitMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -225,6 +225,12 @@ class CommandFactoryProvider implements Provider<CommandFactory>, LifecycleListe
|
||||
}
|
||||
}
|
||||
|
||||
private void log(int rc, String message) {
|
||||
if (logged.compareAndSet(false, true)) {
|
||||
log.onExecute(cmd, rc, ctx.getSession(), message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(ChannelSession channel) {
|
||||
Future<?> future = task.getAndSet(null);
|
||||
|
@ -53,6 +53,7 @@ class SshLog implements LifecycleListener, GerritConfigListener {
|
||||
private static final String P_EXEC = "executionTime";
|
||||
private static final String P_STATUS = "status";
|
||||
private static final String P_AGENT = "agent";
|
||||
private static final String P_MESSAGE = "message";
|
||||
|
||||
private final Provider<SshSession> session;
|
||||
private final Provider<Context> context;
|
||||
@ -147,6 +148,10 @@ class SshLog implements LifecycleListener, GerritConfigListener {
|
||||
}
|
||||
|
||||
void onExecute(DispatchCommand dcmd, int exitValue, SshSession sshSession) {
|
||||
onExecute(dcmd, exitValue, sshSession, null);
|
||||
}
|
||||
|
||||
void onExecute(DispatchCommand dcmd, int exitValue, SshSession sshSession, String message) {
|
||||
final Context ctx = context.get();
|
||||
ctx.finished = TimeUtil.nowMs();
|
||||
|
||||
@ -180,6 +185,10 @@ class SshLog implements LifecycleListener, GerritConfigListener {
|
||||
event.setProperty(P_AGENT, peerAgent);
|
||||
}
|
||||
|
||||
if (message != null) {
|
||||
event.setProperty(P_MESSAGE, message);
|
||||
}
|
||||
|
||||
if (async != null) {
|
||||
async.append(event);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public final class SshLogLayout extends Layout {
|
||||
private static final String P_EXEC = "executionTime";
|
||||
private static final String P_STATUS = "status";
|
||||
private static final String P_AGENT = "agent";
|
||||
private static final String P_MESSAGE = "message";
|
||||
|
||||
private final Calendar calendar;
|
||||
private long lastTimeMillis;
|
||||
@ -68,6 +69,7 @@ public final class SshLogLayout extends Layout {
|
||||
|
||||
opt(P_WAIT, buf, event);
|
||||
opt(P_EXEC, buf, event);
|
||||
opt(P_MESSAGE, buf, event);
|
||||
opt(P_STATUS, buf, event);
|
||||
opt(P_AGENT, buf, event);
|
||||
|
||||
|
@ -37,6 +37,7 @@ import com.google.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.storage.pack.PackStatistics;
|
||||
import org.eclipse.jgit.transport.PostUploadHook;
|
||||
import org.eclipse.jgit.transport.PostUploadHookChain;
|
||||
import org.eclipse.jgit.transport.PreUploadHook;
|
||||
@ -54,6 +55,8 @@ final class Upload extends AbstractGitCommand {
|
||||
@Inject private SshSession session;
|
||||
@Inject private PermissionBackend permissionBackend;
|
||||
|
||||
private PackStatistics stats;
|
||||
|
||||
@Override
|
||||
protected void runImpl() throws IOException, Failure {
|
||||
PermissionBackend.ForProject perm =
|
||||
@ -94,6 +97,7 @@ final class Upload extends AbstractGitCommand {
|
||||
up.setProtocolV2Hook(tracingHook);
|
||||
up.upload(in, out, err);
|
||||
session.setPeerAgent(up.getPeerUserAgent());
|
||||
stats = up.getStatistics();
|
||||
} catch (UploadValidationException e) {
|
||||
// UploadValidationException is used by the UploadValidators to
|
||||
// stop the uploadPack. We do not want this exception to go beyond this
|
||||
@ -104,4 +108,36 @@ final class Upload extends AbstractGitCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExit(int rc) {
|
||||
exit.onExit(
|
||||
rc,
|
||||
stats != null
|
||||
? stats.getTimeNegotiating()
|
||||
+ "ms "
|
||||
+ stats.getTimeSearchingForReuse()
|
||||
+ "ms "
|
||||
+ stats.getTimeSearchingForSizes()
|
||||
+ "ms "
|
||||
+ stats.getTimeCounting()
|
||||
+ "ms "
|
||||
+ stats.getTimeCompressing()
|
||||
+ "ms "
|
||||
+ stats.getTimeWriting()
|
||||
+ "ms "
|
||||
+ stats.getTimeTotal()
|
||||
+ "ms "
|
||||
+ stats.getBitmapIndexMisses()
|
||||
+ " "
|
||||
+ stats.getTotalDeltas()
|
||||
+ " "
|
||||
+ stats.getTotalObjects()
|
||||
+ " "
|
||||
+ stats.getTotalBytes()
|
||||
: "-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1");
|
||||
if (cleanup != null) {
|
||||
cleanup.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class ElasticReindexIT extends AbstractReindexTests {
|
||||
|
||||
@ConfigSuite.Config
|
||||
public static Config elasticsearchV7() {
|
||||
return getConfig(ElasticVersion.V7_5);
|
||||
return getConfig(ElasticVersion.V7_6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public class ElasticIndexIT extends AbstractIndexTests {
|
||||
|
||||
@ConfigSuite.Config
|
||||
public static Config elasticsearchV7() {
|
||||
return getConfig(ElasticVersion.V7_5);
|
||||
return getConfig(ElasticVersion.V7_6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,6 +64,8 @@ public class ElasticContainer extends ElasticsearchContainer {
|
||||
return "blacktop/elasticsearch:7.4.2";
|
||||
case V7_5:
|
||||
return "blacktop/elasticsearch:7.5.2";
|
||||
case V7_6:
|
||||
return "blacktop/elasticsearch:7.6.0";
|
||||
}
|
||||
throw new IllegalStateException("No tests for version: " + version.name());
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
client = HttpAsyncClients.createDefault();
|
||||
client.start();
|
||||
|
@ -41,7 +41,7 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class ElasticV7QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
return;
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,9 @@ public class ElasticVersionTest {
|
||||
|
||||
assertThat(ElasticVersion.forVersion("7.5.0")).isEqualTo(ElasticVersion.V7_5);
|
||||
assertThat(ElasticVersion.forVersion("7.5.1")).isEqualTo(ElasticVersion.V7_5);
|
||||
|
||||
assertThat(ElasticVersion.forVersion("7.6.0")).isEqualTo(ElasticVersion.V7_6);
|
||||
assertThat(ElasticVersion.forVersion("7.6.1")).isEqualTo(ElasticVersion.V7_6);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -93,6 +96,7 @@ public class ElasticVersionTest {
|
||||
assertThat(ElasticVersion.V7_3.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
|
||||
assertThat(ElasticVersion.V7_4.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
|
||||
assertThat(ElasticVersion.V7_5.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
|
||||
assertThat(ElasticVersion.V7_6.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -111,6 +115,7 @@ public class ElasticVersionTest {
|
||||
assertThat(ElasticVersion.V7_3.isV6OrLater()).isTrue();
|
||||
assertThat(ElasticVersion.V7_4.isV6OrLater()).isTrue();
|
||||
assertThat(ElasticVersion.V7_5.isV6OrLater()).isTrue();
|
||||
assertThat(ElasticVersion.V7_6.isV6OrLater()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -129,5 +134,6 @@ public class ElasticVersionTest {
|
||||
assertThat(ElasticVersion.V7_3.isV7OrLater()).isTrue();
|
||||
assertThat(ElasticVersion.V7_4.isV7OrLater()).isTrue();
|
||||
assertThat(ElasticVersion.V7_5.isV7OrLater()).isTrue();
|
||||
assertThat(ElasticVersion.V7_6.isV7OrLater()).isTrue();
|
||||
}
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ def declare_nongoogle_deps():
|
||||
# and httpasyncclient as necessary.
|
||||
maven_jar(
|
||||
name = "elasticsearch-rest-client",
|
||||
artifact = "org.elasticsearch.client:elasticsearch-rest-client:7.5.2",
|
||||
sha1 = "e11393f600a425b7f62e6f653e19a9e53556fd79",
|
||||
artifact = "org.elasticsearch.client:elasticsearch-rest-client:7.6.0",
|
||||
sha1 = "3d56c1fca22af1aab5a1b23698ae9ec6f71db1a2",
|
||||
)
|
||||
|
||||
maven_jar(
|
||||
|
Loading…
x
Reference in New Issue
Block a user