Do not create table on 'query', only on 'store' (#11961)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2022-01-04 21:26:52 +01:00 committed by GitHub
parent d45bcdb7aa
commit 346fcd068c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -193,19 +193,16 @@ public class JdbcPersistenceService extends JdbcMapper implements QueryablePersi
String table = sqlTables.get(itemName);
if (table == null) {
logger.warn(
"JDBC::query: unable to find table for query, no data in database for item '{}'. Current number of tables in the database: {}",
itemName, sqlTables.size());
// if enabled, table will be created immediately
logger.warn("JDBC::query: try to generate the table for item '{}'", itemName);
table = getTable(item);
logger.debug("JDBC::query: unable to find table for item with name: '{}', no data in database.", itemName);
return List.of();
}
long timerStart = System.currentTimeMillis();
List<HistoricItem> items = getHistItemFilterQuery(filter, conf.getNumberDecimalcount(), table, item);
logger.debug("JDBC::query: query for {} returned {} rows in {} ms", itemName, items.size(),
System.currentTimeMillis() - timerStart);
if (logger.isDebugEnabled()) {
logger.debug("JDBC: Query for item '{}' returned {} rows in {} ms", itemName, items.size(),
System.currentTimeMillis() - timerStart);
}
// Success
errCnt = 0;