dream120 / common-schema

Automatically exported from code.google.com/p/common-schema
0 stars 0 forks source link

sql_range_partition does not function as expected when the column is a timestamp integer #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which version of common_schema are you using? (specify
revision+distribution)
2.2

Which component is failing? (specify the view, function, etc.)
sql_range_partitions

What is the expected output? What do you see instead?
Expected sql_add_next_partition to return the next partition in integer order. 
Instead of that, it's starting somewhere in the past from 1970.

Can you provide with sample data?

(As of version 1.1), please provide output of
SELECT * FROM common_schema.status
mysql> select * from common_schema.status\G
*************************** 1. row ***************************
                       project_name: common_schema
                            version: 2.2
                           revision: 523
                       install_time: 2014-10-21 14:02:49
                    install_success: 1
          base_components_installed: 1
 innodb_plugin_components_installed: 1
percona_server_components_installed: 1
              install_mysql_version: 5.5.36-MariaDB-log
                   install_sql_mode: NO_AUTO_VALUE_ON_ZERO

Please provide any additional information below.

mysql> show create table zabbix.trends\G
*************************** 1. row ***************************
       Table: trends
Create Table: CREATE TABLE `trends` (
  `itemid` bigint(20) unsigned NOT NULL,
  `clock` int(11) NOT NULL DEFAULT '0',
  `num` int(11) NOT NULL DEFAULT '0',
  `value_min` double(16,4) NOT NULL DEFAULT '0.0000',
  `value_avg` double(16,4) NOT NULL DEFAULT '0.0000',
  `value_max` double(16,4) NOT NULL DEFAULT '0.0000',
  PRIMARY KEY (`itemid`,`clock`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE ( clock)
(PARTITION p201409 VALUES LESS THAN (1412121600) ENGINE = InnoDB,
 PARTITION p201410 VALUES LESS THAN (1414800000) ENGINE = InnoDB,
 PARTITION p201411 VALUES LESS THAN (1417392000) ENGINE = InnoDB) */
1 row in set (0.00 sec)

mysql> select * from common_schema.sql_range_partitions where 
table_name='trends'\G
*************************** 1. row ***************************
            table_schema: zabbix
              table_name: trends
        count_partitions: 3
   count_past_partitions: 1
 count_future_partitions: 2
            has_maxvalue: 0
sql_drop_first_partition: alter table `zabbix`.`trends` drop partition `p201409`
  sql_add_next_partition: alter table `zabbix`.`trends` add partition (partition `p_19700201003334` values less than (2680414) /* 1970-02-01 00:33:34 */ )
1 row in set, 93 warnings (0.08 sec)

Original issue reported on code.google.com by guilla...@adishatz.net on 21 Oct 2014 at 2:35