Nikolay200669 / common-schema

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

Problem with sql_range_partitions #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Which version of common_schema are you using? 
2.2

Which component is failing? 
sql_range_partitions

What is the expected output? What do you see instead?
I expected an output with count_past_partitions, count_future_partitions and 
sql_add_next_partition filled, because we have some tables created with range 
partitions for every month since 2009-01-01, two partitions for the years 
before and one with maxvalue. The partitions have been limited by to_days().
Instead of this expection, the output shows null for these three columns.

Can you provide with sample data?
Here is a shortened output of SHOW CREATE TABLE:
CREATE TABLE `receipt_line` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `receipt_id` int(11) unsigned DEFAULT NULL,
  `status` char(1) COLLATE utf8_unicode_ci DEFAULT NULL,
  `receipt_date` date NOT NULL,
  `product_id` int(11) DEFAULT NULL,
  `data_status` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`,`receipt_date`),
) ENGINE=InnoDB AUTO_INCREMENT=46694279 DEFAULT CHARSET=utf8 
COLLATE=utf8_unicode_ci PACK_KEYS=1 DELAY_KEY_WRITE=1
/*!50100 PARTITION BY RANGE (to_days(receipt_date))
(PARTITION p2007 VALUES LESS THAN (733407) ENGINE = InnoDB,
 PARTITION p2008 VALUES LESS THAN (733773) ENGINE = InnoDB,
 PARTITION p200901 VALUES LESS THAN (733804) ENGINE = InnoDB,
 PARTITION p200902 VALUES LESS THAN (733832) ENGINE = InnoDB,
 PARTITION p200903 VALUES LESS THAN (733863) ENGINE = InnoDB,
 PARTITION p200904 VALUES LESS THAN (733893) ENGINE = InnoDB,
 PARTITION p200905 VALUES LESS THAN (733924) ENGINE = InnoDB,
 PARTITION p200906 VALUES LESS THAN (733954) ENGINE = InnoDB,
 PARTITION p200907 VALUES LESS THAN (733985) ENGINE = InnoDB,
 PARTITION p200908 VALUES LESS THAN (734016) ENGINE = InnoDB,
 PARTITION p200909 VALUES LESS THAN (734046) ENGINE = InnoDB,
 PARTITION p200910 VALUES LESS THAN (734077) ENGINE = InnoDB,
 PARTITION p200911 VALUES LESS THAN (734107) ENGINE = InnoDB,
 PARTITION p200912 VALUES LESS THAN (734138) ENGINE = InnoDB,
 PARTITION p201001 VALUES LESS THAN (734169) ENGINE = InnoDB,
 PARTITION p201002 VALUES LESS THAN (734197) ENGINE = InnoDB,
 PARTITION p201003 VALUES LESS THAN (734228) ENGINE = InnoDB,
 PARTITION p201004 VALUES LESS THAN (734258) ENGINE = InnoDB,
 PARTITION p201005 VALUES LESS THAN (734289) ENGINE = InnoDB,
 PARTITION p201006 VALUES LESS THAN (734319) ENGINE = InnoDB,
 PARTITION p201007 VALUES LESS THAN (734350) ENGINE = InnoDB,
 PARTITION p201008 VALUES LESS THAN (734381) ENGINE = InnoDB,
 PARTITION p201009 VALUES LESS THAN (734411) ENGINE = InnoDB,
 PARTITION p201010 VALUES LESS THAN (734442) ENGINE = InnoDB,
 PARTITION p201011 VALUES LESS THAN (734472) ENGINE = InnoDB,
 PARTITION p201012 VALUES LESS THAN (734503) ENGINE = InnoDB,
 PARTITION p201101 VALUES LESS THAN (734534) ENGINE = InnoDB,
 PARTITION p201102 VALUES LESS THAN (734562) ENGINE = InnoDB,
 PARTITION p201103 VALUES LESS THAN (734593) ENGINE = InnoDB,
 PARTITION p201104 VALUES LESS THAN (734623) ENGINE = InnoDB,
 PARTITION p201105 VALUES LESS THAN (734654) ENGINE = InnoDB,
 PARTITION p201106 VALUES LESS THAN (734684) ENGINE = InnoDB,
 PARTITION p201107 VALUES LESS THAN (734715) ENGINE = InnoDB,
 PARTITION p201108 VALUES LESS THAN (734746) ENGINE = InnoDB,
 PARTITION p201109 VALUES LESS THAN (734776) ENGINE = InnoDB,
 PARTITION p201110 VALUES LESS THAN (734807) ENGINE = InnoDB,
 PARTITION p201111 VALUES LESS THAN (734837) ENGINE = InnoDB,
 PARTITION p201112 VALUES LESS THAN (734868) ENGINE = InnoDB,
 PARTITION p201201 VALUES LESS THAN (734899) ENGINE = InnoDB,
 PARTITION p201202 VALUES LESS THAN (734928) ENGINE = InnoDB,
 PARTITION p201203 VALUES LESS THAN (734959) ENGINE = InnoDB,
 PARTITION p201204 VALUES LESS THAN (734989) ENGINE = InnoDB,
 PARTITION p201205 VALUES LESS THAN (735020) ENGINE = InnoDB,
 PARTITION p201206 VALUES LESS THAN (735050) ENGINE = InnoDB,
 PARTITION p201207 VALUES LESS THAN (735081) ENGINE = InnoDB,
 PARTITION p201208 VALUES LESS THAN (735112) ENGINE = InnoDB,
 PARTITION p201209 VALUES LESS THAN (735142) ENGINE = InnoDB,
 PARTITION p201210 VALUES LESS THAN (735173) ENGINE = InnoDB,
 PARTITION p201211 VALUES LESS THAN (735203) ENGINE = InnoDB,
 PARTITION p201212 VALUES LESS THAN (735234) ENGINE = InnoDB,
 PARTITION p201301 VALUES LESS THAN (735265) ENGINE = InnoDB,
 PARTITION p201302 VALUES LESS THAN (735293) ENGINE = InnoDB,
 PARTITION p201303 VALUES LESS THAN (735324) ENGINE = InnoDB,
 PARTITION p201304 VALUES LESS THAN (735354) ENGINE = InnoDB,
 PARTITION p201305 VALUES LESS THAN (735385) ENGINE = InnoDB,
 PARTITION p201306 VALUES LESS THAN (735415) ENGINE = InnoDB,
 PARTITION p201307 VALUES LESS THAN (735446) ENGINE = InnoDB,
 PARTITION p201308 VALUES LESS THAN (735477) ENGINE = InnoDB,
 PARTITION p201309 VALUES LESS THAN (735507) ENGINE = InnoDB,
 PARTITION p201310 VALUES LESS THAN (735538) ENGINE = InnoDB,
 PARTITION p201311 VALUES LESS THAN (735568) ENGINE = InnoDB,
 PARTITION p201312 VALUES LESS THAN (735599) ENGINE = InnoDB,
 PARTITION p201401 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */

(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: 2013-11-14 13:52:11
                    install_success: 1
          base_components_installed: 1
 innodb_plugin_components_installed: 1
percona_server_components_installed: 0
              install_mysql_version: 5.6.12-enterprise-commercial-advanced-log
                   install_sql_mode: NO_AUTO_VALUE_ON_ZERO

Please provide any additional information below.
The MySQL Version has been changed to 5.6.14-enterprise_commercial-advanced-log.

Original issue reported on code.google.com by matzekoe...@gmail.com on 15 Nov 2013 at 1:24

GoogleCodeExporter commented 8 years ago
"This view auto-deduces the "next in sequence" partition value. It handles 
consistent partitioning schemes, where the interval of values between 
partitions makes some sense. Such an interval can be a constant value, but can 
also be a time-based interval. "

The problem here is that there is an inconsistent interval within your 
partitions: at first there's a full year, then followed by a single month 
scheme.
At this time, this view only handles fully consistent schemes; there's a TODO 
to review the last n partitions and ignore old ones, to handle the exact 
scenario you describe.

Original comment by sno...@outbrain.com on 16 Nov 2013 at 5:47