@@ -30,9 +30,7 @@ Created 11/26/1995 Heikki Tuuri
30
30
#include " buf0flu.h"
31
31
#include " page0types.h"
32
32
#include " mtr0log.h"
33
- #include " log0log.h"
34
33
#include " row0trunc.h"
35
-
36
34
#include " log0recv.h"
37
35
38
36
/* * Iterate over a memo block in reverse. */
@@ -204,143 +202,84 @@ struct FindPage
204
202
205
203
/* * Release latches and decrement the buffer fix count.
206
204
@param slot memo slot */
207
- static
208
- void
209
- memo_slot_release (mtr_memo_slot_t * slot)
210
- {
211
- switch (slot->type ) {
212
- case MTR_MEMO_BUF_FIX:
213
- case MTR_MEMO_PAGE_S_FIX:
214
- case MTR_MEMO_PAGE_SX_FIX:
215
- case MTR_MEMO_PAGE_X_FIX: {
216
-
217
- buf_block_t * block;
218
-
219
- block = reinterpret_cast <buf_block_t *>(slot->object );
220
-
221
- buf_block_unfix (block);
222
- buf_page_release_latch (block, slot->type );
223
- break ;
224
- }
225
-
226
- case MTR_MEMO_S_LOCK:
227
- rw_lock_s_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
228
- break ;
229
-
230
- case MTR_MEMO_SX_LOCK:
231
- rw_lock_sx_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
232
- break ;
233
-
234
- case MTR_MEMO_X_LOCK:
235
- rw_lock_x_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
236
- break ;
237
-
238
- #ifdef UNIV_DEBUG
239
- default :
240
- ut_ad (slot->type == MTR_MEMO_MODIFY);
241
- #endif /* UNIV_DEBUG */
242
- }
243
-
244
- slot->object = NULL ;
245
- }
246
-
247
- /* * Unfix a page, do not release the latches on the page.
248
- @param slot memo slot */
249
- static
250
- void
251
- memo_block_unfix (mtr_memo_slot_t * slot)
252
- {
253
- switch (slot->type ) {
254
- case MTR_MEMO_BUF_FIX:
255
- case MTR_MEMO_PAGE_S_FIX:
256
- case MTR_MEMO_PAGE_X_FIX:
257
- case MTR_MEMO_PAGE_SX_FIX: {
258
- buf_block_unfix (reinterpret_cast <buf_block_t *>(slot->object ));
259
- break ;
260
- }
261
-
262
- case MTR_MEMO_S_LOCK:
263
- case MTR_MEMO_X_LOCK:
264
- case MTR_MEMO_SX_LOCK:
265
- break ;
266
- #ifdef UNIV_DEBUG
267
- default :
268
- #endif /* UNIV_DEBUG */
269
- break ;
270
- }
271
- }
272
- /* * Release latches represented by a slot.
273
- @param slot memo slot */
274
- static
275
- void
276
- memo_latch_release (mtr_memo_slot_t * slot)
205
+ static void memo_slot_release (mtr_memo_slot_t *slot)
277
206
{
278
- switch (slot->type ) {
279
- case MTR_MEMO_BUF_FIX:
280
- case MTR_MEMO_PAGE_S_FIX:
281
- case MTR_MEMO_PAGE_SX_FIX:
282
- case MTR_MEMO_PAGE_X_FIX: {
283
- buf_block_t * block;
284
-
285
- block = reinterpret_cast <buf_block_t *>(slot->object );
286
-
287
- memo_block_unfix (slot);
288
-
289
- buf_page_release_latch (block, slot->type );
290
-
291
- slot->object = NULL ;
292
- break ;
293
- }
294
-
295
- case MTR_MEMO_S_LOCK:
296
- rw_lock_s_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
297
- slot->object = NULL ;
298
- break ;
299
-
300
- case MTR_MEMO_X_LOCK:
301
- rw_lock_x_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
302
- slot->object = NULL ;
303
- break ;
304
-
305
- case MTR_MEMO_SX_LOCK:
306
- rw_lock_sx_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
307
- slot->object = NULL ;
308
- break ;
309
-
207
+ switch (slot->type ) {
310
208
#ifdef UNIV_DEBUG
311
- default :
312
- ut_ad (slot->type == MTR_MEMO_MODIFY);
313
-
314
- slot->object = NULL ;
209
+ default :
210
+ ut_ad (!" invalid type" );
211
+ break ;
212
+ case MTR_MEMO_MODIFY:
213
+ break ;
315
214
#endif /* UNIV_DEBUG */
316
- }
215
+ case MTR_MEMO_S_LOCK:
216
+ rw_lock_s_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
217
+ break ;
218
+ case MTR_MEMO_SX_LOCK:
219
+ rw_lock_sx_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
220
+ break ;
221
+ case MTR_MEMO_X_LOCK:
222
+ rw_lock_x_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
223
+ break ;
224
+ case MTR_MEMO_BUF_FIX:
225
+ case MTR_MEMO_PAGE_S_FIX:
226
+ case MTR_MEMO_PAGE_SX_FIX:
227
+ case MTR_MEMO_PAGE_X_FIX:
228
+ buf_block_t *block= reinterpret_cast <buf_block_t *>(slot->object );
229
+ buf_block_unfix (block);
230
+ buf_page_release_latch (block, slot->type );
231
+ break ;
232
+ }
233
+ slot->object = NULL ;
317
234
}
318
235
319
236
/* * Release the latches acquired by the mini-transaction. */
320
237
struct ReleaseLatches {
321
-
322
- /* * @return true always. */
323
- bool operator ()(mtr_memo_slot_t * slot) const
324
- {
325
- if (slot->object != NULL ) {
326
- memo_latch_release (slot);
327
- }
328
-
329
- return (true );
330
- }
238
+ /* * @return true always. */
239
+ bool operator ()(mtr_memo_slot_t *slot) const
240
+ {
241
+ if (!slot->object )
242
+ return true ;
243
+ switch (slot->type ) {
244
+ #ifdef UNIV_DEBUG
245
+ default :
246
+ ut_ad (!" invalid type" );
247
+ break ;
248
+ case MTR_MEMO_MODIFY:
249
+ break ;
250
+ #endif /* UNIV_DEBUG */
251
+ case MTR_MEMO_S_LOCK:
252
+ rw_lock_s_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
253
+ break ;
254
+ case MTR_MEMO_X_LOCK:
255
+ rw_lock_x_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
256
+ break ;
257
+ case MTR_MEMO_SX_LOCK:
258
+ rw_lock_sx_unlock (reinterpret_cast <rw_lock_t *>(slot->object ));
259
+ break ;
260
+ case MTR_MEMO_BUF_FIX:
261
+ case MTR_MEMO_PAGE_S_FIX:
262
+ case MTR_MEMO_PAGE_SX_FIX:
263
+ case MTR_MEMO_PAGE_X_FIX:
264
+ buf_block_t *block= reinterpret_cast <buf_block_t *>(slot->object );
265
+ buf_block_unfix (block);
266
+ buf_page_release_latch (block, slot->type );
267
+ break ;
268
+ }
269
+ slot->object = NULL ;
270
+ return true ;
271
+ }
331
272
};
332
273
333
274
/* * Release the latches and blocks acquired by the mini-transaction. */
334
275
struct ReleaseAll {
335
- /* * @return true always. */
336
- bool operator ()(mtr_memo_slot_t * slot) const
337
- {
338
- if (slot->object != NULL ) {
339
- memo_slot_release (slot);
340
- }
341
-
342
- return (true );
343
- }
276
+ /* * @return true always. */
277
+ bool operator ()(mtr_memo_slot_t *slot) const
278
+ {
279
+ if (slot->object )
280
+ memo_slot_release (slot);
281
+ return true ;
282
+ }
344
283
};
345
284
346
285
#ifdef UNIV_DEBUG
@@ -349,7 +288,7 @@ struct DebugCheck {
349
288
/* * @return true always. */
350
289
bool operator ()(const mtr_memo_slot_t * slot) const
351
290
{
352
- ut_a ( slot->object == NULL );
291
+ ut_ad (! slot->object );
353
292
return (true );
354
293
}
355
294
};
0 commit comments