fix: drop history export and tolerate empty tdengine tables

This commit is contained in:
lingniu
2026-06-29 14:47:54 +08:00
parent b631d5d998
commit 7abac30ea4
4 changed files with 68 additions and 190 deletions

View File

@@ -63,6 +63,9 @@ public final class TdengineJdbcHistoryReader implements TdengineHistoryReader {
}
}
} catch (SQLException e) {
if (isTableMissing(e)) {
return new TdenginePage<>(List.of(), Optional.empty());
}
throw new IOException("tdengine history query failed", e);
}
boolean hasMore = rows.size() > pageSize;
@@ -73,6 +76,21 @@ public final class TdengineJdbcHistoryReader implements TdengineHistoryReader {
return new TdenginePage<>(items, next);
}
private static boolean isTableMissing(SQLException e) {
for (Throwable current = e; current != null; current = current.getCause()) {
String message = current.getMessage();
if (message != null) {
String normalized = message.toLowerCase();
if (normalized.contains("table does not exist")
|| normalized.contains("0x2603")
|| normalized.contains("table not exist")) {
return true;
}
}
}
return false;
}
private static void bind(PreparedStatement prepared, List<Object> values) throws SQLException {
for (int i = 0; i < values.size(); i++) {
Object value = values.get(i);