Bug #50845 BACKPORT: The test backup_client_coverage is failing in the porting tree
Submitted: 2 Feb 2010 18:33 Modified: 3 Sep 2010 8:41
Reporter: Chuck Bell Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:5.4.4 OS:Any
Assigned to: Ingo Strüwing CPU Architecture:Any

[2 Feb 2010 18:33] Chuck Bell
Description:
The test backup_client_coverage is failing on certain platforms in the porting tree in PB (mysql-backup-backport).

The test fails on the following platforms: HPUX, Solaris, Windows but seems random, but fails regularly on Winx32 platforms.

The failure is (predictably):

ackup.backup_client_coverage            [ fail ]
        Test ended at 2010-01-29 21:49:47

CURRENT_TEST: backup.backup_client_coverage
*** /export/tmp/pb2/test/sb_1-1263794-1264794810.39/mysql-5.6.0-beta-hpux11.31-ia64-test/mysql-test/suite/backup/r/backup_client_coverage.result	Fri Jan 29 22:32:59 2010
--- /export/tmp/pb2/test/sb_1-1263794-1264794810.39/mysql-5.6.0-beta-hpux11.31-ia64-test/mysql-test/suite/backup/r/backup_client_coverage.reject	Fri Jan 29 23:49:47 2010
***************
*** 344,352 ****
  
  ERROR: ERROR_INJECT("bcat_add_item_perdb_insert")
  
  mysqlbackup: Out of memory
  
! ERROR: error on stream library read of catalog.
  
  # Injecting error at bcat_add_item_ordered_insert
  
--- 344,354 ----
  
  ERROR: ERROR_INJECT("bcat_add_item_perdb_insert")
  
+ Server charset:      'utf8'
+ Backup image chrset: 'utf8'
  mysqlbackup: Out of memory
  
! ERROR: error on stream library read of meta data.
  
  # Injecting error at bcat_add_item_ordered_insert

How to repeat:
./mysql-test-run.pl backup_client_coverage

Suggested fix:
Unknown. 

Notes (from email conversation)
-------------------------------
There is one possible explanation though. Dynamic arrays (here
bup_database->db_perdbs) can be preallocated. Then an insert_dynamic()
does not always need to call my_malloc(). However, for this test to
work, I set the preallocation of all arrays to 0 and the allocation
chunk size to 1, so that every insert_dynamic() must always call
my_malloc(). Perhaps this failed somehow and bup_database->db_perdbs
became preallocated?

If you grab/print bup_database->db_perdbs.elements and
bup_database->db_perdbs.max_element at this place in
client/backup_stream.c, it should tell us, if the above happened. If the
code works as expected, both values must be equal. Then a malloc is
forced. And with my_malloc_error_inject set by ERROR_INJECT it should
give an allocation error.

result: 

Before call: elements = 0, max_elements = 1     

  err= insert_dynamic(&bup_database->db_perdbs, (uchar*) &bup_perdb);

After call: elements = 1, max_elements = 1
[3 Feb 2010 11:49] Ingo Strüwing
In 5.6 a buffer allocation is forced. Hence the error injection does not work as designed for 6.0. In 6.0 a dynamic array can be created without initial allocation. This has been introduced by http://lists.mysql.com/maria/142 revid:serg@mysql.com-20080808111127-rv1sk7teaohl2ovs

Do we want to have this in 5.6? Otherwise a couple of tests based on error injection to dynamic arrays need to be redesigned.
[4 Feb 2010 16:32] Ingo Strüwing
The failure does not show up on all platforms. If insert_dynamic() does not fail as planned, the next operation is another insert_dynamic() into another array. Dependent on the order of elements found in the backup image, it can happen that the second insert_dynamic() is the first or second one for the other array. Then a malloc is either done or not done. Hence the error injection can hit at that place or or pass another time.
[4 Feb 2010 17:14] 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/99329

3081 Ingo Struewing	2010-02-04
      Bug#50845 - BACKPORT: The test backup_client_coverage is failing in the porting tree
      Back ported part of revid:serg@mysql.com-20080808111127-rv1sk7teaohl2ovs
        wt_thd_lazy_init(), per-thread deadlock search depths and timeouts
      
      The original message is misleading. The patch contained a change to dynamic
      arrays too. Only these extra changes have been included here.
     @ mysys/array.c
        Bug#50845 - BACKPORT: The test backup_client_coverage is failing in the porting tree
            lazy alloc in dynamic array
        Allow zero initial buffer allocation. Thus force allocation at first insert.
     @ sql-common/client.c
        Bug#50845 - BACKPORT: The test backup_client_coverage is failing in the porting tree
            for dynamic array, specify init_alloc==alloc_increment explicitly
[4 Feb 2010 17:17] Ingo Strüwing
Pure backport. No review required.
[5 Feb 2010 16:26] Ingo Strüwing
Queued to mysql-next-mr-backup, mysql-next-mr-backup-merge, and mysql-backup-backport.
[3 Sep 2010 8:41] Ingo Strüwing
The feature will not be implemented.