Bug #71681 MySQL Applier for Hadoop doesn't compile with MySQL server versions prior to 5.6
Submitted: 12 Feb 2014 11:23 Modified: 13 Feb 2014 6:16
Reporter: Shubhangi Garg Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities: Binlog Events Severity:S3 (Non-critical)
Version:0.1.0 OS:Any
Assigned to: CPU Architecture:Any

[12 Feb 2014 11:23] Shubhangi Garg
Description:
MySQL Applier for Hadoop fails to build, when MYSQL_DIR points to server versions prior to 5.6. The reason for incompatibility with prior versions is the introduction of the new field types in 5.6, 'MYSQL_TYPE_TIME2’, 'MYSQL_TYPE_TIMESTAMP2’, and 'MYSQL_TYPE_DATETIME2’.

The bug has been reported unofficially as comments on the blog for the Applier
Link: 
http://innovating-technology.blogspot.in/2013/04/mysql-hadoop-applier-part-1.html?showComm...

How to repeat:
1. set MYSQL_DIR to point to base directory for MySQL 5.5
2. run cmake . && make

The build fails with the following output:

 [  3%] Building CXX object src/CMakeFiles/replication_shared.dir/value.cpp.o
/bzrroot/mysql/binlog-api/users/mkindahl/testing-trunk/src/value.cpp: In function ‘uint32_t mysql::calc_field_size(unsigned char, const unsigned char*, uint32_t)’:
/bzrroot/mysql/binlog-api/users/mkindahl/testing-trunk/src/value.cpp:151:8: error: ‘MYSQL_TYPE_TIME2’ was not declared in this scope
/bzrroot/mysql/binlog-api/users/mkindahl/testing-trunk/src/value.cpp:157:8: error: ‘MYSQL_TYPE_TIMESTAMP2’ was not declared in this scope
/bzrroot/mysql/binlog-api/users/mkindahl/testing-trunk/src/value.cpp:163:8: error: ‘MYSQL_TYPE_DATETIME2’ was not declared in this scope
make[2]: *** [src/CMakeFiles/replication_shared.dir/value.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/replication_shared.dir/all] Error 2
make: *** [all] Error 2 

Suggested fix:
1. Exclude new field types introduced in MYSQL 5.6

=== modified file 'src/value.cpp'
--- src/value.cpp
+++ src/value.cpp 2013-10-30 04:51:41 +0000
@@ -148,6 +148,8 @@
       }
       break;
     }
+//excluding the new field types introduced in 5.6 version 
+#if 0
   case MYSQL_TYPE_TIME2:
     if (metadata >  MAX_TIME_WIDTH)
       length= 3 + (metadata - MAX_TIME_WIDTH)/2;
@@ -166,6 +168,7 @@
     else
       length= 5;
     break;
+#endif
   default:
     length= UINT_MAX;
   }