~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to storage/myisammrg/myrg_open.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
        myrg_attach_children(). Please duplicate changes in these
34
34
        functions or make common sub-functions.
35
35
*/
36
 
/* purecov: begin deadcode */ /* not used in MySQL server */
37
36
 
38
37
MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
39
38
{
47
46
  MI_INFO *isam=0;
48
47
  uint found_merge_insert_method= 0;
49
48
  size_t name_buff_length;
 
49
  my_bool bad_children= FALSE;
50
50
  DBUG_ENTER("myrg_open");
51
51
 
52
52
  LINT_INIT(key_parts);
97
97
      fn_format(buff, buff, "", "", 0);
98
98
    if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
99
99
    {
100
 
      my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
101
100
      if (handle_locking & HA_OPEN_FOR_REPAIR)
102
101
      {
103
102
        myrg_print_wrong_table(buff);
 
103
        bad_children= TRUE;
104
104
        continue;
105
105
      }
106
 
      goto err;
 
106
      goto bad_children;
107
107
    }
108
108
    if (!m_info)                                /* First file */
109
109
    {
128
128
    files++;
129
129
    if (m_info->reclength != isam->s->base.reclength)
130
130
    {
131
 
      my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
132
131
      if (handle_locking & HA_OPEN_FOR_REPAIR)
133
132
      {
134
133
        myrg_print_wrong_table(buff);
 
134
        bad_children= TRUE;
135
135
        continue;
136
136
      }
137
 
      goto err;
 
137
      goto bad_children;
138
138
    }
139
139
    m_info->options|= isam->s->options;
140
140
    m_info->records+= isam->state->records;
147
147
                                     m_info->tables);
148
148
  }
149
149
 
150
 
  if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
151
 
    goto err;
 
150
  if (bad_children)
 
151
    goto bad_children;
152
152
  if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
153
153
                                                  MYF(MY_WME | MY_ZEROFILL))))
154
154
    goto err;
178
178
  pthread_mutex_unlock(&THR_LOCK_open);
179
179
  DBUG_RETURN(m_info);
180
180
 
 
181
bad_children:
 
182
  my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
181
183
err:
182
184
  save_errno=my_errno;
183
185
  switch (errpos) {
184
186
  case 3:
185
187
    while (files)
186
 
      mi_close(m_info->open_tables[--files].table);
 
188
      (void) mi_close(m_info->open_tables[--files].table);
187
189
    my_free((char*) m_info,MYF(0));
188
190
    /* Fall through */
189
191
  case 2:
195
197
  my_errno=save_errno;
196
198
  DBUG_RETURN (NULL);
197
199
}
198
 
/* purecov: end */
199
200
 
200
201
 
201
202
/**
392
393
  uint       child_nr;
393
394
  uint       key_parts;
394
395
  uint       min_keys;
 
396
  my_bool    bad_children= FALSE;
395
397
  DBUG_ENTER("myrg_attach_children");
396
398
  DBUG_PRINT("myrg", ("handle_locking: %d", handle_locking));
397
399
 
424
426
      if (!m_info->rec_per_key_part)
425
427
      {
426
428
        if(!(m_info->rec_per_key_part= (ulong*)
427
 
             my_malloc(key_parts * sizeof(long), MYF(MY_WME|MY_ZEROFILL))))
 
429
             my_malloc(key_parts * sizeof(long), MYF(MY_WME))))
428
430
          goto err; /* purecov: inspected */
429
431
        errpos= 1;
430
432
      }
 
433
      bzero((char*) m_info->rec_per_key_part, key_parts * sizeof(long));
431
434
    }
432
435
 
433
436
    /* Add MyISAM table info. */
441
444
      DBUG_PRINT("error", ("definition mismatch table: '%s'  repair: %d",
442
445
                           myisam->filename,
443
446
                           (handle_locking & HA_OPEN_FOR_REPAIR)));
444
 
      my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
445
447
      if (handle_locking & HA_OPEN_FOR_REPAIR)
446
448
      {
447
449
        myrg_print_wrong_table(myisam->filename);
 
450
        bad_children= TRUE;
448
451
        continue;
449
452
      }
450
 
      goto err;
 
453
      goto bad_children;
451
454
    }
452
455
 
453
456
    m_info->options|= myisam->s->options;
462
465
    child_nr++;
463
466
  }
464
467
 
 
468
  if (bad_children)
 
469
    goto bad_children;
 
470
  /* Note: callback() resets my_errno, so it is safe to check it here */
465
471
  if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
466
472
    goto err;
467
473
  if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
477
483
  pthread_mutex_unlock(&m_info->mutex);
478
484
  DBUG_RETURN(0);
479
485
 
 
486
bad_children:
 
487
  my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
480
488
err:
481
489
  save_errno= my_errno;
482
490
  switch (errpos) {