Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cbayer jdk17 spring 3.0.2 #588

Merged
merged 17 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -47,9 +47,10 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- name: Setup Java JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: 'zulu'

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
Expand All @@ -67,4 +68,4 @@ jobs:
./gradlew -PdockerRepo=salesforce/ -x test build --info

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v1
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 1.11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 1.11
distribution: 'zulu'
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Log into registry
Expand Down Expand Up @@ -42,5 +43,4 @@ jobs:
# with:
# image-name: salesforce/carbonj:${{ env.GRADLE_PROJECT_VERSION }}
# severity-threshold: CRITICAL
# run-quality-checks: false

# run-quality-checks: false
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 1.11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 1.11
java-version: 17
distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set git user
Expand All @@ -26,4 +27,4 @@ jobs:
- name: Release with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew -PdockerRepo=salesforce/ clean build -Prelease.useAutomaticVersion=true -x test :carbonj.service:release --info --stacktrace
run: ./gradlew -PdockerRepo=salesforce/ clean build -Prelease.useAutomaticVersion=true -x test :carbonj.service:release --info --stacktrace
35 changes: 17 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ buildscript {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.5.6")
classpath("org.springframework.boot:spring-boot-gradle-plugin:3.0.2")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add this to the top-level gradle.properties instead?

}
}

