[t:2054], rename some functions

git-svn-id: file:///svn/mysql/tokudb-engine/src@15470 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Zardosht Kasheff 2009-10-26 20:09:07 +00:00 committed by Yoni Fogel
parent 3ba84a9e3e
commit 9f989739e7
2 changed files with 18 additions and 10 deletions

View file

@ -1580,10 +1580,15 @@ cleanup:
return error;
}
int ha_tokudb::write_to_status(DB* db, HA_METADATA_KEY curr_key_data, void* data, uint size ){
return write_metadata(db, &curr_key_data, sizeof(curr_key_data), data, size);
}
//
// helper function to write a piece of metadata in to status.tokudb
//
int ha_tokudb::write_metadata(DB* db, HA_METADATA_KEY curr_key_data, void* data, uint size ){
int ha_tokudb::write_metadata(DB* db, void* key_data, uint key_size, void* val_data, uint val_size ){
int error;
DBT key;
DBT value;
@ -1598,10 +1603,10 @@ int ha_tokudb::write_metadata(DB* db, HA_METADATA_KEY curr_key_data, void* data,
bzero(&key, sizeof(key));
bzero(&value, sizeof(value));
key.data = &curr_key_data;
key.size = sizeof(curr_key_data);
value.data = data;
value.size = size;
key.data = key_data;
key.size = key_size;
value.data = val_data;
value.size = val_size;
error = db->put(db, txn, &key, &value, 0);
if (error) {
goto cleanup;
@ -1632,7 +1637,7 @@ cleanup:
//
//
int ha_tokudb::update_max_auto_inc(DB* db, ulonglong val){
return write_metadata(db,hatoku_max_ai,&val,sizeof(val));
return write_to_status(db,hatoku_max_ai,&val,sizeof(val));
}
//
@ -1647,7 +1652,7 @@ int ha_tokudb::update_max_auto_inc(DB* db, ulonglong val){
//
//
int ha_tokudb::write_auto_inc_create(DB* db, ulonglong val){
return write_metadata(db,hatoku_ai_create_value,&val,sizeof(val));
return write_to_status(db,hatoku_ai_create_value,&val,sizeof(val));
}
@ -4966,16 +4971,18 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in
version = HA_TOKU_VERSION;
capabilities = HA_TOKU_CAP;
error = write_metadata(status_block, hatoku_version,&version,sizeof(version));
error = write_to_status(status_block, hatoku_version,&version,sizeof(version));
if (error) { goto cleanup; }
error = write_metadata(status_block, hatoku_capabilities,&capabilities,sizeof(capabilities));
error = write_to_status(status_block, hatoku_capabilities,&capabilities,sizeof(capabilities));
if (error) { goto cleanup; }
error = write_auto_inc_create(status_block, create_info->auto_increment_value);
if (error) { goto cleanup; }
error = add_table_to_metadata(name, form);
if (error) {
goto cleanup;

View file

@ -262,7 +262,8 @@ private:
int acquire_table_lock (DB_TXN* trans, TABLE_LOCK_TYPE lt);
int estimate_num_rows(DB* db, u_int64_t* num_rows);
bool has_auto_increment_flag(uint* index);
int write_metadata(DB* db, HA_METADATA_KEY curr_key_data, void* data, uint size );
int write_to_status(DB* db, HA_METADATA_KEY curr_key_data, void* data, uint size );
int write_metadata(DB* db, void* key, uint key_size, void* data, uint data_size );
int update_max_auto_inc(DB* db, ulonglong val);
int write_auto_inc_create(DB* db, ulonglong val);
void init_auto_increment();