Comments (3)
`int32_t BatchPutOp(Client* client, int32_t argc, std::string* argv, ErrorCode* err) {
if (argc != 4) {
LOG(ERROR) << "args number error: " << argc << ", need 4.";
PrintCmdHelpInfo(argv[1]);
return -1;
}
std::string tablename = argv[2];
std::string record_file = argv[3];
TablePtr table(client->OpenTable(tablename, err));
if (table == NULL) {
LOG(ERROR) << "fail to open table";
return -1;
}
const int32_t buf_size = 1024 * 1024;
char buf[buf_size];
std::ifstream stream(record_file.c_str());
// input record format: rowkey columnfamily:qualifier value
// or: key:value
std::vector<std::string> input_v;
g_start_time = time(NULL);
while (stream.getline(buf, buf_size)) {
SplitString(buf, " ", &input_v);
if (input_v.size() != 3 && input_v.size() != 2) {
LOG(ERROR) << "input file format error, skip it: " << buf;
continue;
}
std::string rowkey = input_v[0];
if (FLAGS_readable && !ParseDebugString(input_v[0], &rowkey)) {
LOG(ERROR) << "input file format error, skip it: " << buf;
continue;
}
std::string family;
std::string qualifier;
std::string value = input_v[input_v.size() - 1];
if (FLAGS_readable && !ParseDebugString(input_v[input_v.size() - 1], &value)) {
LOG(ERROR) << "input file format error, skip it: " << buf;
continue;
}
RowMutation* mutation = table->NewRowMutation(rowkey);
if (input_v.size() == 2) {
// for kv mode
mutation->Put(value);
} else {
// for table mode, put(family, qulifier, value)
ParseCfQualifier(input_v[1], &family, &qualifier);
mutation->Put(family, qualifier, value);
}
mutation->SetCallBack(BatchPutCallBack);
table->ApplyMutation(mutation);
}
// 这里如果产生极限情况的话
while (!table->IsPutFinished()) {
usleep(100000);
}
g_end_time = time(NULL);
g_used_time = g_end_time-g_start_time;
LOG(INFO) << "Write done,write_key_num=" << g_key_num << " used_time=" << g_used_time <<std::endl;
return 0;
}
`
from tera.
@NightStarSoul 感谢你的反馈,这个问题确实存在。在tera内部版本的代码中已经把sdk端OpenTable返回的Table* 指针——其实是TableWrapper* 指针,所包含的TableImpl* 改为shared_ptr的了,table的生命周期有shared_ptr保证,这个问题会得到解决。
from tera.
新版本已更新,问题已修复
from tera.
Related Issues (20)
- fix teracli scan null key
- leveldb数据爆增 HOT 7
- The safe mode threshold is too high
- 现在除了百度,还有哪些企业在用tera? HOT 3
- Add UnitTest for trackable gc
- trackable gc cannot clean empty tablet dir
- remove IncrementalGcStrategy
- SDK发送一个任务给服务器成功后,过了一定时间SDK内部超时管理器认为任务超时,返回错误码给teracli,teracli析构了TableImpl,但是这时服务器把先前的任务又返回了,但是TableImpl已经析构了,就会崩溃是吗? HOT 5
- when a tabletnode node dead, tablets on it cannot use until this node is ready? HOT 6
- stop master and does not use kill -9 , master will crash at MasterZkAdapter destruction func。error code Device or resource busy HOT 4
- 通过Append接口放入多条数据,读出来时会有数据丢失 HOT 1
- 内存泄漏问题 HOT 3
- build.sh package not found HOT 1
- Scan on non-existent column family should fail earlier
- 这里可能有一个bug? HOT 1
- merge 2.14 to master
- tera 是线上检索的doc server吗? HOT 2
- tera client客户端连接问题 HOT 3
- 请问是否有GlobalTranaction 介绍文档呢? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tera.