Skip to content
Permalink
Browse files
[refactor] modify all OLAP_LOG_WARNING to LOG(WARNING) (#9473)
Co-authored-by: BePPPower <fangtiewei@selectdb.com>
  • Loading branch information
BePPPower and BePPPower committed May 10, 2022
1 parent 76154f1 commit 51db78d3754572aba5859808fafbfddd8ab772bf
Showing 40 changed files with 350 additions and 358 deletions.
@@ -104,7 +104,7 @@ Status HeartbeatServer::_heartbeat(const TMasterInfo& master_info) {
}
} else {
if (_master_info->cluster_id != master_info.cluster_id) {
OLAP_LOG_WARNING("invalid cluster id: %d. ignore.", master_info.cluster_id);
LOG(WARNING) << "invalid cluster id: " << master_info.cluster_id << ". ignore.";
return Status::InternalError("invalid cluster id. ignore.");
}
}
@@ -41,10 +41,8 @@ Status BloomFilterIndexReader::init(char* buffer, size_t buffer_size, bool is_us
_hash_function_num = hash_function_num;
_start_offset = sizeof(BloomFilterIndexHeader);
if (_step_size * _entry_count + _start_offset > _buffer_size) {
OLAP_LOG_WARNING(
"invalid param found. "
"[buffer_size=%lu bit_num=%u block_count=%lu header_size=%lu]",
buffer_size, bit_num, _entry_count, _start_offset);
LOG(WARNING) << "invalid param found.[buffer_size=" << buffer_size << " bit_num=" << bit_num
<< " block_count=" << _entry_count << " header_size=" << _start_offset << "]";
return Status::OLAPInternalError(OLAP_ERR_INPUT_PARAMETER_ERROR);
}

@@ -32,7 +32,7 @@ Status BloomFilterIndexWriter::add_bloom_filter(BloomFilter* bf) {
try {
_bloom_filters.push_back(bf);
} catch (...) {
OLAP_LOG_WARNING("add bloom filter to vector fail");
LOG(WARNING) << "add bloom filter to vector fail";
return Status::OLAPInternalError(OLAP_ERR_STL_ERROR);
}

@@ -51,15 +51,15 @@ uint64_t BloomFilterIndexWriter::estimate_buffered_memory() {
Status BloomFilterIndexWriter::write_to_buffer(OutStream* out_stream) {
Status res = Status::OK();
if (nullptr == out_stream) {
OLAP_LOG_WARNING("out stream is null");
LOG(WARNING) << "out stream is null";
return Status::OLAPInternalError(OLAP_ERR_INPUT_PARAMETER_ERROR);
}

// write header
_header.block_count = _bloom_filters.size();
res = out_stream->write(reinterpret_cast<char*>(&_header), sizeof(_header));
if (!res.ok()) {
OLAP_LOG_WARNING("write bloom filter index header fail");
LOG(WARNING) << "write bloom filter index header fail";
return res;
}

@@ -69,7 +69,7 @@ Status BloomFilterIndexWriter::write_to_buffer(OutStream* out_stream) {
uint32_t data_len = _bloom_filters[i]->bit_set_data_len();
res = out_stream->write(reinterpret_cast<char*>(data), sizeof(uint64_t) * data_len);
if (!res.ok()) {
OLAP_LOG_WARNING("write bloom filter index fail, i=%u", i);
LOG(WARNING) << "write bloom filter index fail, i=" << i;
return res;
}
}
@@ -80,13 +80,13 @@ Status BloomFilterIndexWriter::write_to_buffer(OutStream* out_stream) {
Status BloomFilterIndexWriter::write_to_buffer(char* buffer, size_t buffer_size) {
Status res = Status::OK();
if (nullptr == buffer) {
OLAP_LOG_WARNING("out stream is nullptr.");
LOG(WARNING) << "out stream is nullptr.";
return Status::OLAPInternalError(OLAP_ERR_INPUT_PARAMETER_ERROR);
}

if (estimate_buffered_memory() > buffer_size) {
OLAP_LOG_WARNING("need more buffer. [scr_size=%lu buffer_size=%lu]",
estimate_buffered_memory(), buffer_size);
LOG(WARNING) << "need more buffer. [scr_size=" << estimate_buffered_memory()
<< " buffer_size=" << buffer_size << "]";
return Status::OLAPInternalError(OLAP_ERR_INPUT_PARAMETER_ERROR);
}

@@ -100,7 +100,8 @@ StorageByteBuffer* StorageByteBuffer::mmap(void* start, uint64_t length, int pro
char* memory = (char*)::mmap(start, length, prot, flags, fd, offset);

if (MAP_FAILED == memory) {
OLAP_LOG_WARNING("fail to mmap. [errno='%d' errno_str='%s']", Errno::no(), Errno::str());
LOG(WARNING) << "fail to mmap. [errno='" << Errno::no() << "' errno_str='" << Errno::str()
<< "']";
RELEASE_THREAD_LOCAL_MEM_TRACKER(length);
return nullptr;
}
@@ -112,7 +113,7 @@ StorageByteBuffer* StorageByteBuffer::mmap(void* start, uint64_t length, int pro

if (nullptr == buf) {
deleter(memory);
OLAP_LOG_WARNING("fail to allocate StorageByteBuffer.");
LOG(WARNING) << "fail to allocate StorageByteBuffer.";
RELEASE_THREAD_LOCAL_MEM_TRACKER(length);
return nullptr;
}
@@ -128,7 +129,7 @@ StorageByteBuffer* StorageByteBuffer::mmap(void* start, uint64_t length, int pro
StorageByteBuffer* StorageByteBuffer::mmap(FileHandler* handler, uint64_t offset, int prot,
int flags) {
if (nullptr == handler) {
OLAP_LOG_WARNING("invalid file handler");
LOG(WARNING) << "invalid file handler";
return nullptr;
}

@@ -138,7 +139,8 @@ StorageByteBuffer* StorageByteBuffer::mmap(FileHandler* handler, uint64_t offset
char* memory = (char*)::mmap(nullptr, length, prot, flags, fd, offset);

if (MAP_FAILED == memory) {
OLAP_LOG_WARNING("fail to mmap. [errno='%d' errno_str='%s']", Errno::no(), Errno::str());
LOG(WARNING) << "fail to mmap. [errno='" << Errno::no() << "' errno_str='" << Errno::str()
<< "']";
RELEASE_THREAD_LOCAL_MEM_TRACKER(length);
return nullptr;
}
@@ -150,7 +152,7 @@ StorageByteBuffer* StorageByteBuffer::mmap(FileHandler* handler, uint64_t offset

if (nullptr == buf) {
deleter(memory);
OLAP_LOG_WARNING("fail to allocate StorageByteBuffer.");
LOG(WARNING) << "fail to allocate StorageByteBuffer.";
RELEASE_THREAD_LOCAL_MEM_TRACKER(length);
return nullptr;
}
@@ -814,8 +814,9 @@ Status DataDir::move_to_trash(const FilePathDesc& segment_path_desc) {
std::filesystem::path trash_local_path(trash_local_file);
string trash_local_dir = trash_local_path.parent_path().string();
if (!FileUtils::check_exist(trash_local_dir) && !FileUtils::create_dir(trash_local_dir).ok()) {
OLAP_LOG_WARNING("delete file failed. due to mkdir failed. [file=%s new_dir=%s]",
segment_path_desc.filepath.c_str(), trash_local_dir.c_str());
LOG(WARNING) << "delete file failed. due to mkdir failed. [file="
<< segment_path_desc.filepath.c_str() << " new_dir=" << trash_local_dir.c_str()
<< "]";
return Status::OLAPInternalError(OLAP_ERR_OS_ERROR);
}

@@ -843,9 +844,9 @@ Status DataDir::move_to_trash(const FilePathDesc& segment_path_desc) {
Status rename_status = storage_backend->rename_dir(segment_path_desc.remote_path,
trash_path_desc.remote_path);
if (!rename_status.ok()) {
OLAP_LOG_WARNING("Move remote file to trash failed. [file=%s target='%s']",
segment_path_desc.remote_path.c_str(),
trash_path_desc.remote_path.c_str());
LOG(WARNING) << "Move remote file to trash failed. [file="
<< segment_path_desc.remote_path << " target='"
<< trash_path_desc.remote_path << "']";
return Status::OLAPInternalError(OLAP_ERR_OS_ERROR);
}
} else if (status.is_not_found()) {
@@ -860,8 +861,8 @@ Status DataDir::move_to_trash(const FilePathDesc& segment_path_desc) {
VLOG_NOTICE << "move file to trash. " << segment_path_desc.filepath << " -> "
<< trash_local_file;
if (rename(segment_path_desc.filepath.c_str(), trash_local_file.c_str()) < 0) {
OLAP_LOG_WARNING("move file to trash failed. [file=%s target='%s' err='%m']",
segment_path_desc.filepath.c_str(), trash_local_file.c_str());
LOG(WARNING) << "move file to trash failed. [file=" << segment_path_desc.filepath
<< " target='" << trash_local_file << "' err='" << Errno::str() << "']";
return Status::OLAPInternalError(OLAP_ERR_OS_ERROR);
}

@@ -46,7 +46,7 @@ struct decimal12_t {
fraction += (sign ? -FRAC_RATIO : FRAC_RATIO);
}

//OLAP_LOG_WARNING("agg: int=%ld, frac=%d", integer, fraction);
//LOG(WARNING) << "agg: int=" << integer << ", frac=" << fraction;
//_set_flag();
return *this;
}
@@ -150,7 +150,7 @@ bool DeleteConditionHandler::is_condition_value_valid(const TabletColumn& column
case OLAP_FIELD_TYPE_BOOL:
return valid_bool(value_str);
default:
OLAP_LOG_WARNING("unknown field type. [type=%d]", field_type);
LOG(WARNING) << "unknown field type. [type=" << field_type << "]";
}
return false;
}
@@ -160,7 +160,7 @@ Status DeleteConditionHandler::check_condition_valid(const TabletSchema& schema,
// Check whether the column exists
int32_t field_index = schema.field_index(cond.column_name);
if (field_index < 0) {
OLAP_LOG_WARNING("field is not existent. [field_index=%d]", field_index);
LOG(WARNING) << "field is not existent. [field_index=" << field_index << "]";
return Status::OLAPInternalError(OLAP_ERR_DELETE_INVALID_CONDITION);
}

@@ -178,7 +178,8 @@ Status DeleteConditionHandler::check_condition_valid(const TabletSchema& schema,
// Check operator and operands size are matched.
if ("*=" != cond.condition_op && "!*=" != cond.condition_op &&
cond.condition_values.size() != 1) {
OLAP_LOG_WARNING("invalid condition value size. [size=%ld]", cond.condition_values.size());
LOG(WARNING) << "invalid condition value size. [size=" << cond.condition_values.size()
<< "]";
return Status::OLAPInternalError(OLAP_ERR_DELETE_INVALID_CONDITION);
}

@@ -253,7 +254,7 @@ Status DeleteHandler::init(const TabletSchema& schema, const DelPredicateArray&
for (const auto& sub_predicate : delete_condition.sub_predicates()) {
TCondition condition;
if (!_parse_condition(sub_predicate, &condition)) {
OLAP_LOG_WARNING("fail to parse condition. [condition=%s]", sub_predicate.c_str());
LOG(WARNING) << "fail to parse condition. [condition=" << sub_predicate << "]";
return Status::OLAPInternalError(OLAP_ERR_DELETE_INVALID_PARAMETERS);
}

@@ -292,7 +292,7 @@ off_t FileHandler::length() const {
struct stat stat_data;

if (fstat(_fd, &stat_data) < 0) {
OLAP_LOG_WARNING("fstat error. [fd=%d]", _fd);
LOG(WARNING) << "fstat error. [fd=" << _fd << "]";
return -1;
}

@@ -356,7 +356,7 @@ Status FileHandlerWithBuf::close() {

Status FileHandlerWithBuf::read(void* buf, size_t size) {
if (OLAP_UNLIKELY(nullptr == _fp)) {
OLAP_LOG_WARNING("Fail to write, fp is nullptr!");
LOG(WARNING) << "Fail to write, fp is nullptr!";
return Status::OLAPInternalError(OLAP_ERR_NOT_INITED);
}

@@ -380,7 +380,7 @@ Status FileHandlerWithBuf::read(void* buf, size_t size) {

Status FileHandlerWithBuf::pread(void* buf, size_t size, size_t offset) {
if (OLAP_UNLIKELY(nullptr == _fp)) {
OLAP_LOG_WARNING("Fail to write, fp is nullptr!");
LOG(WARNING) << "Fail to write, fp is nullptr!";
return Status::OLAPInternalError(OLAP_ERR_NOT_INITED);
}

@@ -397,7 +397,7 @@ Status FileHandlerWithBuf::pread(void* buf, size_t size, size_t offset) {

Status FileHandlerWithBuf::write(const void* buf, size_t buf_size) {
if (OLAP_UNLIKELY(nullptr == _fp)) {
OLAP_LOG_WARNING("Fail to write, fp is nullptr!");
LOG(WARNING) << "Fail to write, fp is nullptr!";
return Status::OLAPInternalError(OLAP_ERR_NOT_INITED);
}

@@ -415,7 +415,7 @@ Status FileHandlerWithBuf::write(const void* buf, size_t buf_size) {

Status FileHandlerWithBuf::pwrite(const void* buf, size_t buf_size, size_t offset) {
if (OLAP_UNLIKELY(nullptr == _fp)) {
OLAP_LOG_WARNING("Fail to write, fp is nullptr!");
LOG(WARNING) << "Fail to write, fp is nullptr!";
return Status::OLAPInternalError(OLAP_ERR_NOT_INITED);
}

@@ -63,12 +63,12 @@ Status ReadOnlyFileStream::_assure_data() {
SCOPED_RAW_TIMER(&_stats->io_ns);
res = _file_cursor.read(reinterpret_cast<char*>(&header), sizeof(header));
if (OLAP_UNLIKELY(!res.ok())) {
OLAP_LOG_WARNING("read header fail");
LOG(WARNING) << "read header fail";
return res;
}
res = _fill_compressed(header.length);
if (OLAP_UNLIKELY(!res.ok())) {
OLAP_LOG_WARNING("read header fail");
LOG(WARNING) << "read header fail";
return res;
}
_stats->compressed_bytes_read += sizeof(header) + header.length;
@@ -122,7 +122,7 @@ Status ReadOnlyFileStream::seek(PositionProvider* position) {
VLOG_TRACE << "file stream eof.";
return res;
} else {
OLAP_LOG_WARNING("fail to assure data after seek");
LOG(WARNING) << "fail to assure data after seek";
return res;
}
}
@@ -171,7 +171,7 @@ Status ReadOnlyFileStream::_fill_compressed(size_t length) {

Status res = _file_cursor.read((*_shared_buffer)->array(), length);
if (!res.ok()) {
OLAP_LOG_WARNING("fail to fill compressed buffer.");
LOG(WARNING) << "fail to fill compressed buffer.";
return res;
}

@@ -64,7 +64,7 @@ class ReadOnlyFileStream {
Status init() {
_compressed_helper = StorageByteBuffer::create(_compress_buffer_size);
if (nullptr == _compressed_helper) {
OLAP_LOG_WARNING("fail to create compressed buffer");
LOG(WARNING) << "fail to create compressed buffer";
return Status::OLAPInternalError(OLAP_ERR_MALLOC_ERROR);
}

@@ -59,7 +59,7 @@ Status InStream::_slice(uint64_t chunk_size, StorageByteBuffer** out_slice) {
return Status::OK();
} else if (_current_range >= _inputs.size() - 1) {
// 如果buffer用完了
OLAP_LOG_WARNING("EOF in InStream. [Need=%lu]", chunk_size);
LOG(WARNING) << "EOF in InStream. [Need=" << chunk_size << "]";
return Status::OLAPInternalError(OLAP_ERR_OUT_OF_BOUND);
}

@@ -112,7 +112,7 @@ Status InStream::_slice(uint64_t chunk_size, StorageByteBuffer** out_slice) {
// 到这里就意味着上边的循环里没有取到足够的buf
// 回退到进来之前的状态
_seek(old_offset);
OLAP_LOG_WARNING("EOF in InStream. [Need=%lu]", chunk_size);
LOG(WARNING) << "EOF in InStream. [Need=" << chunk_size << "]";
return Status::OLAPInternalError(OLAP_ERR_OUT_OF_BOUND);
}

@@ -146,8 +146,8 @@ Status InStream::_assure_data() {
_compressed->get((char*)&head, sizeof(head));

if (head.length > _compress_buffer_size) {
OLAP_LOG_WARNING("chunk size is larger than buffer size. [chunk=%u buffer_size=%u]",
head.length, _compress_buffer_size);
LOG(WARNING) << "chunk size is larger than buffer size. [chunk=" << head.length
<< " buffer_size=" << _compress_buffer_size << "]";
return Status::OLAPInternalError(OLAP_ERR_COLUMN_READ_STREAM);
}

@@ -158,7 +158,7 @@ Status InStream::_assure_data() {
// 根据head取一块buf,这里应该要调整_current_offset
res = _slice(head.length, &slice);
if (OLAP_LIKELY(!res.ok())) {
OLAP_LOG_WARNING("fail to slice data from stream.");
LOG(WARNING) << "fail to slice data from stream.";
return Status::OLAPInternalError(OLAP_ERR_COLUMN_READ_STREAM);
}

@@ -179,10 +179,10 @@ Status InStream::_assure_data() {
SAFE_DELETE(slice);
}
} else {
OLAP_LOG_WARNING(
"compressed remaining size less than stream head size. "
"[compressed_remaining_size=%lu stream_head_size=%lu]",
_compressed->remaining(), sizeof(StreamHead));
LOG(WARNING) << "compressed remaining size less than stream head size. "
"[compressed_remaining_size="
<< _compressed->remaining() << " stream_head_size=" << sizeof(StreamHead)
<< "]";
return Status::OLAPInternalError(OLAP_ERR_COLUMN_READ_STREAM);
}

@@ -20,28 +20,28 @@

namespace doris {

#define OLAP_CACHE_STRING_TO_BUF(cur, str, r_len) \
do { \
if (r_len > str.size()) { \
memcpy(cur, str.c_str(), str.size()); \
r_len -= str.size(); \
cur += str.size(); \
} else { \
OLAP_LOG_WARNING("construct cache key buf not enough."); \
return CacheKey(nullptr, 0); \
} \
#define OLAP_CACHE_STRING_TO_BUF(cur, str, r_len) \
do { \
if (r_len > str.size()) { \
memcpy(cur, str.c_str(), str.size()); \
r_len -= str.size(); \
cur += str.size(); \
} else { \
LOG(WARNING) << "construct cache key buf not enough."; \
return CacheKey(nullptr, 0); \
} \
} while (0)

#define OLAP_CACHE_NUMERIC_TO_BUF(cur, numeric, r_len) \
do { \
if (r_len > sizeof(numeric)) { \
memcpy(cur, &numeric, sizeof(numeric)); \
r_len -= sizeof(numeric); \
cur += sizeof(numeric); \
} else { \
OLAP_LOG_WARNING("construct cache key buf not enough."); \
return CacheKey(nullptr, 0); \
} \
#define OLAP_CACHE_NUMERIC_TO_BUF(cur, numeric, r_len) \
do { \
if (r_len > sizeof(numeric)) { \
memcpy(cur, &numeric, sizeof(numeric)); \
r_len -= sizeof(numeric); \
cur += sizeof(numeric); \
} else { \
LOG(WARNING) << "construct cache key buf not enough."; \
return CacheKey(nullptr, 0); \
} \
} while (0)

class Cache;

0 comments on commit 51db78d

Please sign in to comment.