summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2022-01-31 23:46:04 +0100
committerGitHub <noreply@github.com>2022-01-31 23:46:04 +0100
commit6e92177dbbf6023cabaaa0c8ac24a82cd155b0e3 (patch)
treeba734a0c30b93a121d8e58177771ffb9d58d9b06
parenta1620d5103e9597b25548fca09c8d22a2ae261c0 (diff)
parenta0300536c74ddccf78be6b599f1abb11c152a54a (diff)
Merge pull request #20971 from vespa-engine/hmusum/upgrade-questdb
Upgrade questdb
-rw-r--r--node-repository/pom.xml2
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/QuestMetricsDb.java15
2 files changed, 14 insertions, 3 deletions
diff --git a/node-repository/pom.xml b/node-repository/pom.xml
index 0227ada15af..60aa0a83107 100644
--- a/node-repository/pom.xml
+++ b/node-repository/pom.xml
@@ -81,7 +81,7 @@
<dependency>
<groupId>org.questdb</groupId>
<artifactId>questdb</artifactId>
- <version>6.0.4</version>
+ <version>6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/QuestMetricsDb.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/QuestMetricsDb.java
index 08a9e373085..a73b6896c2c 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/QuestMetricsDb.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/QuestMetricsDb.java
@@ -18,6 +18,7 @@ import io.questdb.cairo.sql.Record;
import io.questdb.cairo.sql.RecordCursor;
import io.questdb.cairo.sql.RecordCursorFactory;
import io.questdb.griffin.CompiledQuery;
+import io.questdb.griffin.QueryFuture;
import io.questdb.griffin.SqlCompiler;
import io.questdb.griffin.SqlException;
import io.questdb.griffin.SqlExecutionContext;
@@ -341,6 +342,16 @@ public class QuestMetricsDb extends AbstractComponent implements MetricsDb {
}
}
+ /**
+ * Issues and wait for an SQL statement to be executed against the QuestDb engine.
+ * Needs to be done for some queries, e.g. 'alter table' queries, see https://github.com/questdb/questdb/issues/1846
+ */
+ private void issueAsync(String sql, SqlExecutionContext context) throws SqlException {
+ try (QueryFuture future = issue(sql, context).execute(null)) {
+ future.await();
+ }
+ }
+
private SqlExecutionContext newContext() {
return new SqlExecutionContextImpl(engine(), 1);
}
@@ -374,7 +385,7 @@ public class QuestMetricsDb extends AbstractComponent implements MetricsDb {
void gc() {
synchronized (writeLock) {
try {
- issue("alter table " + name + " drop partition where at < dateadd('d', -4, now());", newContext());
+ issueAsync("alter table " + name + " drop partition where at < dateadd('d', -4, now());", newContext());
}
catch (SqlException e) {
log.log(Level.WARNING, "Failed to gc old metrics data in " + dir + " table " + name, e);
@@ -396,7 +407,7 @@ public class QuestMetricsDb extends AbstractComponent implements MetricsDb {
void ensureColumnExists(String column, String columnType) throws SqlException {
if (columnNames().contains(column)) return;
- issue("alter table " + name + " add column " + column + " " + columnType, newContext());
+ issueAsync("alter table " + name + " add column " + column + " " + columnType, newContext());
}
private Optional<Long> adjustOrDiscard(Instant at) {