NIFI-11745 Upgraded QuestDB from 6.7 to 7.2

This closes #7430

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Bence Simon 2023-06-26 10:50:43 +02:00 committed by exceptionfactory
parent 5c8f4bf70c
commit c5946b2e6c
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
5 changed files with 39 additions and 10 deletions

View File

@ -182,7 +182,7 @@
<dependency>
<groupId>org.questdb</groupId>
<artifactId>questdb</artifactId>
<version>6.7-jdk8</version>
<version>7.2</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>

View File

@ -20,7 +20,6 @@ import io.questdb.cairo.CairoConfiguration;
import io.questdb.cairo.CairoEngine;
import io.questdb.griffin.SqlCompiler;
import io.questdb.griffin.SqlExecutionContext;
import io.questdb.griffin.SqlExecutionContextImpl;
public class QuestDbContext {
private final CairoEngine engine;
@ -38,7 +37,7 @@ public class QuestDbContext {
}
public SqlExecutionContext getSqlExecutionContext() {
return new SqlExecutionContextImpl(engine, 1);
return SqlExecutionContextFactory.getInstance(engine);
}
public SqlCompiler getCompiler() {

View File

@ -21,11 +21,6 @@ import io.questdb.cairo.CairoEngine;
import io.questdb.cairo.DefaultCairoConfiguration;
import io.questdb.griffin.SqlCompiler;
import io.questdb.griffin.SqlExecutionContext;
import io.questdb.griffin.SqlExecutionContextImpl;
import org.apache.nifi.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
@ -33,6 +28,9 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.nifi.util.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The database manager is responsible for checking and maintaining the health of the database during startup.
@ -149,7 +147,7 @@ public final class QuestDbDatabaseManager {
final CairoEngine engine = new CairoEngine(configuration);
final SqlCompiler compiler = new SqlCompiler(engine)
) {
final SqlExecutionContext context = new SqlExecutionContextImpl(engine, 1);
final SqlExecutionContext context = SqlExecutionContextFactory.getInstance(engine);
// Node status tables
compiler.compile(QuestDbQueries.CREATE_GARBAGE_COLLECTION_STATUS, context);

View File

@ -54,7 +54,7 @@ public abstract class QuestDbWritingTemplate<T> {
}
try (
final TableWriter tableWriter = engine.getWriter(context.getCairoSecurityContext(), engine.getTableToken(tableName), "adding rows")
final TableWriter tableWriter = engine.getWriter(engine.getTableTokenIfExists(tableName), "adding rows")
) {
addRows(tableWriter, entries);
tableWriter.commit();

View File

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.nifi.controller.status.history.questdb;
import io.questdb.cairo.CairoEngine;
import io.questdb.cairo.security.AllowAllSecurityContext;
import io.questdb.griffin.SqlExecutionContext;
import io.questdb.griffin.SqlExecutionContextImpl;
final class SqlExecutionContextFactory {
private SqlExecutionContextFactory() {
// Not to be instantiated
}
public static SqlExecutionContext getInstance(final CairoEngine engine) {
return new SqlExecutionContextImpl(engine, 1).with(AllowAllSecurityContext.INSTANCE, null);
}
}