62
62
+ ptrdiff_t frame_offset)
65
+ block->frame = ((void*)(block->frame) + frame_offset);
65
+ block->frame += frame_offset;
67
67
+ UNIV_MEM_DESC(block->frame, UNIV_PAGE_SIZE, block);
79
79
+#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
81
81
+ if (block->page.zip.data)
82
+ block->page.zip.data = ((void*)(block->page.zip.data) + frame_offset);
82
+ block->page.zip.data += frame_offset;
84
84
+ block->is_hashed = FALSE;
144
144
+ "InnoDB: Otherwise, data corruption in datafiles may result.\n");
146
146
+ /* FIXME: This is vague id still */
147
+ binary_id = (ulint) ((void*)mtr_commit - (void*)btr_root_get)
148
+ + (ulint) ((void*)os_get_os_version - (void*)buf_calc_page_new_checksum)
149
+ + (ulint) ((void*)page_dir_find_owner_slot - (void*)dfield_data_is_binary_equal)
150
+ + (ulint) ((void*)que_graph_publish - (void*)dict_casedn_str)
151
+ + (ulint) ((void*)read_view_oldest_copy_or_open_new - (void*)fil_space_get_version)
152
+ + (ulint) ((void*)rec_get_n_extern_new - (void*)fsp_get_size_low)
153
+ + (ulint) ((void*)row_get_trx_id_offset - (void*)ha_create_func)
154
+ + (ulint) ((void*)srv_set_io_thread_op_info - (void*)thd_is_replication_slave_thread)
155
+ + (ulint) ((void*)mutex_create_func - (void*)ibuf_inside)
156
+ + (ulint) ((void*)trx_set_detailed_error - (void*)lock_check_trx_id_sanity)
157
+ + (ulint) ((void*)ut_time - (void*)mem_heap_strdup);
147
+ binary_id = (ulint) ((byte*)mtr_commit - (byte*)btr_root_get)
148
+ + (ulint) ((byte*)os_get_os_version - (byte*)buf_calc_page_new_checksum)
149
+ + (ulint) ((byte*)page_dir_find_owner_slot - (byte*)dfield_data_is_binary_equal)
150
+ + (ulint) ((byte*)que_graph_publish - (byte*)dict_casedn_str)
151
+ + (ulint) ((byte*)read_view_oldest_copy_or_open_new - (byte*)fil_space_get_version)
152
+ + (ulint) ((byte*)rec_get_n_extern_new - (byte*)fsp_get_size_low)
153
+ + (ulint) ((byte*)row_get_trx_id_offset - (byte*)ha_create_func)
154
+ + (ulint) ((byte*)srv_set_io_thread_op_info - (byte*)thd_is_replication_slave_thread)
155
+ + (ulint) ((byte*)mutex_create_func - (byte*)ibuf_inside)
156
+ + (ulint) ((byte*)trx_set_detailed_error - (byte*)lock_check_trx_id_sanity)
157
+ + (ulint) ((byte*)ut_time - (byte*)mem_heap_strdup);
159
159
+ chunk->mem = os_shm_alloc(&chunk->mem_size, srv_buffer_pool_shm_key, &is_new);
171
171
+ shm_info = chunk->mem;
173
+ zip_hash_tmp = (hash_table_t*)((void*)chunk->mem + chunk->mem_size - zip_hash_mem_size);
173
+ zip_hash_tmp = (hash_table_t*)((byte*)chunk->mem + chunk->mem_size - zip_hash_mem_size);
176
176
+ strncpy(shm_info->head_str, BUF_SHM_INFO_HEAD, 8);
227
227
+ ut_a(shm_info->zip_hash_n == zip_hash_n);
229
229
+ /* check checksum */
230
+ checksum = ut_fold_binary(chunk->mem + sizeof(buf_shm_info_t),
230
+ checksum = ut_fold_binary((byte*)chunk->mem + sizeof(buf_shm_info_t),
231
231
+ chunk->mem_size - sizeof(buf_shm_info_t));
232
232
+ if (shm_info->checksum != checksum) {
233
233
+ fprintf(stderr,
260
260
/* Allocate the block descriptors from
261
261
the start of the memory block. */
262
262
+ if (srv_buffer_pool_shm_key) {
263
+ chunk->blocks = chunk->mem + sizeof(buf_shm_info_t);
263
+ chunk->blocks = (buf_block_t*)((byte*)chunk->mem + sizeof(buf_shm_info_t));
265
265
chunk->blocks = chunk->mem;
268
268
/* Align a pointer to the first frame. Note that when
269
269
os_large_page_size is smaller than UNIV_PAGE_SIZE,
270
@@ -795,8 +1003,13 @@
270
@@ -795,8 +1006,13 @@
271
271
it is bigger, we may allocate more blocks than requested. */
273
273
frame = ut_align(chunk->mem, UNIV_PAGE_SIZE);
303
303
+ chunk->size = shm_info->chunk_backup.size;
304
+ phys_offset = (void*)frame - (void*)((void*)chunk->mem + shm_info->frame_offset);
305
+ logi_offset = (void*)frame - (void*)chunk->blocks[0].frame;
304
+ phys_offset = frame - (byte*)chunk->mem + shm_info->frame_offset;
305
+ logi_offset = frame - chunk->blocks[0].frame;
306
306
+ previous_frame_address = chunk->blocks[0].frame;
307
+ blocks_offset = (void*)chunk->blocks - (void*)shm_info->chunk_backup.blocks;
307
+ blocks_offset = (byte*)chunk->blocks - (byte*)shm_info->chunk_backup.blocks;
309
309
+ if (phys_offset || logi_offset || blocks_offset) {
310
310
+ fprintf(stderr,
315
315
+ "InnoDB: Pysical offset : %ld (%#lx)\n"
316
316
+ "InnoDB: Logical offset (frames) : %ld (%#lx)\n"
317
317
+ "InnoDB: Logical offset (blocks) : %ld (%#lx)\n",
318
+ (void*)((void*)chunk->mem + shm_info->frame_offset),
319
+ (void*)chunk->blocks[0].frame, (void*)frame,
318
+ (byte*)chunk->mem + shm_info->frame_offset,
319
+ chunk->blocks[0].frame, frame,
320
320
+ phys_offset, phys_offset, logi_offset, logi_offset,
321
321
+ blocks_offset, blocks_offset);
328
328
+ fprintf(stderr,
329
329
+ "InnoDB: Aligning physical offset...");
331
+ memmove((void*)frame, (void*)((void*)chunk->mem + shm_info->frame_offset),
331
+ memmove(frame, (byte*)chunk->mem + shm_info->frame_offset,
332
332
+ chunk->size * UNIV_PAGE_SIZE);
334
334
+ fprintf(stderr,
356
356
+ previous_frame_address, logi_offset, blocks_offset);
357
357
+ if (shm_info->buf_pool_backup.LRU_old)
358
358
+ shm_info->buf_pool_backup.LRU_old =
359
+ ((void*)(shm_info->buf_pool_backup.LRU_old)
359
+ (buf_page_t*)((byte*)(shm_info->buf_pool_backup.LRU_old)
360
360
+ + (((void*)shm_info->buf_pool_backup.LRU_old > previous_frame_address)
361
361
+ ? logi_offset : blocks_offset));
380
380
/* Init block structs and assign frames for them. Then we
381
381
assign the frames to the first blocks (we already mapped the
382
382
memory above). */
383
@@ -833,6 +1138,11 @@
383
@@ -833,6 +1141,11 @@
385
385
frame += UNIV_PAGE_SIZE;
389
389
+ if (shm_info) {
390
+ shm_info->frame_offset = (void*)chunk->blocks[0].frame - (void*)chunk->mem;
390
+ shm_info->frame_offset = chunk->blocks[0].frame - (byte*)chunk->mem;
395
@@ -1014,6 +1324,8 @@
395
@@ -1014,6 +1327,8 @@
396
396
UNIV_MEM_UNDESC(block);
413
413
buf_pool->last_printout_time = time(NULL);
415
@@ -1078,6 +1393,86 @@
415
@@ -1078,6 +1396,86 @@
416
416
--------------------------- */
417
417
/* All fields are initialized by mem_zalloc(). */
419
419
+ if (srv_buffer_pool_shm_key) {
420
420
+ buf_shm_info_t* shm_info;
422
+ ut_a(chunk->blocks == chunk->mem + sizeof(buf_shm_info_t));
422
+ ut_a((byte*)chunk->blocks == (byte*)chunk->mem + sizeof(buf_shm_info_t));
423
423
+ shm_info = chunk->mem;
425
+ buf_pool->zip_hash = (hash_table_t*)((void*)chunk->mem + shm_info->zip_hash_offset);
425
+ buf_pool->zip_hash = (hash_table_t*)((byte*)chunk->mem + shm_info->zip_hash_offset);
427
427
+ if(shm_info->is_new) {
428
428
+ shm_info->is_new = FALSE; /* initialization was finished */
511
511
+ chunk = buf_pool->chunks;
512
512
+ shm_info = chunk->mem;
513
+ ut_a(chunk->blocks == chunk->mem + sizeof(buf_shm_info_t));
513
+ ut_a((byte*)chunk->blocks == (byte*)chunk->mem + sizeof(buf_shm_info_t));
515
515
+ /* validation the shared memory segment doesn't have unrecoverable contents. */
516
516
+ /* Currently, validation became not needed */
520
520
+ memcpy(&(shm_info->chunk_backup), chunk, sizeof(buf_chunk_t));
522
522
+ if (srv_fast_shutdown < 2) {
523
+ shm_info->checksum = ut_fold_binary(chunk->mem + sizeof(buf_shm_info_t),
523
+ shm_info->checksum = ut_fold_binary((byte*)chunk->mem + sizeof(buf_shm_info_t),
524
524
+ chunk->mem_size - sizeof(buf_shm_info_t));
525
525
+ shm_info->clean = TRUE;
530
530
chunks = buf_pool->chunks;
531
531
chunk = chunks + buf_pool->n_chunks;
533
@@ -1110,10 +1529,13 @@
533
@@ -1110,10 +1532,13 @@
534
534
would fail at shutdown. */
535
535
os_mem_free_large(chunk->mem, chunk->mem_size);
608
608
+ offset = (sizeof(hash_table_t) + 7) / 8;
611
+ table->array = (hash_cell_t*)(((void*)table) + offset);
611
+ table->array = (hash_cell_t*)(((byte*)table) + offset);
612
612
+ table->n_cells = prime;
613
613
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
614
614
+ table->adaptive = FALSE;
634
634
+ offset = (sizeof(hash_table_t) + 7) / 8;
637
+ table->array = (hash_cell_t*)(((void*)table) + offset);
637
+ table->array = (hash_cell_t*)(((byte*)table) + offset);
638
638
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
694
694
+/* the fold should be relative when srv_buffer_pool_shm_key is enabled */
695
695
+#define BUF_POOL_ZIP_FOLD_PTR(ptr) (!srv_buffer_pool_shm_key\
696
696
+ ?((ulint) (ptr) / UNIV_PAGE_SIZE)\
697
+ :((ulint) ((void*)ptr - (void*)(buf_pool->chunks->blocks->frame)) / UNIV_PAGE_SIZE))
697
+ :((ulint) ((byte*)ptr - (byte*)(buf_pool->chunks->blocks->frame)) / UNIV_PAGE_SIZE))
698
698
#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
699
699
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
748
748
+ NODE_TYPE* node2222;\
750
750
+ if ((TABLE)->array[i2222].node) \
751
+ (TABLE)->array[i2222].node \
752
+ += (((TABLE)->array[i2222].node > (void*)FADDR)?FOFFSET:BOFFSET);\
751
+ (TABLE)->array[i2222].node = (void*)((byte*)(TABLE)->array[i2222].node \
752
+ + (((TABLE)->array[i2222].node > (void*)FADDR)?FOFFSET:BOFFSET));\
753
753
+ node2222 = HASH_GET_FIRST((TABLE), i2222);\
755
755
+ while (node2222) {\
756
756
+ if (node2222->PTR_NAME) \
757
+ node2222->PTR_NAME = ((void*)node2222->PTR_NAME) \
758
+ + ((((void*)node2222->PTR_NAME) > (void*)FADDR)?FOFFSET:BOFFSET);\
757
+ node2222->PTR_NAME = (void*)((byte*)(node2222->PTR_NAME) \
758
+ + ((((void*)node2222->PTR_NAME) > (void*)FADDR)?FOFFSET:BOFFSET));\
760
760
+ node2222 = node2222->PTR_NAME;\
840
840
+ TYPE* ut_list_node_313; \
842
842
+ if ((BASE).start) \
843
+ (BASE).start = ((void*)((BASE).start) \
843
+ (BASE).start = (void*)((byte*)((BASE).start) \
844
844
+ + (((void*)((BASE).start) > (void*)FADDR)?FOFFSET:BOFFSET));\
845
845
+ if ((BASE).end) \
846
+ (BASE).end = ((void*)((BASE).end) \
846
+ (BASE).end = (void*)((byte*)((BASE).end) \
847
847
+ + (((void*)((BASE).end) > (void*)FADDR)?FOFFSET:BOFFSET));\
849
849
+ ut_list_node_313 = (BASE).start; \
851
851
+ for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
852
852
+ ut_a(ut_list_node_313); \
853
853
+ if ((ut_list_node_313->NAME).prev) \
854
+ (ut_list_node_313->NAME).prev = ((void*)((ut_list_node_313->NAME).prev)\
854
+ (ut_list_node_313->NAME).prev = (void*)((byte*)((ut_list_node_313->NAME).prev)\
855
855
+ + (((void*)((ut_list_node_313->NAME).prev) > (void*)FADDR)?FOFFSET:BOFFSET));\
856
856
+ if ((ut_list_node_313->NAME).next) \
857
+ (ut_list_node_313->NAME).next = ((void*)((ut_list_node_313->NAME).next)\
857
+ (ut_list_node_313->NAME).next = (void*)((byte*)((ut_list_node_313->NAME).next)\
858
858
+ + (((void*)((ut_list_node_313->NAME).next)> (void*)FADDR)?FOFFSET:BOFFSET));\
859
859
+ ut_list_node_313 = (ut_list_node_313->NAME).next; \