fix: drop history export and tolerate empty tdengine tables
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user