Bug #37843 Comment for Query_cache::send_result_to_client is wrong
Submitted: 3 Jul 2008 17:31 Modified: 7 Mar 2010 18:23
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.62/5.1/6.0 OS:Any
Assigned to: Davi Arnaut CPU Architecture:Any
Tags: cache, query, send_result_to_client

[3 Jul 2008 17:31] Mark Callaghan
Description:
send_result_to_client returns 1 when a result is returned to the client, not 0 as stated in the comment.

/*
  Check if the query is in the cache. If it was cached, send it
  to the user.

  RESULTS
        1       Query was not cached.
        0       The query was cached and user was sent the result.
        -1      The query was cached but we didn't have rights to use it.
                No error is sent to the client yet.

  NOTE
  This method requires that sql points to allocated memory of size:
  tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
*/

int
Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
{

How to repeat:
Read the code.

Suggested fix:
Fix the comment
[3 Jul 2008 18:34] MySQL Verification Team
Thank you for the bug report.

  BLOCK_UNLOCK_RD(query_block);
  DBUG_RETURN(1);				// Result sent to client

err_unlock:
  STRUCT_UNLOCK(&structure_guard_mutex);
err:
  DBUG_RETURN(0);				// Query was not cached
}
[3 Jul 2008 18:47] 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/48980

2672 Davi Arnaut	2008-07-03
      Bug#37843 Comment for Query_cache::send_result_to_client is wrong
      
      Correct wrong description of the Query_cache::send_result_to_client
      function.
[3 Jul 2008 18:50] Davi Arnaut
Queued to 6.0-runtime, will queue to lower trees later.
[7 Aug 2008 3:01] 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/51061

2749 Davi Arnaut	2008-08-06 [merge]
      Merge mysql-6.0 into mysql-6.0-bugteam
[7 Aug 2008 3:06] 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/51062

2749 Davi Arnaut	2008-08-07 [merge]
      Merge mysql-6.0 into mysql-6.0-bugteam
[7 Aug 2008 3:16] 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/51063

2749 Davi Arnaut	2008-08-07 [merge]
      Merge mysql-6.0 into mysql-6.0-bugteam
[13 Sep 2008 23:50] Bugs System
Pushed into 6.0.7-alpha  (revid:davi@sun.com-20080703184138-1orffi9l3hp028yv) (version source revid:timothy.smith@sun.com-20080813063149-5o63l7vlvbm6nuhm) (pib:3)
[18 Sep 2008 7:15] Paul DuBois
No user-visible change. No changelog entry needed.

Setting report to NDI pending push into 5.0.x/5.1.x.
[18 Sep 2008 8:59] Paul DuBois
This patch is not going to be pushed to 5.0.x or 5.1.x. Closing report.
[10 Nov 2009 18:33] 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/89995

2918 Davi Arnaut	2009-11-10
      Backport of Bug#37843 to mysql-next-mr
     @ sql/sql_cache.cc
        Swap return value description.
[20 Nov 2009 12:54] Bugs System
Pushed into 5.6.0-beta (revid:davi.arnaut@sun.com-20091119234808-xbjpkwaxjt5x5c0b) (version source revid:davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t) (merge vers: 6.0.12-alpha) (pib:13)
[20 Nov 2009 12:56] Bugs System
Pushed into 6.0.14-alpha (revid:kostja@sun.com-20091120124947-yi6h2jbgw0kbciwm) (version source revid:davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t) (merge vers: 6.0.12-alpha) (pib:13)
[20 Nov 2009 23:53] Paul DuBois
No user-visible change. No changelog entry needed.
[6 Mar 2010 10:51] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:davi.arnaut@sun.com-20090522170916-fzc5ca3tjs9roy1t) (merge vers: 6.0.12-alpha) (pib:16)
[7 Mar 2010 18:23] Paul DuBois
No changelog entry needed.