Bug #46206 compressed protocol doesn't work
Submitted: 15 Jul 2009 15:03 Modified: 30 Jul 2009 12:34
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C Severity:S3 (Non-critical)
Version:6.0.1 OS:Any
Assigned to: CPU Architecture:Any

[15 Jul 2009 15:03] Georg Richter
Description:
Connector/C doesn't support compressed protocol.

How to repeat:
static int test_compress(MYSQL *mysql)
{
  my_bool my_true= TRUE;
  int thread_id;
  MYSQL_RES *res;
  MYSQL_ROW row;
  int rc;

  mysql= mysql_init(NULL);
  FAIL_IF(!mysql, "not enough memory");

  FAIL_UNLESS(mysql->reconnect == 0, "reconnect != 0");

  rc= mysql_options(mysql, MYSQL_OPT_RECONNECT, NULL);
  check_mysql_rc(rc, mysql);
  FAIL_UNLESS(mysql->reconnect == 1, "reconnect != 1");

  /* use compressed protocol */
  rc= mysql_options(mysql, MYSQL_OPT_COMPRESS, &my_true);

  if (!(mysql_real_connect(mysql, hostname, username,
                           password, schema, port,
                           socketname, 0)))
  {
    diag("connection failed");
    return FAIL;
  }

  rc= mysql_query(mysql, "SHOW STATUS LIKE 'compression'");
  check_mysql_rc(rc, mysql);
  res= mysql_store_result(mysql);
  row= mysql_fetch_row(res);
  diag("%s %s", row[0], row[1]);
  FAIL_UNLESS(strcmp(row[1], "ON") == 0, "Compression is off");
  mysql_free_result(res);
  
  mysql_close(mysql);
  return OK;
}
[16 Jul 2009 9:46] Peter Laursen
I would really like to know if the latest C-API's of 5.0, 5.1 and 5.4 -trees are affected!
[25 Jul 2009 15:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/79293

2859 Georg Richter	2009-07-25
      Fix for bug #46206
      - added missing HAVE_COMPRESS definition
      - added test
[28 Jul 2009 8:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/79386

2859 Georg Richter	2009-07-28
      fix for bug #46206
      - added missing definition of HAVE_COMPRESS
      - added test
[28 Jul 2009 17:18] Georg Richter
pushed into lp:libmysql - rev. 2859
[30 Jul 2009 12:34] Tony Bedford
An entry has been added to the 6.0.2 changelog:

MySQL Connector/C did not support communication with the server if compression was enabled.