Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
git-svn-id: http://code.taobao.org/svn/tair/trunk@1142 ed5bfd34-b61d-4ad5-b956-f82ce90ca771
  • Loading branch information
nayan@taobao.com committed Sep 18, 2012
1 parent f83ccca commit 097da0e
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 82 deletions.
2 changes: 1 addition & 1 deletion share/dataserver.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ldb_do_seek_compaction=1
## all the time, so data will be reused even if buckets owned by server changed(maybe cluster has changed),
## map : handle to get better balance among all instances. same bucket may be sharded to different instance based
## on different buckets set(TODO: data will be migrated among instances).
ldb_bucket_index_to_instance_strategy=map
ldb_bucket_index_to_instance_strategy=hash
## bucket index can be updated. this is useful if the cluster wouldn't change once started
## even server down/up accidently.
ldb_bucket_index_can_update=0
Expand Down
36 changes: 20 additions & 16 deletions src/client/tair_client_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,6 @@ namespace tair {
int version,
bool fill_cache = true);

/**
** @brief batch put data to tair
**
** @param area namespace
** @param kvs key && value
** @param fail_request fail_keys
**
** @return 0 -- success, otherwise fail,you can use get_error_msg(ret) to get more information.
**/

int mput(int area,
const tair_client_kv_map& kvs,
int& fail_request,
bool compress = true);

/**
* @brief get data from tair cluster
*
Expand Down Expand Up @@ -544,7 +529,26 @@ namespace tair {

int64_t ping(uint64_t server_id);

// following cmd is useful for multi_cluster_client
/*** Following interface is specially useful for multi-cluster (FastDump, etc.). ***/
/**
** @brief batch put data to tair
** @ NOTE: This interface is specially for dump data to server
** in some specific condition(FastDump etc.).
** Do NOT use it only when you konw what you're doing.
**
** @param area namespace
** @param kvs key && value
** @param fail_request fail_keys
** @param compress whether compress data
**
** @return 0 -- success, otherwise fail,you can use get_error_msg(ret) to get more information.
**/

int mput(int area,
const tair_client_kv_map& kvs,
int& fail_request,
bool compress = true);

/**
* @param group: group names of which you wanna know the status
* @param status: group statuses, in the format of 'group_1: group_status=on'
Expand Down
2 changes: 1 addition & 1 deletion src/client/tair_multi_cluster_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace tair
tair_multi_cluster_client_impl::tair_multi_cluster_client_impl()
{
updater_ = new cluster_info_updater();
handler_mgr_ = new bucket_shard_cluster_handler_manager(updater_, MAP_SHARDING_TYPE);
handler_mgr_ = new bucket_shard_cluster_handler_manager(updater_, MAP_SHARDING_TYPE); // default map sharding
}

tair_multi_cluster_client_impl::~tair_multi_cluster_client_impl()
Expand Down
124 changes: 62 additions & 62 deletions src/common/data_entry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,74 +534,74 @@ namespace tair
class value_entry {
public:
value_entry() : version(0), expire(0)
{
}
{
}

value_entry(const value_entry &entry)
{
d_entry = entry.d_entry;
version = entry.version;
expire = entry.expire;
}
{
d_entry = entry.d_entry;
version = entry.version;
expire = entry.expire;
}

value_entry& clone(const value_entry &entry)
{
assert(this != &entry);
d_entry = entry.d_entry;
version = entry.version;
expire = entry.expire;
{
assert(this != &entry);
d_entry = entry.d_entry;
version = entry.version;
expire = entry.expire;

return *this;
}
return *this;
}

void set_d_entry(const data_entry& in_d_entry)
{
d_entry = in_d_entry;
}
{
d_entry = in_d_entry;
}

data_entry& get_d_entry()
{
return d_entry;
}
{
return d_entry;
}

void set_expire(int32_t expire_time)
{
expire = expire_time;
}
{
expire = expire_time;
}

int32_t get_expire() const
{
return expire;
}
{
return expire;
}

void set_version(uint16_t kv_version)
{
version = kv_version;
}
{
version = kv_version;
}

uint16_t get_version() const
{
return version;
}
{
return version;
}

void encode(tbnet::DataBuffer *output) const
{
d_entry.encode(output);
output->writeInt16(version);
output->writeInt32(expire);
}
{
d_entry.encode(output);
output->writeInt16(version);
output->writeInt32(expire);
}

void decode(tbnet::DataBuffer *input)
{
d_entry.decode(input);
version = input->readInt16();
expire = input->readInt32();
}
{
d_entry.decode(input);
version = input->readInt16();
expire = input->readInt32();
}

int get_size() const
{
return d_entry.get_size()+ 2 + 4;
}
{
return d_entry.get_size()+ 2 + 4;
}

private:
data_entry d_entry;
Expand All @@ -612,28 +612,28 @@ namespace tair
class mput_record {
public:
mput_record()
{
key = NULL;
value = NULL;
}
{
key = NULL;
value = NULL;
}

mput_record(mput_record &rec)
{
key = new data_entry(*(rec.key));
value = new value_entry(*(rec.value));
}
{
key = new data_entry(*(rec.key));
value = new value_entry(*(rec.value));
}

~mput_record()
{
if (key != NULL ) {
delete key;
key = NULL;
}
if (value != NULL) {
delete value;
value = NULL;
}
{
if (key != NULL ) {
delete key;
key = NULL;
}
if (value != NULL) {
delete value;
value = NULL;
}
}

public:
data_entry* key;
Expand Down
4 changes: 2 additions & 2 deletions src/storage/ldb/ldb_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ namespace tair

if (ret != TAIR_RETURN_SUCCESS && new_cache != NULL)
{
destroy_container(new_cache, i);
destroy_container(new_cache, i+1);
}

return ret;
Expand Down Expand Up @@ -1041,7 +1041,7 @@ namespace tair

if (ret != TAIR_RETURN_SUCCESS && new_ldb_instance != NULL)
{
destroy_container(new_ldb_instance, i);
destroy_container(new_ldb_instance, i+1);
}

delete[] tmp_buckets;
Expand Down

0 comments on commit 097da0e

Please sign in to comment.