Commit b418b08d234b95c488a2b8ef76dbb22eeb6367f0
Committed by
Andrew Shvayka
1 parent
0d28d627
code simplified
Showing
1 changed file
with
5 additions
and
10 deletions
@@ -116,16 +116,11 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa | @@ -116,16 +116,11 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa | ||
116 | partitioningRepository.save(psqlPartition); | 116 | partitioningRepository.save(psqlPartition); |
117 | log.trace("Adding partition to Set: {}", psqlPartition); | 117 | log.trace("Adding partition to Set: {}", psqlPartition); |
118 | partitions.put(psqlPartition.getStart(), psqlPartition); | 118 | partitions.put(psqlPartition.getStart(), psqlPartition); |
119 | - } catch (Exception e) { | ||
120 | - log.trace("Error occurred during partition save:", e); | ||
121 | - if (e instanceof DataIntegrityViolationException) { | ||
122 | - DataIntegrityViolationException ex = (DataIntegrityViolationException) e; | ||
123 | - Throwable cause = ex.getCause(); | ||
124 | - if (cause instanceof ConstraintViolationException) { | ||
125 | - ConstraintViolationException constraintViolationException = (ConstraintViolationException) cause; | ||
126 | - log.warn("Saving partition [{}] rejected: {}", psqlPartition.getPartitionDate(), constraintViolationException.getCause().getMessage()); | ||
127 | - partitions.put(psqlPartition.getStart(), psqlPartition); | ||
128 | - } | 119 | + } catch (DataIntegrityViolationException ex) { |
120 | + log.trace("Error occurred during partition save:", ex); | ||
121 | + if (ex.getCause() instanceof ConstraintViolationException) { | ||
122 | + log.warn("Saving partition [{}] rejected. Timeseries data will save to the ts_kv_indefinite (DEFAULT) partition.", psqlPartition.getPartitionDate()); | ||
123 | + partitions.put(psqlPartition.getStart(), psqlPartition); | ||
129 | } | 124 | } |
130 | } finally { | 125 | } finally { |
131 | partitionCreationLock.unlock(); | 126 | partitionCreationLock.unlock(); |