Module: sip-router Branch: adubovikov/homer Commit: 1010f7bf5a024679e2ec056fd1db2c20b8d7a3b9 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1010f7bf...
Author: Alexandr Dubovikov alexandr.dubovikov@gmail.com Committer: Alexandr Dubovikov alexandr.dubovikov@gmail.com Date: Thu Sep 22 17:17:42 2011 +0200
modules/sipcapture: fix mysql MAXVALUE partitioning.
Thanks Dorn B. djbinter@gmail.com for report and fix.
---
modules/sipcapture/examples/partrotate_todays.pl | 5 +++-- .../examples/partrotate_unixtimestamp.pl | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/sipcapture/examples/partrotate_todays.pl b/modules/sipcapture/examples/partrotate_todays.pl index f9e9059..2469a7c 100644 --- a/modules/sipcapture/examples/partrotate_todays.pl +++ b/modules/sipcapture/examples/partrotate_todays.pl @@ -74,8 +74,9 @@ for(my $i=0; $i<$newparts; $i++) {
if(!$exist) {
- $query = "ALTER TABLE ".$table." ADD PARTITION (PARTITION ".$newpartname - ."\n VALUES LESS THAN (".$curtodays.") ENGINE = MyISAM)"; + $query = "ALTER TABLE ".$table." REORGANIZE PARTITION pmax INTO (PARTITION ".$newpartname + ."\n VALUES LESS THAN (".$curtodays.") ENGINE = MyISAM, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM)"; + $db->do($query); if (!$db->{Executed}) { print "Couldn't add partition: $newpartname\n"; diff --git a/modules/sipcapture/examples/partrotate_unixtimestamp.pl b/modules/sipcapture/examples/partrotate_unixtimestamp.pl index 40d36a4..b9e221e 100644 --- a/modules/sipcapture/examples/partrotate_unixtimestamp.pl +++ b/modules/sipcapture/examples/partrotate_unixtimestamp.pl @@ -83,8 +83,10 @@ for(my $i=0; $i<$newparts; $i++) {
if(!$exist) {
- $query = "ALTER TABLE ".$table." ADD PARTITION (PARTITION ".$newpartname - ."\n VALUES LESS THAN (".$curtstamp.") ENGINE = MyISAM)"; + # Fix MAXVALUE. Thanks Dorn B. djbinter@gmail.com for report and fix. + $query = "ALTER TABLE ".$table." REORGANIZE PARTITION pmax INTO (PARTITION ".$newpartname + ."\n VALUES LESS THAN (".$curtstamp.") ENGINE = MyISAM, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM)"; + $db->do($query); if (!$db->{Executed}) { print "Couldn't add partition: $newpartname\n";