Bug #41416 connector/j spits out 'invalid value' when no auto_increment_increment
Submitted: 12 Dec 2008 2:03 Modified: 16 Jul 2009 13:25
Reporter: marc slemko Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.7 OS:Any
Assigned to: CPU Architecture:Any

[12 Dec 2008 2:03] marc slemko
Description:
We are trying to upgrade to connector/j 5.1.7 running against mysql 4.1.18.  Whenever we get a connection we get this message spit out:

Thu Dec 11 17:38:21 PST 2008 WARN: Invalid value {1} for server variable named {0}, falling back to sane default of {2}.

It appears this is due to code added to fix bug 39956:

   this.autoIncrementIncrement = getServerVariableAsInt("auto_increment_increment", 1);

This is executed as long as the server is above 3.21.22, but this variable doesn't exist in most versions of mysql.  It is not in 4.1.18, so getServerVariableAsInt throws a NumberFormatException and this error is logged.

This is related to bug 40772 (Meaningless warning message 'Invalid value {1} for server ...' is displayed.), but that bug is just talking about how the values aren't properly filled into the template in the message.  This bug is about the message appearing when it shouldn't.

I understand that 4.1 is an old version of mysql, but this makes it hard to incrementally upgrade when you have a variety of versions of mysql involved.

How to repeat:
Open a connection using 5.1.7 to a server running 4.1.18 or another mysql version that doesn't support auto_increment_increment (anything pre 5.0.2 according to the docs).

Suggested fix:
The code should probably assume it has a value of 1 if the server doesn't support the variable.
[12 Dec 2008 9:19] Tonci Grgin
Hi and thanks for your report.

Verified as described looking into c/J 5.1 sources:
ConnectionImplementation.java, line 3416:
  if (versionMeetsMinimum(3, 21, 22)) {
	loadServerVariables();
	this.autoIncrementIncrement = getServerVariableAsInt("auto_increment_increment", 1);

There should be a condition as in line 3855:
  if (versionMeetsMinimum(5, 0, 2)) {
	results = stmt.executeQuery(versionComment + "SELECT @@session.auto_increment_increment");
[3 Jul 2009 12:47] Mark Matthews
Fixed for 5.1.8.
[16 Jul 2009 13:25] Tony Bedford
An entry was added to the 5.1.8 changelog:

When using Connector/J 5.1.7 to connect to MySQL Server 4.1.18 the following error message was generated:

Thu Dec 11 17:38:21 PST 2008 WARN: Invalid value {1} for server variable named {0},
falling back to sane default of {2}

This occurred with MySQL Server version that did not support auto_increment_increment. The error message should not have been generated.