|
|
@ -22,6 +22,7 @@ import org.thingsboard.server.dao.model.ModelConstants; |
|
|
import org.thingsboard.server.dao.util.PsqlTsDao; |
|
|
import org.thingsboard.server.dao.util.PsqlTsDao; |
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
import java.sql.Connection; |
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
|
|
|
|
@PsqlTsDao |
|
|
@PsqlTsDao |
|
|
@Service |
|
|
@Service |
|
|
@ -32,7 +33,7 @@ public class PsqlTimeseriesCleanUpService extends AbstractTimeseriesCleanUpServi |
|
|
private String partitionType; |
|
|
private String partitionType; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void doCleanUp(Connection connection) { |
|
|
protected void doCleanUp(Connection connection) throws SQLException { |
|
|
long totalPartitionsRemoved = executeQuery(connection, "call drop_partitions_by_max_ttl('" + partitionType + "'," + systemTtl + ", 0);"); |
|
|
long totalPartitionsRemoved = executeQuery(connection, "call drop_partitions_by_max_ttl('" + partitionType + "'," + systemTtl + ", 0);"); |
|
|
log.info("Total partitions removed by TTL: [{}]", totalPartitionsRemoved); |
|
|
log.info("Total partitions removed by TTL: [{}]", totalPartitionsRemoved); |
|
|
long totalEntitiesTelemetryRemoved = executeQuery(connection, "call cleanup_timeseries_by_ttl('" + ModelConstants.NULL_UUID_STR + "'," + systemTtl + ", 0);"); |
|
|
long totalEntitiesTelemetryRemoved = executeQuery(connection, "call cleanup_timeseries_by_ttl('" + ModelConstants.NULL_UUID_STR + "'," + systemTtl + ", 0);"); |
|
|
|