Skip to content

Instantly share code, notes, and snippets.

View sns-seb's full-sized avatar

Sébastien Lesaint sns-seb

View GitHub Profile
@sns-seb
sns-seb / checkDriverDefaults.java
Last active September 25, 2020 14:18
Exploring Postgres driver defaults on sonarcould-core
@Override
public void start() {
try (Connection connection = database.getDataSource().getConnection()) {
try (ResultSet typeInfo = connection.getMetaData().getTypeInfo()) {
int fetchSize = typeInfo.getFetchSize();
int fetchDirection = typeInfo.getFetchDirection();
LOG.info("fetchSize=" + fetchSize + " fetchDirection=" + toFetchDirectionName(fetchDirection));
while (typeInfo.next()) {
int dataTypeId = typeInfo.getInt("DATA_TYPE");
String dataTypeName = toSqlTypeName(dataTypeId);
[slesaint@search-n2-Dev SC-1226]$ curl -X GET "10.0.72.231:9032/_nodes/hot_threads?pretty"
::: {search-n3-Dev}{0NZ7ydJgTq6Cz7oO9-bLfw}{dvHu0TTVRZy8_U7dv131OQ}{10.0.95.194}{10.0.95.194:9001}{rack_id=search-n3-Dev}
Hot threads at 2020-01-31T14:36:48.958Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
::: {search-n2-Dev}{eCDgBprbSCGEZvNMGLO-aw}{7aMbRrj5SiipXNTGseXRlQ}{10.0.72.231}{10.0.72.231:9001}{rack_id=search-n2-Dev}
Hot threads at 2020-01-31T14:36:48.960Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
::: {search-n1-Dev}{qGLbuap-QT-Zt9GmAD7Hzg}{yJL22PSuQJWoo0HSJo3qzA}{10.0.60.168}{10.0.60.168:9001}{rack_id=search-n1-Dev}
Hot threads at 2020-01-31T14:36:48.958Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
/*
* SonarQube
* Copyright (C) 2009-2019 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
============================
Vanilla
----
400000
250
Driver Name?= Microsoft JDBC Driver 7.3 for SQL Server, Driver Version?= 7.3.1.0, Product Name?= Microsoft SQL Server, Product Version?= 12.00.5571
rate 550 insert/s. progress 250/400000
rate 1190 insert/s. progress 500/400000
rate 605 insert/s. progress 750/400000
rate 939 insert/s. progress 1000/400000
package org.sonar.ce.task.projectanalysis.step;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
/*
* SonarQube
* Copyright (C) 2009-2019 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
-- ##H2
create TABLE TEST_SEB (
COL_1 varchar(10),
COL_2 varchar(10) NOT NULL
)
-- do not change nullity nor type
alter table TEST_SEB ALTER COLUMN COL_1 varchar(10) NULL;
alter table TEST_SEB ALTER COLUMN COL_2 varchar(10) NOT NULL;
-- change nullity
-- ##mssql
create TABLE TEST_SEB (
COL_1 nvarchar(10),
COL_2 nvarchar(10) NOT NULL
)
-- do not change nullity nor type
alter table TEST_SEB ALTER COLUMN COL_1 nvarchar(10) NULL;
alter table TEST_SEB ALTER COLUMN COL_2 nvarchar(10) NOT NULL;
-- change nullity
-- ##mysql
create TABLE TEST_SEB (
COL_1 varchar(10),
COL_2 varchar(10) NOT NULL
)
-- do not change nullity nor type
alter table TEST_SEB
MODIFY COLUMN COL_1 varchar(10) NULL,
MODIFY COLUMN COL_2 varchar(10) NOT NULL;