mirror of https://github.com/apache/nifi.git
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:
parent
5c8f4bf70c
commit
c5946b2e6c
|
@ -182,7 +182,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.questdb</groupId>
|
<groupId>org.questdb</groupId>
|
||||||
<artifactId>questdb</artifactId>
|
<artifactId>questdb</artifactId>
|
||||||
<version>6.7-jdk8</version>
|
<version>7.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.nifi</groupId>
|
<groupId>org.apache.nifi</groupId>
|
||||||
|
|
|
@ -20,7 +20,6 @@ import io.questdb.cairo.CairoConfiguration;
|
||||||
import io.questdb.cairo.CairoEngine;
|
import io.questdb.cairo.CairoEngine;
|
||||||
import io.questdb.griffin.SqlCompiler;
|
import io.questdb.griffin.SqlCompiler;
|
||||||
import io.questdb.griffin.SqlExecutionContext;
|
import io.questdb.griffin.SqlExecutionContext;
|
||||||
import io.questdb.griffin.SqlExecutionContextImpl;
|
|
||||||
|
|
||||||
public class QuestDbContext {
|
public class QuestDbContext {
|
||||||
private final CairoEngine engine;
|
private final CairoEngine engine;
|
||||||
|
@ -38,7 +37,7 @@ public class QuestDbContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlExecutionContext getSqlExecutionContext() {
|
public SqlExecutionContext getSqlExecutionContext() {
|
||||||
return new SqlExecutionContextImpl(engine, 1);
|
return SqlExecutionContextFactory.getInstance(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlCompiler getCompiler() {
|
public SqlCompiler getCompiler() {
|
||||||
|
|
|
@ -21,11 +21,6 @@ import io.questdb.cairo.CairoEngine;
|
||||||
import io.questdb.cairo.DefaultCairoConfiguration;
|
import io.questdb.cairo.DefaultCairoConfiguration;
|
||||||
import io.questdb.griffin.SqlCompiler;
|
import io.questdb.griffin.SqlCompiler;
|
||||||
import io.questdb.griffin.SqlExecutionContext;
|
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.io.File;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -33,6 +28,9 @@ import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
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.
|
* 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 CairoEngine engine = new CairoEngine(configuration);
|
||||||
final SqlCompiler compiler = new SqlCompiler(engine)
|
final SqlCompiler compiler = new SqlCompiler(engine)
|
||||||
) {
|
) {
|
||||||
final SqlExecutionContext context = new SqlExecutionContextImpl(engine, 1);
|
final SqlExecutionContext context = SqlExecutionContextFactory.getInstance(engine);
|
||||||
|
|
||||||
// Node status tables
|
// Node status tables
|
||||||
compiler.compile(QuestDbQueries.CREATE_GARBAGE_COLLECTION_STATUS, context);
|
compiler.compile(QuestDbQueries.CREATE_GARBAGE_COLLECTION_STATUS, context);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public abstract class QuestDbWritingTemplate<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try (
|
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);
|
addRows(tableWriter, entries);
|
||||||
tableWriter.commit();
|
tableWriter.commit();
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue