void _GetFontArrayBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) { if (args.Length() < 1) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); return; } CNativeControl* pNative = unwrap_nativeobject(args.This()); BYTE* pData = NULL; DWORD len = 0; std::wstring strDir = pNative->m_strFontsDirectory; #if 0 if (strDir.length() != 0) { strDir += L"/"; strDir += to_cstring(args[0]); } else #endif // TODO: // по идее файлы могут совпадать по имени, но лежать в разных директориях. // и поэтому в AllFonts.js надо бы писать пути полные. // пока оставим по-старому std::wstring sFind = to_cstring(args[0]); bool bIsFullFilePath = (std::wstring::npos != sFind.find('\\') || std::wstring::npos != sFind.find('/')); if (bIsFullFilePath) { bIsFullFilePath = NSFile::CFileBinary::Exists(sFind); } if (!bIsFullFilePath) { std::map<std::wstring, std::wstring>::iterator pair = pNative->m_map_fonts.find(sFind); if (pair != pNative->m_map_fonts.end()) strDir = pair->second; else strDir = pNative->m_sDefaultFont; } else { strDir = sFind; } pNative->getFileData(strDir, pData, len); v8::Local<v8::ArrayBuffer> _buffer = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), (void*)pData, (size_t)len); v8::Local<v8::Uint8Array> _array = v8::Uint8Array::New(_buffer, 0, (size_t)len); args.GetReturnValue().Set(_array); }
int ObRootTableOperation::report_tablets(const ObTabletReportInfoList& tablets, const int32_t server_index, const int64_t frozen_mem_version) { int ret = OB_SUCCESS; UNUSED(frozen_mem_version); TBSYS_LOG(INFO, "cs (cs_index=%d) report new tablet.", server_index); if (NULL == schema_manager_) { TBSYS_LOG(WARN, "inner stat error. check it. schema_manager=%p", schema_manager_); ret = OB_ERROR; } else { int64_t index = tablets.tablet_list_.get_array_index(); ObTabletReportInfo* p_table_info = NULL; for(int64_t i = 0; i < index; ++i) { p_table_info = tablets.tablet_list_.at(i); if (p_table_info != NULL) { if (!p_table_info->tablet_info_.range_.is_left_open_right_closed()) { TBSYS_LOG(WARN, "cs reported illegal tablet, server=%d crc=%lu range=%s", server_index, p_table_info->tablet_info_.crc_sum_, to_cstring(p_table_info->tablet_info_.range_)); continue; } //todo add schema check if (NULL == schema_manager_->get_table_schema(p_table_info->tablet_info_.range_.table_id_)) { TBSYS_LOG(DEBUG, "report table is %lu, refuse to add", p_table_info->tablet_info_.range_.table_id_); continue; } TBSYS_LOG(DEBUG, "add a tablet, server=%d crc=%lu version=%ld seq=%ld range=%s", server_index, p_table_info->tablet_info_.crc_sum_, p_table_info->tablet_location_.tablet_version_, p_table_info->tablet_location_.tablet_seq_, to_cstring(p_table_info->tablet_info_.range_)); ret = new_root_table_->add(p_table_info->tablet_info_, server_index, p_table_info->tablet_location_.tablet_version_, p_table_info->tablet_location_.tablet_seq_); if (OB_SUCCESS != ret) { TBSYS_LOG(WARN, "fail to add tablet. range=%s", to_cstring(p_table_info->tablet_info_.range_)); break; } } } } return ret; }
void total_scan(const char *fname, PageArena<char> &allocer, MockClient &client, const char *version_range) { ObScanner scanner; ObScanParam scan_param; read_scan_param(fname, SCAN_PARAM_SECTION, allocer, scan_param); scan_param.set_version_range(str2range(version_range)); scan_param.set_is_read_consistency(false); int64_t total_fullfilled_num = 0; int64_t total_row_counter = 0; int64_t total_timeu = 0; while (true) { int64_t timeu = tbsys::CTimeUtil::getTime(); int err = client.ups_scan(scan_param, scanner, timeout); timeu = tbsys::CTimeUtil::getTime() - timeu; if (OB_SUCCESS != err) { fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err); break; } else { int64_t row_counter = 0; while (OB_SUCCESS == scanner.next_cell()) { ObCellInfo *ci = NULL; bool is_row_changed = false; scanner.get_cell(&ci, &is_row_changed); //fprintf(stdout, "%s\n", updateserver::print_cellinfo(ci, "CLI_SCAN")); if (is_row_changed) { row_counter++; } } bool is_fullfilled = false; int64_t fullfilled_num = 0; ObRowkey last_rk; scanner.get_last_row_key(last_rk); scanner.get_is_req_fullfilled(is_fullfilled, fullfilled_num); fprintf(stdout, "[SINGLE_SCAN] is_fullfilled=%s fullfilled_num=%ld row_counter=%ld timeu=%ld last_row_key=[%s]\n", STR_BOOL(is_fullfilled), fullfilled_num, row_counter, timeu, to_cstring(last_rk)); total_fullfilled_num += fullfilled_num; total_row_counter += row_counter; total_timeu += timeu; if (is_fullfilled) { break; } else { const_cast<ObNewRange*>(scan_param.get_range())->start_key_ = last_rk; const_cast<ObNewRange*>(scan_param.get_range())->border_flag_.unset_min_value(); const_cast<ObNewRange*>(scan_param.get_range())->border_flag_.unset_inclusive_start(); } } } fprintf(stdout, "[TOTAL_SCAN] total_fullfilled_num=%ld total_row_counter=%ld total_timeu=%ld\n", total_fullfilled_num, total_row_counter, total_timeu); }
/// ZIP ----- void _zipOpenFile(const v8::FunctionCallbackInfo<v8::Value>& args) { if (args.Length() < 1) { args.GetReturnValue().Set(v8::Null(v8::Isolate::GetCurrent())); return; } CNativeControl* pNative = unwrap_nativeobject(args.This()); bool bIsOpen = pNative->m_oZipWorker.Open(to_cstring(args[0])); if (!bIsOpen) { args.GetReturnValue().Set(v8::Null(v8::Isolate::GetCurrent())); return; } v8::Local<v8::Object> obj = v8::Object::New(v8::Isolate::GetCurrent()); for (std::vector<std::wstring>::iterator i = pNative->m_oZipWorker.m_arFiles.begin(); i != pNative->m_oZipWorker.m_arFiles.end(); i++) { std::string sFile = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(*i); v8::Local<v8::String> _k = v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sFile.c_str(), v8::String::kNormalString, -1); v8::Local<v8::String> _v = v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sFile.c_str(), v8::String::kNormalString, -1); obj->Set(_k, _v); } args.GetReturnValue().Set(obj); }
int ObNewRange::deserialize(const char* buf, const int64_t data_len, int64_t& pos) { int ret = OB_SUCCESS; if (NULL == start_key_.get_obj_ptr() || NULL == end_key_.get_obj_ptr()) { TBSYS_LOG(WARN, "start_key or end_key ptr is NULL, start_key=%s, end_key=%s", to_cstring(start_key_), to_cstring(end_key_)); ret = OB_ALLOCATE_MEMORY_FAILED; } if (OB_SUCCESS == ret) { ret = serialization::decode_vi64(buf, data_len, pos, (int64_t*)&table_id_); } if (OB_SUCCESS == ret) { int8_t flag = 0; ret = serialization::decode_i8(buf, data_len, pos, &flag); if (OB_SUCCESS == ret) border_flag_.set_data(flag); } if (OB_SUCCESS == ret) { ret = start_key_.deserialize(buf, data_len, pos); if (OB_SUCCESS != ret) { TBSYS_LOG(WARN, "failed to deserialize start key, ret=%d, buf=%p, data_len=%ld, pos=%ld", ret, buf, data_len, pos); } } if (OB_SUCCESS == ret) { ret = end_key_.deserialize(buf, data_len, pos); if (OB_SUCCESS != ret) { TBSYS_LOG(WARN, "failed to deserialize end key, ret=%d, buf=%p, data_len=%ld, pos=%ld", ret, buf, data_len, pos); } } return ret; }
void _SetFilePath(const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) return; CNativeControl* pNative = unwrap_nativeobject(args.This()); pNative->SetFilePath(to_cstring(args[0])); }
int64_t ObNewRange::to_string(char* buffer, const int64_t length) const { int64_t pos = 0; if (pos < length) { databuff_printf(buffer, length, pos, "table_id:%lu,%s%s; %s%s", table_id_, border_flag_.inclusive_start() ? "[":"(", to_cstring(start_key_), to_cstring(end_key_), border_flag_.inclusive_end() ? "]":")"); } return pos; }
bool ObSSTableTable::check_rowkey_range(const::ObRow& row, const bool not_table_first_row) { bool ret = false; const ObRowkey* rowkey = NULL; TableRangeStruct& range = table_range_array_[table_range_array_flag_]; if (OB_SUCCESS != (ret = row.get_rowkey(rowkey))) { TBSYS_LOG(WARN, "row get rowkey error:ret=%d,row=%s,rowkey=%p", ret, to_cstring(row), rowkey); } else { if (not_table_first_row) { //not the first row of table; should only check the end_key_, //becouse the rowkey bas been //compared with the last rowkey //必须是前开后闭 if ((*rowkey) <= range.table_range_.end_key_) { ret = true; } else { TBSYS_LOG(WARN, "cur rowkey > the end_key_ of range:" "*rowkey=%s,table_range_.end key=%s", to_cstring(*rowkey), to_cstring(range.table_range_.end_key_)); ret = false; } } else { //the firest rowkey of the table, //should check both the start_key and the endkey if ((*rowkey) > range.table_range_.start_key_ && (*rowkey) <= range.table_range_.end_key_) { ret = true; } else { TBSYS_LOG(WARN, "cur rowkey > the end_key_ of range or " "cur rowkey < range.table_range_.start_key_:" "*rowkey=%s,table_range.start_key=%s" "table_range_.end key=%s", to_cstring(*rowkey), to_cstring(range.table_range_.start_key_), to_cstring(range.table_range_.end_key_)); ret = false; } } } return ret; }
int main(int argc, const char* argv[]) { char* truepath = realpath(argv[1], NULL); string_dynarray result = string_dynarray_make(1); string current = char_dynarray_make(1); string total = char_dynarray_make(1); int i; for (i=0; truepath[i] != '\0'; i++) { if (truepath[i] != '/') { current = char_dynarray_add(current, truepath[i]); } else { printf("%s", to_cstring(current)); printf("%s", " "); printf("%s", to_cstring(total)); printf("%s", "\n"); result = string_dynarray_add(result, current); current = char_dynarray_make(1); } total = char_dynarray_add(total, truepath[i]); } return 0; }
bool ObNewRange::check(void) const { bool ret = true; if ((start_key_ > end_key_) && (!end_key_.is_max_row()) && (!start_key_.is_min_row())) { TBSYS_LOG(WARN, "check start key gt than end key, start_key=%s, end_key=%s", to_cstring(start_key_), to_cstring(end_key_)); ret = false; } else if (start_key_ == end_key_) { if (!start_key_.is_min_row() && !end_key_.is_max_row()) { if (start_key_.length() == 0 || !border_flag_.inclusive_start() || !border_flag_.inclusive_end()) { TBSYS_LOG(WARN, "check border flag or length failed:length[%ld], flag[%u]", start_key_.length(), border_flag_.get_data()); ret = false; } } } return ret; }
// Slight modification to an original function found in the V8 sample shell.cc. void Global::reportException(TryCatch* tryCatch) { HandleScope handleScope(fIsolate); String::Utf8Value exception(tryCatch->Exception()); const char* exceptionString = to_cstring(exception); Handle<Message> message = tryCatch->Message(); if (message.IsEmpty()) { // V8 didn't provide any extra information about this error; just // print the exception. fprintf(stderr, "%s\n", exceptionString); } else { // Print (filename):(line number): (message). String::Utf8Value filename(message->GetScriptOrigin().ResourceName()); const char* filenameString = to_cstring(filename); int linenum = message->GetLineNumber(); fprintf(stderr, "%s:%i: %s\n", filenameString, linenum, exceptionString); // Print line of source code. String::Utf8Value sourceline(message->GetSourceLine()); const char* sourceLineString = to_cstring(sourceline); fprintf(stderr, "%s\n", sourceLineString); // Print wavy underline. int start = message->GetStartColumn(); for (int i = 0; i < start; i++) { fprintf(stderr, " "); } int end = message->GetEndColumn(); for (int i = start; i < end; i++) { fprintf(stderr, "^"); } fprintf(stderr, "\n"); String::Utf8Value stackTrace(tryCatch->StackTrace()); if (stackTrace.length() > 0) { const char* stackTraceString = to_cstring(stackTrace); fprintf(stderr, "%s\n", stackTraceString); } } }
int ObSSTableScanner::trans_input_scan_range(const ObSSTableScanParam &scan_param) { int iret = OB_SUCCESS; scan_param_ = scan_param; if (!scan_param_.is_valid()) { TBSYS_LOG(ERROR, "input scan parmeter invalid, cannot scan any data."); iret = OB_INVALID_ARGUMENT; } const ObNewRange &input_range = scan_param.get_range(); ObRowkey start_key = input_range.start_key_; ObRowkey end_key = input_range.end_key_; if (OB_SUCCESS == iret && input_range.start_key_.is_min_row())// only end_key valid { if ( (!input_range.end_key_.is_max_row()) && (NULL == end_key.ptr() || end_key.length() <= 0)) { TBSYS_LOG(ERROR, "invalid end key, rang=%s", to_cstring(input_range)); iret = OB_INVALID_ARGUMENT; } } if (OB_SUCCESS == iret && input_range.end_key_.is_max_row())// only start_key valid { if ( (!input_range.start_key_.is_min_row()) && (NULL == start_key.ptr() || start_key.length() <= 0)) { TBSYS_LOG(ERROR, "invalid start key, range=%s", to_cstring(input_range)); iret = OB_INVALID_ARGUMENT; } } return iret; }
int ObRpcStub::send_0_return_0(const ObServer& server, const int64_t timeout, const int32_t pcode, const int32_t version) const { int ret = OB_SUCCESS; int64_t pos = 0; ObResultCode rc; ObDataBuffer data_buffer; if (OB_SUCCESS != (ret = get_rpc_buffer(data_buffer))) { TBSYS_LOG(WARN, "get_rpc_buffer failed with rpc call, ret =%d", ret); } else if (OB_SUCCESS != (ret = rpc_frame_->send_request( server, pcode, version, timeout, data_buffer))) { TBSYS_LOG(WARN, "send_request failed, ret=%d, server=%s, pcode=%d, version=%d, timeout=%ld", ret, to_cstring(server), pcode, version, timeout); } else if (OB_SUCCESS != (ret = deserialize_result_0(data_buffer, pos, rc))) { TBSYS_LOG(WARN, "deserialize_result failed, ret=%d, server=%s, pcode=%d, version=%d, timeout=%ld", ret, to_cstring(server), pcode, version, timeout); } return ret; }
// The callback that is invoked by v8 whenever the JavaScript 'print' // function is called. Prints its arguments on stdout separated by // spaces and ending with a newline. // // JS: print("foo", "bar"); void Global::Print(const v8::FunctionCallbackInfo<v8::Value>& args) { bool first = true; HandleScope handleScope(args.GetIsolate()); for (int i = 0; i < args.Length(); i++) { if (first) { first = false; } else { printf(" "); } v8::String::Utf8Value str(args[i]); printf("%s", to_cstring(str)); } printf("\n"); fflush(stdout); }
void _zipGetFileAsString(const v8::FunctionCallbackInfo<v8::Value>& args) { if (args.Length() < 1) { args.GetReturnValue().Set(v8::Null(v8::Isolate::GetCurrent())); return; } CNativeControl* pNative = unwrap_nativeobject(args.This()); BYTE* pData = NULL; DWORD len = 0; pNative->m_oZipWorker.GetFileData(to_cstring(args[0]), pData, len); args.GetReturnValue().Set(v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), (char*)pData, v8::String::kNormalString, len)); }
void _AddImageInChanges(const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) return; CNativeControl* pNative = unwrap_nativeobject(args.This()); std::wstring sImage = to_cstring(args[0]); if (sImage.empty()) return; std::map<std::wstring, bool>::const_iterator iter = pNative->m_mapImagesInChanges.find(sImage); if (iter == pNative->m_mapImagesInChanges.end()) pNative->m_mapImagesInChanges.insert(std::pair<std::wstring, bool>(sImage, true)); }
bool ObSSTableScanParam::is_valid() const { int ret = true; if (range_.empty()) { TBSYS_LOG(ERROR, "range=%s is empty, cannot find any key.", to_cstring(range_)); ret = false; } else if (column_id_list_.get_array_index() <= 0) { TBSYS_LOG(ERROR, "query not request any columns=%ld", column_id_list_.get_array_index()); ret = false; } return ret; }
void ups_show_sessions(MockClient &client) { ObNewScanner scanner; int err = client.ups_show_sessions(scanner, timeout); fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err); if (OB_SUCCESS == err) { SessionMgr sm; ShowSessions ss(sm, scanner); scanner.set_default_row_desc(&(ss.get_row_desc())); ObRow row; while (OB_SUCCESS == scanner.get_next_row(row)) { fprintf(stdout, "%s\n", to_cstring(row)); } } }
void _zipGetFileAsBinary(const v8::FunctionCallbackInfo<v8::Value>& args) { if (args.Length() < 1) { args.GetReturnValue().Set(v8::Null(v8::Isolate::GetCurrent())); return; } CNativeControl* pNative = unwrap_nativeobject(args.This()); BYTE* pData = NULL; DWORD len = 0; pNative->m_oZipWorker.GetFileData(to_cstring(args[0]), pData, len); v8::Local<v8::ArrayBuffer> _buffer = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), (void*)pData, (size_t)len); v8::Local<v8::Uint8Array> _array = v8::Uint8Array::New(_buffer, 0, (size_t)len); args.GetReturnValue().Set(_array); }
// Callback function for SkEvents used to implement timeouts. bool Global::TimeOutProc(const SkEvent& evt) { // Create a handle scope to keep the temporary object references. HandleScope handleScope(gGlobal->getIsolate()); // Create a local context from our global context. Local<Context> context = gGlobal->getContext(); // Enter the context so all the remaining operations take place there. Context::Scope contextScope(context); // Set up an exception handler before calling the Process function. TryCatch tryCatch; int32_t id = evt.getFast32(); if (gGlobal->fTimeouts.find(gGlobal->fLastTimerID) == gGlobal->fTimeouts.end()) { printf("Not a valid timer ID.\n"); return true; } const int argc = 0; Local<Function> onTimeout = Local<Function>::New(gGlobal->getIsolate(), gGlobal->fTimeouts[id]); Handle<Value> result = onTimeout->Call(context->Global(), argc, NULL); gGlobal->fTimeouts.erase(id); // Handle any exceptions or output. if (result.IsEmpty()) { SkASSERT(tryCatch.HasCaught()); // Print errors that happened during execution. gGlobal->reportException(&tryCatch); } else { SkASSERT(!tryCatch.HasCaught()); if (!result->IsUndefined()) { // If all went well and the result wasn't undefined then print the // returned value. String::Utf8Value str(result); const char* cstr = to_cstring(str); printf("%s\n", cstr); } } return true; }
int64_t ObRowkey::to_string(char* buffer, const int64_t length) const { int64_t pos = 0; if (is_min_row()) { if (pos < length) { databuff_printf(buffer, length, pos, "MIN"); } } else if (is_max_row()) { if (pos < length) { databuff_printf(buffer, length, pos, "MAX"); } } else { for (int i = 0; i < obj_cnt_; ++i) { if (pos < length) { databuff_printf(buffer, length, pos, "%s", to_cstring(obj_ptr_[i])); if (i < obj_cnt_ - 1) { databuff_printf(buffer, length, pos, ","); } } else { break; } } } return pos; }
void print_scanner(ObScanner &scanner) { int64_t row_counter = 0; while (OB_SUCCESS == scanner.next_cell()) { ObCellInfo *ci = NULL; bool is_row_changed = false; scanner.get_cell(&ci, &is_row_changed); fprintf(stdout, "%s\n", common::print_cellinfo(ci, "CLI_SCAN")); if (is_row_changed) { row_counter++; } } bool is_fullfilled = false; int64_t fullfilled_num = 0; ObRowkey last_rk; scanner.get_last_row_key(last_rk); scanner.get_is_req_fullfilled(is_fullfilled, fullfilled_num); fprintf(stdout, "is_fullfilled=%s fullfilled_num=%ld row_counter=%ld last_row_key=[%s]\n", STR_BOOL(is_fullfilled), fullfilled_num, row_counter, to_cstring(last_rk)); }
int param_get(const char *fname, MockClient &client) { int err = OB_SUCCESS; int fd = open(fname, O_RDONLY); if (-1 == fd) { fprintf(stdout, "open [%s] fail errno=%u\n", fname, errno); err = OB_ERROR; } else { struct stat st; fstat(fd, &st); char *buf = (char*)malloc(st.st_size); if (NULL == buf) { fprintf(stdout, "malloc buf fail size=%ld\n", st.st_size); err = OB_ERROR; } else { ssize_t __attribute__((unused)) ret = read(fd, buf, st.st_size); int64_t pos = 0; ObGetParam get_param; if (OB_SUCCESS != get_param.deserialize(buf, st.st_size, pos)) { fprintf(stdout, "deserialize get_param fail\n"); err = OB_ERROR; } else { get_param.set_is_read_consistency(false); ObScanner scanner; int err = client.ups_get(get_param, scanner, timeout); fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err); if (OB_SUCCESS == err) { int64_t row_counter = 0; while (OB_SUCCESS == scanner.next_cell()) { ObCellInfo *ci = NULL; bool is_row_changed = false; scanner.get_cell(&ci, &is_row_changed); fprintf(stdout, "%s\n", common::print_cellinfo(ci, "CLI_GET")); if (is_row_changed) { row_counter++; } } bool is_fullfilled = false; int64_t fullfilled_num = 0; ObRowkey last_rk; scanner.get_last_row_key(last_rk); scanner.get_is_req_fullfilled(is_fullfilled, fullfilled_num); fprintf(stdout, "is_fullfilled=%s fullfilled_num=%ld row_counter=%ld last_row_key=[%s]\n", STR_BOOL(is_fullfilled), fullfilled_num, row_counter, to_cstring(last_rk)); } } free(buf); } close(fd); } return err; }
int ObSqlGetParam::copy_rowkey(const ObRowkey &rowkey, ObRowkey &stored_rowkey) { int err = OB_SUCCESS; if (OB_SUCCESS != (err = rowkey.deep_copy(stored_rowkey, buffer_pool_))) { TBSYS_LOG(WARN,"fail to copy rowkey to local buffer [err:%d].[rowkey=%s]", err, to_cstring(rowkey)); } return err; }
/** * initialize block object with block data * @param [in] scan_param input scan param * @param [in] block_data_buf block data buffer from sstable files or blockcache * @param [in] block_data_len size of block data * @return * OB_SUCCESS on success * OB_BEYOND_THE_RANGE , scan out of range, caller should look forward * on next blocks * OB_ITER_END, scan out of range, caller should not look forward on * next blocks. * others, internal error code. */ int ObSSTableBlockScanner::set_scan_param( const common::ObRowDesc& row_desc, const ObSSTableScanParam & scan_param, const ObSSTableBlockReader::BlockDataDesc& data_desc, const ObSSTableBlockReader::BlockData& block_data, bool &need_looking_forward) { int32_t ret = OB_SUCCESS; need_looking_forward = true; reader_.reset(); //reset reader before assign start_iterator and last_iterator const_iterator start_iterator = reader_.end(); const_iterator last_iterator = reader_.end(); current_row_.set_row_desc(row_desc); current_row_.reset(false, scan_param.is_not_exit_col_ret_nop() ? ObRow::DEFAULT_NOP : ObRow::DEFAULT_NULL); const ObNewRange & range = scan_param.get_range(); if (!block_data.available() || !data_desc.available()) { TBSYS_LOG(ERROR, "block_data,desc invalid, bd=(%p,%ld, %p, %ld), desc=(%p,%ld,%ld) ", block_data.data_buffer_, block_data.data_bufsiz_, block_data.internal_buffer_, block_data.internal_bufsiz_, data_desc.rowkey_info_, data_desc.rowkey_column_count_, data_desc.store_style_); ret = OB_INVALID_ARGUMENT; } else if (OB_SUCCESS != (ret = initialize(scan_param.is_reverse_scan(), scan_param.is_full_row_scan(), data_desc.store_style_, scan_param.is_not_exit_col_ret_nop()))) { // cannot happen } else if (OB_SUCCESS != (ret = reader_.deserialize(data_desc, block_data)) ) { TBSYS_LOG(ERROR, "deserialize error, ret=%d, data bufsiz=%ld", ret, block_data.data_bufsiz_); } else if (OB_SUCCESS != (ret = locate_start_pos(range, start_iterator, need_looking_forward))) { TBSYS_LOG(DEBUG, "locate start key out of range or error=%d", ret); } else if (OB_SUCCESS != (ret = locate_end_pos(range, last_iterator, need_looking_forward))) { TBSYS_LOG(DEBUG, "locate end key out of range or error=%d", ret); } else if (start_iterator > last_iterator) { TBSYS_LOG(DEBUG, "query key not exist in this block, start_iterator > last_iterator." " pls check input parameters, start_key(%s) and end_key(%s).", to_cstring(range.start_key_), to_cstring(range.end_key_)); ret = OB_BEYOND_THE_RANGE; need_looking_forward = false; } else { row_start_index_ = start_iterator; row_last_index_ = last_iterator; if (!is_reverse_scan_) { row_cursor_ = row_start_index_; } else { row_cursor_ = row_last_index_; } } // error log if (OB_SUCCESS != ret && OB_BEYOND_THE_RANGE != ret) { char range_buf[OB_RANGE_STR_BUFSIZ]; range.to_string(range_buf, OB_RANGE_STR_BUFSIZ); TBSYS_LOG(ERROR, "set_scan_param error, ret = %d, cursor=%p,%p,%p, range=%s", ret , row_cursor_, row_start_index_, row_last_index_, range_buf); } initialize_status_ = ret; return ret; }