plugins {
id 'com.palantir.docker' version "0.34.0"
id "com.github.jk1.dependency-license-report" version "1.17"
id "com.github.hierynomus.license" version "0.15.0"
id "com.github.hierynomus.license" version "0.16.1"
id "org.sonarqube" version "3.5.0.2730"
id 'net.researchgate.release' version '3.0.2'
}
Expand All @@ -26,7 +26,7 @@ release {

allprojects {
// TODO remove
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: "com.github.hierynomus.license"
apply plugin: 'eclipse'
apply plugin: 'idea'
Expand All @@ -43,8 +43,8 @@ allprojects {
subprojects {
apply plugin: 'java'

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
Expand All @@ -53,20 +53,19 @@ subprojects {
}

dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.14.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.14.2'
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-smile', version: '2.14.2'
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-cbor', version: '2.14.2'
compile group: 'com.google.re2j', name: 're2j', version: '1.7'
testCompile group: 'org.powermock', name: 'powermock-module-javaagent', version: '2.0.9'
testCompile group: 'org.jacoco', name: 'org.jacoco.agent', version: '0.8.8', classifier: 'runtime'
testCompile group: 'org.powermock', name: 'powermock-core', version: '2.0.9'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-smile', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-cbor', version: '2.14.2'
implementation group: 'com.google.re2j', name: 're2j', version: '1.7'
testImplementation group: 'org.powermock', name: 'powermock-module-javaagent', version: '2.0.9'
testImplementation group: 'org.jacoco', name: 'org.jacoco.agent', version: '0.8.8', classifier: 'runtime'
testImplementation group: 'org.powermock', name: 'powermock-core', version: '2.0.9'

testCompile("junit:junit")
testCompile("org.springframework.boot:spring-boot-starter-test")
testImplementation("junit:junit")
// testImplementation("org.springframework.boot:spring-boot-starter-test")
}


}

}
69 changes: 38 additions & 31 deletions carbonj.service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.5")
classpath("org.springframework.boot:spring-boot-gradle-plugin:3.0.2")
classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
classpath 'net.researchgate:gradle-release:2.8.1'
classpath 'com.netflix.nebula:gradle-ospackage-plugin:8.6.3'
Expand Down Expand Up @@ -147,7 +147,7 @@ task rpm(type: Rpm) {

distributions {
custom {
baseName = project.name
// baseName = project.name
contents {
from { 'build/libs' }
from { 'scripts/carbonj.sh' }
Expand Down Expand Up @@ -190,44 +190,51 @@ release {

description = 'CarbonJ Service Implementation'
dependencies {
compile project(':cc-metrics-reporter')
implementation project(':cc-metrics-reporter')
// compile group: 'com.sfcc.um', name: 'metrics_reporter', version:'0.0.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.19.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.19.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.19.0'
compile group: 'org.slf4j', name: 'slf4j-api'
compile group: 'org.rocksdb', name: 'rocksdbjni', version: '6.28.2'
compile group: 'com.google.code.gson', name: 'gson', version: '2.10'
compile group: 'com.google.code.externalsortinginjava', name: 'externalsortinginjava', version: '0.6.1'
compile group: 'com.google.guava', name: 'guava', version: '31.1-jre'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
compile group: 'commons-io', name: 'commons-io', version: '2.11.0'
compile group: 'joda-time', name: 'joda-time', version: '2.12.1'
compile group: 'io.netty', name: 'netty-all', version: '4.1.85.Final'
compile group: 'net.razorvine', name: 'pickle', version: '1.3'
compile group: 'org.python', name: 'jython-standalone', version: '2.7.3'
compile group: 'com.amazonaws', name: 'amazon-kinesis-client', version: '1.14.8'
compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.2.13'
compile group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: '4.2.13'
compile group: 'io.dropwizard.metrics', name: 'metrics-graphite', version: '4.2.13'

testCompile group: 'junit', name: 'junit', version: '4.13.2'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'

compile (group:"org.springframework.boot", name:"spring-boot-starter-logging", version:"2.7.5") {
implementation group: 'org.apache.logging.log4j', name: 'log4j-1.2-api', version: '2.19.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.19.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.19.0'
implementation group: 'org.slf4j', name: 'slf4j-api'
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
implementation group: 'org.rocksdb', name: 'rocksdbjni', version: '7.9.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10'
implementation group: 'com.google.code.externalsortinginjava', name: 'externalsortinginjava', version: '0.6.1'
implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation group: 'joda-time', name: 'joda-time', version: '2.12.1'
implementation group: 'io.netty', name: 'netty-all', version: '4.1.85.Final'
implementation group: 'net.razorvine', name: 'pickle', version: '1.3'
implementation group: 'org.python', name: 'jython-standalone', version: '2.7.3'
implementation group: 'com.amazonaws', name: 'amazon-kinesis-client', version: '1.14.8'
implementation group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.2.13'
implementation group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: '4.2.13'
implementation group: 'io.dropwizard.metrics', name: 'metrics-graphite', version: '4.2.13'
implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0'
implementation 'org.eclipse.jetty:jetty-server'
// implementation 'org.mockito:mockito-core:4.11.0'

testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'

implementation (group:"org.springframework.boot", name:"spring-boot-starter-logging", version:"3.0.2") {
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
}
compile group:"org.springframework.boot", name:"spring-boot-starter-web", version:"2.7.5"
compile group:"org.springframework.boot", name:"spring-boot-starter-jetty", version:"2.7.5"
implementation group:"org.springframework.boot", name:"spring-boot-starter-web", version:"3.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need a version on dependencies when using the spring boot plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately it is needed here.. I think it works for project dependencies but not for buildscript dependencies.

implementation group:"org.springframework.boot", name:"spring-boot-starter-jetty", version:"3.0.2"

compile group:"org.springframework.boot", name:"spring-boot-starter-actuator", version:"2.7.5"
testCompile (group:"org.springframework.boot", name:"spring-boot-starter-test", version:"2.7.5")
implementation group:"org.springframework.boot", name:"spring-boot-starter-actuator", version:"3.0.2"
testImplementation (group:"org.springframework.boot", name:"spring-boot-starter-test", version:"3.0.2")

}

test {
maxHeapSize = "2g"
jvmArgs = [
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's removed, one of the test cases around CarbonJEvent logs will fail.

]
environment "AWS_REGION", "us-east-1"
}

Expand Down Expand Up @@ -266,4 +273,4 @@ tasks.withType(Test) {
}
}
}
}
}
4 changes: 2 additions & 2 deletions carbonj.service/src/main/docker/files/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ fi

cd /app
exec java $JAVA_OPTS $JAVA_OPTS_OVERRIDE --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED \
-Dlogback.debug=true -cp /app:/app/lib/* com.demandware.carbonj.service.engine.CarbonJServiceMain \
--spring.config.location=$CONFIG_LOCATIONS
--add-opens java.base/java.util=ALL-UNNAMED -Dlogback.debug=true -cp /app:/app/lib/* com.demandware.carbonj.service.engine.CarbonJServiceMain \
twoversionsofme marked this conversation as resolved.
Show resolved Hide resolved
--spring.config.location=$CONFIG_LOCATIONS
6 changes: 4 additions & 2 deletions carbonj.service/src/main/docker/files/service.args
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
# metrics reporting not working without: https://stackoverflow.com/questions/55952859/unable-to-make-public-long-com-sun-management-internal-operatingsystemimpl-getop
--add-opens
jdk.management/com.sun.management.internal=ALL-UNNAMED

--add-opens
java.base/java.util=ALL-UNNAMED

#
# GC Logging
#
Expand Down Expand Up @@ -60,4 +62,4 @@ jdk.management/com.sun.management.internal=ALL-UNNAMED
# profiling (64-bit)
# -agentpath:/usr/local/yjp/bin/linux-x86-64/libyjpagent.so=port=20001
# -agentpath:/usr/local/yjp/bin/linux-x86-64/libyjpagent.jnilib=port=20001
# -agentpath:/usr/local/yjp/bin/linux-x86-64/yjpagent.dll=port=20001
# -agentpath:/usr/local/yjp/bin/linux-x86-64/yjpagent.dll=port=20001
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.Charset;
Expand Down Expand Up @@ -991,4 +991,4 @@ private DataPoint toDataPoint( Metric m, String line )
p.setMetricId( m.id );
return p;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void dbDelete( byte[] keyBytes )
final Timer.Context timerContext = delTimer.time();
try
{
db.remove( keyBytes );
db.delete( keyBytes );
}
catch ( RocksDBException e )
{
Expand Down Expand Up @@ -260,4 +260,4 @@ private String dbDeleteTimerName( String dbName )
{
return "db." + dbName + ".delete.time";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
import com.demandware.carbonj.service.db.model.StorageAggregationPolicySource;
import com.demandware.carbonj.service.db.util.DatabaseMetrics;
import com.demandware.carbonj.service.db.util.FileUtils;
import com.demandware.carbonj.service.db.util.Quota;
import com.demandware.carbonj.service.engine.StorageAggregationRulesLoader;
import com.demandware.core.config.cfgMetric;
import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import java.io.File;
import java.util.concurrent.ScheduledExecutorService;
Expand All @@ -27,6 +30,7 @@
import static com.demandware.carbonj.service.config.ConfigUtils.locateConfigFile;

@Configuration
@Import( cfgMetric.class )
public class cfgMetricIndex
{
@Value( "${metrics.store.longId:false}" )
Expand Down Expand Up @@ -65,6 +69,7 @@ public class cfgMetricIndex
@Value( "${metrics.store:config/application.properties}" )
private String metricStoreConfigFile = "config/application.properties";


// TODO duplicated in different cfg beans
@Value( "${app.servicedir:}" )
private String serviceDir;
Expand Down Expand Up @@ -99,6 +104,7 @@ public StorageAggregationPolicySource storageAggregationPolicySource(ScheduledEx
return policySource;
}


@Bean
MetricIndex metricIndex( @Qualifier( "metricNameIndexStore" ) IndexStore<String, NameRecord> nameIndex,
@Qualifier( "metricIdIndexStore" ) IndexStore<Long, IdRecord> idIndex,
Expand All @@ -121,4 +127,4 @@ private File dbDir( String dbName )
File dir = FileUtils.writableDir( parentDir );
return new File( dir, dbName );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public long delete( int ts )
{
try
{
db.remove( key );
db.delete( key );
}
catch ( RocksDBException e )
{
Expand Down Expand Up @@ -217,7 +217,7 @@ private void dbDelete( byte[] key )
{
try
{
db.remove( key );
db.delete( key );
}
catch ( RocksDBException e )
{
Expand Down Expand Up @@ -362,7 +362,7 @@ private void dispose( RocksObject o )
if ( o != null )
{
// contains global lock. Dispose in a separate thread to avoid contention.
cleaner.execute( ( ) -> o.dispose() );
cleaner.execute( ( ) -> o.close() );
}
}

Expand Down Expand Up @@ -573,4 +573,4 @@ public DataPointValue getFirst( long metricId, int from, int to )
return r.isEmpty() ? null : r.get( 0 );
}

}
}
Loading