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

« back to all changes in this revision

Viewing changes to storage/innobase/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:
454
454
/************************************************************************
455
455
Loads definitions for index fields. */
456
456
static
457
 
void
 
457
ulint
458
458
dict_load_fields(
459
459
/*=============*/
 
460
                                /* out: DB_SUCCESS if ok, DB_CORRUPTION 
 
461
                                if failed */
460
462
        dict_table_t*   table,  /* in: table */
461
463
        dict_index_t*   index,  /* in: index whose fields to load */
462
464
        mem_heap_t*     heap)   /* in: memory heap for temporary storage */
474
476
        byte*           buf;
475
477
        ulint           i;
476
478
        mtr_t           mtr;
 
479
        ulint           error = DB_SUCCESS;
477
480
 
478
481
        ut_ad(mutex_own(&(dict_sys->mutex)));
479
482
 
535
538
 
536
539
                field = rec_get_nth_field_old(rec, 4, &len);
537
540
 
 
541
                if (prefix_len >= DICT_MAX_INDEX_COL_LEN) {
 
542
                        fprintf(stderr, "InnoDB: Error: load index"
 
543
                                        " '%s' failed.\n"
 
544
                                        "InnoDB: index field '%s' has a prefix"
 
545
                                        " length of %lu bytes,\n"
 
546
                                        "InnoDB: which exceeds the"
 
547
                                        " maximum limit of %lu bytes.\n"
 
548
                                        "InnoDB: Please use server that"
 
549
                                        " supports long index prefix\n"
 
550
                                        "InnoDB: or turn on"
 
551
                                        " innodb_force_recovery to load"
 
552
                                        " the table\n",
 
553
                                index->name, mem_heap_strdupl(
 
554
                                                heap, (char*) field, len),
 
555
                                (ulong) prefix_len,
 
556
                                (ulong) (DICT_MAX_INDEX_COL_LEN - 1));
 
557
                        error = DB_CORRUPTION;
 
558
                        goto func_exit;
 
559
                }
 
560
 
538
561
                dict_mem_index_add_field(index,
539
562
                                         mem_heap_strdupl(heap,
540
563
                                                          (char*) field, len),
543
566
                btr_pcur_move_to_next_user_rec(&pcur, &mtr);
544
567
        }
545
568
 
 
569
func_exit:
546
570
        btr_pcur_close(&pcur);
547
571
        mtr_commit(&mtr);
 
572
        return(error);
548
573
}
549
574
 
550
575
/************************************************************************
701
726
                                                      space, type, n_fields);
702
727
                        index->id = id;
703
728
 
704
 
                        dict_load_fields(table, index, heap);
 
729
                        error = dict_load_fields(table, index, heap);
 
730
 
 
731
                        if (error != DB_SUCCESS) {
 
732
                                fprintf(stderr, "InnoDB: Error: load index '%s'"
 
733
                                        " for table '%s' failed\n",
 
734
                                        index->name, table->name);
 
735
 
 
736
                                /* If the force recovery flag is set, and
 
737
                                if the failed index is not the primary index, we
 
738
                                will continue and open other indexes */
 
739
                                if (srv_force_recovery
 
740
                                    && !(index->type & DICT_CLUSTERED)) {
 
741
                                        error = DB_SUCCESS;
 
742
                                        goto next_rec;
 
743
                                } else {
 
744
                                        goto func_exit;
 
745
                                }
 
746
                        }
 
747
 
705
748
                        dict_index_add_to_cache(table, index, page_no);
706
749
                }
707
 
 
 
750
next_rec:
708
751
                btr_pcur_move_to_next_user_rec(&pcur, &mtr);
709
752
        }
710
753
 
881
924
                } else {
882
925
                        table->fk_max_recusive_level = 0;
883
926
                }
884
 
        } else if (!srv_force_recovery) {
885
 
                dict_table_remove_from_cache(table);
886
 
                table = NULL;
 
927
        } else {
 
928
                dict_index_t*   index;
 
929
 
 
930
                /* Make sure that at least the clustered index was loaded.
 
931
                Otherwise refuse to load the table */
 
932
                index = dict_table_get_first_index(table);
 
933
 
 
934
                if (!srv_force_recovery || !index
 
935
                     || !(index->type & DICT_CLUSTERED)) {
 
936
                        dict_table_remove_from_cache(table);
 
937
                        table = NULL;
 
938
                }
887
939
        }
888
940
#if 0
889
941
        if (err != DB_SUCCESS && table != NULL) {