~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-proposed

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/dict/dict0load.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496

Show diffs side-by-side

added added

removed removed

Lines of Context:
553
553
}
554
554
 
555
555
/********************************************************************//**
556
 
Loads definitions for index fields. */
 
556
Loads definitions for index fields.
 
557
@return DB_SUCCESS if ok, DB_CORRUPTION if failed */
557
558
static
558
 
void
 
559
ulint
559
560
dict_load_fields(
560
561
/*=============*/
561
562
        dict_index_t*   index,  /*!< in: index whose fields to load */
574
575
        byte*           buf;
575
576
        ulint           i;
576
577
        mtr_t           mtr;
 
578
        ulint           error = DB_SUCCESS;
577
579
 
578
580
        ut_ad(mutex_own(&(dict_sys->mutex)));
579
581
 
640
642
 
641
643
                field = rec_get_nth_field_old(rec, 4, &len);
642
644
 
 
645
                if (prefix_len >= DICT_MAX_INDEX_COL_LEN) {
 
646
                        fprintf(stderr, "InnoDB: Error: load index"
 
647
                                        " '%s' failed.\n"
 
648
                                        "InnoDB: index field '%s' has a prefix"
 
649
                                        " length of %lu bytes,\n"
 
650
                                        "InnoDB: which exceeds the"
 
651
                                        " maximum limit of %lu bytes.\n"
 
652
                                        "InnoDB: Please use server that"
 
653
                                        " supports long index prefix\n"
 
654
                                        "InnoDB: or turn on"
 
655
                                        " innodb_force_recovery to load"
 
656
                                        " the table\n",
 
657
                                index->name, mem_heap_strdupl(
 
658
                                                heap, (char*) field, len),
 
659
                                (ulong) prefix_len,
 
660
                                (ulong) (DICT_MAX_INDEX_COL_LEN - 1));
 
661
                        error = DB_CORRUPTION;
 
662
                        goto func_exit;
 
663
                }
 
664
 
643
665
                dict_mem_index_add_field(index,
644
666
                                         mem_heap_strdupl(heap,
645
667
                                                          (char*) field, len),
649
671
                btr_pcur_move_to_next_user_rec(&pcur, &mtr);
650
672
        }
651
673
 
 
674
func_exit:
652
675
        btr_pcur_close(&pcur);
653
676
        mtr_commit(&mtr);
 
677
        return(error);
654
678
}
655
679
 
656
680
/********************************************************************//**
801
825
                                                      space, type, n_fields);
802
826
                        index->id = id;
803
827
 
804
 
                        dict_load_fields(index, heap);
 
828
                        error = dict_load_fields(index, heap);
 
829
 
 
830
                        if (error != DB_SUCCESS) {
 
831
                                fprintf(stderr, "InnoDB: Error: load index '%s'"
 
832
                                        " for table '%s' failed\n",
 
833
                                        index->name, table->name);
 
834
 
 
835
                                /* If the force recovery flag is set, and
 
836
                                if the failed index is not the primary index, we
 
837
                                will continue and open other indexes */
 
838
                                if (srv_force_recovery
 
839
                                    && !(index->type & DICT_CLUSTERED)) {
 
840
                                        error = DB_SUCCESS;
 
841
                                        goto next_rec;
 
842
                                } else {
 
843
                                        goto func_exit;
 
844
                                }
 
845
                        }
 
846
 
805
847
                        error = dict_index_add_to_cache(table, index, page_no,
806
848
                                                        FALSE);
807
849
                        /* The data dictionary tables should never contain
1027
1069
                } else {
1028
1070
                        table->fk_max_recusive_level = 0;
1029
1071
                }
1030
 
        } else if (!srv_force_recovery) {
1031
 
                dict_table_remove_from_cache(table);
1032
 
                table = NULL;
 
1072
        } else {
 
1073
                dict_index_t*   index;
 
1074
 
 
1075
                /* Make sure that at least the clustered index was loaded.
 
1076
                Otherwise refuse to load the table */
 
1077
                index = dict_table_get_first_index(table);
 
1078
 
 
1079
                if (!srv_force_recovery || !index
 
1080
                     || !(index->type & DICT_CLUSTERED)) {
 
1081
                        dict_table_remove_from_cache(table);
 
1082
                        table = NULL;
 
1083
                }
1033
1084
        }
1034
1085
#if 0
1035
1086
        if (err != DB_SUCCESS && table != NULL) {