Skip to content

Commit

Permalink
Update Jooq version and address bind variable failure in AdmissionCon…
Browse files Browse the repository at this point in the history
…trol Emitter

Signed-off-by: Khushboo Rajput <[email protected]>
  • Loading branch information
khushbr committed Sep 30, 2023
1 parent 2972bd8 commit 9be2f89
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,16 @@ dependencies {
def guavaVersion = "${versions.guava}"
def jakartaVersion = "${versions.jakarta_annotation}"

implementation 'org.jooq:jooq:3.10.8'
// Sqlite and JOOQ version are coupled, see https://www.jooq.org/download/support-matrix
// In case they fall out of compatibility, JOOQ will throw error message:
// 'No bind variables have been provided with a single statement batch execution. This may be due to accidental API misuse>
def jooqVersion = "3.16.20"
def sqliteVersion = "3.41.2.2"

implementation "org.jooq:jooq:${jooqVersion}"
implementation 'org.bouncycastle:bcprov-jdk15to18:1.74'
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.74'
implementation 'org.xerial:sqlite-jdbc:3.41.2.2'
implementation "org.xerial:sqlite-jdbc:${sqliteVersion}"
implementation "com.google.guava:guava:${guavaVersion}"
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.checkerframework:checker-qual:3.29.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ private static class ColumnValuePair {
// It is needed during SQLite file rotation
@Override
synchronized void createNewDSLContext() {
if (create != null) {
create.close();
}
// No need to close DSL Context in Jooq 3.16+, see https://github.com/jOOQ/jOOQ/issues/10512
create = DSL.using(super.conn, SQLDialect.SQLITE);
jooqTableColumns = new HashMap<>();
tableNameToJavaClassMap = new HashMap<>();
Expand Down Expand Up @@ -413,7 +411,7 @@ List<T> readAllForMaxField(Class<T> clz, String fieldName, Class<E> fieldClz)

// This gives the type of the setter parameter.
Class<?> setterType = setter.getParameterTypes()[0];
int nestedRowId = jooqField.cast(Integer.class).getValue(record);
int nestedRowId = record.getValue(jooqField, Integer.class);

// Now that we have the Type of the parameter and the rowID specifying the data
// the object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,6 @@ public static void emitAdmissionControlMetrics(
if (controllerObj.isPresent() && rejectionCountObj.isPresent()) {
handle.bind(
controllerObj.orElseGet(Object::new).toString(),
rejectionCountObj.map(o -> Long.parseLong(o.toString())).orElse(0L),
// the rest are agg fields: sum, avg, min, max
rejectionCountObj.map(o -> Long.parseLong(o.toString())).orElse(0L),
rejectionCountObj.map(o -> Long.parseLong(o.toString())).orElse(0L),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opensearch.performanceanalyzer.PerformanceAnalyzerApp;
import org.opensearch.performanceanalyzer.commons.metrics.AllMetrics;
import org.opensearch.performanceanalyzer.commons.metrics.PerformanceAnalyzerMetrics;
import org.opensearch.performanceanalyzer.config.TroubleshootingConfig;
Expand All @@ -44,6 +46,11 @@ public MetricsEmitterTests() throws SQLException, ClassNotFoundException {

private static final String DB_URL = "jdbc:sqlite:";

@Before
public void setup() {
PerformanceAnalyzerApp.initAggregators();
}

@Test
public void testMetricsEmitter() throws Exception {
//
Expand Down

0 comments on commit 9be2f89

Please sign in to comment.