Tool not compatible with the new DATATIME format on 5.6
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Data Recovery Tool for InnoDB |
Fix Committed
|
Undecided
|
Aleksandr Kuzminsky |
Bug Description
The tool is not compatible with the new DATATIME format in 5.6. There are some changes, for example it only needs 5 bytes instead of 8 and year and month go together.
Therefore, following tools needs to be changed:
- create_defs.pl should use 5 or 8 bytes DATATIME depending on the format stored in the tablespace.
- print_data.c should be able to read the new format to show correct values
I have a patch for print_data.c, thanks to Kalexey.
# diff print_data.c print_data_56.c
17a18
19,30c20,44
< int year, month, day, hour, min, sec;
<
< ldate &= ~(1ULL << 63);
<
< sec = ldate % 100; ldate /= 100;
< min = ldate % 100; ldate /= 100;
< hour = ldate % 100; ldate /= 100;
< day = ldate % 100; ldate /= 100;
< month = ldate % 100; ldate /= 100;
< year = ldate % 10000;
<
< fprintf(f_result, "\"%04u-%02u-%02u %02u:%02u:%02u\"", year, month, day, hour, min, sec);
---
> int year, month, day, hour, min, sec;
> long second_part;
> longlong tmp;
> longlong ymd, hms;
> longlong ymdhms, ym;
> tmp = (longlong) (ldate &~(1ULL << 63));
> second_part = tmp % (1LL << 24);
> ymdhms = tmp >> 24;
> ymd = ymdhms >> 17;
> ym = ymd >> 5;
> hms = ymdhms % (1 << 17);
> day = ymd % (1 << 5);
> month = ym % 13;
> year = ym / 13;
> sec = hms % (1 << 6);
> min = (hms >> 6) % (1 << 6);
> hour = (hms >> 12);
> fprintf(f_result, "\"%04u-%02u-%02u %02u:%02u:%02u\"",
> year, month, day, hour, min, sec);
This patch ignores the microsecond part to make it compatible with the old DATETIME version. It is important to mention that in some tables there could be different DATETIME columns in different formats.
Changed in percona-data-recovery-tool-for-innodb: | |
status: | New → Fix Committed |
assignee: | nobody → Aleksandr Kuzminsky (akuzminsky) |
There is no patch for create_defs.pl. So, if you find a DATETIME column in SYS_COLUMNS of 5 bytes, you will have to change manually the table_defs.h from 8 to 5 bytes.