code simplified

This commit is contained in:
ShvaykaD 2021-02-22 17:04:20 +02:00 committed by Andrew Shvayka
parent 0d28d6279c
commit b418b08d23

View File

@ -116,16 +116,11 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa
partitioningRepository.save(psqlPartition);
log.trace("Adding partition to Set: {}", psqlPartition);
partitions.put(psqlPartition.getStart(), psqlPartition);
} catch (Exception e) {
log.trace("Error occurred during partition save:", e);
if (e instanceof DataIntegrityViolationException) {
DataIntegrityViolationException ex = (DataIntegrityViolationException) e;
Throwable cause = ex.getCause();
if (cause instanceof ConstraintViolationException) {
ConstraintViolationException constraintViolationException = (ConstraintViolationException) cause;
log.warn("Saving partition [{}] rejected: {}", psqlPartition.getPartitionDate(), constraintViolationException.getCause().getMessage());
partitions.put(psqlPartition.getStart(), psqlPartition);
}
} catch (DataIntegrityViolationException ex) {
log.trace("Error occurred during partition save:", ex);
if (ex.getCause() instanceof ConstraintViolationException) {
log.warn("Saving partition [{}] rejected. Timeseries data will save to the ts_kv_indefinite (DEFAULT) partition.", psqlPartition.getPartitionDate());
partitions.put(psqlPartition.getStart(), psqlPartition);
}
} finally {
partitionCreationLock.unlock();