~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/hash0hash.ic

Merge Revision revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6900 from MySQL InnoDB

Original revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6900

Original Authors: mmakela
Original commit message:
branches/zip: Merge c6899 from branches/innodb+:

Add debug assertions to track down Bug #52360.
hash_table_t::magic_n: Add HASH_TABLE_MAGIC_N checks, which were fully absent.
ut_hash_ulint(): Assert table_size > 0 before division.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        hash_table_t*   table,  /*!< in: hash table */
36
36
        ulint           n)      /*!< in: cell index */
37
37
{
 
38
        ut_ad(table);
 
39
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
38
40
        ut_ad(n < table->n_cells);
39
41
 
40
42
        return(table->array + n);
48
50
/*=============*/
49
51
        hash_table_t*   table)  /*!< in/out: hash table */
50
52
{
 
53
        ut_ad(table);
 
54
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
51
55
        memset(table->array, 0x0,
52
56
               table->n_cells * sizeof(*table->array));
53
57
}
61
65
/*=============*/
62
66
        hash_table_t*   table)  /*!< in: table */
63
67
{
 
68
        ut_ad(table);
 
69
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
64
70
        return(table->n_cells);
65
71
}
66
72
 
74
80
        ulint           fold,   /*!< in: folded value */
75
81
        hash_table_t*   table)  /*!< in: hash table */
76
82
{
 
83
        ut_ad(table);
 
84
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
77
85
        return(ut_hash_ulint(fold, table->n_cells));
78
86
}
79
87
 
88
96
        hash_table_t*   table,  /*!< in: hash table */
89
97
        ulint           fold)   /*!< in: fold */
90
98
{
 
99
        ut_ad(table);
 
100
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
91
101
        ut_ad(ut_is_2pow(table->n_mutexes));
92
102
        return(ut_2pow_remainder(hash_calc_hash(fold, table),
93
103
                                 table->n_mutexes));
103
113
        hash_table_t*   table,  /*!< in: hash table */
104
114
        ulint           i)      /*!< in: index of the heap */
105
115
{
 
116
        ut_ad(table);
 
117
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
106
118
        ut_ad(i < table->n_mutexes);
107
119
 
108
120
        return(table->heaps[i]);
120
132
{
121
133
        ulint   i;
122
134
 
 
135
        ut_ad(table);
 
136
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
 
137
 
123
138
        if (table->heap) {
124
139
                return(table->heap);
125
140
        }
139
154
        hash_table_t*   table,  /*!< in: hash table */
140
155
        ulint           i)      /*!< in: index of the mutex */
141
156
{
 
157
        ut_ad(table);
 
158
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
142
159
        ut_ad(i < table->n_mutexes);
143
160
 
144
161
        return(table->mutexes + i);
156
173
{
157
174
        ulint   i;
158
175
 
 
176
        ut_ad(table);
 
177
        ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
 
178
 
159
179
        i = hash_get_mutex_no(table, fold);
160
180
 
161
181
        return(hash_get_nth_mutex(table, i));