这篇教程C++ ut_a函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ut_a函数的典型用法代码示例。如果您正苦于以下问题:C++ ut_a函数的具体用法?C++ ut_a怎么用?C++ ut_a使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ut_a函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ha_insert_for_fold_func/*************************************************************//**Inserts an entry into a hash table. If an entry with the same fold numberis found, its node is updated to point to the new data, and no new nodeis inserted. If btr_search_enabled is set to FALSE, we will only allowupdating existing nodes, but no new node is allowed to be added.@return TRUE if succeed, FALSE if no more memory could be allocated */UNIV_INTERNiboolha_insert_for_fold_func(/*====================*/ hash_table_t* table, /*!< in: hash table */ ulint fold, /*!< in: folded value of data; if a node with the same fold value already exists, it is updated to point to the same data, and no new node is created! */#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG buf_block_t* block, /*!< in: buffer block containing the data */#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ const rec_t* data) /*!< in: data, must not be NULL */{ hash_cell_t* cell; ha_node_t* node; ha_node_t* prev_node; ulint hash; ut_ad(data); ut_ad(table); ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ut_a(block->frame == page_align(data));#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */#ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(block->btr_search_latch, RW_LOCK_EX));#endif /* UNIV_SYNC_DEBUG */ ASSERT_HASH_MUTEX_OWN(table, fold); ut_ad(btr_search_enabled); hash = hash_calc_hash(fold, table); cell = hash_get_nth_cell(table, hash); prev_node = cell->node; while (prev_node != NULL) { if (prev_node->fold == fold) {#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG if (table->adaptive) { buf_block_t* prev_block = prev_node->block; ut_a(prev_block->frame == page_align(prev_node->data)); ut_a(prev_block->n_pointers > 0); prev_block->n_pointers--; block->n_pointers++; } prev_node->block = block;#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ prev_node->data = data; return(TRUE); } prev_node = prev_node->next; } /* We have to allocate a new chain node */ node = mem_heap_alloc(hash_get_heap(table, fold), sizeof(ha_node_t)); if (node == NULL) { /* It was a btr search type memory heap and at the moment no more memory could be allocated: return */ ut_ad(hash_get_heap(table, fold)->type & MEM_HEAP_BTR_SEARCH); return(FALSE); } ha_node_set_data(node, block, data);#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG if (table->adaptive) { block->n_pointers++; }#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ node->fold = fold; node->next = NULL; prev_node = cell->node; if (prev_node == NULL) { cell->node = node; return(TRUE); } while (prev_node->next != NULL) {//.........这里部分代码省略.........
开发者ID:AllenWeb,项目名称:mariadb,代码行数:101,
示例2: ib_handle_errorsiboolib_handle_errors(/*=============*/ enum db_err* new_err,/*!< out: possible new error encountered in lock wait, or if no new error, the value of trx->error_state at the entry of this function */ trx_t* trx, /*!< in: transaction */ que_thr_t* thr, /*!< in: query thread */ trx_savept_t* savept) /*!< in: savepoint or NULL */{ enum db_err err;handle_new_error: err = trx->error_state; ut_a(err != DB_SUCCESS); trx->error_state = DB_SUCCESS; switch (err) { case DB_LOCK_WAIT_TIMEOUT: if (ses_rollback_on_timeout) { trx_general_rollback(trx, FALSE, NULL); break; } /* fall through */ case DB_DUPLICATE_KEY: case DB_FOREIGN_DUPLICATE_KEY: case DB_TOO_BIG_RECORD: case DB_ROW_IS_REFERENCED: case DB_NO_REFERENCED_ROW: case DB_CANNOT_ADD_CONSTRAINT: case DB_TOO_MANY_CONCURRENT_TRXS: case DB_OUT_OF_FILE_SPACE: if (savept) { /* Roll back the latest, possibly incomplete insertion or update */ trx_general_rollback(trx, TRUE, savept); } break; case DB_LOCK_WAIT: srv_suspend_user_thread(thr); if (trx->error_state != DB_SUCCESS) { que_thr_stop_client(thr); goto handle_new_error; } *new_err = err; return(TRUE); /* Operation needs to be retried. */ case DB_DEADLOCK: case DB_LOCK_TABLE_FULL: /* Roll back the whole transaction; this resolution was added to version 3.23.43 */ trx_general_rollback(trx, FALSE, NULL); break; case DB_MUST_GET_MORE_FILE_SPACE: srv_panic(DB_ERROR, "InnoDB: The database cannot continue" " operation because of/n" "InnoDB: lack of space. You must add" " a new data file/n" "InnoDB: and restart the database./n"); break; case DB_CORRUPTION: ib_logger(ib_stream, "InnoDB: We detected index corruption" " in an InnoDB type table./n" "InnoDB: You have to dump + drop + reimport" " the table or, in/n" "InnoDB: a case of widespread corruption," " dump all InnoDB/n" "InnoDB: tables and recreate the" " whole InnoDB tablespace./n" "InnoDB: If the server crashes" " after the startup or when/n" "InnoDB: you dump the tables, check the /n" "InnoDB: InnoDB website for help./n"); break; default: ib_logger(ib_stream, "InnoDB: unknown error code %lu/n", (ulong) err); ut_error; } if (trx->error_state != DB_SUCCESS) { *new_err = trx->error_state; } else { *new_err = err; } trx->error_state = DB_SUCCESS;//.........这里部分代码省略.........
开发者ID:toffaletti,项目名称:turtle,代码行数:101,
示例3: trx_undo_rec_get_partial_row/*******************************************************************//**Builds a partial row from an update undo log record. It contains thecolumns which occur as ordering in any index of the table.@return pointer to remaining part of undo record */UNIV_INTERNbyte*trx_undo_rec_get_partial_row(/*=========================*/ byte* ptr, /*!< in: remaining part in update undo log record of a suitable type, at the start of the stored index columns; NOTE that this copy of the undo log record must be preserved as long as the partial row is used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used only in the assertion. */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */{ const byte* end_ptr; ulint row_len; ut_ad(index); ut_ad(ptr); ut_ad(row); ut_ad(heap); ut_ad(dict_index_is_clust(index)); row_len = dict_table_get_n_cols(index->table); *row = dtuple_create(heap, row_len); dict_table_copy_types(*row, index->table); end_ptr = ptr + mach_read_from_2(ptr); ptr += 2; while (ptr != end_ptr) { dfield_t* dfield; byte* field; ulint field_no; const dict_col_t* col; ulint col_no; ulint len; ulint orig_len; ptr = trx_undo_update_rec_get_field_no(ptr, &field_no); col = dict_index_get_nth_col(index, field_no); col_no = dict_col_get_no(col); ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); dfield = dtuple_get_nth_field(*row, col_no); dfield_set_data(dfield, field, len); if (len != UNIV_SQL_NULL && len >= UNIV_EXTERN_STORAGE_FIELD) { dfield_set_len(dfield, len - UNIV_EXTERN_STORAGE_FIELD); dfield_set_ext(dfield); /* If the prefix of this column is indexed, ensure that enough prefix is stored in the undo log record. */ ut_a(ignore_prefix || !col->ord_part || dfield_get_len(dfield) >= REC_MAX_INDEX_COL_LEN + BTR_EXTERN_FIELD_REF_SIZE); } } return(ptr);}
开发者ID:pombredanne,项目名称:mysql-1,代码行数:79,
示例4: buf_LRU_invalidate_tablespacevoidbuf_LRU_invalidate_tablespace(/*==========================*/ ulint id) /* in: space id */{ buf_block_t* block; ulint page_no; ibool all_freed; /* Before we attempt to drop pages one by one we first attempt to drop page hash index entries in batches to make it more efficient. The batching attempt is a best effort attempt and does not guarantee that all pages hash entries will be dropped. We get rid of remaining page hash entries one by one below. */ buf_LRU_drop_page_hash_for_tablespace(id);scan_again: mutex_enter(&(buf_pool->mutex)); all_freed = TRUE; block = UT_LIST_GET_LAST(buf_pool->LRU); while (block != NULL) { buf_block_t* prev_block; mutex_enter(&block->mutex); prev_block = UT_LIST_GET_PREV(LRU, block); ut_a(block->state == BUF_BLOCK_FILE_PAGE); if (block->space == id && (block->buf_fix_count > 0 || block->io_fix != 0)) { /* We cannot remove this page during this scan yet; maybe the system is currently reading it in, or flushing the modifications to the file */ all_freed = FALSE; goto next_page; } if (block->space == id) {#ifdef UNIV_DEBUG if (buf_debug_prints) { fprintf(stderr, "Dropping space %lu page %lu/n", (ulong) block->space, (ulong) block->offset); }#endif if (block->is_hashed) { page_no = block->offset; mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); /* Note that the following call will acquire an S-latch on the page */ btr_search_drop_page_hash_when_freed(id, page_no); goto scan_again; } if (0 != ut_dulint_cmp(block->oldest_modification, ut_dulint_zero)) { /* Remove from the flush list of modified blocks */ block->oldest_modification = ut_dulint_zero; UT_LIST_REMOVE(flush_list, buf_pool->flush_list, block); } /* Remove from the LRU list */ buf_LRU_block_remove_hashed_page(block); buf_LRU_block_free_hashed_page(block); }next_page: mutex_exit(&block->mutex); block = prev_block; } mutex_exit(&(buf_pool->mutex)); if (!all_freed) { os_thread_sleep(20000); goto scan_again; }}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:96,
示例5: buf_LRU_add_block_low/**********************************************************************Adds a block to the LRU list. */UNIV_INLINEvoidbuf_LRU_add_block_low(/*==================*/ buf_block_t* block, /* in: control block */ ibool old) /* in: TRUE if should be put to the old blocks in the LRU list, else put to the start; if the LRU list is very short, the block is added to the start, regardless of this parameter */{ ulint cl; ut_ad(buf_pool); ut_ad(block); ut_ad(mutex_own(&(buf_pool->mutex))); ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(!block->in_LRU_list); block->old = old; cl = buf_pool_clock_tic(); if (srv_use_awe && block->frame) { /* Add to the list of mapped pages; for simplicity we always add to the start, even if the user would have set 'old' TRUE */ UT_LIST_ADD_FIRST(awe_LRU_free_mapped, buf_pool->awe_LRU_free_mapped, block); } if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) { UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, block); block->LRU_position = cl; block->freed_page_clock = buf_pool->freed_page_clock; } else { UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old, block); buf_pool->LRU_old_len++; /* We copy the LRU position field of the previous block to the new block */ block->LRU_position = (buf_pool->LRU_old)->LRU_position; } block->in_LRU_list = TRUE; if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) { ut_ad(buf_pool->LRU_old); /* Adjust the length of the old block list if necessary */ buf_LRU_old_adjust_len(); } else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) { /* The LRU list is now long enough for LRU_old to become defined: init it */ buf_LRU_old_init(); }}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:68,
示例6: row_upd_clust_rec/***************************************************************Updates a clustered index record of a row when the ordering fields donot change. */staticulintrow_upd_clust_rec(/*==============*/ /* out: DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ upd_node_t* node, /* in: row update node */ dict_index_t* index, /* in: clustered index */ que_thr_t* thr, /* in: query thread */ mtr_t* mtr) /* in: mtr; gets committed here */{ big_rec_t* big_rec = NULL; btr_pcur_t* pcur; btr_cur_t* btr_cur; ulint err; ut_ad(node); ut_ad(index->type & DICT_CLUSTERED); pcur = node->pcur; btr_cur = btr_pcur_get_btr_cur(pcur); ut_ad(FALSE == rec_get_deleted_flag(btr_pcur_get_rec(pcur))); /* Try optimistic updating of the record, keeping changes within the page; we do not check locks because we assume the x-lock on the record to update */ if (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE) { err = btr_cur_update_in_place(BTR_NO_LOCKING_FLAG, btr_cur, node->update, node->cmpl_info, thr, mtr); } else { err = btr_cur_optimistic_update(BTR_NO_LOCKING_FLAG, btr_cur, node->update, node->cmpl_info, thr, mtr); } mtr_commit(mtr); if (err == DB_SUCCESS) { return(err); } /* We may have to modify the tree structure: do a pessimistic descent down the index tree */ mtr_start(mtr); /* NOTE: this transaction has an s-lock or x-lock on the record and therefore other transactions cannot modify the record when we have no latch on the page. In addition, we assume that other query threads of the same transaction do not modify the record in the meantime. Therefore we can assert that the restoration of the cursor succeeds. */ ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr)); ut_ad(FALSE == rec_get_deleted_flag(btr_pcur_get_rec(pcur))); err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG, btr_cur, &big_rec, node->update, node->cmpl_info, thr, mtr); mtr_commit(mtr); if (err == DB_SUCCESS && big_rec) { mtr_start(mtr); ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr)); err = btr_store_big_rec_extern_fields(index, btr_cur_get_rec(btr_cur), big_rec, mtr); mtr_commit(mtr); } if (big_rec) { dtuple_big_rec_free(big_rec); } return(err);}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:84,
示例7: row_upd_build_difference_binaryupd_t*row_upd_build_difference_binary(/*============================*/ /* out, own: update vector of differing fields, excluding roll ptr and trx id */ dict_index_t* index, /* in: clustered index */ dtuple_t* entry, /* in: entry to insert */ ulint* ext_vec,/* in: array containing field numbers of externally stored fields in entry, or NULL */ ulint n_ext_vec,/* in: number of fields in ext_vec */ rec_t* rec, /* in: clustered index record */ mem_heap_t* heap) /* in: memory heap from which allocated */{ upd_field_t* upd_field; dfield_t* dfield; byte* data; ulint len; upd_t* update; ulint n_diff; ulint roll_ptr_pos; ulint trx_id_pos; ulint i; /* This function is used only for a clustered index */ ut_a(index->type & DICT_CLUSTERED); update = upd_create(dtuple_get_n_fields(entry), heap); n_diff = 0; roll_ptr_pos = dict_index_get_sys_col_pos(index, DATA_ROLL_PTR); trx_id_pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID); for (i = 0; i < dtuple_get_n_fields(entry); i++) { data = rec_get_nth_field(rec, i, &len); dfield = dtuple_get_nth_field(entry, i); /* NOTE: we compare the fields as binary strings! (No collation) */ if (i == trx_id_pos || i == roll_ptr_pos) { goto skip_compare; } if (rec_get_nth_field_extern_bit(rec, i) != upd_ext_vec_contains(ext_vec, n_ext_vec, i) || !dfield_data_is_binary_equal(dfield, len, data)) { upd_field = upd_get_nth_field(update, n_diff); dfield_copy(&(upd_field->new_val), dfield); upd_field_set_field_no(upd_field, i, index); if (upd_ext_vec_contains(ext_vec, n_ext_vec, i)) { upd_field->extern_storage = TRUE; } else { upd_field->extern_storage = FALSE; } n_diff++; }skip_compare: ; } update->n_fields = n_diff; return(update);}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:73,
示例8: dtuple_convert_big_rec/**************************************************************//**Moves parts of long fields in entry to the big record vector so thatthe size of tuple drops below the maximum record size allowed in thedatabase. Moves data only from those fields which are not necessaryto determine uniquely the insertion place of the tuple in the index.@return own: created big record vector, NULL if we are not able toshorten the entry enough, i.e., if there are too many fixed-length orshort fields in entry or the index is clustered */UNIV_INTERNbig_rec_t*dtuple_convert_big_rec(/*===================*/ dict_index_t* index, /*!< in: index */ dtuple_t* entry, /*!< in/out: index entry */ ulint* n_ext) /*!< in/out: number of externally stored columns */{ mem_heap_t* heap; big_rec_t* vector; dfield_t* dfield; dict_field_t* ifield; ulint size; ulint n_fields; ulint local_len; ulint local_prefix_len; if (UNIV_UNLIKELY(!dict_index_is_clust(index))) { return(NULL); } if (dict_table_get_format(index->table) < DICT_TF_FORMAT_ZIP) { /* up to MySQL 5.1: store a 768-byte prefix locally */ local_len = BTR_EXTERN_FIELD_REF_SIZE + DICT_ANTELOPE_MAX_INDEX_COL_LEN; } else { /* new-format table: do not store any BLOB prefix locally */ local_len = BTR_EXTERN_FIELD_REF_SIZE; } ut_a(dtuple_check_typed_no_assert(entry)); size = rec_get_converted_size(index, entry, *n_ext); if (UNIV_UNLIKELY(size > 1000000000)) { fprintf(stderr, "InnoDB: Warning: tuple size very big: %lu/n", (ulong) size); fputs("InnoDB: Tuple contents: ", stderr); dtuple_print(stderr, entry); putc('/n', stderr); } heap = mem_heap_create(size + dtuple_get_n_fields(entry) * sizeof(big_rec_field_t) + 1000); vector = mem_heap_alloc(heap, sizeof(big_rec_t)); vector->heap = heap; vector->fields = mem_heap_alloc(heap, dtuple_get_n_fields(entry) * sizeof(big_rec_field_t)); /* Decide which fields to shorten: the algorithm is to look for a variable-length field that yields the biggest savings when stored externally */ n_fields = 0; while (page_zip_rec_needs_ext(rec_get_converted_size(index, entry, *n_ext), dict_table_is_comp(index->table), dict_index_get_n_fields(index), dict_table_zip_size(index->table))) { ulint i; ulint longest = 0; ulint longest_i = ULINT_MAX; byte* data; big_rec_field_t* b; for (i = dict_index_get_n_unique_in_tree(index); i < dtuple_get_n_fields(entry); i++) { ulint savings; dfield = dtuple_get_nth_field(entry, i); ifield = dict_index_get_nth_field(index, i); /* Skip fixed-length, NULL, externally stored, or short columns */ if (ifield->fixed_len || dfield_is_null(dfield) || dfield_is_ext(dfield) || dfield_get_len(dfield) <= local_len || dfield_get_len(dfield) <= BTR_EXTERN_FIELD_REF_SIZE * 2) { goto skip_field; } savings = dfield_get_len(dfield) - local_len; /* Check that there would be savings *///.........这里部分代码省略.........
开发者ID:0x00xw,项目名称:mysql-2,代码行数:101,
示例9: sync_array_reserve_cell/******************************************************************//**Reserves a wait array cell for waiting for an object.The event of the cell is reset to nonsignalled state. */UNIV_INTERNvoidsync_array_reserve_cell(/*====================*/ sync_array_t* arr, /*!< in: wait array */ void* object, /*!< in: pointer to the object to wait for */ ulint type, /*!< in: lock request type */ const char* file, /*!< in: file where requested */ ulint line, /*!< in: line where requested */ ulint* index) /*!< out: index of the reserved cell */{ sync_cell_t* cell; os_event_t event; ulint i; ut_a(object); ut_a(index); sync_array_enter(arr); arr->res_count++; /* Reserve a new cell. */ for (i = 0; i < arr->n_cells; i++) { cell = sync_array_get_nth_cell(arr, i); if (cell->wait_object == NULL) { cell->waiting = FALSE; cell->wait_object = object; if (type == SYNC_MUTEX) { cell->old_wait_mutex = object; } else { cell->old_wait_rw_lock = object; } cell->request_type = type; cell->file = file; cell->line = line; arr->n_reserved++; *index = i; sync_array_exit(arr); /* Make sure the event is reset and also store the value of signal_count at which the event was reset. */ event = sync_cell_get_event(cell); cell->signal_count = os_event_reset(event); cell->reservation_time = time(NULL); cell->thread = os_thread_get_curr_id(); return; } } ut_error; /* No free cell found */ return;}
开发者ID:YannNayn,项目名称:mariadb-galera-msvc,代码行数:69,
示例10: dict_create_sys_tables_tuple/*****************************************************************//**Based on a table object, this function builds the entry to be insertedin the SYS_TABLES system table.@return the tuple which should be inserted */staticdtuple_t*dict_create_sys_tables_tuple( /*=========================*/ const dict_table_t* table, /*!< in: table */ mem_heap_t* heap) /*!< in: memory heap from which the memory for the built tuple is allocated */{ dict_table_t* sys_tables; dtuple_t* entry; dfield_t* dfield; byte* ptr; ut_ad(table); ut_ad(heap); sys_tables = dict_sys->sys_tables; entry = dtuple_create(heap, 8 + DATA_N_SYS_COLS); dict_table_copy_types(entry, sys_tables); /* 0: NAME -----------------------------*/ dfield = dtuple_get_nth_field(entry, 0/*NAME*/); dfield_set_data(dfield, table->name, ut_strlen(table->name)); /* 3: ID -------------------------------*/ dfield = dtuple_get_nth_field(entry, 1/*ID*/); ptr = mem_heap_alloc(heap, 8); mach_write_to_8(ptr, table->id); dfield_set_data(dfield, ptr, 8); /* 4: N_COLS ---------------------------*/ dfield = dtuple_get_nth_field(entry, 2/*N_COLS*/);#if DICT_TF_COMPACT != 1#error#endif ptr = mem_heap_alloc(heap, 4); if (dict_table_is_gcs(table)) /* ±í C++ ut_ad函数代码示例 C++ utMalloc函数代码示例
|