File tree Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -360,8 +360,11 @@ def do_partition(conf):
360360 except partitionmanager .types .DatabaseCommandException as e :
361361 log .warning ("Failed to automatically handle %s: %s" , table , e )
362362 metrics .add ("alter_errors" , table .name , 1 )
363- except partitionmanager .types .TableEmptyException :
364- log .warning ("Table %s appears to be empty. Skipping." , table )
363+ except (
364+ partitionmanager .types .TableEmptyException ,
365+ partitionmanager .types .NoValidRatesOfChangeException ,
366+ ) as e :
367+ log .warning ("Table %s appears to be empty (%s). Skipping." , table , e )
365368 except (ValueError , Exception ) as e :
366369 log .warning ("Failed to handle %s: %s" , table , e )
367370 metrics .add ("alter_errors" , table .name , 1 )
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ def _get_weighted_position_increase_per_day_for_partitions(partitions):
287287 log .error (
288288 "No rates of change were valid for the partition list: %s" , partitions
289289 )
290- raise ValueError ( "No valid rates of change" )
290+ raise partitionmanager . types . NoValidRatesOfChangeException
291291
292292 # Initialize a list with a zero for each position
293293 weighted_sums = [0 ] * partitions [0 ].num_columns
Original file line number Diff line number Diff line change 99 DuplicatePartitionException ,
1010 NewPlannedPartition ,
1111 NoEmptyPartitionsAvailableException ,
12+ NoValidRatesOfChangeException ,
1213 InstantPartition ,
1314 SqlInput ,
1415 SqlQuery ,
@@ -444,6 +445,12 @@ def test_get_weighted_position_increase_per_day_for_partitions(self):
444445 ),
445446 [548.3636363636364 ],
446447 )
448+ with self .assertRaises (NoValidRatesOfChangeException ):
449+ _get_weighted_position_increase_per_day_for_partitions (
450+ [
451+ mkPPart ("p_736563646E64" , 1200000 ),
452+ ]
453+ )
447454
448455 def test_predict_forward_position (self ):
449456 with self .assertRaises (ValueError ):
Original file line number Diff line number Diff line change @@ -625,3 +625,7 @@ class DatabaseCommandException(Exception):
625625
626626class NoExactTimeException (Exception ):
627627 """Raised if there's no exact time available for this partition."""
628+
629+
630+ class NoValidRatesOfChangeException (Exception ):
631+ """Raised if the table's rate of change cannot be calculated."""
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ name = "mariadb-sequential-partition-manager"
77maintainers = [
88 {name = " J.C. Jones" , email = " jc@letsencrypt.org" },
99]
10- version = " 0.4.0 "
10+ version = " 0.4.1 "
1111description = " Manage DB partitions based on sequential IDs"
1212license = {file = " LICENSE.txt" }
1313classifiers = [
You can’t perform that action at this time.
0 commit comments