You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2018/12/05 10:47:04 UTC
[GitHub] chaoyli closed pull request #391: rename OLAPTable to Tablet
chaoyli closed pull request #391: rename OLAPTable to Tablet
URL: https://github.com/apache/incubator-doris/pull/391
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/be/src/agent/agent_server.cpp b/be/src/agent/agent_server.cpp
index 72aeeb08..d9379390 100644
--- a/be/src/agent/agent_server.cpp
+++ b/be/src/agent/agent_server.cpp
@@ -78,11 +78,11 @@ AgentServer::AgentServer(ExecEnv* exec_env,
// boost::filesystem::create_directories(config::agent_tmp_dir);
// init task worker pool
- _create_table_workers = new TaskWorkerPool(
+ _create_tablet_workers = new TaskWorkerPool(
TaskWorkerPool::TaskWorkerType::CREATE_TABLE,
_exec_env,
master_info);
- _drop_table_workers = new TaskWorkerPool(
+ _drop_tablet_workers = new TaskWorkerPool(
TaskWorkerPool::TaskWorkerType::DROP_TABLE,
_exec_env,
master_info);
@@ -106,7 +106,7 @@ AgentServer::AgentServer(ExecEnv* exec_env,
TaskWorkerPool::TaskWorkerType::DELETE,
_exec_env,
master_info);
- _alter_table_workers = new TaskWorkerPool(
+ _alter_tablet_workers = new TaskWorkerPool(
TaskWorkerPool::TaskWorkerType::ALTER_TABLE,
_exec_env,
master_info);
@@ -134,7 +134,7 @@ AgentServer::AgentServer(ExecEnv* exec_env,
TaskWorkerPool::TaskWorkerType::REPORT_DISK_STATE,
_exec_env,
master_info);
- _report_olap_table_workers = new TaskWorkerPool(
+ _report_tablet_workers = new TaskWorkerPool(
TaskWorkerPool::TaskWorkerType::REPORT_OLAP_TABLE,
_exec_env,
master_info);
@@ -163,21 +163,21 @@ AgentServer::AgentServer(ExecEnv* exec_env,
_exec_env,
master_info);
#ifndef BE_TEST
- _create_table_workers->start();
- _drop_table_workers->start();
+ _create_tablet_workers->start();
+ _drop_tablet_workers->start();
_push_workers->start();
_publish_version_workers->start();
_clear_alter_task_workers->start();
_clear_transaction_task_workers->start();
_delete_workers->start();
- _alter_table_workers->start();
+ _alter_tablet_workers->start();
_clone_workers->start();
_storage_medium_migrate_workers->start();
_cancel_delete_data_workers->start();
_check_consistency_workers->start();
_report_task_workers->start();
_report_disk_state_workers->start();
- _report_olap_table_workers->start();
+ _report_tablet_workers->start();
_upload_workers->start();
_download_workers->start();
_make_snapshot_workers->start();
@@ -192,11 +192,11 @@ AgentServer::AgentServer(ExecEnv* exec_env,
}
AgentServer::~AgentServer() {
- if (_create_table_workers != NULL) {
- delete _create_table_workers;
+ if (_create_tablet_workers != NULL) {
+ delete _create_tablet_workers;
}
- if (_drop_table_workers != NULL) {
- delete _drop_table_workers;
+ if (_drop_tablet_workers != NULL) {
+ delete _drop_tablet_workers;
}
if (_push_workers != NULL) {
delete _push_workers;
@@ -213,8 +213,8 @@ AgentServer::~AgentServer() {
if (_delete_workers != NULL) {
delete _delete_workers;
}
- if (_alter_table_workers != NULL) {
- delete _alter_table_workers;
+ if (_alter_tablet_workers != NULL) {
+ delete _alter_tablet_workers;
}
if (_clone_workers != NULL) {
delete _clone_workers;
@@ -234,8 +234,8 @@ AgentServer::~AgentServer() {
if (_report_disk_state_workers != NULL) {
delete _report_disk_state_workers;
}
- if (_report_olap_table_workers != NULL) {
- delete _report_olap_table_workers;
+ if (_report_tablet_workers != NULL) {
+ delete _report_tablet_workers;
}
if (_upload_workers != NULL) {
delete _upload_workers;
@@ -284,14 +284,14 @@ void AgentServer::submit_tasks(
switch (task_type) {
case TTaskType::CREATE:
if (task.__isset.create_tablet_req) {
- _create_table_workers->submit_task(task);
+ _create_tablet_workers->submit_task(task);
} else {
status_code = TStatusCode::ANALYSIS_ERROR;
}
break;
case TTaskType::DROP:
if (task.__isset.drop_tablet_req) {
- _drop_table_workers->submit_task(task);
+ _drop_tablet_workers->submit_task(task);
} else {
status_code = TStatusCode::ANALYSIS_ERROR;
}
@@ -335,7 +335,7 @@ void AgentServer::submit_tasks(
case TTaskType::ROLLUP:
case TTaskType::SCHEMA_CHANGE:
if (task.__isset.alter_tablet_req) {
- _alter_table_workers->submit_task(task);
+ _alter_tablet_workers->submit_task(task);
} else {
status_code = TStatusCode::ANALYSIS_ERROR;
}
diff --git a/be/src/agent/agent_server.h b/be/src/agent/agent_server.h
index f1e584d8..c559c7ee 100644
--- a/be/src/agent/agent_server.h
+++ b/be/src/agent/agent_server.h
@@ -93,21 +93,21 @@ class AgentServer {
ExecEnv* _exec_env;
const TMasterInfo& _master_info;
- TaskWorkerPool* _create_table_workers;
- TaskWorkerPool* _drop_table_workers;
+ TaskWorkerPool* _create_tablet_workers;
+ TaskWorkerPool* _drop_tablet_workers;
TaskWorkerPool* _push_workers;
TaskWorkerPool* _publish_version_workers;
TaskWorkerPool* _clear_alter_task_workers;
TaskWorkerPool* _clear_transaction_task_workers;
TaskWorkerPool* _delete_workers;
- TaskWorkerPool* _alter_table_workers;
+ TaskWorkerPool* _alter_tablet_workers;
TaskWorkerPool* _clone_workers;
TaskWorkerPool* _storage_medium_migrate_workers;
TaskWorkerPool* _cancel_delete_data_workers;
TaskWorkerPool* _check_consistency_workers;
TaskWorkerPool* _report_task_workers;
TaskWorkerPool* _report_disk_state_workers;
- TaskWorkerPool* _report_olap_table_workers;
+ TaskWorkerPool* _report_tablet_workers;
TaskWorkerPool* _upload_workers;
TaskWorkerPool* _download_workers;
TaskWorkerPool* _make_snapshot_workers;
diff --git a/be/src/agent/pusher.cpp b/be/src/agent/pusher.cpp
index a26d0f11..e56e69b7 100644
--- a/be/src/agent/pusher.cpp
+++ b/be/src/agent/pusher.cpp
@@ -31,7 +31,7 @@
#include "olap/olap_common.h"
#include "olap/olap_define.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
using std::list;
using std::string;
@@ -57,11 +57,11 @@ AgentStatus Pusher::init() {
}
// Check replica exist
- TabletSharedPtr olap_table;
- olap_table = _engine->get_table(
+ TabletSharedPtr tablet;
+ tablet = _engine->get_tablet(
_push_req.tablet_id,
_push_req.schema_hash);
- if (olap_table.get() == NULL) {
+ if (tablet.get() == NULL) {
OLAP_LOG_WARNING("get tables failed. tablet_id: %ld, schema_hash: %ld",
_push_req.tablet_id, _push_req.schema_hash);
status = DORIS_PUSH_INVALID_TABLE;
@@ -82,7 +82,7 @@ AgentStatus Pusher::init() {
// Get local download path
LOG(INFO) << "start get file. remote_full_path: " << remote_full_path;
- string root_path = olap_table->storage_root_path_name();
+ string root_path = tablet->storage_root_path_name();
status = _get_tmp_file_dir(root_path, &tmp_file_dir);
if (DORIS_SUCCESS != status) {
diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp
index cb464efb..73ff55a1 100644
--- a/be/src/agent/task_worker_pool.cpp
+++ b/be/src/agent/task_worker_pool.cpp
@@ -38,7 +38,7 @@
#include "gen_cpp/Types_types.h"
#include "olap/olap_common.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/store.h"
#include "olap/utils.h"
#include "common/resource_tls.h"
@@ -113,12 +113,12 @@ void TaskWorkerPool::start() {
// Init task pool and task workers
switch (_task_worker_type) {
case TaskWorkerType::CREATE_TABLE:
- _worker_count = config::create_table_worker_count;
- _callback_function = _create_table_worker_thread_callback;
+ _worker_count = config::create_tablet_worker_count;
+ _callback_function = _create_tablet_worker_thread_callback;
break;
case TaskWorkerType::DROP_TABLE:
- _worker_count = config::drop_table_worker_count;
- _callback_function = _drop_table_worker_thread_callback;
+ _worker_count = config::drop_tablet_worker_count;
+ _callback_function = _drop_tablet_worker_thread_callback;
break;
case TaskWorkerType::PUSH:
case TaskWorkerType::REALTIME_PUSH:
@@ -143,8 +143,8 @@ void TaskWorkerPool::start() {
_callback_function = _push_worker_thread_callback;
break;
case TaskWorkerType::ALTER_TABLE:
- _worker_count = config::alter_table_worker_count;
- _callback_function = _alter_table_worker_thread_callback;
+ _worker_count = config::alter_tablet_worker_count;
+ _callback_function = _alter_tablet_worker_thread_callback;
break;
case TaskWorkerType::CLONE:
_worker_count = config::clone_worker_count;
@@ -172,7 +172,7 @@ void TaskWorkerPool::start() {
break;
case TaskWorkerType::REPORT_OLAP_TABLE:
_worker_count = REPORT_OLAP_TABLE_WORKER_COUNT;
- _callback_function = _report_olap_table_worker_thread_callback;
+ _callback_function = _report_tablet_worker_thread_callback;
break;
case TaskWorkerType::UPLOAD:
_worker_count = config::upload_worker_count;
@@ -407,7 +407,7 @@ uint32_t TaskWorkerPool::_get_next_task_index(
return index;
}
-void* TaskWorkerPool::_create_table_worker_thread_callback(void* arg_this) {
+void* TaskWorkerPool::_create_tablet_worker_thread_callback(void* arg_this) {
TaskWorkerPool* worker_pool_this = (TaskWorkerPool*)arg_this;
#ifndef BE_TEST
@@ -431,7 +431,7 @@ void* TaskWorkerPool::_create_table_worker_thread_callback(void* arg_this) {
TStatus task_status;
OLAPStatus create_status =
- worker_pool_this->_env->olap_engine()->create_table(create_tablet_req);
+ worker_pool_this->_env->olap_engine()->create_tablet(create_tablet_req);
if (create_status != OLAPStatus::OLAP_SUCCESS) {
OLAP_LOG_WARNING("create table failed. status: %d, signature: %ld",
create_status, agent_task_req.signature);
@@ -459,7 +459,7 @@ void* TaskWorkerPool::_create_table_worker_thread_callback(void* arg_this) {
return (void*)0;
}
-void* TaskWorkerPool::_drop_table_worker_thread_callback(void* arg_this) {
+void* TaskWorkerPool::_drop_tablet_worker_thread_callback(void* arg_this) {
TaskWorkerPool* worker_pool_this = (TaskWorkerPool*)arg_this;
#ifndef BE_TEST
@@ -482,7 +482,7 @@ void* TaskWorkerPool::_drop_table_worker_thread_callback(void* arg_this) {
vector<string> error_msgs;
TStatus task_status;
- AgentStatus status = worker_pool_this->_drop_table(drop_tablet_req);
+ AgentStatus status = worker_pool_this->_drop_tablet(drop_tablet_req);
if (status != DORIS_SUCCESS) {
OLAP_LOG_WARNING(
"drop table failed! signature: %ld", agent_task_req.signature);
@@ -506,7 +506,7 @@ void* TaskWorkerPool::_drop_table_worker_thread_callback(void* arg_this) {
return (void*)0;
}
-void* TaskWorkerPool::_alter_table_worker_thread_callback(void* arg_this) {
+void* TaskWorkerPool::_alter_tablet_worker_thread_callback(void* arg_this) {
TaskWorkerPool* worker_pool_this = (TaskWorkerPool*)arg_this;
#ifndef BE_TEST
@@ -534,7 +534,7 @@ void* TaskWorkerPool::_alter_table_worker_thread_callback(void* arg_this) {
switch (task_type) {
case TTaskType::SCHEMA_CHANGE:
case TTaskType::ROLLUP:
- worker_pool_this->_alter_table(alter_tablet_request,
+ worker_pool_this->_alter_tablet(alter_tablet_request,
signatrue,
task_type,
&finish_task_request);
@@ -552,7 +552,7 @@ void* TaskWorkerPool::_alter_table_worker_thread_callback(void* arg_this) {
return (void*)0;
}
-void TaskWorkerPool::_alter_table(
+void TaskWorkerPool::_alter_tablet(
const TAlterTabletReq& alter_tablet_request,
int64_t signature,
const TTaskType::type task_type,
@@ -586,18 +586,18 @@ void TaskWorkerPool::_alter_table(
// Because if delete failed create rollup will failed
if (status == DORIS_SUCCESS) {
// Check lastest schema change status
- AlterTableStatus alter_table_status = _show_alter_table_status(
+ AlterTableStatus alter_tablet_status = _show_alter_tablet_status(
base_tablet_id,
base_schema_hash);
- LOG(INFO) << "get alter table status:" << alter_table_status
+ LOG(INFO) << "get alter table status:" << alter_tablet_status
<< ", signature:" << signature;
// Delete failed alter table tablet file
- if (alter_table_status == ALTER_TABLE_FAILED) {
+ if (alter_tablet_status == ALTER_TABLE_FAILED) {
TDropTabletReq drop_tablet_req;
drop_tablet_req.__set_tablet_id(alter_tablet_request.new_tablet_req.tablet_id);
drop_tablet_req.__set_schema_hash(alter_tablet_request.new_tablet_req.tablet_schema.schema_hash);
- status = _drop_table(drop_tablet_req);
+ status = _drop_tablet(drop_tablet_req);
if (status != DORIS_SUCCESS) {
OLAP_LOG_WARNING("delete failed rollup file failed, status: %d, "
@@ -609,14 +609,14 @@ void TaskWorkerPool::_alter_table(
}
if (status == DORIS_SUCCESS) {
- if (alter_table_status == ALTER_TABLE_FINISHED
- || alter_table_status == ALTER_TABLE_FAILED
- || alter_table_status == ALTER_TABLE_WAITING) {
+ if (alter_tablet_status == ALTER_TABLE_FINISHED
+ || alter_tablet_status == ALTER_TABLE_FAILED
+ || alter_tablet_status == ALTER_TABLE_WAITING) {
// Create rollup table
OLAPStatus ret = OLAPStatus::OLAP_SUCCESS;
switch (task_type) {
case TTaskType::ROLLUP:
- ret = _env->olap_engine()->create_rollup_table(alter_tablet_request);
+ ret = _env->olap_engine()->create_rollup_tablet(alter_tablet_request);
break;
case TTaskType::SCHEMA_CHANGE:
ret = _env->olap_engine()->schema_change(alter_tablet_request);
@@ -1043,7 +1043,7 @@ void* TaskWorkerPool::_clone_worker_thread_callback(void* arg_this) {
TBackend src_host;
// Check local tablet exist or not
TabletSharedPtr tablet =
- worker_pool_this->_env->olap_engine()->get_table(
+ worker_pool_this->_env->olap_engine()->get_tablet(
clone_req.tablet_id, clone_req.schema_hash);
if (tablet.get() != NULL) {
LOG(INFO) << "clone tablet exist yet, begin to incremental clone. "
@@ -1209,7 +1209,7 @@ void* TaskWorkerPool::_clone_worker_thread_callback(void* arg_this) {
TDropTabletReq drop_req;
drop_req.tablet_id = clone_req.tablet_id;
drop_req.schema_hash = clone_req.schema_hash;
- AgentStatus drop_status = worker_pool_this->_drop_table(drop_req);
+ AgentStatus drop_status = worker_pool_this->_drop_tablet(drop_req);
if (drop_status != DORIS_SUCCESS) {
// just log
OLAP_LOG_WARNING(
@@ -1856,7 +1856,7 @@ void* TaskWorkerPool::_report_disk_state_worker_thread_callback(void* arg_this)
return (void*)0;
}
-void* TaskWorkerPool::_report_olap_table_worker_thread_callback(void* arg_this) {
+void* TaskWorkerPool::_report_tablet_worker_thread_callback(void* arg_this) {
TaskWorkerPool* worker_pool_this = (TaskWorkerPool*)arg_this;
TReportRequest request;
@@ -1886,7 +1886,7 @@ void* TaskWorkerPool::_report_olap_table_worker_thread_callback(void* arg_this)
#ifndef BE_TEST
// wait for notifying until timeout
OLAPEngine::get_instance()->wait_for_report_notify(
- config::report_olap_table_interval_seconds, true);
+ config::report_tablet_interval_seconds, true);
continue;
#else
return (void*)0;
@@ -1906,7 +1906,7 @@ void* TaskWorkerPool::_report_olap_table_worker_thread_callback(void* arg_this)
#ifndef BE_TEST
// wait for notifying until timeout
OLAPEngine::get_instance()->wait_for_report_notify(
- config::report_olap_table_interval_seconds, true);
+ config::report_tablet_interval_seconds, true);
}
#endif
@@ -2184,17 +2184,17 @@ void* TaskWorkerPool::_release_snapshot_thread_callback(void* arg_this) {
return (void*)0;
}
-AlterTableStatus TaskWorkerPool::_show_alter_table_status(
+AlterTableStatus TaskWorkerPool::_show_alter_tablet_status(
TTabletId tablet_id,
TSchemaHash schema_hash) {
- AlterTableStatus alter_table_status =
- _env->olap_engine()->show_alter_table_status(tablet_id, schema_hash);
- return alter_table_status;
+ AlterTableStatus alter_tablet_status =
+ _env->olap_engine()->show_alter_tablet_status(tablet_id, schema_hash);
+ return alter_tablet_status;
}
-AgentStatus TaskWorkerPool::_drop_table(const TDropTabletReq& req) {
+AgentStatus TaskWorkerPool::_drop_tablet(const TDropTabletReq& req) {
AgentStatus status = DORIS_SUCCESS;
- OLAPStatus drop_status = _env->olap_engine()->drop_table(req.tablet_id, req.schema_hash);
+ OLAPStatus drop_status = _env->olap_engine()->drop_tablet(req.tablet_id, req.schema_hash);
if (drop_status != OLAP_SUCCESS && drop_status != OLAP_ERR_TABLE_NOT_FOUND) {
status = DORIS_ERROR;
}
@@ -2293,7 +2293,7 @@ AgentStatus TaskWorkerPool::_move_dir(
bool overwrite,
std::vector<std::string>* error_msgs) {
- TabletSharedPtr tablet = _env->olap_engine()->get_table(
+ TabletSharedPtr tablet = _env->olap_engine()->get_tablet(
tablet_id, schema_hash);
if (tablet.get() == NULL) {
LOG(INFO) << "failed to get tablet. tablet_id:" << tablet_id
diff --git a/be/src/agent/task_worker_pool.h b/be/src/agent/task_worker_pool.h
index 750dbcf2..2c96feef 100644
--- a/be/src/agent/task_worker_pool.h
+++ b/be/src/agent/task_worker_pool.h
@@ -94,20 +94,20 @@ class TaskWorkerPool {
uint32_t _get_next_task_index(int32_t thread_count, std::deque<TAgentTaskRequest>& tasks,
TPriority::type priority);
- static void* _create_table_worker_thread_callback(void* arg_this);
- static void* _drop_table_worker_thread_callback(void* arg_this);
+ static void* _create_tablet_worker_thread_callback(void* arg_this);
+ static void* _drop_tablet_worker_thread_callback(void* arg_this);
static void* _push_worker_thread_callback(void* arg_this);
static void* _publish_version_worker_thread_callback(void* arg_this);
static void* _clear_alter_task_worker_thread_callback(void* arg_this);
static void* _clear_transaction_task_worker_thread_callback(void* arg_this);
- static void* _alter_table_worker_thread_callback(void* arg_this);
+ static void* _alter_tablet_worker_thread_callback(void* arg_this);
static void* _clone_worker_thread_callback(void* arg_this);
static void* _storage_medium_migrate_worker_thread_callback(void* arg_this);
static void* _cancel_delete_data_worker_thread_callback(void* arg_this);
static void* _check_consistency_worker_thread_callback(void* arg_this);
static void* _report_task_worker_thread_callback(void* arg_this);
static void* _report_disk_state_worker_thread_callback(void* arg_this);
- static void* _report_olap_table_worker_thread_callback(void* arg_this);
+ static void* _report_tablet_worker_thread_callback(void* arg_this);
static void* _upload_worker_thread_callback(void* arg_this);
static void* _download_worker_thread_callback(void* arg_this);
static void* _make_snapshot_thread_callback(void* arg_this);
@@ -125,17 +125,17 @@ class TaskWorkerPool {
const std::vector<Version>* missing_versions,
bool* allow_incremental_clone);
- void _alter_table(
+ void _alter_tablet(
const TAlterTabletReq& create_rollup_request,
int64_t signature,
const TTaskType::type task_type,
TFinishTaskRequest* finish_task_request);
- AlterTableStatus _show_alter_table_status(
+ AlterTableStatus _show_alter_tablet_status(
const TTabletId tablet_id,
const TSchemaHash schema_hash);
- AgentStatus _drop_table(const TDropTabletReq& drop_tablet_req);
+ AgentStatus _drop_tablet(const TDropTabletReq& drop_tablet_req);
AgentStatus _get_tablet_info(
const TTabletId tablet_id,
diff --git a/be/src/common/config.h b/be/src/common/config.h
index 544f2de8..e3871ed2 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -55,9 +55,9 @@ namespace config {
// the count of heart beat service
CONF_Int32(heartbeat_service_thread_count, "1");
// the count of thread to create table
- CONF_Int32(create_table_worker_count, "3");
+ CONF_Int32(create_tablet_worker_count, "3");
// the count of thread to drop table
- CONF_Int32(drop_table_worker_count, "3");
+ CONF_Int32(drop_tablet_worker_count, "3");
// the count of thread to batch load
CONF_Int32(push_worker_count_normal_priority, "3");
// the count of thread to high priority batch load
@@ -71,7 +71,7 @@ namespace config {
// the count of thread to delete
CONF_Int32(delete_worker_count, "3");
// the count of thread to alter table
- CONF_Int32(alter_table_worker_count, "3");
+ CONF_Int32(alter_tablet_worker_count, "3");
// the count of thread to clone
CONF_Int32(clone_worker_count, "3");
// the count of thread to clone
@@ -93,9 +93,9 @@ namespace config {
// the interval time(seconds) for agent report disk state to FE
CONF_Int32(report_disk_state_interval_seconds, "60");
// the interval time(seconds) for agent report olap table to FE
- CONF_Int32(report_olap_table_interval_seconds, "60");
+ CONF_Int32(report_tablet_interval_seconds, "60");
// the timeout(seconds) for alter table
- CONF_Int32(alter_table_timeout_seconds, "86400");
+ CONF_Int32(alter_tablet_timeout_seconds, "86400");
// the timeout(seconds) for make snapshot
CONF_Int32(make_snapshot_timeout_seconds, "600");
// the timeout(seconds) for release snapshot
diff --git a/be/src/exec/CMakeLists.txt b/be/src/exec/CMakeLists.txt
index 1d512caa..e7258d19 100644
--- a/be/src/exec/CMakeLists.txt
+++ b/be/src/exec/CMakeLists.txt
@@ -55,8 +55,8 @@ set(EXEC_FILES
olap_scanner.cpp
olap_meta_reader.cpp
olap_common.cpp
- olap_table_info.cpp
- olap_table_sink.cpp
+ tablet_info.cpp
+ tablet_sink.cpp
plain_text_line_reader.cpp
mysql_scan_node.cpp
mysql_scanner.cpp
diff --git a/be/src/exec/data_sink.cpp b/be/src/exec/data_sink.cpp
index 8f480df1..1cdca443 100644
--- a/be/src/exec/data_sink.cpp
+++ b/be/src/exec/data_sink.cpp
@@ -22,7 +22,7 @@
#include <memory>
#include "exec/exec_node.h"
-#include "exec/olap_table_sink.h"
+#include "exec/tablet_sink.h"
#include "exprs/expr.h"
#include "gen_cpp/PaloInternalService_types.h"
#include "runtime/data_stream_sender.h"
diff --git a/be/src/exec/olap_meta_reader.cpp b/be/src/exec/olap_meta_reader.cpp
index 023304a9..0a3855e3 100644
--- a/be/src/exec/olap_meta_reader.cpp
+++ b/be/src/exec/olap_meta_reader.cpp
@@ -43,7 +43,7 @@ Status EngineMetaReader::get_hints(
RuntimeProfile* profile) {
auto tablet_id = scan_range->scan_range().tablet_id;
int32_t schema_hash = strtoul(scan_range->scan_range().schema_hash.c_str(), NULL, 10);
- TabletSharedPtr table = OLAPEngine::get_instance()->get_table(
+ TabletSharedPtr table = OLAPEngine::get_instance()->get_tablet(
tablet_id, schema_hash);
if (table.get() == NULL) {
LOG(WARNING) << "tablet does not exist. tablet_id=" << tablet_id << ", schema_hash="
diff --git a/be/src/exec/olap_scanner.cpp b/be/src/exec/olap_scanner.cpp
index e3576b0d..13e2425f 100644
--- a/be/src/exec/olap_scanner.cpp
+++ b/be/src/exec/olap_scanner.cpp
@@ -79,8 +79,8 @@ Status OlapScanner::_prepare(
VersionHash version_hash =
strtoul(scan_range->scan_range().version_hash.c_str(), nullptr, 10);
{
- _olap_table = OLAPEngine::get_instance()->get_table(tablet_id, schema_hash);
- if (_olap_table.get() == nullptr) {
+ _tablet = OLAPEngine::get_instance()->get_tablet(tablet_id, schema_hash);
+ if (_tablet.get() == nullptr) {
OLAP_LOG_WARNING("tablet does not exist. [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
@@ -89,8 +89,8 @@ Status OlapScanner::_prepare(
return Status(ss.str());
}
{
- ReadLock rdlock(_olap_table->get_header_lock_ptr());
- const PDelta* delta = _olap_table->lastest_version();
+ ReadLock rdlock(_tablet->get_header_lock_ptr());
+ const PDelta* delta = _tablet->lastest_version();
if (delta == NULL) {
std::stringstream ss;
ss << "fail to get latest version of tablet: " << tablet_id;
@@ -130,7 +130,7 @@ Status OlapScanner::open() {
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init reader.[res=%d]", res);
std::stringstream ss;
- ss << "failed to initialize storage reader. tablet=" << _params.olap_table->full_name()
+ ss << "failed to initialize storage reader. tablet=" << _params.tablet->full_name()
<< ", res=" << res << ", backend=" << BackendOptions::get_localhost();
return Status(ss.str().c_str());
}
@@ -143,7 +143,7 @@ Status OlapScanner::_init_params(
const std::vector<TCondition>& is_nulls) {
RETURN_IF_ERROR(_init_return_columns());
- _params.olap_table = _olap_table;
+ _params.tablet = _tablet;
_params.reader_type = READER_QUERY;
_params.aggregation = _aggregation;
_params.version = Version(0, _version);
@@ -176,11 +176,11 @@ Status OlapScanner::_init_params(
if (_aggregation) {
_params.return_columns = _return_columns;
} else {
- for (size_t i = 0; i < _olap_table->num_key_fields(); ++i) {
+ for (size_t i = 0; i < _tablet->num_key_fields(); ++i) {
_params.return_columns.push_back(i);
}
for (auto index : _return_columns) {
- if (_olap_table->tablet_schema()[index].is_key) {
+ if (_tablet->tablet_schema()[index].is_key) {
continue;
} else {
_params.return_columns.push_back(index);
@@ -189,12 +189,12 @@ Status OlapScanner::_init_params(
}
// use _params.return_columns, because reader use this to merge sort
- OLAPStatus res = _read_row_cursor.init(_olap_table->tablet_schema(), _params.return_columns);
+ OLAPStatus res = _read_row_cursor.init(_tablet->tablet_schema(), _params.return_columns);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init row cursor.[res=%d]", res);
return Status("failed to initialize storage read row cursor");
}
- _read_row_cursor.allocate_memory_for_string_type(_olap_table->tablet_schema());
+ _read_row_cursor.allocate_memory_for_string_type(_tablet->tablet_schema());
for (auto cid : _return_columns) {
_query_fields.push_back(_read_row_cursor.get_field_by_index(cid));
}
@@ -207,7 +207,7 @@ Status OlapScanner::_init_return_columns() {
if (!slot->is_materialized()) {
continue;
}
- int32_t index = _olap_table->get_field_index(slot->col_name());
+ int32_t index = _tablet->get_field_index(slot->col_name());
if (index < 0) {
std::stringstream ss;
ss << "field name is invalied. field=" << slot->col_name();
@@ -215,12 +215,12 @@ Status OlapScanner::_init_return_columns() {
return Status(ss.str());
}
_return_columns.push_back(index);
- if (_olap_table->tablet_schema()[index].type == OLAP_FIELD_TYPE_VARCHAR ||
- _olap_table->tablet_schema()[index].type == OLAP_FIELD_TYPE_HLL) {
+ if (_tablet->tablet_schema()[index].type == OLAP_FIELD_TYPE_VARCHAR ||
+ _tablet->tablet_schema()[index].type == OLAP_FIELD_TYPE_HLL) {
_request_columns_size.push_back(
- _olap_table->tablet_schema()[index].length - sizeof(StringLengthType));
+ _tablet->tablet_schema()[index].length - sizeof(StringLengthType));
} else {
- _request_columns_size.push_back(_olap_table->tablet_schema()[index].length);
+ _request_columns_size.push_back(_tablet->tablet_schema()[index].length);
}
_query_slots.push_back(slot);
}
diff --git a/be/src/exec/olap_scanner.h b/be/src/exec/olap_scanner.h
index 054c4832..c9f7c614 100644
--- a/be/src/exec/olap_scanner.h
+++ b/be/src/exec/olap_scanner.h
@@ -115,7 +115,7 @@ class OlapScanner {
ReaderParams _params;
std::unique_ptr<Reader> _reader;
- TabletSharedPtr _olap_table;
+ TabletSharedPtr _tablet;
int64_t _version;
std::vector<uint32_t> _return_columns;
diff --git a/be/src/exec/olap_table_info.cpp b/be/src/exec/tablet_info.cpp
similarity index 99%
rename from be/src/exec/olap_table_info.cpp
rename to be/src/exec/tablet_info.cpp
index 04e8f9f8..67cd6545 100644
--- a/be/src/exec/olap_table_info.cpp
+++ b/be/src/exec/tablet_info.cpp
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include "exec/olap_table_info.h"
+#include "exec/tablet_info.h"
#include "runtime/mem_pool.h"
#include "runtime/mem_tracker.h"
diff --git a/be/src/exec/olap_table_info.h b/be/src/exec/tablet_info.h
similarity index 100%
rename from be/src/exec/olap_table_info.h
rename to be/src/exec/tablet_info.h
diff --git a/be/src/exec/olap_table_sink.cpp b/be/src/exec/tablet_sink.cpp
similarity index 99%
rename from be/src/exec/olap_table_sink.cpp
rename to be/src/exec/tablet_sink.cpp
index 5bf3fd93..906fda6a 100644
--- a/be/src/exec/olap_table_sink.cpp
+++ b/be/src/exec/tablet_sink.cpp
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include "exec/olap_table_sink.h"
+#include "exec/tablet_sink.h"
#include <sstream>
diff --git a/be/src/exec/olap_table_sink.h b/be/src/exec/tablet_sink.h
similarity index 99%
rename from be/src/exec/olap_table_sink.h
rename to be/src/exec/tablet_sink.h
index 44866d23..ecf97224 100644
--- a/be/src/exec/olap_table_sink.h
+++ b/be/src/exec/tablet_sink.h
@@ -27,7 +27,7 @@
#include "common/status.h"
#include "common/object_pool.h"
#include "exec/data_sink.h"
-#include "exec/olap_table_info.h"
+#include "exec/tablet_info.h"
#include "gen_cpp/Types_types.h"
#include "gen_cpp/internal_service.pb.h"
#include "gen_cpp/palo_internal_service.pb.h"
diff --git a/be/src/http/action/meta_action.cpp b/be/src/http/action/meta_action.cpp
index c349d4f6..bb2aafae 100644
--- a/be/src/http/action/meta_action.cpp
+++ b/be/src/http/action/meta_action.cpp
@@ -30,7 +30,7 @@
#include "olap/olap_engine.h"
#include "olap/olap_define.h"
#include "olap/olap_header.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "common/logging.h"
#include "util/json_util.h"
@@ -49,12 +49,12 @@ Status MetaAction::_handle_header(HttpRequest *req, std::string* json_header) {
}
uint64_t tablet_id = std::stoull(req_tablet_id);
uint32_t schema_hash = std::stoul(req_schema_hash);
- TabletSharedPtr olap_table = OLAPEngine::get_instance()->get_table(tablet_id, schema_hash);
- if (olap_table == nullptr) {
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(tablet_id, schema_hash);
+ if (tablet == nullptr) {
LOG(WARNING) << "no tablet for tablet_id:" << tablet_id << " schema hash:" << schema_hash;
return Status("no tablet exist");
}
- OLAPStatus s = OlapHeaderManager::get_json_header(olap_table->store(), tablet_id, schema_hash, json_header);
+ OLAPStatus s = OlapHeaderManager::get_json_header(tablet->store(), tablet_id, schema_hash, json_header);
if (s == OLAP_ERR_META_KEY_NOT_FOUND) {
return Status("no header exist");
} else if (s != OLAP_SUCCESS) {
diff --git a/be/src/http/action/restore_tablet_action.cpp b/be/src/http/action/restore_tablet_action.cpp
index b2c816fe..8cc8f5f1 100644
--- a/be/src/http/action/restore_tablet_action.cpp
+++ b/be/src/http/action/restore_tablet_action.cpp
@@ -85,7 +85,7 @@ Status RestoreTabletAction::_handle(HttpRequest *req) {
LOG(INFO) << "get restore tablet action request: " << tablet_id << "-" << schema_hash;
TabletSharedPtr tablet =
- OLAPEngine::get_instance()->get_table(tablet_id, schema_hash);
+ OLAPEngine::get_instance()->get_tablet(tablet_id, schema_hash);
if (tablet.get() != nullptr) {
LOG(WARNING) << "find tablet. tablet_id=" << tablet_id << " schema_hash=" << schema_hash;
return Status("tablet already exists, can not restore.");
diff --git a/be/src/olap/CMakeLists.txt b/be/src/olap/CMakeLists.txt
index e0e1a82e..c6d09eab 100644
--- a/be/src/olap/CMakeLists.txt
+++ b/be/src/olap/CMakeLists.txt
@@ -59,7 +59,7 @@ add_library(Olap STATIC
olap_meta.cpp
olap_server.cpp
olap_snapshot.cpp
- olap_table.cpp
+ tablet.cpp
options.cpp
out_stream.cpp
push_handler.cpp
diff --git a/be/src/olap/base_compaction.cpp b/be/src/olap/base_compaction.cpp
index 32f8b602..1e162b26 100644
--- a/be/src/olap/base_compaction.cpp
+++ b/be/src/olap/base_compaction.cpp
@@ -29,7 +29,7 @@
#include "olap/olap_engine.h"
#include "olap/olap_header.h"
#include "olap/segment_group.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/utils.h"
#include "util/doris_metrics.h"
@@ -40,20 +40,20 @@ using std::vector;
namespace doris {
-OLAPStatus BaseCompaction::init(TabletSharedPtr table, bool is_manual_trigger) {
+OLAPStatus BaseCompaction::init(TabletSharedPtr tablet, bool is_manual_trigger) {
// 表在首次查询或PUSH等操作时,会被加载到内存
// 如果表没有被加载,表明该表上目前没有任何操作,所以不进行BE操作
- if (!table->is_loaded()) {
+ if (!tablet->is_loaded()) {
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
- LOG(INFO) << "init base compaction handler. [table=" << table->full_name() << "]";
+ LOG(INFO) << "init base compaction handler. [tablet=" << tablet->full_name() << "]";
- _table = table;
+ _tablet = tablet;
// 1. 尝试取得base compaction的锁
if (!_try_base_compaction_lock()) {
- LOG(WARNING) << "another base compaction is running. table=" << table->full_name();
+ LOG(WARNING) << "another base compaction is running. tablet=" << tablet->full_name();
return OLAP_ERR_BE_TRY_BE_LOCK_ERROR;
}
@@ -83,7 +83,7 @@ OLAPStatus BaseCompaction::init(TabletSharedPtr table, bool is_manual_trigger) {
}
OLAPStatus BaseCompaction::run() {
- LOG(INFO) << "start base compaction. tablet=" << _table->full_name()
+ LOG(INFO) << "start base compaction. tablet=" << _tablet->full_name()
<< ", old_base_version=" << _old_base_version.second
<< ", new_base_version=" << _new_base_version.second;
@@ -92,10 +92,10 @@ OLAPStatus BaseCompaction::run() {
// 1. 计算新base的version hash
VersionHash new_base_version_hash;
- res = _table->compute_all_versions_hash(_need_merged_versions, &new_base_version_hash);
+ res = _tablet->compute_all_versions_hash(_need_merged_versions, &new_base_version_hash);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to calculate new base version hash.[table=%s; new_base_version=%d]",
- _table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to calculate new base version hash.[tablet=%s; new_base_version=%d]",
+ _tablet->full_name().c_str(),
_new_base_version.second);
_garbage_collection();
return res;
@@ -105,10 +105,10 @@ OLAPStatus BaseCompaction::run() {
// 2. 获取生成新base需要的data sources
vector<ColumnData*> base_data_sources;
- _table->acquire_data_sources_by_versions(_need_merged_versions, &base_data_sources);
+ _tablet->acquire_data_sources_by_versions(_need_merged_versions, &base_data_sources);
if (base_data_sources.empty()) {
- OLAP_LOG_WARNING("fail to acquire need data sources. [table=%s; version=%d]",
- _table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to acquire need data sources. [tablet=%s; version=%d]",
+ _tablet->full_name().c_str(),
_new_base_version.second);
_garbage_collection();
return OLAP_ERR_BE_ACQUIRE_DATA_SOURCES_ERROR;
@@ -133,10 +133,10 @@ OLAPStatus BaseCompaction::run() {
&base_data_sources,
&row_count);
// 释放不再使用的ColumnData对象
- _table->release_data_sources(&base_data_sources);
+ _tablet->release_data_sources(&base_data_sources);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to do base version. [table=%s; version=%d]",
- _table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to do base version. [tablet=%s; version=%d]",
+ _tablet->full_name().c_str(),
_new_base_version.second);
_garbage_collection();
return res;
@@ -150,7 +150,7 @@ OLAPStatus BaseCompaction::run() {
vector<SegmentGroup*> unused_olap_indices;
res = _update_header(row_count, &unused_olap_indices);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to update header. table=" << _table->full_name()
+ LOG(WARNING) << "fail to update header. tablet=" << _tablet->full_name()
<< ", version=" << _new_base_version.first << "-" << _new_base_version.second;
_garbage_collection();
return res;
@@ -186,10 +186,10 @@ static bool version_comparator(const Version& lhs, const Version& rhs) {
bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
vector<Version>* candidate_versions) {
- ReadLock rdlock(_table->get_header_lock_ptr());
- int32_t cumulative_layer_point = _table->cumulative_layer_point();
+ ReadLock rdlock(_tablet->get_header_lock_ptr());
+ int32_t cumulative_layer_point = _tablet->cumulative_layer_point();
if (cumulative_layer_point == -1) {
- LOG(FATAL) << "tablet has an unreasonable cumulative layer point. [tablet='" << _table->full_name()
+ LOG(FATAL) << "tablet has an unreasonable cumulative layer point. [tablet='" << _tablet->full_name()
<< "' cumulative_layer_point=" << cumulative_layer_point << "]";
return false;
}
@@ -198,7 +198,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
--cumulative_layer_point;
vector<Version> path_versions;
- if (OLAP_SUCCESS != _table->select_versions_to_span(Version(0, cumulative_layer_point),
+ if (OLAP_SUCCESS != _tablet->select_versions_to_span(Version(0, cumulative_layer_point),
&path_versions)) {
OLAP_LOG_WARNING("fail to select shortest version path. [start=%d end=%d]",
0, cumulative_layer_point);
@@ -214,8 +214,8 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
// base文件
if (temp.first == 0) {
_old_base_version = temp;
- base_size = _table->get_version_data_size(temp);
- base_creation_time = _table->get_delta(index)->creation_time();
+ base_size = _tablet->get_version_data_size(temp);
+ base_creation_time = _tablet->get_delta(index)->creation_time();
continue;
}
@@ -229,7 +229,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
// 只有1个base文件和1个delta文件
if (base_compaction_layer_point == -1) {
VLOG(3) << "can't do base compaction: no cumulative files."
- << "table=" << _table->full_name()
+ << "tablet=" << _tablet->full_name()
<< ", base_version=0-" << _old_base_version.second
<< ", cumulative_layer_point=" << cumulative_layer_point + 1;
return false;
@@ -238,14 +238,14 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
// 只有1个cumulative文件
if (base_compaction_layer_point == _old_base_version.second) {
VLOG(3) << "can't do base compaction: only one cumulative file."
- << "table=" << _table->full_name()
+ << "tablet=" << _tablet->full_name()
<< ", base_version=0-" << _old_base_version.second
<< ", cumulative_layer_point=" << cumulative_layer_point + 1;
return false;
}
// 使用最短路径算法,选择可合并的cumulative版本
- if (OLAP_SUCCESS != _table->select_versions_to_span(_new_base_version,
+ if (OLAP_SUCCESS != _tablet->select_versions_to_span(_new_base_version,
candidate_versions)) {
LOG(WARNING) << "fail to select shortest version path."
<< "start=" << _new_base_version.first
@@ -258,7 +258,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
// 如果是手动执行START_BASE_COMPACTION命令,则不检查base compaction policy,
// 也不考虑删除版本过期问题, 只要有可以合并的cumulative,就执行base compaction
if (is_manual_trigger) {
- VLOG(3) << "manual trigger base compaction. table=" << _table->full_name();
+ VLOG(3) << "manual trigger base compaction. tablet=" << _tablet->full_name();
return true;
}
@@ -272,7 +272,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
continue;
}
// cumulative文件
- cumulative_total_size += _table->get_version_data_size(temp);
+ cumulative_total_size += _tablet->get_version_data_size(temp);
}
// 检查是否满足base compaction的触发条件
@@ -282,7 +282,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
= config::base_compaction_num_cumulative_deltas;
// candidate_versions中包含base文件,所以这里减1
if (candidate_versions->size() - 1 >= base_compaction_num_cumulative_deltas) {
- LOG(INFO) << "satisfy the base compaction policy. table="<< _table->full_name()
+ LOG(INFO) << "satisfy the base compaction policy. tablet="<< _tablet->full_name()
<< ", num_cumulative_deltas=" << candidate_versions->size() - 1
<< ", base_compaction_num_cumulative_deltas=" << base_compaction_num_cumulative_deltas;
return true;
@@ -292,7 +292,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
const double base_cumulative_delta_ratio = config::base_cumulative_delta_ratio;
double cumulative_base_ratio = static_cast<double>(cumulative_total_size) / base_size;
if (cumulative_base_ratio > base_cumulative_delta_ratio) {
- LOG(INFO) << "satisfy the base compaction policy. table=" << _table->full_name()
+ LOG(INFO) << "satisfy the base compaction policy. tablet=" << _tablet->full_name()
<< ", cumualtive_total_size=" << cumulative_total_size
<< ", base_size=" << base_size
<< ", cumulative_base_ratio=" << cumulative_base_ratio
@@ -304,13 +304,13 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
const uint32_t interval_since_last_operation = config::base_compaction_interval_seconds_since_last_operation;
int64_t interval_since_last_be = time(NULL) - base_creation_time;
if (interval_since_last_be > interval_since_last_operation) {
- LOG(INFO) << "satisfy the base compaction policy. table=" << _table->full_name()
+ LOG(INFO) << "satisfy the base compaction policy. tablet=" << _tablet->full_name()
<< ", interval_since_last_be=" << interval_since_last_be
<< ", policy_interval=" << interval_since_last_operation;
return true;
}
- VLOG(3) << "don't satisfy the base compaction policy. table=" << _table->full_name()
+ VLOG(3) << "don't satisfy the base compaction policy. tablet=" << _tablet->full_name()
<< ", cumulative_files_number=" << candidate_versions->size() - 1
<< ", cumulative_base_ratio=" << cumulative_base_ratio
<< ", interval_since_last_be=" << interval_since_last_be;
@@ -322,7 +322,7 @@ OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash
vector<ColumnData*>* base_data_sources,
uint64_t* row_count) {
// 1. 生成新base文件对应的olap index
- SegmentGroup* new_base = new (std::nothrow) SegmentGroup(_table.get(),
+ SegmentGroup* new_base = new (std::nothrow) SegmentGroup(_tablet.get(),
_new_base_version,
new_base_version_hash,
false, 0, 0);
@@ -331,7 +331,7 @@ OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash
return OLAP_ERR_MALLOC_ERROR;
}
- LOG(INFO) << "start merge new base. tablet=" << _table->full_name()
+ LOG(INFO) << "start merge new base. tablet=" << _tablet->full_name()
<< ", version=" << _new_base_version.second;
// 2. 执行base compaction的merge
// 注意:无论是行列存,还是列存,在执行merge时都使用Merger类,不能使用MassiveMerger。
@@ -345,25 +345,25 @@ OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash
uint64_t merged_rows = 0;
uint64_t filted_rows = 0;
OLAPStatus res = OLAP_SUCCESS;
- if (_table->data_file_type() == COLUMN_ORIENTED_FILE) {
- _table->obtain_header_rdlock();
- _table->release_header_lock();
+ if (_tablet->data_file_type() == COLUMN_ORIENTED_FILE) {
+ _tablet->obtain_header_rdlock();
+ _tablet->release_header_lock();
- Merger merger(_table, new_base, READER_BASE_COMPACTION);
+ Merger merger(_tablet, new_base, READER_BASE_COMPACTION);
res = merger.merge(*base_data_sources, &merged_rows, &filted_rows);
if (res == OLAP_SUCCESS) {
*row_count = merger.row_count();
}
} else {
OLAP_LOG_WARNING("unknown data file type. [type=%s]",
- DataFileType_Name(_table->data_file_type()).c_str());
+ DataFileType_Name(_tablet->data_file_type()).c_str());
res = OLAP_ERR_DATA_FILE_TYPE_ERROR;
}
// 3. 如果merge失败,执行清理工作,返回错误码退出
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to make new base version. [table='%s' version='%d.%d' res=%d]",
- _table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to make new base version. [tablet='%s' version='%d.%d' res=%d]",
+ _tablet->full_name().c_str(),
_new_base_version.first,
_new_base_version.second,
res);
@@ -377,16 +377,16 @@ OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash
// 4. 如果merge成功,则将新base文件对应的olap index载入
_new_olap_indices.push_back(new_base);
- VLOG(10) << "merge new base success, start load index. tablet=" << _table->full_name()
+ VLOG(10) << "merge new base success, start load index. tablet=" << _tablet->full_name()
<< ", version=" << _new_base_version.second;
res = new_base->load();
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load index. [version='%d-%d' version_hash=%ld table='%s']",
+ OLAP_LOG_WARNING("fail to load index. [version='%d-%d' version_hash=%ld tablet='%s']",
new_base->version().first,
new_base->version().second,
new_base->version_hash(),
- _table->full_name().c_str());
+ _tablet->full_name().c_str());
return res;
}
@@ -413,24 +413,24 @@ OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash
<< ", new_index_rows=" << new_base->num_rows();
}
- LOG(INFO) << "succeed to do base compaction. table=" << _table->full_name()
+ LOG(INFO) << "succeed to do base compaction. tablet=" << _tablet->full_name()
<< ", base_version=" << _new_base_version.first << "-" << _new_base_version.second;
return OLAP_SUCCESS;
}
OLAPStatus BaseCompaction::_update_header(uint64_t row_count, vector<SegmentGroup*>* unused_olap_indices) {
- WriteLock wrlock(_table->get_header_lock_ptr());
+ WriteLock wrlock(_tablet->get_header_lock_ptr());
vector<Version> unused_versions;
_get_unused_versions(&unused_versions);
OLAPStatus res = OLAP_SUCCESS;
// 由于在replace_data_sources中可能会发生很小概率的非事务性失败, 因此这里定位FATAL错误
- res = _table->replace_data_sources(&unused_versions,
+ res = _tablet->replace_data_sources(&unused_versions,
&_new_olap_indices,
unused_olap_indices);
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "fail to replace data sources. res" << res
- << ", tablet=" << _table->full_name()
+ << ", tablet=" << _tablet->full_name()
<< ", new_base_version=" << _new_base_version.second
<< ", old_base_verison=" << _old_base_version.second;
return res;
@@ -440,14 +440,14 @@ OLAPStatus BaseCompaction::_update_header(uint64_t row_count, vector<SegmentGrou
// Base Compaction完成之后,需要删除header中版本号小于等于新base文件版本号的删除条件
DeleteConditionHandler cond_handler;
- cond_handler.delete_cond(_table, _new_base_version.second, true);
+ cond_handler.delete_cond(_tablet, _new_base_version.second, true);
// 如果保存Header失败, 所有新增的信息会在下次启动时丢失, 属于严重错误
// 暂时没办法做很好的处理,报FATAL
- res = _table->save_header();
+ res = _tablet->save_header();
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "fail to save header. res=" << res
- << ", tablet=" << _table->full_name()
+ << ", tablet=" << _tablet->full_name()
<< ", new_base_version=" << _new_base_version.second
<< ", old_base_version=" << _old_base_version.second;
return OLAP_ERR_BE_SAVE_HEADER_ERROR;
@@ -520,11 +520,11 @@ bool BaseCompaction::_validate_need_merged_versions(
OLAPStatus BaseCompaction::_validate_delete_file_action() {
// 1. acquire the latest version to make sure all is right after deleting files
- ReadLock rdlock(_table->get_header_lock_ptr());
- const PDelta* lastest_version = _table->lastest_version();
+ ReadLock rdlock(_tablet->get_header_lock_ptr());
+ const PDelta* lastest_version = _tablet->lastest_version();
Version test_version = Version(0, lastest_version->end_version());
vector<ColumnData*> test_sources;
- _table->acquire_data_sources(test_version, &test_sources);
+ _tablet->acquire_data_sources(test_version, &test_sources);
if (test_sources.size() == 0) {
LOG(INFO) << "acquire data sources failed. version="
@@ -532,7 +532,7 @@ OLAPStatus BaseCompaction::_validate_delete_file_action() {
return OLAP_ERR_BE_ERROR_DELETE_ACTION;
}
- _table->release_data_sources(&test_sources);
+ _tablet->release_data_sources(&test_sources);
VLOG(3) << "delete file action is OK";
return OLAP_SUCCESS;
diff --git a/be/src/olap/base_compaction.h b/be/src/olap/base_compaction.h
index 3d2e82f8..b2bfb119 100644
--- a/be/src/olap/base_compaction.h
+++ b/be/src/olap/base_compaction.h
@@ -23,7 +23,7 @@
#include "olap/olap_common.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
namespace doris {
@@ -47,7 +47,7 @@ class BaseCompaction {
// 2. 如果满足,计算需要合并哪些版本
//
// 输入参数:
- // - table: 待执行BE的OLAPTable的智能指针
+ // - tablet: 待执行BE的Tablet的智能指针
// - is_manual_trigger
// - 如果为true,则是手动执行START_BASE_COMPACTION命令
// - 如果为false,则是根据BE策略来执行
@@ -55,7 +55,7 @@ class BaseCompaction {
// 返回值:
// - 如果init执行成功,即可以执行BE,则返回OLAP_SUCCESS;
// - 其它情况下,返回相应的错误码
- OLAPStatus init(TabletSharedPtr table, bool is_manual_trigger = false);
+ OLAPStatus init(TabletSharedPtr tablet, bool is_manual_trigger = false);
// 执行BaseCompaction, 可能会持续很长时间
//
@@ -133,7 +133,7 @@ class BaseCompaction {
unused_versions->clear();
std::vector<Version> all_versions;
- _table->list_versions(&all_versions);
+ _tablet->list_versions(&all_versions);
for (std::vector<Version>::const_iterator iter = all_versions.begin();
iter != all_versions.end(); ++iter) {
if (iter->first <= _new_base_version.second) {
@@ -148,7 +148,7 @@ class BaseCompaction {
}
bool _try_base_compaction_lock() {
- if (_table->try_base_compaction_lock()) {
+ if (_tablet->try_base_compaction_lock()) {
_base_compaction_locked = true;
return true;
}
@@ -158,13 +158,13 @@ class BaseCompaction {
void _release_base_compaction_lock() {
if (_base_compaction_locked) {
- _table->release_base_compaction_lock();
+ _tablet->release_base_compaction_lock();
_base_compaction_locked = false;
}
}
// 需要进行操作的Table指针
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
// 新base的version
Version _new_base_version;
// 现有base的version
diff --git a/be/src/olap/column_data.cpp b/be/src/olap/column_data.cpp
index 5d6f146c..08e03720 100644
--- a/be/src/olap/column_data.cpp
+++ b/be/src/olap/column_data.cpp
@@ -19,14 +19,14 @@
#include "olap/segment_reader.h"
#include "olap/olap_cond.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_block.h"
namespace doris {
ColumnData* ColumnData::create(SegmentGroup* segment_group) {
ColumnData* data = NULL;
- DataFileType file_type = segment_group->table()->data_file_type();
+ DataFileType file_type = segment_group->tablet()->data_file_type();
switch (file_type) {
case COLUMN_ORIENTED_FILE:
@@ -50,8 +50,8 @@ ColumnData::ColumnData(SegmentGroup* segment_group)
_runtime_state(NULL),
_is_using_cache(false),
_segment_reader(NULL) {
- _table = segment_group->table();
- _num_rows_per_block = _table->num_rows_per_row_block();
+ _tablet = segment_group->tablet();
+ _num_rows_per_block = _tablet->num_rows_per_row_block();
}
ColumnData::~ColumnData() {
@@ -64,7 +64,7 @@ OLAPStatus ColumnData::init() {
auto res = _short_key_cursor.init(_segment_group->short_key_fields());
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "key cursor init failed, table:" << _table->id()
+ LOG(WARNING) << "key cursor init failed, tablet:" << _tablet->id()
<< ", res:" << res;
return res;
}
@@ -139,7 +139,7 @@ OLAPStatus ColumnData::_seek_to_block(const RowBlockPosition& block_pos, bool wi
std::string file_name;
file_name = segment_group()->construct_data_file_path(segment_group()->segment_group_id(), block_pos.segment);
_segment_reader = new(std::nothrow) SegmentReader(
- file_name, _table, segment_group(), block_pos.segment,
+ file_name, _tablet, segment_group(), block_pos.segment,
_seek_columns, _load_bf_columns, _conditions,
_col_predicates, _delete_handler, _delete_status, _runtime_state, _stats);
if (_segment_reader == nullptr) {
@@ -285,8 +285,8 @@ OLAPStatus ColumnData::_find_position_by_full_key(
OLAPStatus ColumnData::_seek_to_row(const RowCursor& key, bool find_last_key, bool is_end_key) {
RowBlockPosition position;
OLAPStatus res = OLAP_SUCCESS;
- FieldType type = _table->get_field_type_by_index(key.field_count() - 1);
- if (key.field_count() > _table->num_short_key_fields() || OLAP_FIELD_TYPE_VARCHAR == type) {
+ FieldType type = _tablet->get_field_type_by_index(key.field_count() - 1);
+ if (key.field_count() > _tablet->num_short_key_fields() || OLAP_FIELD_TYPE_VARCHAR == type) {
res = _find_position_by_full_key(key, find_last_key, &position);
} else {
res = _find_position_by_short_key(key, find_last_key, &position);
@@ -455,24 +455,24 @@ void ColumnData::set_read_params(
}
}
- for (uint32_t i = 0; i < _table->tablet_schema().size(); i++) {
+ for (uint32_t i = 0; i < _tablet->tablet_schema().size(); i++) {
if (i < max_key_column_count || column_set.find(i) != column_set.end()) {
_seek_columns.push_back(i);
}
}
- auto res = _cursor.init(_table->tablet_schema());
+ auto res = _cursor.init(_tablet->tablet_schema());
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init row_cursor");
}
_read_vector_batch.reset(new VectorizedRowBatch(
- _table->tablet_schema(), _return_columns, _num_rows_per_block));
+ _tablet->tablet_schema(), _return_columns, _num_rows_per_block));
_seek_vector_batch.reset(new VectorizedRowBatch(
- _table->tablet_schema(), _seek_columns, _num_rows_per_block));
+ _tablet->tablet_schema(), _seek_columns, _num_rows_per_block));
- _read_block.reset(new RowBlock(_table->tablet_schema()));
+ _read_block.reset(new RowBlock(_tablet->tablet_schema()));
RowBlockInfo block_info;
block_info.row_num = _num_rows_per_block;
block_info.null_supported = true;
@@ -554,7 +554,7 @@ bool ColumnData::delta_pruning_filter() {
int ColumnData::delete_pruning_filter() {
if (empty() || zero_num_rows()) {
- // should return DEL_NOT_SATISFIED, because that when creating rollup table,
+ // should return DEL_NOT_SATISFIED, because that when creating rollup tablet,
// the delete version file should preserved for filter data.
return DEL_NOT_SATISFIED;
}
@@ -610,21 +610,21 @@ uint64_t ColumnData::get_filted_rows() {
OLAPStatus ColumnData::_schema_change_init() {
_is_using_cache = false;
- for (int i = 0; i < _table->tablet_schema().size(); ++i) {
+ for (int i = 0; i < _tablet->tablet_schema().size(); ++i) {
_return_columns.push_back(i);
_seek_columns.push_back(i);
}
- auto res = _cursor.init(_table->tablet_schema());
+ auto res = _cursor.init(_tablet->tablet_schema());
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init row_cursor");
return res;
}
_read_vector_batch.reset(new VectorizedRowBatch(
- _table->tablet_schema(), _return_columns, _num_rows_per_block));
+ _tablet->tablet_schema(), _return_columns, _num_rows_per_block));
- _read_block.reset(new RowBlock(_table->tablet_schema()));
+ _read_block.reset(new RowBlock(_tablet->tablet_schema()));
RowBlockInfo block_info;
block_info.row_num = _num_rows_per_block;
diff --git a/be/src/olap/column_data.h b/be/src/olap/column_data.h
index 78220bf0..d792171f 100644
--- a/be/src/olap/column_data.h
+++ b/be/src/olap/column_data.h
@@ -33,7 +33,7 @@
namespace doris {
-class OLAPTable;
+class Tablet;
class SegmentReader;
@@ -171,7 +171,7 @@ class ColumnData {
OlapReaderStatistics _owned_stats;
OlapReaderStatistics* _stats = &_owned_stats;
- OLAPTable* _table;
+ Tablet* _tablet;
// whether in normal read, use return columns to load block
bool _is_normal_read = false;
bool _end_key_is_set = false;
diff --git a/be/src/olap/cumulative_compaction.cpp b/be/src/olap/cumulative_compaction.cpp
index f2a57075..b8c69e28 100755
--- a/be/src/olap/cumulative_compaction.cpp
+++ b/be/src/olap/cumulative_compaction.cpp
@@ -32,37 +32,37 @@ using std::vector;
namespace doris {
-OLAPStatus CumulativeCompaction::init(TabletSharedPtr table) {
- LOG(INFO) << "init cumulative compaction handler. [table=" << table->full_name() << "]";
+OLAPStatus CumulativeCompaction::init(TabletSharedPtr tablet) {
+ LOG(INFO) << "init cumulative compaction handler. [tablet=" << tablet->full_name() << "]";
if (_is_init) {
- OLAP_LOG_WARNING("cumulative handler has been inited.[table=%s]",
- table->full_name().c_str());
+ OLAP_LOG_WARNING("cumulative handler has been inited.[tablet=%s]",
+ tablet->full_name().c_str());
return OLAP_ERR_CUMULATIVE_REPEAT_INIT;
}
- if (!table->is_loaded()) {
+ if (!tablet->is_loaded()) {
return OLAP_ERR_CUMULATIVE_INVALID_PARAMETERS;
}
- _table = table;
+ _tablet = tablet;
_max_delta_file_size = config::cumulative_compaction_budgeted_bytes;
- if (!_table->try_cumulative_lock()) {
- OLAP_LOG_WARNING("another cumulative is running. [table=%s]",
- _table->full_name().c_str());
+ if (!_tablet->try_cumulative_lock()) {
+ OLAP_LOG_WARNING("another cumulative is running. [tablet=%s]",
+ _tablet->full_name().c_str());
return OLAP_ERR_CE_TRY_CE_LOCK_ERROR;
}
_obtain_header_rdlock();
- _old_cumulative_layer_point = _table->cumulative_layer_point();
+ _old_cumulative_layer_point = _tablet->cumulative_layer_point();
_release_header_lock();
// 如果为-1,则该table之前没有设置过cumulative layer point
// 我们在这里设置一下
if (_old_cumulative_layer_point == -1) {
- LOG(INFO) << "tablet has an unreasonable cumulative layer point. [tablet='" << _table->full_name()
+ LOG(INFO) << "tablet has an unreasonable cumulative layer point. [tablet='" << _tablet->full_name()
<< "' cumulative_layer_point=" << _old_cumulative_layer_point << "]";
- _table->release_cumulative_lock();
+ _tablet->release_cumulative_lock();
return OLAP_ERR_CUMULATIVE_INVALID_PARAMETERS;
}
@@ -70,13 +70,13 @@ OLAPStatus CumulativeCompaction::init(TabletSharedPtr table) {
OLAPStatus res = _calculate_need_merged_versions();
_release_header_lock();
if (res != OLAP_SUCCESS) {
- _table->release_cumulative_lock();
+ _tablet->release_cumulative_lock();
LOG(INFO) << "no suitable delta versions. don't do cumulative compaction now.";
return res;
}
if (!_validate_need_merged_versions()) {
- _table->release_cumulative_lock();
+ _tablet->release_cumulative_lock();
LOG(FATAL) << "error! invalid need merged versions.";
return OLAP_ERR_CUMULATIVE_INVALID_NEED_MERGED_VERSIONS;
}
@@ -90,36 +90,36 @@ OLAPStatus CumulativeCompaction::init(TabletSharedPtr table) {
OLAPStatus CumulativeCompaction::run() {
if (!_is_init) {
- _table->release_cumulative_lock();
+ _tablet->release_cumulative_lock();
OLAP_LOG_WARNING("cumulative handler is not inited.");
return OLAP_ERR_NOT_INITED;
}
// 0. 准备工作
- LOG(INFO) << "start cumulative compaction. tablet=" << _table->full_name()
+ LOG(INFO) << "start cumulative compaction. tablet=" << _tablet->full_name()
<< ", cumulative_version=" << _cumulative_version.first << "-"
<< _cumulative_version.second;
OlapStopWatch watch;
// 1. 计算新的cumulative文件的version hash
OLAPStatus res = OLAP_SUCCESS;
- res = _table->compute_all_versions_hash(_need_merged_versions, &_cumulative_version_hash);
+ res = _tablet->compute_all_versions_hash(_need_merged_versions, &_cumulative_version_hash);
if (res != OLAP_SUCCESS) {
- _table->release_cumulative_lock();
+ _tablet->release_cumulative_lock();
OLAP_LOG_WARNING("failed to computer cumulative version hash. "
- "[table=%s; cumulative_version=%d-%d]",
- _table->full_name().c_str(),
+ "[tablet=%s; cumulative_version=%d-%d]",
+ _tablet->full_name().c_str(),
_cumulative_version.first,
_cumulative_version.second);
return res;
}
// 2. 获取待合并的delta文件对应的data文件
- _table->acquire_data_sources_by_versions(_need_merged_versions, &_data_source);
+ _tablet->acquire_data_sources_by_versions(_need_merged_versions, &_data_source);
if (_data_source.size() == 0) {
- _table->release_cumulative_lock();
- OLAP_LOG_WARNING("failed to acquire data source. [table=%s]",
- _table->full_name().c_str());
+ _tablet->release_cumulative_lock();
+ OLAP_LOG_WARNING("failed to acquire data source. [tablet=%s]",
+ _tablet->full_name().c_str());
return OLAP_ERR_CUMULATIVE_FAILED_ACQUIRE_DATA_SOURCE;
}
@@ -134,14 +134,14 @@ OLAPStatus CumulativeCompaction::run() {
do {
// 3. 生成新cumulative文件对应的olap index
- _new_segment_group = new (nothrow) SegmentGroup(_table.get(),
+ _new_segment_group = new (nothrow) SegmentGroup(_tablet.get(),
_cumulative_version,
_cumulative_version_hash,
false, 0, 0);
if (_new_segment_group == NULL) {
OLAP_LOG_WARNING("failed to malloc new cumulative olap index. "
- "[table=%s; cumulative_version=%d-%d]",
- _table->full_name().c_str(),
+ "[tablet=%s; cumulative_version=%d-%d]",
+ _tablet->full_name().c_str(),
_cumulative_version.first,
_cumulative_version.second);
break;
@@ -151,8 +151,8 @@ OLAPStatus CumulativeCompaction::run() {
res = _do_cumulative_compaction();
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("failed to do cumulative compaction. "
- "[table=%s; cumulative_version=%d-%d]",
- _table->full_name().c_str(),
+ "[tablet=%s; cumulative_version=%d-%d]",
+ _tablet->full_name().c_str(),
_cumulative_version.first,
_cumulative_version.second);
break;
@@ -166,10 +166,10 @@ OLAPStatus CumulativeCompaction::run() {
}
if (_data_source.size() != 0) {
- _table->release_data_sources(&_data_source);
+ _tablet->release_data_sources(&_data_source);
}
- _table->release_cumulative_lock();
+ _tablet->release_cumulative_lock();
VLOG(10) << "elapsed time of doing cumulative compaction. "
<< "time=" << watch.get_elapse_time_us();
@@ -207,11 +207,11 @@ OLAPStatus CumulativeCompaction::_calculate_need_merged_versions() {
}
Version delta = delta_versions[index];
- size_t delta_size = _table->get_version_data_size(delta);
+ size_t delta_size = _tablet->get_version_data_size(delta);
// 如果遇到大的delta文件,或delete版本文件,则:
if (delta_size >= _max_delta_file_size
- || _table->is_delete_data_version(delta)
- || _table->is_load_delete_version(delta)) {
+ || _tablet->is_delete_data_version(delta)
+ || _tablet->is_load_delete_version(delta)) {
// 1) 如果need_merged_versions为空,表示这2类文件在区间的开头,直接跳过
if (need_merged_versions.empty()) {
continue;
@@ -235,7 +235,7 @@ OLAPStatus CumulativeCompaction::_calculate_need_merged_versions() {
if (need_merged_versions.size() == 1 || total_size == 0) {
// 如果区间末尾是较大的delta版, 则与它合并
if (index < delta_number
- && _table->get_version_data_size(delta_versions[index]) >=
+ && _tablet->get_version_data_size(delta_versions[index]) >=
_max_delta_file_size) {
need_merged_versions.push_back(delta_versions[index]);
++index;
@@ -277,8 +277,8 @@ OLAPStatus CumulativeCompaction::_calculate_need_merged_versions() {
// 如果不设置新的cumulative_layer_point, 则下次执行cumulative compaction时,扫描的文件和这次
// 扫描的文件相同,依然找不到可以合并的delta文件, 无法执行合并过程。
// 依此类推,就进入了死循环状态,永远不会进行cumulative compaction
- _table->set_cumulative_layer_point(delta_versions[index].first);
- _table->save_header();
+ _tablet->set_cumulative_layer_point(delta_versions[index].first);
+ _tablet->save_header();
return OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSIONS;
}
@@ -290,7 +290,7 @@ OLAPStatus CumulativeCompaction::_get_delta_versions(Versions* delta_versions) {
delta_versions->clear();
Versions all_versions;
- _table->list_versions(&all_versions);
+ _tablet->list_versions(&all_versions);
for (Versions::const_iterator version = all_versions.begin();
version != all_versions.end(); ++version) {
@@ -317,12 +317,12 @@ OLAPStatus CumulativeCompaction::_get_delta_versions(Versions* delta_versions) {
// can't do cumulative expansion if there has a hole
Versions versions_path;
- OLAPStatus select_status = _table->select_versions_to_span(
+ OLAPStatus select_status = _tablet->select_versions_to_span(
Version(delta_versions->front().first, delta_versions->back().second), &versions_path);
if (select_status != OLAP_SUCCESS) {
OLAP_LOG_WARNING("can't do cumulative expansion if fail to select shortest version path. "
- "[table=%s start=%d; end=%d]",
- _table->full_name().c_str(),
+ "[tablet=%s start=%d; end=%d]",
+ _tablet->full_name().c_str(),
delta_versions->front().first, delta_versions->back().second);
return select_status;
}
@@ -333,7 +333,7 @@ OLAPStatus CumulativeCompaction::_get_delta_versions(Versions* delta_versions) {
bool CumulativeCompaction::_find_previous_version(const Version current_version,
Version* previous_version) {
Versions all_versions;
- if (OLAP_SUCCESS != _table->select_versions_to_span(Version(0, current_version.second),
+ if (OLAP_SUCCESS != _tablet->select_versions_to_span(Version(0, current_version.second),
&all_versions)) {
OLAP_LOG_WARNING("fail to select shortest version path. [start=%d; end=%d]",
0, current_version.second);
@@ -349,12 +349,12 @@ bool CumulativeCompaction::_find_previous_version(const Version current_version,
}
if (version->second == current_version.first - 1) {
- if (_table->is_delete_data_version(*version)
- || _table->is_load_delete_version(*version)) {
+ if (_tablet->is_delete_data_version(*version)
+ || _tablet->is_load_delete_version(*version)) {
return false;
}
- size_t data_size = _table->get_version_data_size(*version);
+ size_t data_size = _tablet->get_version_data_size(*version);
if (data_size >= _max_delta_file_size) {
return false;
}
@@ -369,15 +369,15 @@ bool CumulativeCompaction::_find_previous_version(const Version current_version,
OLAPStatus CumulativeCompaction::_do_cumulative_compaction() {
OLAPStatus res = OLAP_SUCCESS;
- Merger merger(_table, _new_segment_group, READER_CUMULATIVE_COMPACTION);
+ Merger merger(_tablet, _new_segment_group, READER_CUMULATIVE_COMPACTION);
// 1. merge delta files into new cumulative file
uint64_t merged_rows = 0;
uint64_t filted_rows = 0;
res = merger.merge(_data_source, &merged_rows, &filted_rows);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to do cumulative merge. [table=%s; cumulative_version=%d-%d]",
- _table->full_name().c_str(),
+ OLAP_LOG_WARNING("failed to do cumulative merge. [tablet=%s; cumulative_version=%d-%d]",
+ _tablet->full_name().c_str(),
_cumulative_version.first,
_cumulative_version.second);
return res;
@@ -386,8 +386,8 @@ OLAPStatus CumulativeCompaction::_do_cumulative_compaction() {
// 2. load new cumulative file
res = _new_segment_group->load();
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to load cumulative index. [table=%s; cumulative_version=%d-%d]",
- _table->full_name().c_str(),
+ OLAP_LOG_WARNING("failed to load cumulative index. [tablet=%s; cumulative_version=%d-%d]",
+ _tablet->full_name().c_str(),
_cumulative_version.first,
_cumulative_version.second);
return res;
@@ -415,14 +415,14 @@ OLAPStatus CumulativeCompaction::_do_cumulative_compaction() {
<< ", new_index_rows=" << _new_segment_group->num_rows();
}
- // 3. add new cumulative file into table
+ // 3. add new cumulative file into tablet
vector<SegmentGroup*> unused_indices;
_obtain_header_wrlock();
res = _update_header(&unused_indices);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("failed to update header for new cumulative."
- "[table=%s; cumulative_version=%d-%d]",
- _table->full_name().c_str(),
+ "[tablet=%s; cumulative_version=%d-%d]",
+ _tablet->full_name().c_str(),
_cumulative_version.first,
_cumulative_version.second);
_release_header_lock();
@@ -433,27 +433,27 @@ OLAPStatus CumulativeCompaction::_do_cumulative_compaction() {
res = _validate_delete_file_action();
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "delete action of cumulative compaction has error. roll back."
- << "tablet=" << _table->full_name()
+ << "tablet=" << _tablet->full_name()
<< ", cumulative_version=" << _cumulative_version.first
<< "-" << _cumulative_version.second;
// if error happened, roll back
OLAPStatus ret = _roll_back(unused_indices);
if (ret != OLAP_SUCCESS) {
- LOG(FATAL) << "roll back failed. [table=" << _table->full_name() << "]";
+ LOG(FATAL) << "roll back failed. [tablet=" << _tablet->full_name() << "]";
}
_release_header_lock();
return res;
}
// 5. 如果合并成功,设置新的cumulative_layer_point
- _table->set_cumulative_layer_point(_new_cumulative_layer_point);
- _table->save_header();
+ _tablet->set_cumulative_layer_point(_new_cumulative_layer_point);
+ _tablet->save_header();
_release_header_lock();
// 6. delete delta files which have been merged into new cumulative file
_delete_unused_delta_files(&unused_indices);
- LOG(INFO) << "succeed to do cumulative compaction. tablet=" << _table->full_name()
+ LOG(INFO) << "succeed to do cumulative compaction. tablet=" << _tablet->full_name()
<< ", cumulative_version=" << _cumulative_version.first << "-"
<< _cumulative_version.second;
return res;
@@ -464,17 +464,17 @@ OLAPStatus CumulativeCompaction::_update_header(vector<SegmentGroup*>* unused_in
new_indices.push_back(_new_segment_group);
OLAPStatus res = OLAP_SUCCESS;
- res = _table->replace_data_sources(&_need_merged_versions, &new_indices, unused_indices);
+ res = _tablet->replace_data_sources(&_need_merged_versions, &new_indices, unused_indices);
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "failed to replace data sources. res=" << res
- << ", tablet=" << _table->full_name();
+ << ", tablet=" << _tablet->full_name();
return res;
}
- res = _table->save_header();
+ res = _tablet->save_header();
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "failed to save header. res=" << res
- << ", tablet=" << _table->full_name();
+ << ", tablet=" << _tablet->full_name();
return res;
}
@@ -514,14 +514,14 @@ OLAPStatus CumulativeCompaction::_validate_delete_file_action() {
// 1. acquire the new cumulative version to make sure that all is right after deleting files
Version test_version = Version(0, _cumulative_version.second);
vector<ColumnData*> test_sources;
- _table->acquire_data_sources(test_version, &test_sources);
+ _tablet->acquire_data_sources(test_version, &test_sources);
if (test_sources.size() == 0) {
OLAP_LOG_WARNING("acquire data source failed. [test_verison=%d-%d]",
test_version.first, test_version.second);
return OLAP_ERR_CUMULATIVE_ERROR_DELETE_ACTION;
}
- _table->release_data_sources(&test_sources);
+ _tablet->release_data_sources(&test_sources);
return OLAP_SUCCESS;
}
@@ -533,15 +533,15 @@ OLAPStatus CumulativeCompaction::_roll_back(const vector<SegmentGroup*>& old_ola
vector<SegmentGroup*> unused_indices;
OLAPStatus res = OLAP_SUCCESS;
- res = _table->replace_data_sources(&need_remove_version, &old_olap_indices, &unused_indices);
+ res = _tablet->replace_data_sources(&need_remove_version, &old_olap_indices, &unused_indices);
if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "failed to replace data sources. [table=" << _table->full_name() << "]";
+ LOG(FATAL) << "failed to replace data sources. [tablet=" << _tablet->full_name() << "]";
return res;
}
- res = _table->save_header();
+ res = _tablet->save_header();
if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "failed to save header. [table=" << _table->full_name() << "]";
+ LOG(FATAL) << "failed to save header. [tablet=" << _tablet->full_name() << "]";
return res;
}
diff --git a/be/src/olap/cumulative_compaction.h b/be/src/olap/cumulative_compaction.h
index 47394dc4..48dfc9d3 100755
--- a/be/src/olap/cumulative_compaction.h
+++ b/be/src/olap/cumulative_compaction.h
@@ -26,7 +26,7 @@
#include "olap/merger.h"
#include "olap/column_data.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
namespace doris {
@@ -49,12 +49,12 @@ class CumulativeCompaction {
// - 计算可合并的delta文件
//
// 输入参数:
- // - table 待执行cumulative compaction的olap table
+ // - tablet 待执行cumulative compaction的tablet
//
// 返回值:
// - 如果触发cumulative compaction,返回OLAP_SUCCESS
// - 否则,返回对应错误码
- OLAPStatus init(TabletSharedPtr table);
+ OLAPStatus init(TabletSharedPtr tablet);
// 执行cumulative compaction
//
@@ -102,7 +102,7 @@ class CumulativeCompaction {
// - 如果不成功,返回相应错误码
OLAPStatus _do_cumulative_compaction();
- // 将合并得到的新cumulative文件载入table
+ // 将合并得到的新cumulative文件载入tablet
//
// 输出参数:
// - unused_indices: 返回不再使用的delta文件对应的olap index
@@ -136,18 +136,18 @@ class CumulativeCompaction {
OLAPStatus _roll_back(const std::vector<SegmentGroup*>& old_olap_indices);
void _obtain_header_rdlock() {
- _table->obtain_header_rdlock();
+ _tablet->obtain_header_rdlock();
_header_locked = true;
}
void _obtain_header_wrlock() {
- _table->obtain_header_wrlock();
+ _tablet->obtain_header_wrlock();
_header_locked = true;
}
void _release_header_lock() {
if (_header_locked) {
- _table->release_header_lock();
+ _tablet->release_header_lock();
_header_locked = false;
}
}
@@ -163,8 +163,8 @@ class CumulativeCompaction {
// 一个cumulative文件大小的最大值
// 当delta文件的大小超过该值时,我们认为该delta文件是cumulative文件
size_t _max_delta_file_size;
- // 待执行cumulative compaction的olap table
- TabletSharedPtr _table;
+ // 待执行cumulative compaction的tablet
+ TabletSharedPtr _tablet;
// 新cumulative文件的版本
Version _cumulative_version;
// 新cumulative文件的version hash
diff --git a/be/src/olap/data_writer.cpp b/be/src/olap/data_writer.cpp
index 35fecd9f..53694f92 100644
--- a/be/src/olap/data_writer.cpp
+++ b/be/src/olap/data_writer.cpp
@@ -26,24 +26,24 @@
namespace doris {
-ColumnDataWriter* ColumnDataWriter::create(TabletSharedPtr table, SegmentGroup* segment_group, bool is_push_write) {
+ColumnDataWriter* ColumnDataWriter::create(TabletSharedPtr tablet, SegmentGroup* segment_group, bool is_push_write) {
ColumnDataWriter* writer = NULL;
- switch (table->data_file_type()) {
+ switch (tablet->data_file_type()) {
case COLUMN_ORIENTED_FILE:
- writer = new (std::nothrow) ColumnDataWriter(table, segment_group, is_push_write);
+ writer = new (std::nothrow) ColumnDataWriter(tablet, segment_group, is_push_write);
break;
default:
- LOG(WARNING) << "unknown data file type. type=" << DataFileType_Name(table->data_file_type());
+ LOG(WARNING) << "unknown data file type. type=" << DataFileType_Name(tablet->data_file_type());
break;
}
return writer;
}
-ColumnDataWriter::ColumnDataWriter(TabletSharedPtr table, SegmentGroup* segment_group, bool is_push_write)
+ColumnDataWriter::ColumnDataWriter(TabletSharedPtr tablet, SegmentGroup* segment_group, bool is_push_write)
: _is_push_write(is_push_write),
- _table(table),
- _column_statistics(_table->num_key_fields(),
+ _tablet(tablet),
+ _column_statistics(_tablet->num_key_fields(),
std::pair<WrapperField*, WrapperField*>(NULL, NULL)),
_row_index(0),
_segment_group(segment_group),
@@ -72,36 +72,36 @@ OLAPStatus ColumnDataWriter::init() {
OLAPStatus res = OLAP_SUCCESS;
for (size_t i = 0; i < _column_statistics.size(); ++i) {
- _column_statistics[i].first = WrapperField::create(_table->tablet_schema()[i]);
+ _column_statistics[i].first = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(_column_statistics[i].first != nullptr) << "fail to create column statistics field.";
_column_statistics[i].first->set_to_max();
- _column_statistics[i].second = WrapperField::create(_table->tablet_schema()[i]);
+ _column_statistics[i].second = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(_column_statistics[i].second != nullptr) << "fail to create column statistics field.";
_column_statistics[i].second->set_null();
_column_statistics[i].second->set_to_min();
}
- double size = static_cast<double>(_table->segment_size());
+ double size = static_cast<double>(_tablet->segment_size());
size *= OLAP_COLUMN_FILE_SEGMENT_SIZE_SCALE;
_max_segment_size = static_cast<uint32_t>(lround(size));
- _row_block = new(std::nothrow) RowBlock(_table->tablet_schema());
+ _row_block = new(std::nothrow) RowBlock(_tablet->tablet_schema());
if (NULL == _row_block) {
- LOG(WARNING) << "fail to new RowBlock. [table='" << _table->full_name() << "']";
+ LOG(WARNING) << "fail to new RowBlock. [tablet='" << _tablet->full_name() << "']";
return OLAP_ERR_MALLOC_ERROR;
}
- res = _cursor.init(_table->tablet_schema());
+ res = _cursor.init(_tablet->tablet_schema());
if (OLAP_SUCCESS != res) {
OLAP_LOG_WARNING("fail to initiate row cursor. [res=%d]", res);
return res;
}
- VLOG(3) << "init ColumnData writer. [table='" << _table->full_name()
- << "' block_row_size=" << _table->num_rows_per_row_block() << "]";
- RowBlockInfo block_info(0U, _table->num_rows_per_row_block(), 0);
+ VLOG(3) << "init ColumnData writer. [tablet='" << _tablet->full_name()
+ << "' block_row_size=" << _tablet->num_rows_per_row_block() << "]";
+ RowBlockInfo block_info(0U, _tablet->num_rows_per_row_block(), 0);
block_info.data_file_type = DataFileType::COLUMN_ORIENTED_FILE;
block_info.null_supported = true;
@@ -131,7 +131,7 @@ OLAPStatus ColumnDataWriter::_init_segment() {
}
OLAPStatus ColumnDataWriter::attached_by(RowCursor* row_cursor) {
- if (_row_index >= _table->num_rows_per_row_block()) {
+ if (_row_index >= _tablet->num_rows_per_row_block()) {
if (OLAP_SUCCESS != _flush_row_block(false)) {
OLAP_LOG_WARNING("failed to flush data while attaching row cursor.");
return OLAP_ERR_OTHER_ERROR;
@@ -143,7 +143,7 @@ OLAPStatus ColumnDataWriter::attached_by(RowCursor* row_cursor) {
}
OLAPStatus ColumnDataWriter::write(const char* row) {
- if (_row_index >= _table->num_rows_per_row_block()) {
+ if (_row_index >= _tablet->num_rows_per_row_block()) {
if (OLAP_SUCCESS != _flush_row_block(false)) {
OLAP_LOG_WARNING("failed to flush data while attaching row cursor.");
return OLAP_ERR_OTHER_ERROR;
@@ -156,7 +156,7 @@ OLAPStatus ColumnDataWriter::write(const char* row) {
void ColumnDataWriter::next(const RowCursor& row_cursor) {
- for (size_t i = 0; i < _table->num_key_fields(); ++i) {
+ for (size_t i = 0; i < _tablet->num_key_fields(); ++i) {
char* right = row_cursor.get_field_by_index(i)->get_field_ptr(row_cursor.get_buf());
if (_column_statistics[i].first->cmp(right) > 0) {
_column_statistics[i].first->copy(right);
@@ -171,7 +171,7 @@ void ColumnDataWriter::next(const RowCursor& row_cursor) {
}
void ColumnDataWriter::next(const char* row, const Schema* schema) {
- for (size_t i = 0; i < _table->num_key_fields(); ++i) {
+ for (size_t i = 0; i < _tablet->num_key_fields(); ++i) {
char* right = const_cast<char*>(row + schema->get_col_offset(i));
if (_column_statistics[i].first->cmp(right) > 0) {
_column_statistics[i].first->copy(right);
@@ -257,7 +257,7 @@ OLAPStatus ColumnDataWriter::_add_segment() {
}
file_name = _segment_group->construct_data_file_path(_segment_group->segment_group_id(), _segment);
- _segment_writer = new(std::nothrow) SegmentWriter(file_name, _table,
+ _segment_writer = new(std::nothrow) SegmentWriter(file_name, _tablet,
OLAP_DEFAULT_COLUMN_STREAM_BUFFER_SIZE);
if (NULL == _segment_writer) {
diff --git a/be/src/olap/data_writer.h b/be/src/olap/data_writer.h
index 1f4356f1..bc5132cd 100644
--- a/be/src/olap/data_writer.h
+++ b/be/src/olap/data_writer.h
@@ -18,7 +18,7 @@
#ifndef DORIS_BE_SRC_OLAP_COLUMN_FILE_DATA_WRITER_H
#define DORIS_BE_SRC_OLAP_COLUMN_FILE_DATA_WRITER_H
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_block.h"
#include "olap/schema.h"
#include "olap/wrapper_field.h"
@@ -31,8 +31,8 @@ class ColumnDataWriter {
public:
// Factory function
// 调用者获得新建的对象, 并负责delete释放
- static ColumnDataWriter* create(TabletSharedPtr table, SegmentGroup* segment_group, bool is_push_write);
- ColumnDataWriter(TabletSharedPtr table, SegmentGroup* segment_group, bool is_push_write);
+ static ColumnDataWriter* create(TabletSharedPtr tablet, SegmentGroup* segment_group, bool is_push_write);
+ ColumnDataWriter(TabletSharedPtr tablet, SegmentGroup* segment_group, bool is_push_write);
~ColumnDataWriter();
OLAPStatus init();
OLAPStatus attached_by(RowCursor* row_cursor);
@@ -50,7 +50,7 @@ class ColumnDataWriter {
OLAPStatus _init_segment();
bool _is_push_write;
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
// first is min, second is max
std::vector<std::pair<WrapperField*, WrapperField*>> _column_statistics;
uint32_t _row_index;
diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp
index 5aee5ffd..8ba3de79 100644
--- a/be/src/olap/delete_handler.cpp
+++ b/be/src/olap/delete_handler.cpp
@@ -50,10 +50,10 @@ namespace doris {
// 1. 删除条件的版本要不是当前最大的delta版本号,要不是最大的delta版本号加1
// 2. 删除条件中指定的列在table中存在,必须是key列,且不能是double,float类型
OLAPStatus DeleteConditionHandler::store_cond(
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
const int32_t version,
const vector<TCondition>& conditions) {
- if (conditions.size() == 0 || _check_version_valid(table, version) != OLAP_SUCCESS) {
+ if (conditions.size() == 0 || _check_version_valid(tablet, version) != OLAP_SUCCESS) {
OLAP_LOG_WARNING("invalid parameters for store_cond. "
"[version=%d condition_size=%u]",
version, conditions.size());
@@ -62,21 +62,21 @@ OLAPStatus DeleteConditionHandler::store_cond(
// 检查删除条件是否符合要求
for (const TCondition& condition : conditions) {
- if (check_condition_valid(table, condition) != OLAP_SUCCESS) {
+ if (check_condition_valid(tablet, condition) != OLAP_SUCCESS) {
OLAP_LOG_WARNING("invalid condition. [%s]",
ThriftDebugString(condition).c_str());
return OLAP_ERR_DELETE_INVALID_CONDITION;
}
}
- int cond_index = _check_whether_condition_exist(table, version);
+ int cond_index = _check_whether_condition_exist(tablet, version);
DeleteConditionMessage* del_cond = NULL;
if (cond_index == -1) { // 删除条件不存在
- del_cond = table->add_delete_data_conditions();
+ del_cond = tablet->add_delete_data_conditions();
del_cond->set_version(version);
} else { // 删除条件已经存在
- del_cond = table->mutable_delete_data_conditions(cond_index);
+ del_cond = tablet->mutable_delete_data_conditions(cond_index);
del_cond->clear_sub_conditions();
}
@@ -109,7 +109,7 @@ string DeleteConditionHandler::construct_sub_conditions(const TCondition& condit
// 删除指定版本号的删除条件;需要注意的是,如果table上没有任何删除条件,或者
// 指定版本号的删除条件不存在,也会返回OLAP_SUCCESS。
-OLAPStatus DeleteConditionHandler::delete_cond(TabletSharedPtr table,
+OLAPStatus DeleteConditionHandler::delete_cond(TabletSharedPtr tablet,
const int32_t version,
bool delete_smaller_version_conditions) {
if (version < 0) {
@@ -117,7 +117,7 @@ OLAPStatus DeleteConditionHandler::delete_cond(TabletSharedPtr table,
return OLAP_ERR_DELETE_INVALID_PARAMETERS;
}
- del_cond_array* delete_conditions = table->mutable_delete_data_conditions();
+ del_cond_array* delete_conditions = tablet->mutable_delete_data_conditions();
if (delete_conditions->size() == 0) {
return OLAP_SUCCESS;
@@ -157,10 +157,10 @@ OLAPStatus DeleteConditionHandler::delete_cond(TabletSharedPtr table,
return OLAP_SUCCESS;
}
-OLAPStatus DeleteConditionHandler::log_conds(TabletSharedPtr table) {
- LOG(INFO) << "display all delete condition. tablet=" << table->full_name();
- table->obtain_header_rdlock();
- const del_cond_array& delete_conditions = table->delete_data_conditions();
+OLAPStatus DeleteConditionHandler::log_conds(TabletSharedPtr tablet) {
+ LOG(INFO) << "display all delete condition. tablet=" << tablet->full_name();
+ tablet->obtain_header_rdlock();
+ const del_cond_array& delete_conditions = tablet->delete_data_conditions();
for (int index = 0; index != delete_conditions.size(); ++index) {
DeleteConditionMessage temp = delete_conditions.Get(index);
@@ -176,15 +176,15 @@ OLAPStatus DeleteConditionHandler::log_conds(TabletSharedPtr table) {
<< ", condition=" << del_cond_str;
}
- table->release_header_lock();
+ tablet->release_header_lock();
return OLAP_SUCCESS;
}
OLAPStatus DeleteConditionHandler::check_condition_valid(
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
const TCondition& cond) {
// 检查指定列名的列是否存在
- int field_index = table->get_field_index(cond.column_name);
+ int field_index = tablet->get_field_index(cond.column_name);
if (field_index < 0) {
OLAP_LOG_WARNING("field is not existent. [field_index=%d]", field_index);
@@ -192,7 +192,7 @@ OLAPStatus DeleteConditionHandler::check_condition_valid(
}
// 检查指定的列是不是key,是不是float或doulbe类型
- FieldInfo field_info = table->tablet_schema()[field_index];
+ FieldInfo field_info = tablet->tablet_schema()[field_index];
if (!field_info.is_key
|| field_info.type == OLAP_FIELD_TYPE_DOUBLE
@@ -257,11 +257,11 @@ OLAPStatus DeleteConditionHandler::check_condition_valid(
}
}
-OLAPStatus DeleteConditionHandler::_check_version_valid(TabletSharedPtr table,
+OLAPStatus DeleteConditionHandler::_check_version_valid(TabletSharedPtr tablet,
const int32_t filter_version) {
// 找到当前最大的delta文件版本号
vector<Version> all_file_versions;
- table->list_versions(&all_file_versions);
+ tablet->list_versions(&all_file_versions);
int max_delta_version = -1;
vector<Version>::const_iterator version_iter = all_file_versions.begin();
@@ -280,8 +280,8 @@ OLAPStatus DeleteConditionHandler::_check_version_valid(TabletSharedPtr table,
}
}
-int DeleteConditionHandler::_check_whether_condition_exist(TabletSharedPtr table, int cond_version) {
- const del_cond_array& delete_conditions = table->delete_data_conditions();
+int DeleteConditionHandler::_check_whether_condition_exist(TabletSharedPtr tablet, int cond_version) {
+ const del_cond_array& delete_conditions = tablet->delete_data_conditions();
if (delete_conditions.size() == 0) {
return -1;
@@ -334,15 +334,15 @@ bool DeleteHandler::_parse_condition(const std::string& condition_str, TConditio
return true;
}
-OLAPStatus DeleteHandler::init(TabletSharedPtr olap_table, int32_t version) {
+OLAPStatus DeleteHandler::init(TabletSharedPtr tablet, int32_t version) {
if (_is_inited) {
OLAP_LOG_WARNING("reintialize delete handler.");
return OLAP_ERR_INIT_FAILED;
}
- if (!olap_table) {
- OLAP_LOG_WARNING("invalid parameters: invalid olap table.");
+ if (!tablet) {
+ OLAP_LOG_WARNING("invalid parameters: invalid tablet.");
return OLAP_ERR_DELETE_INVALID_PARAMETERS;
}
@@ -351,7 +351,7 @@ OLAPStatus DeleteHandler::init(TabletSharedPtr olap_table, int32_t version) {
return OLAP_ERR_DELETE_INVALID_PARAMETERS;
}
- const del_cond_array& delete_conditions = olap_table->delete_data_conditions();
+ const del_cond_array& delete_conditions = tablet->delete_data_conditions();
del_cond_array::const_iterator it = delete_conditions.begin();
for (; it != delete_conditions.end(); ++it) {
@@ -370,7 +370,7 @@ OLAPStatus DeleteHandler::init(TabletSharedPtr olap_table, int32_t version) {
return OLAP_ERR_MALLOC_ERROR;
}
- temp.del_cond->set_table(olap_table);
+ temp.del_cond->set_tablet(tablet);
for (int i = 0; i != it->sub_conditions_size(); ++i) {
TCondition condition;
diff --git a/be/src/olap/delete_handler.h b/be/src/olap/delete_handler.h
index 7b69939e..faf708f8 100644
--- a/be/src/olap/delete_handler.h
+++ b/be/src/olap/delete_handler.h
@@ -26,7 +26,7 @@
#include "olap/field.h"
#include "olap/olap_cond.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_cursor.h"
namespace doris {
@@ -35,16 +35,16 @@ namespace doris {
// * 存储删除条件:
// OLAPStatus res;
// DeleteConditionHandler cond_handler;
-// res = cond_handler.store_cond(olap_table, condition_version, delete_condition);
+// res = cond_handler.store_cond(tablet, condition_version, delete_condition);
// * 移除删除条件
-// res = cond_handler.delete_cond(olap_table, condition_version, true);
+// res = cond_handler.delete_cond(tablet, condition_version, true);
// 或者
-// res = cond_handler.delete_cond(olap_table, condition_version, false);
+// res = cond_handler.delete_cond(tablet, condition_version, false);
// * 将一个table上现存有的所有删除条件打印到log中
-// res = cond_handler.log_conds(olap_table);
+// res = cond_handler.log_conds(tablet);
// 注:
// * 在调用这个类存储和移除删除条件时,需要先对Header文件加写锁;
-// 并在调用完成之后调用olap_table->save_header(),然后再释放Header文件的锁
+// 并在调用完成之后调用tablet->save_header(),然后再释放Header文件的锁
// * 在调用log_conds()的时候,只需要加读锁
class DeleteConditionHandler {
public:
@@ -55,7 +55,7 @@ class DeleteConditionHandler {
// 检查cond表示的删除条件是否符合要求;
// 如果不符合要求,返回OLAP_ERR_DELETE_INVALID_CONDITION;符合要求返回OLAP_SUCCESS
- OLAPStatus check_condition_valid(TabletSharedPtr table, const TCondition& cond);
+ OLAPStatus check_condition_valid(TabletSharedPtr tablet, const TCondition& cond);
// 存储指定版本号的删除条件到Header文件中。因此,调用之前需要对Header文件加写锁
//
@@ -68,7 +68,7 @@ class DeleteConditionHandler {
// * OLAP_ERR_DELETE_INVALID_PARAMETERS:函数参数不符合要求
// * OLAP_ERR_DELETE_INVALID_CONDITION:del_condition不符合要求
OLAPStatus store_cond(
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
const int32_t version,
const std::vector<TCondition>& conditions);
@@ -90,20 +90,20 @@ class DeleteConditionHandler {
// * 这个表没有指定版本号的删除条件
// * OLAP_ERR_DELETE_INVALID_PARAMETERS:函数参数不符合要求
OLAPStatus delete_cond(
- TabletSharedPtr table, const int32_t version, bool delete_smaller_version_conditions);
+ TabletSharedPtr tablet, const int32_t version, bool delete_smaller_version_conditions);
// 将一个olap engine的表上存有的所有删除条件打印到log中。调用前只需要给Header文件加读锁
//
// 输入参数:
- // table: 要打印删除条件的olap engine表
+ // tablet: 要打印删除条件的olap engine表
// 返回值:
// OLAP_SUCCESS:调用成功
- OLAPStatus log_conds(TabletSharedPtr table);
+ OLAPStatus log_conds(TabletSharedPtr tablet);
private:
// 检查指定的删除条件版本是否符合要求;
// 如果不符合要求,返回OLAP_ERR_DELETE_INVALID_VERSION;符合要求返回OLAP_SUCCESS
- OLAPStatus _check_version_valid(TabletSharedPtr table, const int32_t filter_version);
+ OLAPStatus _check_version_valid(TabletSharedPtr tablet, const int32_t filter_version);
// 检查指定版本的删除条件是否已经存在。如果存在,返回指定版本删除条件的数组下标;不存在返回-1
int _check_whether_condition_exist(TabletSharedPtr, int cond_version);
@@ -122,7 +122,7 @@ struct DeleteConditions {
// 1. 使用一个版本号来初始化handler
// OLAPStatus res;
// DeleteHandler delete_handler;
-// res = delete_handler.init(olap_table, condition_version);
+// res = delete_handler.init(tablet, condition_version);
// 2. 使用这个handler来判定一条数据是否符合删除条件
// bool filter_data;
// filter_data = delete_handler.is_filter_data(data_version, row_cursor);
@@ -148,13 +148,13 @@ class DeleteHandler {
// 调用前需要先对Header文件加读锁
//
// 输入参数:
- // * olap_table: 删除条件和数据所在的table
+ // * tablet: 删除条件和数据所在的tablet
// * version: 要取出的删除条件版本号
// 返回值:
// * OLAP_SUCCESS: 调用成功
// * OLAP_ERR_DELETE_INVALID_PARAMETERS: 参数不符合要求
// * OLAP_ERR_MALLOC_ERROR: 在填充_del_conds时,分配内存失败
- OLAPStatus init(TabletSharedPtr olap_table, int32_t version);
+ OLAPStatus init(TabletSharedPtr tablet, int32_t version);
// 判定一条数据是否符合删除条件
//
diff --git a/be/src/olap/delta_writer.cpp b/be/src/olap/delta_writer.cpp
index 1c58dde2..be4513a4 100644
--- a/be/src/olap/delta_writer.cpp
+++ b/be/src/olap/delta_writer.cpp
@@ -28,8 +28,8 @@ OLAPStatus DeltaWriter::open(WriteRequest* req, DeltaWriter** writer) {
}
DeltaWriter::DeltaWriter(WriteRequest* req)
- : _req(*req), _table(nullptr),
- _cur_segment_group(nullptr), _new_table(nullptr),
+ : _req(*req), _tablet(nullptr),
+ _cur_segment_group(nullptr), _new_tablet(nullptr),
_writer(nullptr), _mem_table(nullptr),
_schema(nullptr), _field_infos(nullptr),
_segment_group_id(-1), _delta_written_success(false) {}
@@ -50,9 +50,9 @@ void DeltaWriter::_garbage_collection() {
segment_group->release();
OLAPEngine::get_instance()->add_unused_index(segment_group);
}
- if (_new_table != nullptr) {
+ if (_new_tablet != nullptr) {
OLAPEngine::get_instance()->delete_transaction(_req.partition_id, _req.transaction_id,
- _new_table->tablet_id(), _new_table->schema_hash());
+ _new_tablet->tablet_id(), _new_tablet->schema_hash());
for (SegmentGroup* segment_group : _new_segment_group_vec) {
segment_group->release();
OLAPEngine::get_instance()->add_unused_index(segment_group);
@@ -61,34 +61,34 @@ void DeltaWriter::_garbage_collection() {
}
OLAPStatus DeltaWriter::init() {
- _table = OLAPEngine::get_instance()->get_table(_req.tablet_id, _req.schema_hash);
- if (_table == nullptr) {
+ _tablet = OLAPEngine::get_instance()->get_tablet(_req.tablet_id, _req.schema_hash);
+ if (_tablet == nullptr) {
LOG(WARNING) << "tablet_id: " << _req.tablet_id << ", "
<< "schema_hash: " << _req.schema_hash << " not found";
return OLAP_ERR_TABLE_NOT_FOUND;
}
{
- MutexLock push_lock(_table->get_push_lock());
+ MutexLock push_lock(_tablet->get_push_lock());
RETURN_NOT_OK(OLAPEngine::get_instance()->add_transaction(
_req.partition_id, _req.transaction_id,
_req.tablet_id, _req.schema_hash, _req.load_id));
- //_segment_group_id = _table->current_pending_segment_group_id(_req.transaction_id);
+ //_segment_group_id = _tablet->current_pending_segment_group_id(_req.transaction_id);
if (_req.need_gen_rollup) {
TTabletId new_tablet_id;
TSchemaHash new_schema_hash;
- _table->obtain_header_rdlock();
+ _tablet->obtain_header_rdlock();
bool is_schema_changing =
- _table->get_schema_change_request(&new_tablet_id, &new_schema_hash, nullptr, nullptr);
- _table->release_header_lock();
+ _tablet->get_schema_change_request(&new_tablet_id, &new_schema_hash, nullptr, nullptr);
+ _tablet->release_header_lock();
if (is_schema_changing) {
- LOG(INFO) << "load with schema change." << "old_tablet_id: " << _table->tablet_id() << ", "
- << "old_schema_hash: " << _table->schema_hash() << ", "
+ LOG(INFO) << "load with schema change." << "old_tablet_id: " << _tablet->tablet_id() << ", "
+ << "old_schema_hash: " << _tablet->schema_hash() << ", "
<< "new_tablet_id: " << new_tablet_id << ", "
<< "new_schema_hash: " << new_schema_hash << ", "
<< "transaction_id: " << _req.transaction_id;
- _new_table = OLAPEngine::get_instance()->get_table(new_tablet_id, new_schema_hash);
+ _new_tablet = OLAPEngine::get_instance()->get_tablet(new_tablet_id, new_schema_hash);
OLAPEngine::get_instance()->add_transaction(
_req.partition_id, _req.transaction_id,
new_tablet_id, new_schema_hash, _req.load_id);
@@ -96,14 +96,14 @@ OLAPStatus DeltaWriter::init() {
}
// create pending data dir
- std::string dir_path = _table->construct_pending_data_dir_path();
+ std::string dir_path = _tablet->construct_pending_data_dir_path();
if (!check_dir_existed(dir_path)) {
RETURN_NOT_OK(create_dirs(dir_path));
}
}
++_segment_group_id;
- _cur_segment_group = new SegmentGroup(_table.get(), false, _segment_group_id, 0, true,
+ _cur_segment_group = new SegmentGroup(_tablet.get(), false, _segment_group_id, 0, true,
_req.partition_id, _req.transaction_id);
DCHECK(_cur_segment_group != nullptr) << "failed to malloc SegmentGroup";
_cur_segment_group->acquire();
@@ -111,23 +111,23 @@ OLAPStatus DeltaWriter::init() {
_segment_group_vec.push_back(_cur_segment_group);
// New Writer to write data into SegmentGroup
- VLOG(3) << "init writer. table=" << _table->full_name() << ", "
- << "block_row_size=" << _table->num_rows_per_row_block();
- _writer = ColumnDataWriter::create(_table, _cur_segment_group, true);
+ VLOG(3) << "init writer. tablet=" << _tablet->full_name() << ", "
+ << "block_row_size=" << _tablet->num_rows_per_row_block();
+ _writer = ColumnDataWriter::create(_tablet, _cur_segment_group, true);
DCHECK(_writer != nullptr) << "memory error occur when creating writer";
const std::vector<SlotDescriptor*>& slots = _req.tuple_desc->slots();
- for (auto& field_info : _table->tablet_schema()) {
+ for (auto& field_info : _tablet->tablet_schema()) {
for (size_t i = 0; i < slots.size(); ++i) {
if (slots[i]->col_name() == field_info.name) {
_col_ids.push_back(i);
}
}
}
- _field_infos = &(_table->tablet_schema());
+ _field_infos = &(_tablet->tablet_schema());
_schema = new Schema(*_field_infos),
_mem_table = new MemTable(_schema, _field_infos, &_col_ids,
- _req.tuple_desc, _table->keys_type());
+ _req.tuple_desc, _tablet->keys_type());
_is_init = true;
return OLAP_SUCCESS;
}
@@ -145,7 +145,7 @@ OLAPStatus DeltaWriter::write(Tuple* tuple) {
RETURN_NOT_OK(_mem_table->flush(_writer));
++_segment_group_id;
- _cur_segment_group = new SegmentGroup(_table.get(), false, _segment_group_id, 0, true,
+ _cur_segment_group = new SegmentGroup(_tablet.get(), false, _segment_group_id, 0, true,
_req.partition_id, _req.transaction_id);
DCHECK(_cur_segment_group != nullptr) << "failed to malloc SegmentGroup";
_cur_segment_group->acquire();
@@ -153,12 +153,12 @@ OLAPStatus DeltaWriter::write(Tuple* tuple) {
_segment_group_vec.push_back(_cur_segment_group);
SAFE_DELETE(_writer);
- _writer = ColumnDataWriter::create(_table, _cur_segment_group, true);
+ _writer = ColumnDataWriter::create(_tablet, _cur_segment_group, true);
DCHECK(_writer != nullptr) << "memory error occur when creating writer";
SAFE_DELETE(_mem_table);
_mem_table = new MemTable(_schema, _field_infos, &_col_ids,
- _req.tuple_desc, _table->keys_type());
+ _req.tuple_desc, _tablet->keys_type());
}
return OLAP_SUCCESS;
}
@@ -174,45 +174,45 @@ OLAPStatus DeltaWriter::close(google::protobuf::RepeatedPtrField<PTabletInfo>* t
OLAPStatus res = OLAP_SUCCESS;
//add pending data to tablet
- RETURN_NOT_OK(_table->add_pending_version(_req.partition_id, _req.transaction_id, nullptr));
+ RETURN_NOT_OK(_tablet->add_pending_version(_req.partition_id, _req.transaction_id, nullptr));
for (SegmentGroup* segment_group : _segment_group_vec) {
- RETURN_NOT_OK(_table->add_pending_segment_group(segment_group));
+ RETURN_NOT_OK(_tablet->add_pending_segment_group(segment_group));
RETURN_NOT_OK(segment_group->load());
}
- if (_new_table != nullptr) {
+ if (_new_tablet != nullptr) {
LOG(INFO) << "convert version for schema change";
{
- MutexLock push_lock(_new_table->get_push_lock());
+ MutexLock push_lock(_new_tablet->get_push_lock());
// create pending data dir
- std::string dir_path = _new_table->construct_pending_data_dir_path();
+ std::string dir_path = _new_tablet->construct_pending_data_dir_path();
if (!check_dir_existed(dir_path)) {
RETURN_NOT_OK(create_dirs(dir_path));
}
}
SchemaChangeHandler schema_change;
res = schema_change.schema_version_convert(
- _table, _new_table, &_segment_group_vec, &_new_segment_group_vec);
+ _tablet, _new_tablet, &_segment_group_vec, &_new_segment_group_vec);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "failed to convert delta for new table in schema change."
- << "res: " << res << ", " << "new_table: " << _new_table->full_name();
+ LOG(WARNING) << "failed to convert delta for new tablet in schema change."
+ << "res: " << res << ", " << "new_tablet: " << _new_tablet->full_name();
return res;
}
- RETURN_NOT_OK(_new_table->add_pending_version(_req.partition_id, _req.transaction_id, nullptr));
+ RETURN_NOT_OK(_new_tablet->add_pending_version(_req.partition_id, _req.transaction_id, nullptr));
for (SegmentGroup* segment_group : _new_segment_group_vec) {
- RETURN_NOT_OK(_new_table->add_pending_segment_group(segment_group));
+ RETURN_NOT_OK(_new_tablet->add_pending_segment_group(segment_group));
RETURN_NOT_OK(segment_group->load());
}
}
#ifndef BE_TEST
PTabletInfo* tablet_info = tablet_vec->Add();
- tablet_info->set_tablet_id(_table->tablet_id());
- tablet_info->set_schema_hash(_table->schema_hash());
- if (_new_table != nullptr) {
+ tablet_info->set_tablet_id(_tablet->tablet_id());
+ tablet_info->set_schema_hash(_tablet->schema_hash());
+ if (_new_tablet != nullptr) {
tablet_info = tablet_vec->Add();
- tablet_info->set_tablet_id(_new_table->tablet_id());
- tablet_info->set_schema_hash(_new_table->schema_hash());
+ tablet_info->set_tablet_id(_new_tablet->tablet_id());
+ tablet_info->set_schema_hash(_new_tablet->schema_hash());
}
#endif
diff --git a/be/src/olap/delta_writer.h b/be/src/olap/delta_writer.h
index 539941ef..6f6baa3d 100644
--- a/be/src/olap/delta_writer.h
+++ b/be/src/olap/delta_writer.h
@@ -20,7 +20,7 @@
#include "olap/memtable.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/schema_change.h"
#include "olap/data_writer.h"
#include "runtime/descriptors.h"
@@ -65,11 +65,11 @@ class DeltaWriter {
bool _is_init = false;
WriteRequest _req;
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
SegmentGroup* _cur_segment_group;
std::vector<SegmentGroup*> _segment_group_vec;
std::vector<SegmentGroup*> _new_segment_group_vec;
- TabletSharedPtr _new_table;
+ TabletSharedPtr _new_tablet;
ColumnDataWriter* _writer;
MemTable* _mem_table;
Schema* _schema;
diff --git a/be/src/olap/lru_cache.cpp b/be/src/olap/lru_cache.cpp
index a74c4274..5d810e7f 100644
--- a/be/src/olap/lru_cache.cpp
+++ b/be/src/olap/lru_cache.cpp
@@ -224,7 +224,7 @@ void LRUCache::_lru_append(LRUHandle* list, LRUHandle* e) {
Cache::Handle* LRUCache::lookup(const CacheKey& key, uint32_t hash) {
MutexLock l(&_mutex);
++_lookup_count;
- LRUHandle* e = _table.lookup(key, hash);
+ LRUHandle* e = _tablet.lookup(key, hash);
if (e != NULL) {
++_hit_count;
@@ -260,13 +260,13 @@ Cache::Handle* LRUCache::insert(
e->in_cache = true;
_lru_append(&_in_use, e);
_usage += charge;
- _finish_erase(_table.insert(e));
+ _finish_erase(_tablet.insert(e));
} // else don't cache. (Tests use capacity_==0 to turn off caching.)
while (_usage > _capacity && _lru.next != &_lru) {
LRUHandle* old = _lru.next;
assert(old->refs == 1);
- bool erased = _finish_erase(_table.remove(old->key(), old->hash));
+ bool erased = _finish_erase(_tablet.remove(old->key(), old->hash));
if (!erased) { // to avoid unused variable when compiled NDEBUG
assert(erased);
}
@@ -276,7 +276,7 @@ Cache::Handle* LRUCache::insert(
}
// If e != NULL, finish removing *e from the cache; it has already been removed
-// from the hash table. Return whether e != NULL. Requires mutex_ held.
+// from the hash tablet. Return whether e != NULL. Requires mutex_ held.
bool LRUCache::_finish_erase(LRUHandle* e) {
if (e != NULL) {
assert(e->in_cache);
@@ -290,7 +290,7 @@ bool LRUCache::_finish_erase(LRUHandle* e) {
void LRUCache::erase(const CacheKey& key, uint32_t hash) {
MutexLock l(&_mutex);
- _finish_erase(_table.remove(key, hash));
+ _finish_erase(_tablet.remove(key, hash));
}
int LRUCache::prune() {
@@ -299,7 +299,7 @@ int LRUCache::prune() {
while (_lru.next != &_lru) {
LRUHandle* e = _lru.next;
assert(e->refs == 1);
- bool erased = _finish_erase(_table.remove(e->key(), e->hash));
+ bool erased = _finish_erase(_tablet.remove(e->key(), e->hash));
if (!erased) { // to avoid unused variable when compiled NDEBUG
assert(erased);
}
diff --git a/be/src/olap/lru_cache.h b/be/src/olap/lru_cache.h
index 42b24012..cc251ccf 100644
--- a/be/src/olap/lru_cache.h
+++ b/be/src/olap/lru_cache.h
@@ -247,9 +247,9 @@ namespace doris {
}
} LRUHandle;
- // We provide our own simple hash table since it removes a whole bunch
+ // We provide our own simple hash tablet since it removes a whole bunch
// of porting hacks and is also faster than some of the built-in hash
- // table implementations in some of the compiler/runtime combinations
+ // tablet implementations in some of the compiler/runtime combinations
// we have tested. E.g., readrandom speeds up by ~5% over the g++
// 4.4.3's builtin hashtable.
@@ -270,7 +270,7 @@ namespace doris {
LRUHandle* remove(const CacheKey& key, uint32_t hash);
private:
- // The table consists of an array of buckets where each bucket is
+ // The tablet consists of an array of buckets where each bucket is
// a linked list of cache entries that hash into the bucket.
uint32_t _length;
uint32_t _elems;
@@ -343,7 +343,7 @@ namespace doris {
// Entries are in use by clients, and have refs >= 2 and in_cache==true.
LRUHandle _in_use;
- HandleTable _table;
+ HandleTable _tablet;
uint64_t _lookup_count; // cache查找总次数
uint64_t _hit_count; // 命中cache的总次数
diff --git a/be/src/olap/merger.cpp b/be/src/olap/merger.cpp
index 3d218011..61e48bb1 100644
--- a/be/src/olap/merger.cpp
+++ b/be/src/olap/merger.cpp
@@ -23,7 +23,7 @@
#include "olap/column_data.h"
#include "olap/olap_define.h"
#include "olap/segment_group.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/reader.h"
#include "olap/row_cursor.h"
#include "olap/data_writer.h"
@@ -35,8 +35,8 @@ using std::vector;
namespace doris {
-Merger::Merger(TabletSharedPtr table, SegmentGroup* segment_group, ReaderType type) :
- _table(table),
+Merger::Merger(TabletSharedPtr tablet, SegmentGroup* segment_group, ReaderType type) :
+ _tablet(tablet),
_segment_group(segment_group),
_reader_type(type),
_row_count(0) {}
@@ -47,7 +47,7 @@ OLAPStatus Merger::merge(const vector<ColumnData*>& olap_data_arr,
// OLAPDatas.
Reader reader;
ReaderParams reader_params;
- reader_params.olap_table = _table;
+ reader_params.tablet = _tablet;
reader_params.reader_type = _reader_type;
reader_params.olap_data_arr = olap_data_arr;
@@ -56,13 +56,13 @@ OLAPStatus Merger::merge(const vector<ColumnData*>& olap_data_arr,
}
if (OLAP_SUCCESS != reader.init(reader_params)) {
- OLAP_LOG_WARNING("fail to initiate reader. [table='%s']",
- _table->full_name().c_str());
+ OLAP_LOG_WARNING("fail to initiate reader. [tablet='%s']",
+ _tablet->full_name().c_str());
return OLAP_ERR_INIT_FAILED;
}
// create and initiate writer for generating new index and data files.
- unique_ptr<ColumnDataWriter> writer(ColumnDataWriter::create(_table, _segment_group, false));
+ unique_ptr<ColumnDataWriter> writer(ColumnDataWriter::create(_tablet, _segment_group, false));
if (NULL == writer) {
OLAP_LOG_WARNING("fail to allocate writer.");
@@ -72,7 +72,7 @@ OLAPStatus Merger::merge(const vector<ColumnData*>& olap_data_arr,
bool has_error = false;
RowCursor row_cursor;
- if (OLAP_SUCCESS != row_cursor.init(_table->tablet_schema())) {
+ if (OLAP_SUCCESS != row_cursor.init(_tablet->tablet_schema())) {
OLAP_LOG_WARNING("fail to init row cursor.");
has_error = true;
}
@@ -83,12 +83,12 @@ OLAPStatus Merger::merge(const vector<ColumnData*>& olap_data_arr,
// Attach row cursor to the memory position of the row block being
// written in writer.
if (OLAP_SUCCESS != writer->attached_by(&row_cursor)) {
- OLAP_LOG_WARNING("attach row failed. [table='%s']",
- _table->full_name().c_str());
+ OLAP_LOG_WARNING("attach row failed. [tablet='%s']",
+ _tablet->full_name().c_str());
has_error = true;
break;
}
- row_cursor.allocate_memory_for_string_type(_table->tablet_schema(), writer->mem_pool());
+ row_cursor.allocate_memory_for_string_type(_tablet->tablet_schema(), writer->mem_pool());
// Read one row into row_cursor
OLAPStatus res = reader.next_row_with_aggregation(&row_cursor, &eof);
@@ -107,8 +107,8 @@ OLAPStatus Merger::merge(const vector<ColumnData*>& olap_data_arr,
}
if (OLAP_SUCCESS != writer->finalize()) {
- OLAP_LOG_WARNING("fail to finalize writer. [table='%s']",
- _table->full_name().c_str());
+ OLAP_LOG_WARNING("fail to finalize writer. [tablet='%s']",
+ _tablet->full_name().c_str());
has_error = true;
}
diff --git a/be/src/olap/merger.h b/be/src/olap/merger.h
index 38672351..c754be04 100644
--- a/be/src/olap/merger.h
+++ b/be/src/olap/merger.h
@@ -19,7 +19,7 @@
#define DORIS_BE_SRC_OLAP_MERGER_H
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
namespace doris {
@@ -29,7 +29,7 @@ class ColumnData;
class Merger {
public:
// parameter index is created by caller, and it is empty.
- Merger(TabletSharedPtr table, SegmentGroup* index, ReaderType type);
+ Merger(TabletSharedPtr tablet, SegmentGroup* index, ReaderType type);
virtual ~Merger() {};
@@ -44,7 +44,7 @@ class Merger {
return _row_count;
}
private:
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
SegmentGroup* _segment_group;
ReaderType _reader_type;
uint64_t _row_count;
diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h
index 598fb75d..47c08679 100644
--- a/be/src/olap/olap_common.h
+++ b/be/src/olap/olap_common.h
@@ -138,7 +138,7 @@ enum HllDataType {
enum AlterTabletType {
ALTER_TABLET_SCHEMA_CHANGE = 1, // add/drop/alter column
- ALTER_TABLET_CREATE_ROLLUP_TABLE= 2, // split one table to several sub tables
+ ALTER_TABLET_CREATE_ROLLUP_TABLE= 2, // split one tablet to several sub tables
};
enum AlterTableStatus {
diff --git a/be/src/olap/olap_cond.cpp b/be/src/olap/olap_cond.cpp
index 0b94a0a6..f3f1fc76 100644
--- a/be/src/olap/olap_cond.cpp
+++ b/be/src/olap/olap_cond.cpp
@@ -555,7 +555,7 @@ bool CondColumn::eval(const BloomFilter& bf) const {
}
OLAPStatus Conditions::append_condition(const TCondition& tcond) {
- int32_t index = _table->get_field_index(tcond.column_name);
+ int32_t index = _tablet->get_field_index(tcond.column_name);
if (index < 0) {
OLAP_LOG_WARNING("fail to get field index, name is invalid. [index=%d; field_name=%s]",
index,
@@ -564,7 +564,7 @@ OLAPStatus Conditions::append_condition(const TCondition& tcond) {
}
// Skip column which is non-key, or whose type is string or float
- const FieldInfo& fi = _table->tablet_schema()[index];
+ const FieldInfo& fi = _tablet->tablet_schema()[index];
if (fi.type == OLAP_FIELD_TYPE_DOUBLE || fi.type == OLAP_FIELD_TYPE_FLOAT) {
return OLAP_SUCCESS;
}
@@ -572,7 +572,7 @@ OLAPStatus Conditions::append_condition(const TCondition& tcond) {
CondColumn* cond_col = nullptr;
auto it = _columns.find(index);
if (it == _columns.end()) {
- cond_col = new CondColumn(_table, index);
+ cond_col = new CondColumn(_tablet, index);
_columns[index] = cond_col;
} else {
cond_col = it->second;
diff --git a/be/src/olap/olap_cond.h b/be/src/olap/olap_cond.h
index 0ab3d45a..4ef14150 100644
--- a/be/src/olap/olap_cond.h
+++ b/be/src/olap/olap_cond.h
@@ -28,7 +28,7 @@
#include "olap/bloom_filter.hpp"
#include "olap/stream_index_common.h"
#include "olap/field.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_cursor.h"
namespace doris {
@@ -89,9 +89,9 @@ struct Cond {
// 所有归属于同一列上的条件二元组,聚合在一个CondColumn上
class CondColumn {
public:
- CondColumn(TabletSharedPtr table, int32_t index) : _col_index(index), _table(table) {
+ CondColumn(TabletSharedPtr tablet, int32_t index) : _col_index(index), _tablet(tablet) {
_conds.clear();
- _is_key = _table->tablet_schema()[_col_index].is_key;
+ _is_key = _tablet->tablet_schema()[_col_index].is_key;
}
~CondColumn();
@@ -120,7 +120,7 @@ class CondColumn {
bool _is_key;
int32_t _col_index;
std::vector<Cond*> _conds;
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
};
// 一次请求所关联的条件
@@ -139,11 +139,11 @@ class Conditions {
_columns.clear();
}
- void set_table(TabletSharedPtr table) {
- long do_not_remove_me_until_you_want_a_heart_attacking = table.use_count();
+ void set_tablet(TabletSharedPtr tablet) {
+ long do_not_remove_me_until_you_want_a_heart_attacking = tablet.use_count();
OLAP_UNUSED_ARG(do_not_remove_me_until_you_want_a_heart_attacking);
- _table = table;
+ _tablet = tablet;
}
// 如果成功,则_columns中增加一项,如果失败则无视此condition,同时输出日志
@@ -164,7 +164,7 @@ class Conditions {
}
private:
- TabletSharedPtr _table; // ref to OLAPTable to access schema
+ TabletSharedPtr _tablet; // ref to Tablet to access schema
CondColumns _columns; // list of condition column
};
diff --git a/be/src/olap/olap_define.h b/be/src/olap/olap_define.h
index a51aeb09..5782a2d5 100644
--- a/be/src/olap/olap_define.h
+++ b/be/src/olap/olap_define.h
@@ -170,7 +170,7 @@ enum OLAPStatus {
OLAP_ERR_CE_TABLET_ID_EXIST = -305,
OLAP_ERR_CE_TRY_CE_LOCK_ERROR = -306,
- // OLAPTable
+ // Tablet
// [-400, -500)
OLAP_ERR_TABLE_VERSION_DUPLICATE_ERROR = -400,
OLAP_ERR_TABLE_VERSION_INDEX_MISMATCH_ERROR = -401,
@@ -279,7 +279,7 @@ enum OLAPStatus {
OLAP_ERR_HEADER_INIT_FAILED = -1411,
OLAP_ERR_HEADER_PB_PARSE_FAILED = -1412,
- // OLAPTableSchema
+ // TabletSchema
// [-1500, -1600)
OLAP_ERR_SCHEMA_SCHEMA_INVALID = -1500,
OLAP_ERR_SCHEMA_SCHEMA_FIELD_INVALID = -1501,
diff --git a/be/src/olap/olap_engine.cpp b/be/src/olap/olap_engine.cpp
index b5e17a5e..dbb8541b 100644
--- a/be/src/olap/olap_engine.cpp
+++ b/be/src/olap/olap_engine.cpp
@@ -78,7 +78,7 @@ const std::string HTTP_REQUEST_FILE_PARAM = "&file=";
const uint32_t DOWNLOAD_FILE_MAX_RETRY = 3;
const uint32_t LIST_REMOTE_FILE_TIMEOUT = 15;
-bool _sort_table_by_create_time(const TabletSharedPtr& a, const TabletSharedPtr& b) {
+bool _sort_tablet_by_create_time(const TabletSharedPtr& a, const TabletSharedPtr& b) {
return a->creation_time() < b->creation_time();
}
@@ -112,12 +112,12 @@ OLAPEngine::OLAPEngine(const EngineOptions& options)
_effective_cluster_id(-1),
_is_all_cluster_id_exist(true),
_is_drop_tables(false),
- _global_table_id(0),
+ _global_tablet_id(0),
_index_stream_lru_cache(NULL),
_tablet_stat_cache_update_time_ms(0),
_snapshot_base_id(0),
_is_report_disk_state_already(false),
- _is_report_olap_table_already(false) {
+ _is_report_tablet_already(false) {
if (_s_instance == nullptr) {
_s_instance = this;
}
@@ -142,7 +142,7 @@ OLAPStatus OLAPEngine::_load_store(OlapStore* store) {
OLAPStatus s = store->load_tables(this);
LOG(INFO) << "load header from meta finished";
if (s != OLAP_SUCCESS) {
- LOG(WARNING) << "there is failure when loading table headers, path:" << store_path;
+ LOG(WARNING) << "there is failure when loading tablet headers, path:" << store_path;
return s;
} else {
return OLAP_SUCCESS;
@@ -170,7 +170,7 @@ OLAPStatus OLAPEngine::_load_store(OlapStore* store) {
}
for (const auto& tablet : tablets) {
- // 遍历table目录寻找此table的所有indexedRollupTable,注意不是SegmentGroup,而是OLAPTable
+ // 遍历table目录寻找此table的所有indexedRollupTable,注意不是SegmentGroup,而是Tablet
set<string> schema_hashes;
string one_tablet_path = one_shard_path + '/' + tablet;
if (dir_walk(one_tablet_path, &schema_hashes, NULL) != OLAP_SUCCESS) {
@@ -189,7 +189,7 @@ OLAPStatus OLAPEngine::_load_store(OlapStore* store) {
tablet_id,
tablet_schema_hash,
one_tablet_path + '/' + schema_hash) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load one table, but continue. [path='%s']",
+ OLAP_LOG_WARNING("fail to load one tablet, but continue. [path='%s']",
(one_tablet_path + '/' + schema_hash).c_str());
}
}
@@ -214,15 +214,15 @@ OLAPStatus OLAPEngine::load_one_tablet(
return OLAP_ERR_FILE_NOT_EXIST;
}
- auto olap_table = OLAPTable::create_from_header_file(
+ auto tablet = Tablet::create_from_header_file(
tablet_id, schema_hash, header_path, store);
- if (olap_table == NULL) {
- LOG(WARNING) << "fail to load table. [header_path=" << header_path << "]";
+ if (tablet == NULL) {
+ LOG(WARNING) << "fail to load tablet. [header_path=" << header_path << "]";
move_to_trash(boost_schema_hash_path, boost_schema_hash_path);
return OLAP_ERR_ENGINE_LOAD_INDEX_TABLE_ERROR;
}
- if (olap_table->lastest_version() == NULL && !olap_table->is_schema_changing()) {
+ if (tablet->lastest_version() == NULL && !tablet->is_schema_changing()) {
OLAP_LOG_WARNING("tablet not in schema change state without delta is invalid. "
"[header_path=%s]",
header_path.c_str());
@@ -230,26 +230,26 @@ OLAPStatus OLAPEngine::load_one_tablet(
return OLAP_ERR_ENGINE_LOAD_INDEX_TABLE_ERROR;
}
- // 这里不需要SAFE_DELETE(olap_table),因为olap_table指针已经在add_table中托管到smart pointer中
+ // 这里不需要SAFE_DELETE(tablet),因为tablet指针已经在add_table中托管到smart pointer中
OLAPStatus res = OLAP_SUCCESS;
- string table_name = olap_table->full_name();
- res = add_table(tablet_id, schema_hash, olap_table, force);
+ string table_name = tablet->full_name();
+ res = add_tablet(tablet_id, schema_hash, tablet, force);
if (res != OLAP_SUCCESS) {
// 插入已经存在的table时返回成功
if (res == OLAP_ERR_ENGINE_INSERT_EXISTS_TABLE) {
return OLAP_SUCCESS;
}
- LOG(WARNING) << "failed to add table. [table=" << table_name << "]";
+ LOG(WARNING) << "failed to add tablet. [tablet=" << table_name << "]";
return OLAP_ERR_ENGINE_LOAD_INDEX_TABLE_ERROR;
}
- if (register_table_into_root_path(olap_table.get()) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to register table into root path. [root_path=%s]",
+ if (register_tablet_into_root_path(tablet.get()) != OLAP_SUCCESS) {
+ OLAP_LOG_WARNING("fail to register tablet into root path. [root_path=%s]",
schema_hash_path.c_str());
- if (OLAPEngine::get_instance()->drop_table(tablet_id, schema_hash) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to drop table when create table failed. "
+ if (OLAPEngine::get_instance()->drop_tablet(tablet_id, schema_hash) != OLAP_SUCCESS) {
+ OLAP_LOG_WARNING("fail to drop tablet when create tablet failed. "
"[tablet=%ld schema_hash=%d]",
tablet_id, schema_hash);
}
@@ -258,16 +258,16 @@ OLAPStatus OLAPEngine::load_one_tablet(
}
// load pending data (for realtime push), will add transaction relationship into engine
- olap_table->load_pending_data();
+ tablet->load_pending_data();
- VLOG(3) << "succeed to add table. tablet=" << olap_table->full_name()
+ VLOG(3) << "succeed to add tablet. tablet=" << tablet->full_name()
<< ", path=" << schema_hash_path;
return OLAP_SUCCESS;
}
-void OLAPEngine::check_none_row_oriented_table(const std::vector<OlapStore*>& stores) {
+void OLAPEngine::check_none_row_oriented_tablet(const std::vector<OlapStore*>& stores) {
for (auto store : stores) {
- auto res = _check_none_row_oriented_table_in_store(store);
+ auto res = _check_none_row_oriented_tablet_in_store(store);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "io error when init load tables. res=" << res
<< ", store=" << store->path();
@@ -275,7 +275,7 @@ void OLAPEngine::check_none_row_oriented_table(const std::vector<OlapStore*>& st
}
}
-OLAPStatus OLAPEngine::_check_none_row_oriented_table_in_store(OlapStore* store) {
+OLAPStatus OLAPEngine::_check_none_row_oriented_tablet_in_store(OlapStore* store) {
std::string store_path = store->path();
LOG(INFO) <<"start to load tablets from store_path:" << store_path;
@@ -286,9 +286,9 @@ OLAPStatus OLAPEngine::_check_none_row_oriented_table_in_store(OlapStore* store)
return res;
}
if (is_header_converted) {
- OLAPStatus s = store->check_none_row_oriented_table_in_store(this);
+ OLAPStatus s = store->check_none_row_oriented_tablet_in_store(this);
if (s != OLAP_SUCCESS) {
- LOG(WARNING) << "there is failure when loading table headers, path:" << store_path;
+ LOG(WARNING) << "there is failure when loading tablet headers, path:" << store_path;
return s;
} else {
return OLAP_SUCCESS;
@@ -297,7 +297,7 @@ OLAPStatus OLAPEngine::_check_none_row_oriented_table_in_store(OlapStore* store)
// compatible for old header load method
// walk all directory to load header file
- LOG(INFO) << "check has none row-oriented table from header files";
+ LOG(INFO) << "check has none row-oriented tablet from header files";
// get all shards
set<string> shards;
@@ -316,7 +316,7 @@ OLAPStatus OLAPEngine::_check_none_row_oriented_table_in_store(OlapStore* store)
}
for (const auto& tablet : tablets) {
- // 遍历table目录寻找此table的所有indexedRollupTable,注意不是SegmentGroup,而是OLAPTable
+ // 遍历table目录寻找此table的所有indexedRollupTable,注意不是SegmentGroup,而是Tablet
set<string> schema_hashes;
string one_tablet_path = one_shard_path + '/' + tablet;
if (dir_walk(one_tablet_path, &schema_hashes, NULL) != OLAP_SUCCESS) {
@@ -330,12 +330,12 @@ OLAPStatus OLAPEngine::_check_none_row_oriented_table_in_store(OlapStore* store)
// 遍历schema_hash目录寻找此index的所有schema
// 加载失败依然加载下一个Table
- if (check_none_row_oriented_table_in_path(
+ if (check_none_row_oriented_tablet_in_path(
store,
tablet_id,
tablet_schema_hash,
one_tablet_path + '/' + schema_hash) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load one table, but continue. [path='%s']",
+ OLAP_LOG_WARNING("fail to load one tablet, but continue. [path='%s']",
(one_tablet_path + '/' + schema_hash).c_str());
}
}
@@ -344,7 +344,7 @@ OLAPStatus OLAPEngine::_check_none_row_oriented_table_in_store(OlapStore* store)
return res;
}
-OLAPStatus OLAPEngine::check_none_row_oriented_table_in_path(
+OLAPStatus OLAPEngine::check_none_row_oriented_tablet_in_path(
OlapStore* store, TTabletId tablet_id,
SchemaHash schema_hash, const string& schema_hash_path) {
stringstream header_name_stream;
@@ -358,18 +358,18 @@ OLAPStatus OLAPEngine::check_none_row_oriented_table_in_path(
return OLAP_ERR_FILE_NOT_EXIST;
}
- auto olap_table = OLAPTable::create_from_header_file_for_check(
+ auto tablet = Tablet::create_from_header_file_for_check(
tablet_id, schema_hash, header_path);
- if (olap_table == NULL) {
- LOG(WARNING) << "fail to load table. [header_path=" << header_path << "]";
+ if (tablet == NULL) {
+ LOG(WARNING) << "fail to load tablet. [header_path=" << header_path << "]";
move_to_trash(boost_schema_hash_path, boost_schema_hash_path);
return OLAP_ERR_ENGINE_LOAD_INDEX_TABLE_ERROR;
}
- LOG(INFO) << "data_file_type:" << olap_table->data_file_type();
- if (olap_table->data_file_type() == OLAP_DATA_FILE) {
- LOG(FATAL) << "Not support row-oriented table any more. Please convert it to column-oriented table."
- << "tablet=" << olap_table->full_name();
+ LOG(INFO) << "data_file_type:" << tablet->data_file_type();
+ if (tablet->data_file_type() == OLAP_DATA_FILE) {
+ LOG(FATAL) << "Not support row-oriented tablet any more. Please convert it to column-oriented tablet."
+ << "tablet=" << tablet->full_name();
}
return OLAP_SUCCESS;
@@ -436,7 +436,7 @@ OLAPStatus OLAPEngine::open() {
_max_base_compaction_task_per_disk = (base_compaction_num_threads + file_system_num - 1) / file_system_num;
auto stores = get_stores();
- check_none_row_oriented_table(stores);
+ check_none_row_oriented_tablet(stores);
load_stores(stores);
// 取消未完成的SchemaChange任务
_cancel_unfinished_schema_change();
@@ -586,8 +586,8 @@ OLAPStatus OLAPEngine::get_all_root_path_info(vector<RootPathInfo>* root_paths_i
return res;
}
-OLAPStatus OLAPEngine::register_table_into_root_path(OLAPTable* olap_table) {
- return olap_table->store()->register_table(olap_table);
+OLAPStatus OLAPEngine::register_tablet_into_root_path(Tablet* tablet) {
+ return tablet->store()->register_tablet(tablet);
}
void OLAPEngine::start_disk_stat_monitor() {
@@ -598,17 +598,17 @@ void OLAPEngine::start_disk_stat_monitor() {
_delete_tables_on_unused_root_path();
// if drop tables
- // notify disk_state_worker_thread and olap_table_worker_thread until they received
+ // notify disk_state_worker_thread and tablet_worker_thread until they received
if (_is_drop_tables) {
report_notify(true);
bool is_report_disk_state_expected = true;
- bool is_report_olap_table_expected = true;
+ bool is_report_tablet_expected = true;
bool is_report_disk_state_exchanged =
_is_report_disk_state_already.compare_exchange_strong(is_report_disk_state_expected, false);
- bool is_report_olap_table_exchanged =
- _is_report_olap_table_already.compare_exchange_strong(is_report_olap_table_expected, false);
- if (is_report_disk_state_exchanged && is_report_olap_table_exchanged) {
+ bool is_report_tablet_exchanged =
+ _is_report_tablet_already.compare_exchange_strong(is_report_tablet_expected, false);
+ if (is_report_disk_state_exchanged && is_report_tablet_exchanged) {
_is_drop_tables = false;
}
}
@@ -661,7 +661,7 @@ Status OLAPEngine::set_cluster_id(int32_t cluster_id) {
return Status::OK;
}
-std::vector<OlapStore*> OLAPEngine::get_stores_for_create_table(
+std::vector<OlapStore*> OLAPEngine::get_stores_for_create_tablet(
TStorageMedium::type storage_medium) {
std::vector<OlapStore*> stores;
{
@@ -748,48 +748,48 @@ OLAPStatus OLAPEngine::clear() {
_tablet_map.clear();
_transaction_tablet_map.clear();
- _global_table_id = 0;
+ _global_tablet_id = 0;
return OLAP_SUCCESS;
}
-TabletSharedPtr OLAPEngine::_get_table_with_no_lock(TTabletId tablet_id, SchemaHash schema_hash) {
- VLOG(3) << "begin to get olap table. tablet_id=" << tablet_id;
+TabletSharedPtr OLAPEngine::_get_tablet_with_no_lock(TTabletId tablet_id, SchemaHash schema_hash) {
+ VLOG(3) << "begin to get tablet. tablet_id=" << tablet_id;
tablet_map_t::iterator it = _tablet_map.find(tablet_id);
if (it != _tablet_map.end()) {
- for (TabletSharedPtr table : it->second.table_arr) {
- if (table->equal(tablet_id, schema_hash)) {
- VLOG(3) << "get olap table success. tablet_id=" << tablet_id;
- return table;
+ for (TabletSharedPtr tablet : it->second.table_arr) {
+ if (tablet->equal(tablet_id, schema_hash)) {
+ VLOG(3) << "get tablet success. tablet_id=" << tablet_id;
+ return tablet;
}
}
}
- VLOG(3) << "fail to get olap table. tablet_id=" << tablet_id;
- // Return empty olap_table if fail
- TabletSharedPtr olap_table;
- return olap_table;
+ VLOG(3) << "fail to get tablet. tablet_id=" << tablet_id;
+ // Return empty tablet if fail
+ TabletSharedPtr tablet;
+ return tablet;
}
-TabletSharedPtr OLAPEngine::get_table(TTabletId tablet_id, SchemaHash schema_hash, bool load_table) {
+TabletSharedPtr OLAPEngine::get_tablet(TTabletId tablet_id, SchemaHash schema_hash, bool load_tablet) {
_tablet_map_lock.rdlock();
- TabletSharedPtr olap_table;
- olap_table = _get_table_with_no_lock(tablet_id, schema_hash);
+ TabletSharedPtr tablet;
+ tablet = _get_tablet_with_no_lock(tablet_id, schema_hash);
_tablet_map_lock.unlock();
- if (olap_table.get() != NULL) {
- if (!olap_table->is_used()) {
- OLAP_LOG_WARNING("olap table cannot be used. [table=%ld]", tablet_id);
- olap_table.reset();
- } else if (load_table && !olap_table->is_loaded()) {
- if (olap_table->load() != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load olap table. [table=%ld]", tablet_id);
- olap_table.reset();
+ if (tablet.get() != NULL) {
+ if (!tablet->is_used()) {
+ OLAP_LOG_WARNING("tablet cannot be used. [tablet=%ld]", tablet_id);
+ tablet.reset();
+ } else if (load_tablet && !tablet->is_loaded()) {
+ if (tablet->load() != OLAP_SUCCESS) {
+ OLAP_LOG_WARNING("fail to load tablet. [tablet=%ld]", tablet_id);
+ tablet.reset();
}
}
}
- return olap_table;
+ return tablet;
}
OLAPStatus OLAPEngine::get_tables_by_id(
@@ -801,14 +801,14 @@ OLAPStatus OLAPEngine::get_tables_by_id(
_tablet_map_lock.rdlock();
tablet_map_t::iterator it = _tablet_map.find(tablet_id);
if (it != _tablet_map.end()) {
- for (TabletSharedPtr olap_table : it->second.table_arr) {
- table_list->push_back(olap_table);
+ for (TabletSharedPtr tablet : it->second.table_arr) {
+ table_list->push_back(tablet);
}
}
_tablet_map_lock.unlock();
if (table_list->size() == 0) {
- OLAP_LOG_WARNING("there is no tablet with specified id. [table=%ld]", tablet_id);
+ OLAP_LOG_WARNING("there is no tablet with specified id. [tablet=%ld]", tablet_id);
return OLAP_ERR_TABLE_NOT_FOUND;
}
@@ -816,7 +816,7 @@ OLAPStatus OLAPEngine::get_tables_by_id(
it != table_list->end();) {
if (!(*it)->is_loaded()) {
if ((*it)->load() != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load table. [table='%s']",
+ OLAP_LOG_WARNING("fail to load tablet. [tablet='%s']",
(*it)->full_name().c_str());
it = table_list->erase(it);
continue;
@@ -842,15 +842,15 @@ bool OLAPEngine::check_tablet_id_exist(TTabletId tablet_id) {
return is_exist;
}
-OLAPStatus OLAPEngine::add_table(TTabletId tablet_id, SchemaHash schema_hash,
- const TabletSharedPtr& table, bool force) {
+OLAPStatus OLAPEngine::add_tablet(TTabletId tablet_id, SchemaHash schema_hash,
+ const TabletSharedPtr& tablet, bool force) {
OLAPStatus res = OLAP_SUCCESS;
- VLOG(3) << "begin to add olap table to OLAPEngine. "
+ VLOG(3) << "begin to add tablet to OLAPEngine. "
<< "tablet_id=" << tablet_id << ", schema_hash=" << schema_hash
<< ", force=" << force;
_tablet_map_lock.wrlock();
- table->set_id(_global_table_id++);
+ tablet->set_id(_global_tablet_id++);
TabletSharedPtr table_item;
for (TabletSharedPtr item : _tablet_map[tablet_id].table_arr) {
@@ -861,8 +861,8 @@ OLAPStatus OLAPEngine::add_table(TTabletId tablet_id, SchemaHash schema_hash,
}
if (table_item.get() == NULL) {
- _tablet_map[tablet_id].table_arr.push_back(table);
- _tablet_map[tablet_id].table_arr.sort(_sort_table_by_create_time);
+ _tablet_map[tablet_id].table_arr.push_back(tablet);
+ _tablet_map[tablet_id].table_arr.sort(_sort_tablet_by_create_time);
_tablet_map_lock.unlock();
return res;
@@ -870,7 +870,7 @@ OLAPStatus OLAPEngine::add_table(TTabletId tablet_id, SchemaHash schema_hash,
_tablet_map_lock.unlock();
if (!force) {
- if (table_item->tablet_path() == table->tablet_path()) {
+ if (table_item->tablet_path() == tablet->tablet_path()) {
LOG(WARNING) << "add the same tablet twice! tablet_id="
<< tablet_id << " schema_hash=" << tablet_id;
return OLAP_ERR_ENGINE_INSERT_EXISTS_TABLE;
@@ -879,38 +879,38 @@ OLAPStatus OLAPEngine::add_table(TTabletId tablet_id, SchemaHash schema_hash,
table_item->obtain_header_rdlock();
int64_t old_time = table_item->lastest_version()->creation_time();
- int64_t new_time = table->lastest_version()->creation_time();
+ int64_t new_time = tablet->lastest_version()->creation_time();
int32_t old_version = table_item->lastest_version()->end_version();
- int32_t new_version = table->lastest_version()->end_version();
+ int32_t new_version = tablet->lastest_version()->end_version();
table_item->release_header_lock();
/*
* In restore process, we replace all origin files in tablet dir with
* the downloaded snapshot files. Than we try to reload tablet header.
- * force == true means we forcibly replace the OLAPTable in _tablet_map
+ * force == true means we forcibly replace the Tablet in _tablet_map
* with the new one. But if we do so, the files in the tablet dir will be
- * dropped when the origin OLAPTable deconstruct.
+ * dropped when the origin Tablet deconstruct.
* So we set keep_files == true to not delete files when the
- * origin OLAPTable deconstruct.
+ * origin Tablet deconstruct.
*/
bool keep_files = force ? true : false;
if (force || (new_version > old_version
|| (new_version == old_version && new_time > old_time))) {
- drop_table(tablet_id, schema_hash, keep_files);
+ drop_tablet(tablet_id, schema_hash, keep_files);
_tablet_map_lock.wrlock();
- _tablet_map[tablet_id].table_arr.push_back(table);
- _tablet_map[tablet_id].table_arr.sort(_sort_table_by_create_time);
+ _tablet_map[tablet_id].table_arr.push_back(tablet);
+ _tablet_map[tablet_id].table_arr.sort(_sort_tablet_by_create_time);
_tablet_map_lock.unlock();
} else {
- table->mark_dropped();
+ tablet->mark_dropped();
res = OLAP_ERR_ENGINE_INSERT_EXISTS_TABLE;
}
- LOG(WARNING) << "add duplicated table. force=" << force << ", res=" << res
+ LOG(WARNING) << "add duplicated tablet. force=" << force << ", res=" << res
<< ", tablet_id=" << tablet_id << ", schema_hash=" << schema_hash
<< ", old_version=" << old_version << ", new_version=" << new_version
<< ", old_time=" << old_time << ", new_time=" << new_time
<< ", old_tablet_path=" << table_item->tablet_path()
- << ", new_tablet_path=" << table->tablet_path();
+ << ", new_tablet_path=" << tablet->tablet_path();
return res;
}
@@ -931,7 +931,7 @@ OLAPStatus OLAPEngine::add_transaction(
LOG(WARNING) << "find transaction exists when add to engine."
<< "partition_id: " << key.first
<< ", transaction_id: " << key.second
- << ", table: " << tablet_info.to_string();
+ << ", tablet: " << tablet_info.to_string();
return OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST;
}
}
@@ -942,7 +942,7 @@ OLAPStatus OLAPEngine::add_transaction(
VLOG(3) << "add transaction to engine successfully."
<< "partition_id: " << key.first
<< ", transaction_id: " << key.second
- << ", table: " << tablet_info.to_string();
+ << ", tablet: " << tablet_info.to_string();
return OLAP_SUCCESS;
}
@@ -959,7 +959,7 @@ void OLAPEngine::delete_transaction(
VLOG(3) << "delete transaction to engine successfully."
<< ",partition_id: " << key.first
<< ", transaction_id: " << key.second
- << ", table: " << tablet_info.to_string();
+ << ", tablet: " << tablet_info.to_string();
it->second.erase(tablet_info);
if (it->second.empty()) {
_transaction_tablet_map.erase(it);
@@ -967,7 +967,7 @@ void OLAPEngine::delete_transaction(
// delete transaction from tablet
if (delete_from_tablet) {
- TabletSharedPtr tablet = get_table(tablet_info.tablet_id, tablet_info.schema_hash);
+ TabletSharedPtr tablet = get_tablet(tablet_info.tablet_id, tablet_info.schema_hash);
if (tablet.get() != nullptr) {
tablet->delete_pending_data(transaction_id);
}
@@ -991,7 +991,7 @@ void OLAPEngine::get_transactions_by_tablet(TabletSharedPtr tablet, int64_t* par
VLOG(3) << "find transaction on tablet."
<< "partition_id: " << it.first.first
<< ", transaction_id: " << it.first.second
- << ", table: " << tablet_info.to_string();
+ << ", tablet: " << tablet_info.to_string();
}
}
}
@@ -1048,10 +1048,10 @@ OLAPStatus OLAPEngine::publish_version(const TPublishVersionRequest& publish_ver
<< ", version=" << version.first
<< ", version_hash=" << version_hash
<< ", transaction_id=" << transaction_id;
- TabletSharedPtr tablet = get_table(tablet_info.tablet_id, tablet_info.schema_hash);
+ TabletSharedPtr tablet = get_tablet(tablet_info.tablet_id, tablet_info.schema_hash);
if (tablet.get() == NULL) {
- OLAP_LOG_WARNING("can't get table when publish version. [tablet_id=%ld schema_hash=%d]",
+ OLAP_LOG_WARNING("can't get tablet when publish version. [tablet_id=%ld schema_hash=%d]",
tablet_info.tablet_id, tablet_info.schema_hash);
error_tablet_ids->push_back(tablet_info.tablet_id);
res = OLAP_ERR_PUSH_TABLE_NOT_EXIST;
@@ -1066,7 +1066,7 @@ OLAPStatus OLAPEngine::publish_version(const TPublishVersionRequest& publish_ver
// if data existed, delete transaction from engine and tablet
if (publish_status == OLAP_ERR_PUSH_VERSION_ALREADY_EXIST) {
OLAP_LOG_WARNING("can't publish version on tablet since data existed. "
- "[table=%s transaction_id=%ld version=%d]",
+ "[tablet=%s transaction_id=%ld version=%d]",
tablet->full_name().c_str(), transaction_id, version.first);
delete_transaction(partition_id, transaction_id,
tablet->tablet_id(), tablet->schema_hash());
@@ -1078,7 +1078,7 @@ OLAPStatus OLAPEngine::publish_version(const TPublishVersionRequest& publish_ver
_transaction_tablet_map_lock.wrlock();
auto it2 = _transaction_tablet_map.find(key);
if (it2 != _transaction_tablet_map.end()) {
- VLOG(3) << "delete transaction from engine. table=" << tablet->full_name()
+ VLOG(3) << "delete transaction from engine. tablet=" << tablet->full_name()
<< "transaction_id: " << transaction_id;
it2->second.erase(tablet_info);
if (it2->second.empty()) {
@@ -1089,7 +1089,7 @@ OLAPStatus OLAPEngine::publish_version(const TPublishVersionRequest& publish_ver
} else {
OLAP_LOG_WARNING("fail to publish version on tablet. "
- "[table=%s transaction_id=%ld version=%d res=%d]",
+ "[tablet=%s transaction_id=%ld version=%d res=%d]",
tablet->full_name().c_str(), transaction_id,
version.first, publish_status);
error_tablet_ids->push_back(tablet->tablet_id());
@@ -1203,13 +1203,13 @@ OLAPStatus OLAPEngine::clone_incremental_data(TabletSharedPtr tablet, OLAPHeader
// clone_data to tablet
OLAPStatus clone_res = tablet->clone_data(clone_header, versions_to_clone, versions_to_delete);
- LOG(INFO) << "finish to incremental clone. [table=" << tablet->full_name() << " res=" << clone_res << "]";
+ LOG(INFO) << "finish to incremental clone. [tablet=" << tablet->full_name() << " res=" << clone_res << "]";
return clone_res;
}
OLAPStatus OLAPEngine::clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone_header) {
Version clone_latest_version = clone_header.get_latest_version();
- LOG(INFO) << "begin to full clone. table=" << tablet->full_name() << ","
+ LOG(INFO) << "begin to full clone. tablet=" << tablet->full_name() << ","
<< "clone_latest_version=" << clone_latest_version.first << "-" << clone_latest_version.second;
vector<Version> versions_to_delete;
@@ -1219,14 +1219,14 @@ OLAPStatus OLAPEngine::clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone
tablet->get_delta(i)->end_version());
VersionHash local_version_hash = tablet->get_delta(i)->version_hash();
LOG(INFO) << "check local delta when full clone."
- << "table=" << tablet->full_name()
+ << "tablet=" << tablet->full_name()
<< ", local_version=" << local_version.first << "-" << local_version.second;
// if local version cross src latest, clone failed
if (local_version.first <= clone_latest_version.second
&& local_version.second > clone_latest_version.second) {
LOG(WARNING) << "stop to full clone, version cross src latest."
- << "table=" << tablet->full_name()
+ << "tablet=" << tablet->full_name()
<< ", local_version=" << local_version.first << "-" << local_version.second;
return OLAP_ERR_TABLE_VERSION_DUPLICATE_ERROR;
@@ -1242,7 +1242,7 @@ OLAPStatus OLAPEngine::clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone
&& clone_header.get_delta(j)->version_hash() == local_version_hash) {
existed_in_src = true;
LOG(INFO) << "Delta has already existed in local header, no need to clone."
- << "table=" << tablet->full_name()
+ << "tablet=" << tablet->full_name()
<< ", version='" << local_version.first<< "-" << local_version.second
<< ", version_hash=" << local_version_hash;
@@ -1263,7 +1263,7 @@ OLAPStatus OLAPEngine::clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone
if (!existed_in_src) {
versions_to_delete.push_back(local_version);
LOG(INFO) << "Delete delta not included by the clone header, should delete it from local header."
- << "table=" << tablet->full_name() << ","
+ << "tablet=" << tablet->full_name() << ","
<< ", version=" << local_version.first<< "-" << local_version.second
<< ", version_hash=" << local_version_hash;
}
@@ -1273,7 +1273,7 @@ OLAPStatus OLAPEngine::clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone
for (int i = 0; i < clone_header.file_delta_size(); ++i) {
clone_deltas.push_back(clone_header.get_delta(i));
LOG(INFO) << "Delta to clone."
- << "table=" << tablet->full_name() << ","
+ << "tablet=" << tablet->full_name() << ","
<< ", version=" << clone_header.get_delta(i)->start_version() << "-"
<< clone_header.get_delta(i)->end_version()
<< ", version_hash=" << clone_header.get_delta(i)->version_hash();
@@ -1281,32 +1281,32 @@ OLAPStatus OLAPEngine::clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone
// clone_data to tablet
OLAPStatus clone_res = tablet->clone_data(clone_header, clone_deltas, versions_to_delete);
- LOG(INFO) << "finish to full clone. [table=" << tablet->full_name() << ", res=" << clone_res << "]";
+ LOG(INFO) << "finish to full clone. [tablet=" << tablet->full_name() << ", res=" << clone_res << "]";
return clone_res;
}
-// Drop table specified, the main logical is as follows:
-// 1. table not in schema change:
-// drop specified table directly;
-// 2. table in schema change:
-// a. schema change not finished && dropped table is base :
-// base table cannot be dropped;
+// Drop tablet specified, the main logical is as follows:
+// 1. tablet not in schema change:
+// drop specified tablet directly;
+// 2. tablet in schema change:
+// a. schema change not finished && dropped tablet is base :
+// base tablet cannot be dropped;
// b. other cases:
-// drop specified table and clear schema change info.
-OLAPStatus OLAPEngine::drop_table(
+// drop specified tablet and clear schema change info.
+OLAPStatus OLAPEngine::drop_tablet(
TTabletId tablet_id, SchemaHash schema_hash, bool keep_files) {
- LOG(INFO) << "begin to process drop table."
- << "table=" << tablet_id << ", schema_hash=" << schema_hash;
+ LOG(INFO) << "begin to process drop tablet."
+ << "tablet=" << tablet_id << ", schema_hash=" << schema_hash;
DorisMetrics::drop_tablet_requests_total.increment(1);
OLAPStatus res = OLAP_SUCCESS;
- // Get table which need to be droped
+ // Get tablet which need to be droped
_tablet_map_lock.rdlock();
- TabletSharedPtr dropped_table = _get_table_with_no_lock(tablet_id, schema_hash);
+ TabletSharedPtr dropped_tablet = _get_tablet_with_no_lock(tablet_id, schema_hash);
_tablet_map_lock.unlock();
- if (dropped_table.get() == NULL) {
- OLAP_LOG_WARNING("fail to drop not existed table. [tablet_id=%ld schema_hash=%d]",
+ if (dropped_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("fail to drop not existed tablet. [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
@@ -1316,60 +1316,60 @@ OLAPStatus OLAPEngine::drop_table(
TTabletId related_tablet_id;
TSchemaHash related_schema_hash;
vector<Version> schema_change_versions;
- dropped_table->obtain_header_rdlock();
- bool ret = dropped_table->get_schema_change_request(
+ dropped_tablet->obtain_header_rdlock();
+ bool ret = dropped_tablet->get_schema_change_request(
&related_tablet_id, &related_schema_hash, &schema_change_versions, &type);
- dropped_table->release_header_lock();
+ dropped_tablet->release_header_lock();
- // Drop table directly when not in schema change
+ // Drop tablet directly when not in schema change
if (!ret) {
- return _drop_table_directly(tablet_id, schema_hash, keep_files);
+ return _drop_tablet_directly(tablet_id, schema_hash, keep_files);
}
- // Check table is in schema change or not, is base table or not
+ // Check tablet is in schema change or not, is base tablet or not
bool is_schema_change_finished = true;
if (schema_change_versions.size() != 0) {
is_schema_change_finished = false;
}
- bool is_drop_base_table = false;
+ bool is_drop_base_tablet = false;
_tablet_map_lock.rdlock();
- TabletSharedPtr related_table = _get_table_with_no_lock(
+ TabletSharedPtr related_tablet = _get_tablet_with_no_lock(
related_tablet_id, related_schema_hash);
_tablet_map_lock.unlock();
- if (related_table.get() == NULL) {
- OLAP_LOG_WARNING("drop table directly when related table not found. "
+ if (related_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("drop tablet directly when related tablet not found. "
"[tablet_id=%ld schema_hash=%d]",
related_tablet_id, related_schema_hash);
- return _drop_table_directly(tablet_id, schema_hash, keep_files);
+ return _drop_tablet_directly(tablet_id, schema_hash, keep_files);
}
- if (dropped_table->creation_time() < related_table->creation_time()) {
- is_drop_base_table = true;
+ if (dropped_tablet->creation_time() < related_tablet->creation_time()) {
+ is_drop_base_tablet = true;
}
- if (is_drop_base_table && !is_schema_change_finished) {
- OLAP_LOG_WARNING("base table in schema change cannot be droped. [table=%s]",
- dropped_table->full_name().c_str());
+ if (is_drop_base_tablet && !is_schema_change_finished) {
+ OLAP_LOG_WARNING("base tablet in schema change cannot be droped. [tablet=%s]",
+ dropped_tablet->full_name().c_str());
return OLAP_ERR_PREVIOUS_SCHEMA_CHANGE_NOT_FINISHED;
}
- // Drop specified table and clear schema change info
+ // Drop specified tablet and clear schema change info
_tablet_map_lock.wrlock();
- related_table->obtain_header_wrlock();
- related_table->clear_schema_change_request();
- res = related_table->save_header();
+ related_tablet->obtain_header_wrlock();
+ related_tablet->clear_schema_change_request();
+ res = related_tablet->save_header();
if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "fail to save table header. res=" << res
- << ", tablet=" << related_table->full_name();
+ LOG(FATAL) << "fail to save tablet header. res=" << res
+ << ", tablet=" << related_tablet->full_name();
}
- res = _drop_table_directly_unlocked(tablet_id, schema_hash, keep_files);
- related_table->release_header_lock();
+ res = _drop_tablet_directly_unlocked(tablet_id, schema_hash, keep_files);
+ related_tablet->release_header_lock();
_tablet_map_lock.unlock();
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to drop table which in schema change. [table=%s]",
- dropped_table->full_name().c_str());
+ OLAP_LOG_WARNING("fail to drop tablet which in schema change. [tablet=%s]",
+ dropped_tablet->full_name().c_str());
return res;
}
@@ -1377,21 +1377,21 @@ OLAPStatus OLAPEngine::drop_table(
return res;
}
-OLAPStatus OLAPEngine::_drop_table_directly(
+OLAPStatus OLAPEngine::_drop_tablet_directly(
TTabletId tablet_id, SchemaHash schema_hash, bool keep_files) {
_tablet_map_lock.wrlock();
- OLAPStatus res = _drop_table_directly_unlocked(tablet_id, schema_hash, keep_files);
+ OLAPStatus res = _drop_tablet_directly_unlocked(tablet_id, schema_hash, keep_files);
_tablet_map_lock.unlock();
return res;
}
-OLAPStatus OLAPEngine::_drop_table_directly_unlocked(
+OLAPStatus OLAPEngine::_drop_tablet_directly_unlocked(
TTabletId tablet_id, SchemaHash schema_hash, bool keep_files) {
OLAPStatus res = OLAP_SUCCESS;
- TabletSharedPtr dropped_table = _get_table_with_no_lock(tablet_id, schema_hash);
- if (dropped_table.get() == NULL) {
- OLAP_LOG_WARNING("fail to drop not existed table. [tablet_id=%ld schema_hash=%d]",
+ TabletSharedPtr dropped_tablet = _get_tablet_with_no_lock(tablet_id, schema_hash);
+ if (dropped_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("fail to drop not existed tablet. [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
@@ -1412,9 +1412,9 @@ OLAPStatus OLAPEngine::_drop_table_directly_unlocked(
_tablet_map.erase(tablet_id);
}
- res = dropped_table->store()->deregister_table(dropped_table.get());
+ res = dropped_tablet->store()->deregister_tablet(dropped_tablet.get());
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to unregister from root path. [res=%d table=%ld]",
+ OLAP_LOG_WARNING("fail to unregister from root path. [res=%d tablet=%ld]",
res, tablet_id);
}
@@ -1430,11 +1430,11 @@ OLAPStatus OLAPEngine::drop_tables_on_error_root_path(
for (const TabletInfo& tablet_info : tablet_info_vec) {
TTabletId tablet_id = tablet_info.tablet_id;
TSchemaHash schema_hash = tablet_info.schema_hash;
- VLOG(3) << "drop_table begin. tablet_id=" << tablet_id
+ VLOG(3) << "drop_tablet begin. tablet_id=" << tablet_id
<< ", schema_hash=" << schema_hash;
- TabletSharedPtr dropped_table = _get_table_with_no_lock(tablet_id, schema_hash);
- if (dropped_table.get() == NULL) {
- OLAP_LOG_WARNING("dropping table not exist. [table=%ld schema_hash=%d]",
+ TabletSharedPtr dropped_tablet = _get_tablet_with_no_lock(tablet_id, schema_hash);
+ if (dropped_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("dropping tablet not exist. [tablet=%ld schema_hash=%d]",
tablet_id, schema_hash);
continue;
} else {
@@ -1458,34 +1458,34 @@ OLAPStatus OLAPEngine::drop_tables_on_error_root_path(
return res;
}
-TabletSharedPtr OLAPEngine::create_table(
+TabletSharedPtr OLAPEngine::create_tablet(
const TCreateTabletReq& request, const string* ref_root_path,
- const bool is_schema_change_table, const TabletSharedPtr ref_olap_table) {
+ const bool is_schema_change_tablet, const TabletSharedPtr ref_tablet) {
// Get all available stores, use ref_root_path if the caller specified
std::vector<OlapStore*> stores;
if (ref_root_path == nullptr) {
- stores = get_stores_for_create_table(request.storage_medium);
+ stores = get_stores_for_create_tablet(request.storage_medium);
if (stores.empty()) {
- LOG(WARNING) << "there is no available disk that can be used to create table.";
+ LOG(WARNING) << "there is no available disk that can be used to create tablet.";
return nullptr;
}
} else {
- stores.push_back(ref_olap_table->store());
+ stores.push_back(ref_tablet->store());
}
- TabletSharedPtr olap_table;
- // Try to create table on each of all_available_root_path, util success
+ TabletSharedPtr tablet;
+ // Try to create tablet on each of all_available_root_path, util success
for (auto& store : stores) {
OLAPHeader* header = new OLAPHeader();
- OLAPStatus res = _create_new_table_header(request, store, is_schema_change_table, ref_olap_table, header);
+ OLAPStatus res = _create_new_tablet_header(request, store, is_schema_change_tablet, ref_tablet, header);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to create table header. [res=" << res << " root=" << store->path();
+ LOG(WARNING) << "fail to create tablet header. [res=" << res << " root=" << store->path();
break;
}
- olap_table = OLAPTable::create_from_header(header, store);
- if (olap_table == nullptr) {
- LOG(WARNING) << "fail to load olap table from header. root_path:%s" << store->path();
+ tablet = Tablet::create_from_header(header, store);
+ if (tablet == nullptr) {
+ LOG(WARNING) << "fail to load tablet from header. root_path:%s" << store->path();
break;
}
@@ -1498,14 +1498,14 @@ TabletSharedPtr OLAPEngine::create_table(
break;
}
- return olap_table;
+ return tablet;
}
OLAPStatus OLAPEngine::create_init_version(TTabletId tablet_id, SchemaHash schema_hash,
Version version, VersionHash version_hash) {
VLOG(3) << "begin to create init version. "
<< "begin=" << version.first << ", end=" << version.second;
- TabletSharedPtr table;
+ TabletSharedPtr tablet;
ColumnDataWriter* writer = NULL;
SegmentGroup* new_segment_group = NULL;
OLAPStatus res = OLAP_SUCCESS;
@@ -1519,64 +1519,64 @@ OLAPStatus OLAPEngine::create_init_version(TTabletId tablet_id, SchemaHash schem
break;
}
- // Get olap table and generate new index
- table = get_table(tablet_id, schema_hash);
- if (table.get() == NULL) {
- OLAP_LOG_WARNING("fail to find table. [table=%ld]", tablet_id);
+ // Get tablet and generate new index
+ tablet = get_tablet(tablet_id, schema_hash);
+ if (tablet.get() == NULL) {
+ OLAP_LOG_WARNING("fail to find tablet. [tablet=%ld]", tablet_id);
res = OLAP_ERR_TABLE_NOT_FOUND;
break;
}
- new_segment_group = new(nothrow) SegmentGroup(table.get(), version, version_hash, false, 0, 0);
+ new_segment_group = new(nothrow) SegmentGroup(tablet.get(), version, version_hash, false, 0, 0);
if (new_segment_group == NULL) {
- LOG(WARNING) << "fail to malloc index. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to malloc index. [tablet=" << tablet->full_name() << "]";
res = OLAP_ERR_MALLOC_ERROR;
break;
}
- // Create writer, which write nothing to table, to generate empty data file
- writer = ColumnDataWriter::create(table, new_segment_group, false);
+ // Create writer, which write nothing to tablet, to generate empty data file
+ writer = ColumnDataWriter::create(tablet, new_segment_group, false);
if (writer == NULL) {
- LOG(WARNING) << "fail to create writer. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to create writer. [tablet=" << tablet->full_name() << "]";
res = OLAP_ERR_MALLOC_ERROR;
break;
}
res = writer->finalize();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to finalize writer. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to finalize writer. [tablet=" << tablet->full_name() << "]";
break;
}
- // Load new index and add to table
+ // Load new index and add to tablet
res = new_segment_group->load();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to load new index. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to load new index. [tablet=" << tablet->full_name() << "]";
break;
}
- WriteLock wrlock(table->get_header_lock_ptr());
+ WriteLock wrlock(tablet->get_header_lock_ptr());
index_vec.push_back(new_segment_group);
- res = table->register_data_source(index_vec);
+ res = tablet->register_data_source(index_vec);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to register index to data sources. [table=%s]",
- table->full_name().c_str());
+ OLAP_LOG_WARNING("fail to register index to data sources. [tablet=%s]",
+ tablet->full_name().c_str());
break;
}
- res = table->save_header();
+ res = tablet->save_header();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to save header. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to save header. [tablet=" << tablet->full_name() << "]";
break;
}
} while (0);
// Unregister index and delete files(index and data) if failed
- if (res != OLAP_SUCCESS && table.get() != NULL) {
+ if (res != OLAP_SUCCESS && tablet.get() != NULL) {
std::vector<SegmentGroup*> unused_index;
- table->obtain_header_wrlock();
- table->unregister_data_source(version, &unused_index);
- table->release_header_lock();
+ tablet->obtain_header_wrlock();
+ tablet->unregister_data_source(version, &unused_index);
+ tablet->release_header_lock();
for (SegmentGroup* index : index_vec) {
index->delete_all_files();
@@ -1596,7 +1596,7 @@ bool OLAPEngine::try_schema_change_lock(TTabletId tablet_id) {
tablet_map_t::iterator it = _tablet_map.find(tablet_id);
if (it == _tablet_map.end()) {
- OLAP_LOG_WARNING("tablet does not exists. [table=%ld]", tablet_id);
+ OLAP_LOG_WARNING("tablet does not exists. [tablet=%ld]", tablet_id);
} else {
res = (it->second.schema_change_lock.trylock() == OLAP_SUCCESS);
}
@@ -1612,7 +1612,7 @@ void OLAPEngine::release_schema_change_lock(TTabletId tablet_id) {
tablet_map_t::iterator it = _tablet_map.find(tablet_id);
if (it == _tablet_map.end()) {
- OLAP_LOG_WARNING("tablet does not exists. [table=%ld]", tablet_id);
+ OLAP_LOG_WARNING("tablet does not exists. [tablet=%ld]", tablet_id);
} else {
it->second.schema_change_lock.unlock();
}
@@ -1621,24 +1621,24 @@ void OLAPEngine::release_schema_change_lock(TTabletId tablet_id) {
VLOG(3) << "release_schema_change_lock end. tablet_id=" << tablet_id;
}
-void OLAPEngine::_build_tablet_info(TabletSharedPtr olap_table, TTabletInfo* tablet_info) {
- tablet_info->tablet_id = olap_table->tablet_id();
- tablet_info->schema_hash = olap_table->schema_hash();
+void OLAPEngine::_build_tablet_info(TabletSharedPtr tablet, TTabletInfo* tablet_info) {
+ tablet_info->tablet_id = tablet->tablet_id();
+ tablet_info->schema_hash = tablet->schema_hash();
- olap_table->obtain_header_rdlock();
- tablet_info->row_count = olap_table->get_num_rows();
- tablet_info->data_size = olap_table->get_data_size();
- const PDelta* last_file_version = olap_table->lastest_version();
+ tablet->obtain_header_rdlock();
+ tablet_info->row_count = tablet->get_num_rows();
+ tablet_info->data_size = tablet->get_data_size();
+ const PDelta* last_file_version = tablet->lastest_version();
if (last_file_version == NULL) {
tablet_info->version = -1;
tablet_info->version_hash = 0;
} else {
// report the version before first missing version
vector<Version> missing_versions;
- olap_table->get_missing_versions_with_header_locked(
+ tablet->get_missing_versions_with_header_locked(
last_file_version->end_version(), &missing_versions);
const PDelta* least_complete_version =
- olap_table->least_complete_version(missing_versions);
+ tablet->least_complete_version(missing_versions);
if (least_complete_version == NULL) {
tablet_info->version = -1;
tablet_info->version_hash = 0;
@@ -1647,7 +1647,7 @@ void OLAPEngine::_build_tablet_info(TabletSharedPtr olap_table, TTabletInfo* tab
tablet_info->version_hash = least_complete_version->version_hash();
}
}
- olap_table->release_header_lock();
+ tablet->release_header_lock();
}
OLAPStatus OLAPEngine::report_tablet_info(TTabletInfo* tablet_info) {
@@ -1658,15 +1658,15 @@ OLAPStatus OLAPEngine::report_tablet_info(TTabletInfo* tablet_info) {
OLAPStatus res = OLAP_SUCCESS;
- TabletSharedPtr olap_table = get_table(
+ TabletSharedPtr tablet = get_tablet(
tablet_info->tablet_id, tablet_info->schema_hash);
- if (olap_table.get() == NULL) {
- OLAP_LOG_WARNING("can't find table. [table=%ld schema_hash=%d]",
+ if (tablet.get() == NULL) {
+ OLAP_LOG_WARNING("can't find tablet. [tablet=%ld schema_hash=%d]",
tablet_info->tablet_id, tablet_info->schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
- _build_tablet_info(olap_table, tablet_info);
+ _build_tablet_info(tablet, tablet_info);
LOG(INFO) << "success to process report tablet info.";
return res;
}
@@ -1686,25 +1686,25 @@ OLAPStatus OLAPEngine::report_all_tablets_info(std::map<TTabletId, TTablet>* tab
}
TTablet tablet;
- for (TabletSharedPtr olap_table : item.second.table_arr) {
- if (olap_table.get() == NULL) {
+ for (TabletSharedPtr tablet_ptr : item.second.table_arr) {
+ if (tablet_ptr == NULL) {
continue;
}
TTabletInfo tablet_info;
- _build_tablet_info(olap_table, &tablet_info);
+ _build_tablet_info(tablet_ptr, &tablet_info);
// report expire transaction
vector<int64_t> transaction_ids;
- olap_table->get_expire_pending_data(&transaction_ids);
+ tablet_ptr->get_expire_pending_data(&transaction_ids);
tablet_info.__set_transaction_ids(transaction_ids);
if (_available_storage_medium_type_count > 1) {
- tablet_info.__set_storage_medium(olap_table->store()->storage_medium());
+ tablet_info.__set_storage_medium(tablet_ptr->store()->storage_medium());
}
- tablet_info.__set_version_count(olap_table->file_delta_size());
- tablet_info.__set_path_hash(olap_table->store()->path_hash());
+ tablet_info.__set_version_count(tablet_ptr->file_delta_size());
+ tablet_info.__set_path_hash(tablet_ptr->store()->path_hash());
tablet.tablet_infos.push_back(tablet_info);
}
@@ -1747,17 +1747,17 @@ void OLAPEngine::_build_tablet_stat() {
TTabletStat stat;
stat.tablet_id = item.first;
- for (TabletSharedPtr olap_table : item.second.table_arr) {
- if (olap_table.get() == NULL) {
+ for (TabletSharedPtr tablet : item.second.table_arr) {
+ if (tablet.get() == NULL) {
continue;
}
// we only get base tablet's stat
- stat.__set_data_size(olap_table->get_data_size());
- stat.__set_row_num(olap_table->get_num_rows());
+ stat.__set_data_size(tablet->get_data_size());
+ stat.__set_row_num(tablet->get_num_rows());
VLOG(3) << "tablet_id=" << item.first
- << ", data_size=" << olap_table->get_data_size()
- << ", row_num:" << olap_table->get_num_rows();
+ << ", data_size=" << tablet->get_data_size()
+ << ", row_num:" << tablet->get_num_rows();
break;
}
@@ -1767,26 +1767,26 @@ void OLAPEngine::_build_tablet_stat() {
_tablet_stat_cache_update_time_ms = UnixMillis();
}
-bool OLAPEngine::_can_do_compaction(TabletSharedPtr table) {
+bool OLAPEngine::_can_do_compaction(TabletSharedPtr tablet) {
// 如果table正在做schema change,则通过选路判断数据是否转换完成
// 如果选路成功,则转换完成,可以进行BE
// 如果选路失败,则转换未完成,不能进行BE
- table->obtain_header_rdlock();
- const PDelta* lastest_version = table->lastest_version();
+ tablet->obtain_header_rdlock();
+ const PDelta* lastest_version = tablet->lastest_version();
if (lastest_version == NULL) {
- table->release_header_lock();
+ tablet->release_header_lock();
return false;
}
- if (table->is_schema_changing()) {
+ if (tablet->is_schema_changing()) {
Version test_version = Version(0, lastest_version->end_version());
vector<Version> path_versions;
- if (OLAP_SUCCESS != table->select_versions_to_span(test_version, &path_versions)) {
- table->release_header_lock();
+ if (OLAP_SUCCESS != tablet->select_versions_to_span(test_version, &path_versions)) {
+ tablet->release_header_lock();
return false;
}
}
- table->release_header_lock();
+ tablet->release_header_lock();
return true;
}
@@ -1798,46 +1798,46 @@ void OLAPEngine::start_clean_fd_cache() {
}
void OLAPEngine::perform_cumulative_compaction() {
- TabletSharedPtr best_table = _find_best_tablet_to_compaction(CompactionType::CUMULATIVE_COMPACTION);
- if (best_table == nullptr) { return; }
+ TabletSharedPtr best_tablet = _find_best_tablet_to_compaction(CompactionType::CUMULATIVE_COMPACTION);
+ if (best_tablet == nullptr) { return; }
CumulativeCompaction cumulative_compaction;
- OLAPStatus res = cumulative_compaction.init(best_table);
+ OLAPStatus res = cumulative_compaction.init(best_tablet);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "failed to init cumulative compaction."
- << "table=" << best_table->full_name();
+ << "tablet=" << best_tablet->full_name();
}
res = cumulative_compaction.run();
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "failed to do cumulative compaction."
- << "table=" << best_table->full_name();
+ << "tablet=" << best_tablet->full_name();
}
}
void OLAPEngine::perform_base_compaction() {
- TabletSharedPtr best_table = _find_best_tablet_to_compaction(CompactionType::BASE_COMPACTION);
- if (best_table == nullptr) { return; }
+ TabletSharedPtr best_tablet = _find_best_tablet_to_compaction(CompactionType::BASE_COMPACTION);
+ if (best_tablet == nullptr) { return; }
BaseCompaction base_compaction;
- OLAPStatus res = base_compaction.init(best_table);
+ OLAPStatus res = base_compaction.init(best_tablet);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "failed to init base compaction."
- << "table=" << best_table->full_name();
+ << "tablet=" << best_tablet->full_name();
return;
}
res = base_compaction.run();
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "failed to init base compaction."
- << "table=" << best_table->full_name();
+ << "tablet=" << best_tablet->full_name();
}
}
TabletSharedPtr OLAPEngine::_find_best_tablet_to_compaction(CompactionType compaction_type) {
ReadLock tablet_map_rdlock(&_tablet_map_lock);
uint32_t highest_score = 0;
- TabletSharedPtr best_table;
+ TabletSharedPtr best_tablet;
for (tablet_map_t::value_type& table_ins : _tablet_map){
for (TabletSharedPtr& table_ptr : table_ins.second.table_arr) {
if (!table_ptr->is_loaded() || !_can_do_compaction(table_ptr)) {
@@ -1853,11 +1853,11 @@ TabletSharedPtr OLAPEngine::_find_best_tablet_to_compaction(CompactionType compa
}
if (table_score > highest_score) {
highest_score = table_score;
- best_table = table_ptr;
+ best_tablet = table_ptr;
}
}
}
- return best_table;
+ return best_tablet;
}
void OLAPEngine::get_cache_status(rapidjson::Document* document) const {
@@ -1917,11 +1917,11 @@ OLAPStatus OLAPEngine::start_trash_sweep(double* usage) {
// clear expire incremental segment_group
_tablet_map_lock.rdlock();
for (const auto& item : _tablet_map) {
- for (TabletSharedPtr olap_table : item.second.table_arr) {
- if (olap_table.get() == NULL) {
+ for (TabletSharedPtr tablet : item.second.table_arr) {
+ if (tablet.get() == NULL) {
continue;
}
- olap_table->delete_expire_incremental_data();
+ tablet->delete_expire_incremental_data();
}
}
_tablet_map_lock.unlock();
@@ -1969,11 +1969,11 @@ OLAPStatus OLAPEngine::_do_sweep(
return res;
}
-OLAPStatus OLAPEngine::_create_new_table_header(
+OLAPStatus OLAPEngine::_create_new_tablet_header(
const TCreateTabletReq& request,
OlapStore* store,
- const bool is_schema_change_table,
- const TabletSharedPtr ref_olap_table,
+ const bool is_schema_change_tablet,
+ const TabletSharedPtr ref_tablet,
OLAPHeader* header) {
uint64_t shard = 0;
OLAPStatus res = store->get_shard(&shard);
@@ -2018,8 +2018,8 @@ OLAPStatus OLAPEngine::_create_new_table_header(
uint32_t key_count = 0;
bool has_bf_columns = false;
uint32_t next_unique_id = 0;
- if (true == is_schema_change_table) {
- next_unique_id = ref_olap_table->next_unique_id();
+ if (true == is_schema_change_tablet) {
+ next_unique_id = ref_tablet->next_unique_id();
}
for (TColumn column : request.tablet_schema.columns) {
if (column.column_type.type == TPrimitiveType::VARCHAR
@@ -2028,20 +2028,20 @@ OLAPStatus OLAPEngine::_create_new_table_header(
return OLAP_ERR_SCHEMA_SCHEMA_INVALID;
}
header->add_column();
- if (true == is_schema_change_table) {
+ if (true == is_schema_change_tablet) {
/*
- * for schema change, compare old_olap_table and new_olap_table
- * 1. if column in both new_olap_table and old_olap_table,
- * assign unique_id of old_olap_table to the column of new_olap_table
- * 2. if column exists only in new_olap_table, assign next_unique_id of old_olap_table
+ * for schema change, compare old_tablet and new_tablet
+ * 1. if column in both new_tablet and old_tablet,
+ * assign unique_id of old_tablet to the column of new_tablet
+ * 2. if column exists only in new_tablet, assign next_unique_id of old_tablet
* to the new column
*
*/
- size_t field_num = ref_olap_table->tablet_schema().size();
+ size_t field_num = ref_tablet->tablet_schema().size();
size_t field_off = 0;
for (field_off = 0; field_off < field_num; ++field_off) {
- if (ref_olap_table->tablet_schema()[field_off].name == column.column_name) {
- uint32_t unique_id = ref_olap_table->tablet_schema()[field_off].unique_id;
+ if (ref_tablet->tablet_schema()[field_off].name == column.column_name) {
+ uint32_t unique_id = ref_tablet->tablet_schema()[field_off].unique_id;
header->mutable_column(i)->set_unique_id(unique_id);
break;
}
@@ -2109,10 +2109,10 @@ OLAPStatus OLAPEngine::_create_new_table_header(
}
++i;
}
- if (true == is_schema_change_table){
+ if (true == is_schema_change_tablet){
/*
- * for schema change, next_unique_id of new olap table should be greater than
- * next_unique_id of old olap table
+ * for schema change, next_unique_id of new tablet should be greater than
+ * next_unique_id of old tablet
* */
header->set_next_column_unique_id(next_unique_id);
} else {
@@ -2157,32 +2157,32 @@ void OLAPEngine::_cancel_unfinished_schema_change() {
AlterTabletType type;
for (const auto& tablet_instance : _tablet_map) {
- for (TabletSharedPtr olap_table : tablet_instance.second.table_arr) {
- if (olap_table.get() == NULL) {
+ for (TabletSharedPtr tablet : tablet_instance.second.table_arr) {
+ if (tablet.get() == NULL) {
OLAP_LOG_WARNING("get empty TabletSharedPtr. [tablet_id=%ld]", tablet_instance.first);
continue;
}
- bool ret = olap_table->get_schema_change_request(
+ bool ret = tablet->get_schema_change_request(
&tablet_id, &schema_hash, &schema_change_versions, &type);
if (!ret) {
continue;
}
- TabletSharedPtr new_olap_table = get_table(tablet_id, schema_hash, false);
- if (new_olap_table.get() == NULL) {
- OLAP_LOG_WARNING("the table referenced by schema change cannot be found. "
+ TabletSharedPtr new_tablet = get_tablet(tablet_id, schema_hash, false);
+ if (new_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("the tablet referenced by schema change cannot be found. "
"schema change cancelled. [tablet='%s']",
- olap_table->full_name().c_str());
+ tablet->full_name().c_str());
continue;
}
// DORIS-3741. Upon restart, it should not clear schema change request.
- new_olap_table->set_schema_change_status(
- ALTER_TABLE_FAILED, new_olap_table->schema_hash(), -1);
- olap_table->set_schema_change_status(
- ALTER_TABLE_FAILED, olap_table->schema_hash(), -1);
- VLOG(3) << "cancel unfinished schema change. tablet=" << olap_table->full_name();
+ new_tablet->set_schema_change_status(
+ ALTER_TABLE_FAILED, new_tablet->schema_hash(), -1);
+ tablet->set_schema_change_status(
+ ALTER_TABLE_FAILED, tablet->schema_hash(), -1);
+ VLOG(3) << "cancel unfinished schema change. tablet=" << tablet->full_name();
++canceled_num;
}
}
@@ -2228,7 +2228,7 @@ void OLAPEngine::add_unused_index(SegmentGroup* segment_group) {
}
OLAPStatus OLAPEngine::_create_init_version(
- TabletSharedPtr olap_table, const TCreateTabletReq& request) {
+ TabletSharedPtr tablet, const TCreateTabletReq& request) {
OLAPStatus res = OLAP_SUCCESS;
if (request.version < 1) {
@@ -2256,89 +2256,89 @@ OLAPStatus OLAPEngine::_create_init_version(
}
}
- olap_table->obtain_header_wrlock();
- olap_table->set_cumulative_layer_point(request.version + 1);
- res = olap_table->save_header();
- olap_table->release_header_lock();
+ tablet->obtain_header_wrlock();
+ tablet->set_cumulative_layer_point(request.version + 1);
+ res = tablet->save_header();
+ tablet->release_header_lock();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to save header. [table=" << olap_table->full_name() << "]";
+ LOG(WARNING) << "fail to save header. [tablet=" << tablet->full_name() << "]";
}
return res;
}
// TODO(zc): refactor this funciton
-OLAPStatus OLAPEngine::create_table(const TCreateTabletReq& request) {
+OLAPStatus OLAPEngine::create_tablet(const TCreateTabletReq& request) {
OLAPStatus res = OLAP_SUCCESS;
- bool is_table_added = false;
+ bool is_tablet_added = false;
- LOG(INFO) << "begin to process create table. tablet=" << request.tablet_id
+ LOG(INFO) << "begin to process create tablet. tablet=" << request.tablet_id
<< ", schema_hash=" << request.tablet_schema.schema_hash;
DorisMetrics::create_tablet_requests_total.increment(1);
- // 1. Make sure create_table operation is idempotent:
- // return success if table with same tablet_id and schema_hash exist,
- // false if table with same tablet_id but different schema_hash exist
+ // 1. Make sure create_tablet operation is idempotent:
+ // return success if tablet with same tablet_id and schema_hash exist,
+ // false if tablet with same tablet_id but different schema_hash exist
if (check_tablet_id_exist(request.tablet_id)) {
- TabletSharedPtr table = get_table(
+ TabletSharedPtr tablet = get_tablet(
request.tablet_id, request.tablet_schema.schema_hash);
- if (table.get() != NULL) {
- LOG(INFO) << "create table success for table already exist.";
+ if (tablet.get() != NULL) {
+ LOG(INFO) << "create tablet success for tablet already exist.";
return OLAP_SUCCESS;
} else {
- OLAP_LOG_WARNING("table with different schema hash already exists.");
+ OLAP_LOG_WARNING("tablet with different schema hash already exists.");
return OLAP_ERR_CE_TABLET_ID_EXIST;
}
}
- // 2. Lock to ensure that all create_table operation execute in serial
- static Mutex create_table_lock;
- MutexLock auto_lock(&create_table_lock);
+ // 2. Lock to ensure that all create_tablet operation execute in serial
+ static Mutex create_tablet_lock;
+ MutexLock auto_lock(&create_tablet_lock);
- TabletSharedPtr olap_table;
+ TabletSharedPtr tablet;
do {
- // 3. Create table with only header, no deltas
- olap_table = create_table(request, NULL, false, NULL);
- if (olap_table == NULL) {
+ // 3. Create tablet with only header, no deltas
+ tablet = create_tablet(request, NULL, false, NULL);
+ if (tablet == NULL) {
res = OLAP_ERR_CE_CMD_PARAMS_ERROR;
- OLAP_LOG_WARNING("fail to create olap table. [res=%d]", res);
+ OLAP_LOG_WARNING("fail to create tablet. [res=%d]", res);
break;
}
- // 4. Add table to OlapEngine will make it visiable to user
- res = add_table(
- request.tablet_id, request.tablet_schema.schema_hash, olap_table);
+ // 4. Add tablet to OlapEngine will make it visiable to user
+ res = add_tablet(
+ request.tablet_id, request.tablet_schema.schema_hash, tablet);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to add table to OLAPEngine. [res=%d]", res);
+ OLAP_LOG_WARNING("fail to add tablet to OLAPEngine. [res=%d]", res);
break;
}
- is_table_added = true;
+ is_tablet_added = true;
- TabletSharedPtr olap_table_ptr = get_table(
+ TabletSharedPtr tablet_ptr = get_tablet(
request.tablet_id, request.tablet_schema.schema_hash);
- if (olap_table_ptr.get() == NULL) {
+ if (tablet_ptr.get() == NULL) {
res = OLAP_ERR_TABLE_NOT_FOUND;
- OLAP_LOG_WARNING("fail to get table. [res=%d]", res);
+ OLAP_LOG_WARNING("fail to get tablet. [res=%d]", res);
break;
}
- // 5. Register table into OLAPEngine, so that we can manage table from
+ // 5. Register tablet into OLAPEngine, so that we can manage tablet from
// the perspective of root path.
// Example: unregister all tables when a bad disk found.
- res = register_table_into_root_path(olap_table_ptr.get());
+ res = register_tablet_into_root_path(tablet_ptr.get());
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to register table into OLAPEngine. [res=%d, root_path=%s]",
- res, olap_table_ptr->storage_root_path_name().c_str());
+ OLAP_LOG_WARNING("fail to register tablet into OLAPEngine. [res=%d, root_path=%s]",
+ res, tablet_ptr->storage_root_path_name().c_str());
break;
}
// 6. Create init version if this is not a restore mode replica and request.version is set
// bool in_restore_mode = request.__isset.in_restore_mode && request.in_restore_mode;
// if (!in_restore_mode && request.__isset.version) {
- res = _create_init_version(olap_table_ptr, request);
+ res = _create_init_version(tablet_ptr, request);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to create initial version for table. [res=%d]", res);
+ OLAP_LOG_WARNING("fail to create initial version for tablet. [res=%d]", res);
}
// }
} while (0);
@@ -2346,18 +2346,18 @@ OLAPStatus OLAPEngine::create_table(const TCreateTabletReq& request) {
// 7. clear environment
if (res != OLAP_SUCCESS) {
DorisMetrics::create_tablet_requests_failed.increment(1);
- if (is_table_added) {
- OLAPStatus status = drop_table(
+ if (is_tablet_added) {
+ OLAPStatus status = drop_tablet(
request.tablet_id, request.tablet_schema.schema_hash);
if (status != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to drop table when create table failed. [res=%d]", res);
+ OLAP_LOG_WARNING("fail to drop tablet when create tablet failed. [res=%d]", res);
}
- } else if (NULL != olap_table) {
- olap_table->delete_all_files();
+ } else if (NULL != tablet) {
+ tablet->delete_all_files();
}
}
- LOG(INFO) << "finish to process create table. res=" << res;
+ LOG(INFO) << "finish to process create tablet. res=" << res;
return res;
}
@@ -2370,11 +2370,11 @@ OLAPStatus OLAPEngine::schema_change(const TAlterTabletReq& request) {
OLAPStatus res = OLAP_SUCCESS;
SchemaChangeHandler handler;
- res = handler.process_alter_table(ALTER_TABLET_SCHEMA_CHANGE, request);
+ res = handler.process_alter_tablet(ALTER_TABLET_SCHEMA_CHANGE, request);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("failed to do schema change. "
- "[base_table=%ld new_table=%ld] [res=%d]",
+ "[base_tablet=%ld new_tablet=%ld] [res=%d]",
request.base_tablet_id, request.new_tablet_req.tablet_id, res);
DorisMetrics::schema_change_requests_failed.increment(1);
return res;
@@ -2386,8 +2386,8 @@ OLAPStatus OLAPEngine::schema_change(const TAlterTabletReq& request) {
return res;
}
-OLAPStatus OLAPEngine::create_rollup_table(const TAlterTabletReq& request) {
- LOG(INFO) << "begin to create rollup table. "
+OLAPStatus OLAPEngine::create_rollup_tablet(const TAlterTabletReq& request) {
+ LOG(INFO) << "begin to create rollup tablet. "
<< "old_tablet_id=" << request.base_tablet_id
<< ", new_tablet_id=" << request.new_tablet_req.tablet_id;
@@ -2396,38 +2396,38 @@ OLAPStatus OLAPEngine::create_rollup_table(const TAlterTabletReq& request) {
OLAPStatus res = OLAP_SUCCESS;
SchemaChangeHandler handler;
- res = handler.process_alter_table(ALTER_TABLET_CREATE_ROLLUP_TABLE, request);
+ res = handler.process_alter_tablet(ALTER_TABLET_CREATE_ROLLUP_TABLE, request);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("failed to do rollup. "
- "[base_table=%ld new_table=%ld] [res=%d]",
+ "[base_tablet=%ld new_tablet=%ld] [res=%d]",
request.base_tablet_id, request.new_tablet_req.tablet_id, res);
DorisMetrics::create_rollup_requests_failed.increment(1);
return res;
}
- LOG(INFO) << "success to create rollup table. res=" << res
+ LOG(INFO) << "success to create rollup tablet. res=" << res
<< ", old_tablet_id=" << request.base_tablet_id
<< ", new_tablet_id=" << request.new_tablet_req.tablet_id;
return res;
}
-AlterTableStatus OLAPEngine::show_alter_table_status(
+AlterTableStatus OLAPEngine::show_alter_tablet_status(
TTabletId tablet_id,
TSchemaHash schema_hash) {
- LOG(INFO) << "begin to process show alter table status."
+ LOG(INFO) << "begin to process show alter tablet status."
<< "tablet_id" << tablet_id
<< ", schema_hash" << schema_hash;
AlterTableStatus status = ALTER_TABLE_FINISHED;
- TabletSharedPtr table = OLAPEngine::get_instance()->get_table(tablet_id, schema_hash);
- if (table.get() == NULL) {
- OLAP_LOG_WARNING("fail to get table. [table=%ld schema_hash=%d]",
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(tablet_id, schema_hash);
+ if (tablet.get() == NULL) {
+ OLAP_LOG_WARNING("fail to get tablet. [tablet=%ld schema_hash=%d]",
tablet_id, schema_hash);
status = ALTER_TABLE_FAILED;
} else {
- status = table->schema_change_status().status;
+ status = tablet->schema_change_status().status;
}
return status;
@@ -2450,7 +2450,7 @@ OLAPStatus OLAPEngine::compute_checksum(
return OLAP_ERR_CE_CMD_PARAMS_ERROR;
}
- TabletSharedPtr tablet = get_table(tablet_id, schema_hash);
+ TabletSharedPtr tablet = get_tablet(tablet_id, schema_hash);
if (NULL == tablet.get()) {
OLAP_LOG_WARNING("can't find tablet. [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
@@ -2476,7 +2476,7 @@ OLAPStatus OLAPEngine::compute_checksum(
Reader reader;
ReaderParams reader_params;
- reader_params.olap_table = tablet;
+ reader_params.tablet = tablet;
reader_params.reader_type = READER_CHECKSUM;
reader_params.version = Version(0, version);
@@ -2537,35 +2537,35 @@ OLAPStatus OLAPEngine::cancel_delete(const TCancelDeleteDataReq& request) {
list<TabletSharedPtr> table_list;
res = get_tables_by_id(request.tablet_id, &table_list);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("can't find table. [table=%ld]", request.tablet_id);
+ OLAP_LOG_WARNING("can't find tablet. [tablet=%ld]", request.tablet_id);
return OLAP_ERR_TABLE_NOT_FOUND;
}
// 2. Remove delete conditions from each tablet.
DeleteConditionHandler cond_handler;
- for (TabletSharedPtr temp_table : table_list) {
- temp_table->obtain_header_wrlock();
- res = cond_handler.delete_cond(temp_table, request.version, false);
+ for (TabletSharedPtr temp_tablet : table_list) {
+ temp_tablet->obtain_header_wrlock();
+ res = cond_handler.delete_cond(temp_tablet, request.version, false);
if (res != OLAP_SUCCESS) {
- temp_table->release_header_lock();
- OLAP_LOG_WARNING("cancel delete failed. [res=%d table=%s]",
- res, temp_table->full_name().c_str());
+ temp_tablet->release_header_lock();
+ OLAP_LOG_WARNING("cancel delete failed. [res=%d tablet=%s]",
+ res, temp_tablet->full_name().c_str());
break;
}
- res = temp_table->save_header();
+ res = temp_tablet->save_header();
if (res != OLAP_SUCCESS) {
- temp_table->release_header_lock();
- OLAP_LOG_WARNING("fail to save header. [res=%d table=%s]",
- res, temp_table->full_name().c_str());
+ temp_tablet->release_header_lock();
+ OLAP_LOG_WARNING("fail to save header. [res=%d tablet=%s]",
+ res, temp_tablet->full_name().c_str());
break;
}
- temp_table->release_header_lock();
+ temp_tablet->release_header_lock();
}
// Show delete conditions in tablet header.
- for (TabletSharedPtr table : table_list) {
- cond_handler.log_conds(table);
+ for (TabletSharedPtr tablet : table_list) {
+ cond_handler.log_conds(tablet);
}
LOG(INFO) << "finish to process cancel delete. res=" << res;
@@ -2586,9 +2586,9 @@ OLAPStatus OLAPEngine::delete_data(
}
// 1. Get all tablets with same tablet_id
- TabletSharedPtr table = get_table(request.tablet_id, request.schema_hash);
- if (table.get() == NULL) {
- OLAP_LOG_WARNING("can't find table. [table=%ld schema_hash=%d]",
+ TabletSharedPtr tablet = get_tablet(request.tablet_id, request.schema_hash);
+ if (tablet.get() == NULL) {
+ OLAP_LOG_WARNING("can't find tablet. [tablet=%ld schema_hash=%d]",
request.tablet_id, request.schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
@@ -2596,15 +2596,15 @@ OLAPStatus OLAPEngine::delete_data(
// 2. Process delete data by push interface
PushHandler push_handler;
if (request.__isset.transaction_id) {
- res = push_handler.process_realtime_push(table, request, PUSH_FOR_DELETE, tablet_info_vec);
+ res = push_handler.process_realtime_push(tablet, request, PUSH_FOR_DELETE, tablet_info_vec);
} else {
res = OLAP_ERR_PUSH_BATCH_PROCESS_REMOVED;
}
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to push empty version for delete data. "
- "[res=%d table='%s']",
- res, table->full_name().c_str());
+ "[res=%d tablet='%s']",
+ res, tablet->full_name().c_str());
DorisMetrics::delete_requests_failed.increment(1);
return res;
}
@@ -2615,10 +2615,10 @@ OLAPStatus OLAPEngine::delete_data(
OLAPStatus OLAPEngine::recover_tablet_until_specfic_version(
const TRecoverTabletReq& recover_tablet_req) {
- TabletSharedPtr table = get_table(recover_tablet_req.tablet_id,
+ TabletSharedPtr tablet = get_tablet(recover_tablet_req.tablet_id,
recover_tablet_req.schema_hash);
- if (table == nullptr) { return OLAP_ERR_TABLE_NOT_FOUND; }
- RETURN_NOT_OK(table->recover_tablet_until_specfic_version(recover_tablet_req.version,
+ if (tablet == nullptr) { return OLAP_ERR_TABLE_NOT_FOUND; }
+ RETURN_NOT_OK(tablet->recover_tablet_until_specfic_version(recover_tablet_req.version,
recover_tablet_req.version_hash));
return OLAP_SUCCESS;
}
@@ -2637,12 +2637,12 @@ string OLAPEngine::get_info_before_incremental_clone(TabletSharedPtr tablet,
// TODO: Used in upgraded. If old Doris version, version can be converted.
Version version(least_complete_version->start_version(), least_complete_version->end_version());
missing_versions->push_back(version);
- LOG(INFO) << "least complete version for incremental clone. table=" << tablet->full_name()
+ LOG(INFO) << "least complete version for incremental clone. tablet=" << tablet->full_name()
<< ", least_complete_version=" << least_complete_version->end_version();
}
tablet->release_header_lock();
- LOG(INFO) << "finish to calculate missing versions when clone. [table=" << tablet->full_name()
+ LOG(INFO) << "finish to calculate missing versions when clone. [tablet=" << tablet->full_name()
<< ", committed_version=" << committed_version << " missing_versions_size=" << missing_versions->size() << "]";
// get download path
@@ -2760,9 +2760,9 @@ OLAPStatus OLAPEngine::obtain_shard_path(
return OLAP_ERR_CE_CMD_PARAMS_ERROR;
}
- auto stores = OLAPEngine::get_instance()->get_stores_for_create_table(storage_medium);
+ auto stores = OLAPEngine::get_instance()->get_stores_for_create_tablet(storage_medium);
if (stores.empty()) {
- OLAP_LOG_WARNING("no available disk can be used to create table.");
+ OLAP_LOG_WARNING("no available disk can be used to create tablet.");
return OLAP_ERR_NO_AVAILABLE_ROOT_PATH;
}
@@ -2854,7 +2854,7 @@ OLAPStatus OLAPEngine::clear_alter_task(const TTabletId tablet_id,
const TSchemaHash schema_hash) {
LOG(INFO) << "begin to process clear alter task. tablet_id=" << tablet_id
<< ", schema_hash=" << schema_hash;
- TabletSharedPtr tablet = get_table(tablet_id, schema_hash);
+ TabletSharedPtr tablet = get_tablet(tablet_id, schema_hash);
if (tablet.get() == NULL) {
OLAP_LOG_WARNING("can't find tablet when process clear alter task. ",
"[tablet_id=%ld, schema_hash=%d]", tablet_id, schema_hash);
@@ -2891,23 +2891,23 @@ OLAPStatus OLAPEngine::clear_alter_task(const TTabletId tablet_id,
tablet->release_header_lock();
// clear related tablet's schema change info
- TabletSharedPtr related_table = get_table(related_tablet_id, related_schema_hash);
- if (related_table.get() == NULL) {
- OLAP_LOG_WARNING("related table not found when process clear alter task. "
+ TabletSharedPtr related_tablet = get_tablet(related_tablet_id, related_schema_hash);
+ if (related_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("related tablet not found when process clear alter task. "
"[tablet_id=%ld schema_hash=%d "
"related_tablet_id=%ld related_schema_hash=%d]",
tablet_id, schema_hash, related_tablet_id, related_schema_hash);
} else {
- related_table->obtain_header_wrlock();
- related_table->clear_schema_change_request();
- res = related_table->save_header();
+ related_tablet->obtain_header_wrlock();
+ related_tablet->clear_schema_change_request();
+ res = related_tablet->save_header();
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "fail to save header. [res=" << res << " tablet='"
- << related_table->full_name() << "']";
+ << related_tablet->full_name() << "']";
} else {
- LOG(INFO) << "clear alter task on tablet. [tablet='" << related_table->full_name() << "']";
+ LOG(INFO) << "clear alter task on tablet. [tablet='" << related_tablet->full_name() << "']";
}
- related_table->release_header_lock();
+ related_tablet->release_header_lock();
}
LOG(INFO) << "finish to process clear alter task."
@@ -2929,10 +2929,10 @@ OLAPStatus OLAPEngine::push(
return OLAP_ERR_CE_CMD_PARAMS_ERROR;
}
- TabletSharedPtr olap_table = OLAPEngine::get_instance()->get_table(
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(
request.tablet_id, request.schema_hash);
- if (NULL == olap_table.get()) {
- OLAP_LOG_WARNING("false to find table. [table=%ld schema_hash=%d]",
+ if (NULL == tablet.get()) {
+ OLAP_LOG_WARNING("false to find tablet. [tablet=%ld schema_hash=%d]",
request.tablet_id, request.schema_hash);
DorisMetrics::push_requests_fail_total.increment(1);
return OLAP_ERR_TABLE_NOT_FOUND;
@@ -2948,7 +2948,7 @@ OLAPStatus OLAPEngine::push(
if (request.__isset.transaction_id) {
{
SCOPED_RAW_TIMER(&duration_ns);
- res = push_handler.process_realtime_push(olap_table, request, type, tablet_info_vec);
+ res = push_handler.process_realtime_push(tablet, request, type, tablet_info_vec);
}
} else {
{
@@ -2958,11 +2958,11 @@ OLAPStatus OLAPEngine::push(
}
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to push delta, table=" << olap_table->full_name().c_str()
+ LOG(WARNING) << "fail to push delta, tablet=" << tablet->full_name().c_str()
<< ",cost=" << PrettyPrinter::print(duration_ns, TUnit::TIME_NS);
DorisMetrics::push_requests_fail_total.increment(1);
} else {
- LOG(INFO) << "success to push delta, table=" << olap_table->full_name().c_str()
+ LOG(INFO) << "success to push delta, tablet=" << tablet->full_name().c_str()
<< ",cost=" << PrettyPrinter::print(duration_ns, TUnit::TIME_NS);
DorisMetrics::push_requests_success_total.increment(1);
DorisMetrics::push_request_duration_us.increment(duration_ns / 1000);
diff --git a/be/src/olap/olap_engine.h b/be/src/olap/olap_engine.h
index 21dad561..5415cb65 100644
--- a/be/src/olap/olap_engine.h
+++ b/be/src/olap/olap_engine.h
@@ -40,13 +40,13 @@
#include "olap/lru_cache.h"
#include "olap/olap_common.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/olap_meta.h"
#include "olap/options.h"
namespace doris {
-class OLAPTable;
+class Tablet;
class OlapStore;
struct RootPathInfo {
@@ -85,31 +85,31 @@ class OLAPEngine {
return _s_instance;
}
- // Get table pointer
- TabletSharedPtr get_table(TTabletId tablet_id, SchemaHash schema_hash, bool load_table = true);
+ // Get tablet pointer
+ TabletSharedPtr get_tablet(TTabletId tablet_id, SchemaHash schema_hash, bool load_tablet = true);
OLAPStatus get_tables_by_id(TTabletId tablet_id, std::list<TabletSharedPtr>* table_list);
bool check_tablet_id_exist(TTabletId tablet_id);
- OLAPStatus create_table(const TCreateTabletReq& request);
+ OLAPStatus create_tablet(const TCreateTabletReq& request);
- // Create new table for OLAPEngine
+ // Create new tablet for OLAPEngine
//
- // Return OLAPTable * succeeded; Otherwise, return NULL if failed
- TabletSharedPtr create_table(const TCreateTabletReq& request,
+ // Return Tablet * succeeded; Otherwise, return NULL if failed
+ TabletSharedPtr create_tablet(const TCreateTabletReq& request,
const std::string* ref_root_path,
- const bool is_schema_change_table,
- const TabletSharedPtr ref_olap_table);
+ const bool is_schema_change_tablet,
+ const TabletSharedPtr ref_tablet);
- // Add a table pointer to OLAPEngine
- // If force, drop the existing table add this new one
+ // Add a tablet pointer to OLAPEngine
+ // If force, drop the existing tablet add this new one
//
// Return OLAP_SUCCESS, if run ok
// OLAP_ERR_TABLE_INSERT_DUPLICATION_ERROR, if find duplication
// OLAP_ERR_NOT_INITED, if not inited
- OLAPStatus add_table(TTabletId tablet_id, SchemaHash schema_hash,
- const TabletSharedPtr& table, bool force = false);
+ OLAPStatus add_tablet(TTabletId tablet_id, SchemaHash schema_hash,
+ const TabletSharedPtr& tablet, bool force = false);
OLAPStatus add_transaction(TPartitionId partition_id, TTransactionId transaction_id,
TTabletId tablet_id, SchemaHash schema_hash,
@@ -136,24 +136,24 @@ class OLAPEngine {
OLAPStatus clone_full_data(TabletSharedPtr tablet, OLAPHeader& clone_header);
- // Add empty data for OLAPTable
+ // Add empty data for Tablet
//
// Return OLAP_SUCCESS, if run ok
OLAPStatus create_init_version(
TTabletId tablet_id, SchemaHash schema_hash,
Version version, VersionHash version_hash);
- // Drop a table by description
+ // Drop a tablet by description
// If set keep_files == true, files will NOT be deleted when deconstruction.
// Return OLAP_SUCCESS, if run ok
- // OLAP_ERR_TABLE_DELETE_NOEXIST_ERROR, if table not exist
+ // OLAP_ERR_TABLE_DELETE_NOEXIST_ERROR, if tablet not exist
// OLAP_ERR_NOT_INITED, if not inited
- OLAPStatus drop_table(
+ OLAPStatus drop_tablet(
TTabletId tablet_id, SchemaHash schema_hash, bool keep_files = false);
- // Drop table directly with check schema change info.
- OLAPStatus _drop_table_directly(TTabletId tablet_id, TSchemaHash schema_hash, bool keep_files = false);
- OLAPStatus _drop_table_directly_unlocked(TTabletId tablet_id, TSchemaHash schema_hash, bool keep_files = false);
+ // Drop tablet directly with check schema change info.
+ OLAPStatus _drop_tablet_directly(TTabletId tablet_id, TSchemaHash schema_hash, bool keep_files = false);
+ OLAPStatus _drop_tablet_directly_unlocked(TTabletId tablet_id, TSchemaHash schema_hash, bool keep_files = false);
OLAPStatus drop_tables_on_error_root_path(const std::vector<TabletInfo>& tablet_info_vec);
@@ -184,11 +184,11 @@ class OLAPEngine {
// 获取cache的使用情况信息
void get_cache_status(rapidjson::Document* document) const;
- void check_none_row_oriented_table(const std::vector<OlapStore*>& stores);
- OLAPStatus check_none_row_oriented_table_in_path(
+ void check_none_row_oriented_tablet(const std::vector<OlapStore*>& stores);
+ OLAPStatus check_none_row_oriented_tablet_in_path(
OlapStore* store, TTabletId tablet_id,
SchemaHash schema_hash, const std::string& schema_hash_path);
- OLAPStatus _check_none_row_oriented_table_in_store(OlapStore* store);
+ OLAPStatus _check_none_row_oriented_tablet_in_store(OlapStore* store);
// Note: 这里只能reload原先已经存在的root path,即re-load启动时就登记的root path
// 是允许的,但re-load全新的path是不允许的,因为此处没有彻底更新ce调度器信息
@@ -219,7 +219,7 @@ class OLAPEngine {
void get_all_available_root_path(std::vector<std::string>* available_paths);
- OLAPStatus register_table_into_root_path(OLAPTable* olap_table);
+ OLAPStatus register_tablet_into_root_path(Tablet* tablet);
// 磁盘状态监测。监测unused_flag路劲新的对应root_path unused标识位,
// 当检测到有unused标识时,从内存中删除对应表信息,磁盘数据不动。
@@ -227,9 +227,9 @@ class OLAPEngine {
// 重新加载数据。
void start_disk_stat_monitor();
- // get root path for creating table. The returned vector of root path should be random,
- // for avoiding that all the table would be deployed one disk.
- std::vector<OlapStore*> get_stores_for_create_table(
+ // get root path for creating tablet. The returned vector of root path should be random,
+ // for avoiding that all the tablet would be deployed one disk.
+ std::vector<OlapStore*> get_stores_for_create_tablet(
TStorageMedium::type storage_medium);
OlapStore* get_store(const std::string& path);
@@ -272,12 +272,12 @@ class OLAPEngine {
// the main logical is that generating a new tablet with different
// schema on base tablet.
- // Create rollup tablet on base tablet, after create_rollup_table,
+ // Create rollup tablet on base tablet, after create_rollup_tablet,
// both base tablet and new tablet is effective.
//
// @param [in] request specify base tablet, new tablet and its schema
// @return OLAP_SUCCESS if submit success
- OLAPStatus create_rollup_table(const TAlterTabletReq& request);
+ OLAPStatus create_rollup_tablet(const TAlterTabletReq& request);
// Do schema change on tablet, OLAPEngine support
// add column, drop column, alter column type and order,
@@ -288,11 +288,11 @@ class OLAPEngine {
// @return OLAP_SUCCESS if submit success
OLAPStatus schema_change(const TAlterTabletReq& request);
- // Show status of all alter table operation.
+ // Show status of all alter tablet operation.
//
// @param [in] tablet_id & schema_hash specify a tablet
- // @return alter table status
- AlterTableStatus show_alter_table_status(TTabletId tablet_id, TSchemaHash schema_hash);
+ // @return alter tablet status
+ AlterTableStatus show_alter_tablet_status(TTabletId tablet_id, TSchemaHash schema_hash);
OLAPStatus compute_checksum(
TTabletId tablet_id,
@@ -364,7 +364,7 @@ class OLAPEngine {
std::unique_lock<std::mutex> lk(_report_mtx);
auto cv_status = _report_cv.wait_for(lk, std::chrono::seconds(timeout_sec));
if (cv_status == std::cv_status::no_timeout) {
- is_tablet_report ? _is_report_olap_table_already = true :
+ is_tablet_report ? _is_report_tablet_already = true :
_is_report_disk_state_already = true;
}
}
@@ -389,15 +389,15 @@ class OLAPEngine {
OLAPStatus _judge_and_update_effective_cluster_id(int32_t cluster_id);
OLAPStatus _calc_snapshot_id_path(
- const TabletSharedPtr& olap_table,
+ const TabletSharedPtr& tablet,
std::string* out_path);
std::string _get_schema_hash_full_path(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const std::string& location) const;
std::string _get_header_full_path(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const std::string& schema_hash_path) const;
void _update_header_file_info(
@@ -406,25 +406,25 @@ class OLAPEngine {
OLAPStatus _link_index_and_data_files(
const std::string& header_path,
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const std::vector<VersionEntity>& version_entity_vec);
OLAPStatus _copy_index_and_data_files(
const std::string& header_path,
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
std::vector<VersionEntity>& version_entity_vec);
OLAPStatus _create_snapshot_files(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const TSnapshotRequest& request,
std::string* snapshot_path);
OLAPStatus _create_incremental_snapshot_files(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const TSnapshotRequest& request,
std::string* snapshot_path);
- OLAPStatus _prepare_snapshot_dir(const TabletSharedPtr& ref_olap_table,
+ OLAPStatus _prepare_snapshot_dir(const TabletSharedPtr& ref_tablet,
std::string* snapshot_id_path);
OLAPStatus _append_single_delta(
@@ -453,7 +453,7 @@ class OLAPEngine {
OLAPStatus _start_bg_worker();
- OLAPStatus _create_init_version(TabletSharedPtr olap_table, const TCreateTabletReq& request);
+ OLAPStatus _create_init_version(TabletSharedPtr tablet, const TCreateTabletReq& request);
private:
struct TableInstances {
@@ -497,7 +497,7 @@ class OLAPEngine {
typedef std::map<int64_t, TableInstances> tablet_map_t;
typedef std::map<std::string, uint32_t> file_system_task_count_t;
- TabletSharedPtr _get_table_with_no_lock(TTabletId tablet_id, SchemaHash schema_hash);
+ TabletSharedPtr _get_tablet_with_no_lock(TTabletId tablet_id, SchemaHash schema_hash);
// 遍历root所指定目录, 通过dirs返回此目录下所有有文件夹的名字, files返回所有文件的名字
OLAPStatus _dir_walk(const std::string& root,
@@ -507,23 +507,23 @@ class OLAPEngine {
// 扫描目录, 加载表
OLAPStatus _load_store(OlapStore* store);
- OLAPStatus _create_new_table_header(const TCreateTabletReq& request,
+ OLAPStatus _create_new_tablet_header(const TCreateTabletReq& request,
OlapStore* store,
- const bool is_schema_change_table,
- const TabletSharedPtr ref_olap_table,
+ const bool is_schema_change_tablet,
+ const TabletSharedPtr ref_tablet,
OLAPHeader* header);
OLAPStatus _check_existed_or_else_create_dir(const std::string& path);
TabletSharedPtr _find_best_tablet_to_compaction(CompactionType compaction_type);
- bool _can_do_compaction(TabletSharedPtr table);
+ bool _can_do_compaction(TabletSharedPtr tablet);
void _cancel_unfinished_schema_change();
OLAPStatus _do_sweep(
const std::string& scan_root, const time_t& local_tm_now, const uint32_t expire);
- void _build_tablet_info(TabletSharedPtr olap_table, TTabletInfo* tablet_info);
+ void _build_tablet_info(TabletSharedPtr tablet, TTabletInfo* tablet_info);
void _build_tablet_stat();
EngineOptions _options;
@@ -543,7 +543,7 @@ class OLAPEngine {
RWMutex _transaction_tablet_map_lock;
using TxnKey = std::pair<int64_t, int64_t>; // partition_id, transaction_id;
std::map<TxnKey, std::map<TabletInfo, std::vector<PUniqueId>>> _transaction_tablet_map;
- size_t _global_table_id;
+ size_t _global_tablet_id;
Cache* _file_descriptor_lru_cache;
Cache* _index_stream_lru_cache;
uint32_t _max_base_compaction_task_per_disk;
@@ -576,7 +576,7 @@ class OLAPEngine {
// garbage sweep thread process function. clear snapshot and trash folder
void* _garbage_sweeper_thread_callback(void* arg);
- // delete table with io error process function
+ // delete tablet with io error process function
void* _disk_stat_monitor_thread_callback(void* arg);
// unused index process function
@@ -611,7 +611,7 @@ class OLAPEngine {
std::mutex _report_mtx;
std::condition_variable _report_cv;
std::atomic_bool _is_report_disk_state_already;
- std::atomic_bool _is_report_olap_table_already;
+ std::atomic_bool _is_report_tablet_already;
};
} // namespace doris
diff --git a/be/src/olap/olap_header.h b/be/src/olap/olap_header.h
index f29bffc1..88a03430 100644
--- a/be/src/olap/olap_header.h
+++ b/be/src/olap/olap_header.h
@@ -29,7 +29,7 @@
#include "olap/olap_define.h"
namespace doris {
-// Class for managing olap table header.
+// Class for managing tablet header.
class OLAPHeader : public OLAPHeaderMessage {
public:
explicit OLAPHeader() :
diff --git a/be/src/olap/olap_header_manager.h b/be/src/olap/olap_header_manager.h
index c74be38c..4cd40d1f 100644
--- a/be/src/olap/olap_header_manager.h
+++ b/be/src/olap/olap_header_manager.h
@@ -26,7 +26,7 @@
namespace doris {
-// Helper Class for managing olap table headers of one root path.
+// Helper Class for managing tablet headers of one root path.
class OlapHeaderManager {
public:
static OLAPStatus get_header(OlapStore* store, TTabletId tablet_id, TSchemaHash schema_hash, OLAPHeader* header);
diff --git a/be/src/olap/olap_index.cpp b/be/src/olap/olap_index.cpp
index 5fbc81cf..26ddbec9 100644
--- a/be/src/olap/olap_index.cpp
+++ b/be/src/olap/olap_index.cpp
@@ -23,7 +23,7 @@
#include <fstream>
#include "olap/column_data.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_block.h"
#include "olap/row_cursor.h"
#include "olap/utils.h"
diff --git a/be/src/olap/olap_index.h b/be/src/olap/olap_index.h
index 4140819c..c74ceeb5 100644
--- a/be/src/olap/olap_index.h
+++ b/be/src/olap/olap_index.h
@@ -33,14 +33,14 @@
#include "olap/file_helper.h"
#include "olap/olap_common.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_cursor.h"
#include "olap/utils.h"
namespace doris {
class IndexComparator;
class SegmentGroup;
-class OLAPTable;
+class Tablet;
class RowBlock;
class RowCursor;
class SegmentComparator;
diff --git a/be/src/olap/olap_server.cpp b/be/src/olap/olap_server.cpp
index b236caeb..2c173057 100644
--- a/be/src/olap/olap_server.cpp
+++ b/be/src/olap/olap_server.cpp
@@ -46,7 +46,7 @@ OLAPStatus OLAPEngine::_start_bg_worker() {
_garbage_sweeper_thread_callback(nullptr);
});
- // start thread for monitoring the table with io error
+ // start thread for monitoring the tablet with io error
_disk_stat_monitor_thread = std::thread(
[this] {
_disk_stat_monitor_thread_callback(nullptr);
diff --git a/be/src/olap/olap_snapshot.cpp b/be/src/olap/olap_snapshot.cpp
index 43d3f890..9421bcae 100644
--- a/be/src/olap/olap_snapshot.cpp
+++ b/be/src/olap/olap_snapshot.cpp
@@ -35,7 +35,7 @@
#include "olap/olap_common.h"
#include "olap/column_data.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/olap_header_manager.h"
#include "olap/push_handler.h"
#include "olap/store.h"
@@ -65,23 +65,23 @@ OLAPStatus OLAPEngine::make_snapshot(
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
- TabletSharedPtr ref_olap_table = get_table(request.tablet_id, request.schema_hash);
- if (ref_olap_table.get() == NULL) {
- OLAP_LOG_WARNING("failed to get olap table. [table=%ld schema_hash=%d]",
+ TabletSharedPtr ref_tablet = get_tablet(request.tablet_id, request.schema_hash);
+ if (ref_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("failed to get tablet. [tablet=%ld schema_hash=%d]",
request.tablet_id, request.schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
if (request.__isset.missing_version) {
- res = _create_incremental_snapshot_files(ref_olap_table, request, snapshot_path);
+ res = _create_incremental_snapshot_files(ref_tablet, request, snapshot_path);
// if all nodes has been upgraded, it can be removed
(const_cast<TSnapshotRequest&>(request)).__set_allow_incremental_clone(true);
} else {
- res = _create_snapshot_files(ref_olap_table, request, snapshot_path);
+ res = _create_snapshot_files(ref_tablet, request, snapshot_path);
}
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to make snapshot. [res=%d table=%ld schema_hash=%d]",
+ OLAP_LOG_WARNING("failed to make snapshot. [res=%d tablet=%ld schema_hash=%d]",
res, request.tablet_id, request.schema_hash);
return res;
}
@@ -113,7 +113,7 @@ OLAPStatus OLAPEngine::release_snapshot(const string& snapshot_path) {
}
OLAPStatus OLAPEngine::_calc_snapshot_id_path(
- const TabletSharedPtr& olap_table,
+ const TabletSharedPtr& tablet,
string* out_path) {
OLAPStatus res = OLAP_SUCCESS;
if (out_path == nullptr) {
@@ -131,29 +131,29 @@ OLAPStatus OLAPEngine::_calc_snapshot_id_path(
stringstream snapshot_id_path_stream;
MutexLock auto_lock(&_snapshot_mutex); // will automatically unlock when function return.
- snapshot_id_path_stream << olap_table->storage_root_path_name() << SNAPSHOT_PREFIX
+ snapshot_id_path_stream << tablet->storage_root_path_name() << SNAPSHOT_PREFIX
<< "/" << time_str << "." << _snapshot_base_id++;
*out_path = snapshot_id_path_stream.str();
return res;
}
string OLAPEngine::_get_schema_hash_full_path(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const string& location) const {
stringstream schema_full_path_stream;
schema_full_path_stream << location
- << "/" << ref_olap_table->tablet_id()
- << "/" << ref_olap_table->schema_hash();
+ << "/" << ref_tablet->tablet_id()
+ << "/" << ref_tablet->schema_hash();
string schema_full_path = schema_full_path_stream.str();
return schema_full_path;
}
string OLAPEngine::_get_header_full_path(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const std::string& schema_hash_path) const {
stringstream header_name_stream;
- header_name_stream << schema_hash_path << "/" << ref_olap_table->tablet_id() << ".hdr";
+ header_name_stream << schema_hash_path << "/" << ref_tablet->tablet_id() << ".hdr";
return header_name_stream.str();
}
@@ -183,12 +183,12 @@ void OLAPEngine::_update_header_file_info(
OLAPStatus OLAPEngine::_link_index_and_data_files(
const string& schema_hash_path,
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const vector<VersionEntity>& version_entity_vec) {
OLAPStatus res = OLAP_SUCCESS;
std::stringstream prefix_stream;
- prefix_stream << schema_hash_path << "/" << ref_olap_table->tablet_id();
+ prefix_stream << schema_hash_path << "/" << ref_tablet->tablet_id();
std::string tablet_path_prefix = prefix_stream.str();
for (const VersionEntity& entity : version_entity_vec) {
Version version = entity.version;
@@ -198,26 +198,26 @@ OLAPStatus OLAPEngine::_link_index_and_data_files(
for (int seg_id = 0; seg_id < segment_group_entity.num_segments; ++seg_id) {
std::string index_path =
_construct_index_file_path(tablet_path_prefix, version, v_hash, segment_group_id, seg_id);
- std::string ref_table_index_path =
- ref_olap_table->construct_index_file_path(version, v_hash, segment_group_id, seg_id);
- res = _create_hard_link(ref_table_index_path, index_path);
+ std::string ref_tablet_index_path =
+ ref_tablet->construct_index_file_path(version, v_hash, segment_group_id, seg_id);
+ res = _create_hard_link(ref_tablet_index_path, index_path);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to create hard link. "
<< " schema_hash_path=" << schema_hash_path
- << " from_path=" << ref_table_index_path
+ << " from_path=" << ref_tablet_index_path
<< " to_path=" << index_path;
return res;
}
std:: string data_path =
_construct_data_file_path(tablet_path_prefix, version, v_hash, segment_group_id, seg_id);
- std::string ref_table_data_path =
- ref_olap_table->construct_data_file_path(version, v_hash, segment_group_id, seg_id);
- res = _create_hard_link(ref_table_data_path, data_path);
+ std::string ref_tablet_data_path =
+ ref_tablet->construct_data_file_path(version, v_hash, segment_group_id, seg_id);
+ res = _create_hard_link(ref_tablet_data_path, data_path);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to create hard link."
<< "tablet_path_prefix=" << tablet_path_prefix
- << ", from_path=" << ref_table_data_path << ", to_path=" << data_path;
+ << ", from_path=" << ref_tablet_data_path << ", to_path=" << data_path;
return res;
}
}
@@ -229,10 +229,10 @@ OLAPStatus OLAPEngine::_link_index_and_data_files(
OLAPStatus OLAPEngine::_copy_index_and_data_files(
const string& schema_hash_path,
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
vector<VersionEntity>& version_entity_vec) {
std::stringstream prefix_stream;
- prefix_stream << schema_hash_path << "/" << ref_olap_table->tablet_id();
+ prefix_stream << schema_hash_path << "/" << ref_tablet->tablet_id();
std::string tablet_path_prefix = prefix_stream.str();
for (VersionEntity& entity : version_entity_vec) {
Version version = entity.version;
@@ -242,25 +242,25 @@ OLAPStatus OLAPEngine::_copy_index_and_data_files(
for (int seg_id = 0; seg_id < segment_group_entity.num_segments; ++seg_id) {
string index_path =
_construct_index_file_path(tablet_path_prefix, version, v_hash, segment_group_id, seg_id);
- string ref_table_index_path = ref_olap_table->construct_index_file_path(
+ string ref_tablet_index_path = ref_tablet->construct_index_file_path(
version, v_hash, segment_group_id, seg_id);
- Status res = FileUtils::copy_file(ref_table_index_path, index_path);
+ Status res = FileUtils::copy_file(ref_tablet_index_path, index_path);
if (!res.ok()) {
LOG(WARNING) << "fail to copy index file."
<< "dest=" << index_path
- << ", src=" << ref_table_index_path;
+ << ", src=" << ref_tablet_index_path;
return OLAP_ERR_COPY_FILE_ERROR;
}
string data_path =
_construct_data_file_path(tablet_path_prefix, version, v_hash, segment_group_id, seg_id);
- string ref_table_data_path = ref_olap_table->construct_data_file_path(
+ string ref_tablet_data_path = ref_tablet->construct_data_file_path(
version, v_hash, segment_group_id, seg_id);
- res = FileUtils::copy_file(ref_table_data_path, data_path);
+ res = FileUtils::copy_file(ref_tablet_data_path, data_path);
if (!res.ok()) {
LOG(WARNING) << "fail to copy data file."
<< "dest=" << index_path
- << ", src=" << ref_table_index_path;
+ << ", src=" << ref_tablet_index_path;
return OLAP_ERR_COPY_FILE_ERROR;
}
}
@@ -271,7 +271,7 @@ OLAPStatus OLAPEngine::_copy_index_and_data_files(
}
OLAPStatus OLAPEngine::_create_snapshot_files(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const TSnapshotRequest& request,
string* snapshot_path) {
OLAPStatus res = OLAP_SUCCESS;
@@ -281,16 +281,16 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
}
string snapshot_id_path;
- res = _calc_snapshot_id_path(ref_olap_table, &snapshot_id_path);
+ res = _calc_snapshot_id_path(ref_tablet, &snapshot_id_path);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to calc snapshot_id_path, [ref table=%s]",
- ref_olap_table->storage_root_path_name().c_str());
+ OLAP_LOG_WARNING("failed to calc snapshot_id_path, [ref tablet=%s]",
+ ref_tablet->storage_root_path_name().c_str());
return res;
}
string schema_full_path = _get_schema_hash_full_path(
- ref_olap_table, snapshot_id_path);
- string header_path = _get_header_full_path(ref_olap_table, schema_full_path);
+ ref_tablet, snapshot_id_path);
+ string header_path = _get_header_full_path(ref_tablet, schema_full_path);
if (check_dir_existed(schema_full_path)) {
VLOG(10) << "remove the old schema_full_path.";
remove_all_dir(schema_full_path);
@@ -301,7 +301,7 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
string snapshot_id = canonical(boost_path).string();
bool header_locked = false;
- ref_olap_table->obtain_header_rdlock();
+ ref_tablet->obtain_header_rdlock();
header_locked = true;
vector<ColumnData*> olap_data_sources;
@@ -309,10 +309,10 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
do {
// get latest version
const PDelta* lastest_version = NULL;
- lastest_version = ref_olap_table->lastest_version();
+ lastest_version = ref_tablet->lastest_version();
if (lastest_version == NULL) {
- OLAP_LOG_WARNING("table has not any version. [path='%s']",
- ref_olap_table->full_name().c_str());
+ OLAP_LOG_WARNING("tablet has not any version. [path='%s']",
+ ref_tablet->full_name().c_str());
res = OLAP_ERR_VERSION_NOT_EXIST;
break;
}
@@ -338,27 +338,27 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
// get shortest version path
vector<Version> shortest_path;
vector<VersionEntity> shortest_versions;
- res = ref_olap_table->select_versions_to_span(Version(0, version), &shortest_path);
+ res = ref_tablet->select_versions_to_span(Version(0, version), &shortest_path);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to select versions to span. [res=%d]", res);
break;
}
for (const Version& version : shortest_path) {
- shortest_versions.push_back(ref_olap_table->get_version_entity_by_version(version));
+ shortest_versions.push_back(ref_tablet->get_version_entity_by_version(version));
}
// get data source and add reference count for prevent to delete data files
- ref_olap_table->acquire_data_sources_by_versions(shortest_path, &olap_data_sources);
+ ref_tablet->acquire_data_sources_by_versions(shortest_path, &olap_data_sources);
if (olap_data_sources.size() == 0) {
- OLAP_LOG_WARNING("failed to acquire data sources. [table='%s', version=%d]",
- ref_olap_table->full_name().c_str(), version);
+ OLAP_LOG_WARNING("failed to acquire data sources. [tablet='%s', version=%d]",
+ ref_tablet->full_name().c_str(), version);
res = OLAP_ERR_OTHER_ERROR;
break;
}
- // load table header, in order to remove versions that not in shortest version path
- OlapStore* store = ref_olap_table->store();
+ // load tablet header, in order to remove versions that not in shortest version path
+ OlapStore* store = ref_tablet->store();
new_olap_header = new(nothrow) OLAPHeader();
if (new_olap_header == NULL) {
OLAP_LOG_WARNING("fail to malloc OLAPHeader.");
@@ -366,14 +366,14 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
break;
}
- res = OlapHeaderManager::get_header(store, ref_olap_table->tablet_id(), ref_olap_table->schema_hash(), new_olap_header);
+ res = OlapHeaderManager::get_header(store, ref_tablet->tablet_id(), ref_tablet->schema_hash(), new_olap_header);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to load header. res=" << res
- << "tablet_id=" << ref_olap_table->tablet_id() << ", schema_hash=" << ref_olap_table->schema_hash();
+ << "tablet_id=" << ref_tablet->tablet_id() << ", schema_hash=" << ref_tablet->schema_hash();
break;
}
- ref_olap_table->release_header_lock();
+ ref_tablet->release_header_lock();
header_locked = false;
_update_header_file_info(shortest_versions, new_olap_header);
@@ -381,11 +381,11 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
res = new_olap_header->save(header_path);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to save header. [res=%d tablet_id=%ld, schema_hash=%d, headerpath=%s]",
- res, ref_olap_table->tablet_id(), ref_olap_table->schema_hash(), header_path.c_str());
+ res, ref_tablet->tablet_id(), ref_tablet->schema_hash(), header_path.c_str());
break;
}
- res = _link_index_and_data_files(schema_full_path, ref_olap_table, shortest_versions);
+ res = _link_index_and_data_files(schema_full_path, ref_tablet, shortest_versions);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to create hard link. [path=" << snapshot_id_path << "]";
break;
@@ -419,12 +419,12 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
if (header_locked) {
VLOG(10) << "release header lock.";
- ref_olap_table->release_header_lock();
+ ref_tablet->release_header_lock();
}
- if (ref_olap_table.get() != NULL) {
+ if (ref_tablet.get() != NULL) {
VLOG(10) << "release data sources.";
- ref_olap_table->release_data_sources(&olap_data_sources);
+ ref_tablet->release_data_sources(&olap_data_sources);
}
if (res != OLAP_SUCCESS) {
@@ -443,7 +443,7 @@ OLAPStatus OLAPEngine::_create_snapshot_files(
}
OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const TSnapshotRequest& request,
string* snapshot_path) {
LOG(INFO) << "begin to create incremental snapshot files."
@@ -457,14 +457,14 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
}
string snapshot_id_path;
- res = _calc_snapshot_id_path(ref_olap_table, &snapshot_id_path);
+ res = _calc_snapshot_id_path(ref_tablet, &snapshot_id_path);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to calc snapshot_id_path, [ref table=%s]",
- ref_olap_table->storage_root_path_name().c_str());
+ OLAP_LOG_WARNING("failed to calc snapshot_id_path, [ref tablet=%s]",
+ ref_tablet->storage_root_path_name().c_str());
return res;
}
- string schema_full_path = _get_schema_hash_full_path(ref_olap_table, snapshot_id_path);
+ string schema_full_path = _get_schema_hash_full_path(ref_tablet, snapshot_id_path);
if (check_dir_existed(schema_full_path)) {
VLOG(10) << "remove the old schema_full_path.";
remove_all_dir(schema_full_path);
@@ -474,19 +474,19 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
path boost_path(snapshot_id_path);
string snapshot_id = canonical(boost_path).string();
- ref_olap_table->obtain_header_rdlock();
+ ref_tablet->obtain_header_rdlock();
do {
// save header to snapshot path
OLAPHeader olap_header;
- res = OlapHeaderManager::get_header(ref_olap_table->store(),
- ref_olap_table->tablet_id(), ref_olap_table->schema_hash(), &olap_header);
+ res = OlapHeaderManager::get_header(ref_tablet->store(),
+ ref_tablet->tablet_id(), ref_tablet->schema_hash(), &olap_header);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to load header. res=" << res << "tablet_id="
- << ref_olap_table->tablet_id() << ", schema_hash=" << ref_olap_table->schema_hash();
+ << ref_tablet->tablet_id() << ", schema_hash=" << ref_tablet->schema_hash();
break;
}
- string header_path = _get_header_full_path(ref_olap_table, schema_full_path);
+ string header_path = _get_header_full_path(ref_tablet, schema_full_path);
res = olap_header.save(header_path);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to save header to path:" << header_path;
@@ -498,7 +498,7 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
// find missing version
const PDelta* incremental_delta =
- ref_olap_table->get_incremental_delta(Version(missing_version, missing_version));
+ ref_tablet->get_incremental_delta(Version(missing_version, missing_version));
if (incremental_delta != nullptr) {
VLOG(3) << "success to find missing version when snapshot, "
<< "begin to link files. tablet_id=" << request.tablet_id
@@ -507,7 +507,7 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
// link files
for (uint32_t i = 0; i < incremental_delta->segment_group(0).num_segments(); i++) {
int32_t segment_group_id = incremental_delta->segment_group(0).segment_group_id();
- string from = ref_olap_table->construct_incremental_index_file_path(
+ string from = ref_tablet->construct_incremental_index_file_path(
Version(missing_version, missing_version),
incremental_delta->version_hash(), segment_group_id, i);
string to = schema_full_path + '/' + basename(from.c_str());
@@ -515,7 +515,7 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
break;
}
- from = ref_olap_table->construct_incremental_data_file_path(
+ from = ref_tablet->construct_incremental_data_file_path(
Version(missing_version, missing_version),
incremental_delta->version_hash(), segment_group_id, i);
to = schema_full_path + '/' + basename(from.c_str());
@@ -530,7 +530,7 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
} else {
OLAP_LOG_WARNING("failed to find missing version when snapshot. "
- "[table=%ld schema_hash=%d version=%ld]",
+ "[tablet=%ld schema_hash=%d version=%ld]",
request.tablet_id, request.schema_hash, missing_version);
res = OLAP_ERR_VERSION_NOT_EXIST;
break;
@@ -539,7 +539,7 @@ OLAPStatus OLAPEngine::_create_incremental_snapshot_files(
} while (0);
- ref_olap_table->release_header_lock();
+ ref_tablet->release_header_lock();
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("failed to make incremental snapshot, try to delete the snapshot path. "
@@ -572,7 +572,7 @@ OLAPStatus OLAPEngine::_append_single_delta(
request.tablet_id, request.schema_hash);
return res;
}
- auto tablet = OLAPTable::create_from_header(new_olap_header, store);
+ auto tablet = Tablet::create_from_header(new_olap_header, store);
if (tablet == NULL) {
OLAP_LOG_WARNING("fail to load tablet. [res=%d tablet_id='%ld, schema_hash=%d']",
res, request.tablet_id, request.schema_hash);
@@ -614,7 +614,7 @@ string OLAPEngine::_construct_index_file_path(
const Version& version,
VersionHash version_hash,
int32_t segment_group_id, int32_t segment) const {
- return OLAPTable::construct_file_path(tablet_path_prefix, version, version_hash, segment_group_id, segment, "idx");
+ return Tablet::construct_file_path(tablet_path_prefix, version, version_hash, segment_group_id, segment, "idx");
}
string OLAPEngine::_construct_data_file_path(
@@ -622,7 +622,7 @@ string OLAPEngine::_construct_data_file_path(
const Version& version,
VersionHash version_hash,
int32_t segment_group_id, int32_t segment) const {
- return OLAPTable::construct_file_path(tablet_path_prefix, version, version_hash, segment_group_id, segment, "dat");
+ return Tablet::construct_file_path(tablet_path_prefix, version, version_hash, segment_group_id, segment, "dat");
}
OLAPStatus OLAPEngine::_create_hard_link(const string& from_path, const string& to_path) {
@@ -646,9 +646,9 @@ OLAPStatus OLAPEngine::storage_medium_migrate(
DorisMetrics::storage_migrate_requests_total.increment(1);
OLAPStatus res = OLAP_SUCCESS;
- TabletSharedPtr tablet = get_table(tablet_id, schema_hash);
+ TabletSharedPtr tablet = get_tablet(tablet_id, schema_hash);
if (tablet.get() == NULL) {
- OLAP_LOG_WARNING("can't find olap table. [tablet_id=%ld schema_hash=%d]",
+ OLAP_LOG_WARNING("can't find tablet. [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
@@ -697,7 +697,7 @@ OLAPStatus OLAPEngine::storage_medium_migrate(
tablet->release_header_lock();
// generate schema hash path where files will be migrated
- auto stores = get_stores_for_create_table(storage_medium);
+ auto stores = get_stores_for_create_tablet(storage_medium);
if (stores.empty()) {
res = OLAP_ERR_INVALID_ROOT_PATH;
OLAP_LOG_WARNING("fail to get root path for create tablet.");
@@ -741,23 +741,23 @@ OLAPStatus OLAPEngine::storage_medium_migrate(
}
// load the new tablet into OLAPEngine
- auto olap_table = OLAPTable::create_from_header(new_olap_header, stores[0]);
- if (olap_table == NULL) {
+ auto tablet = Tablet::create_from_header(new_olap_header, stores[0]);
+ if (tablet == NULL) {
OLAP_LOG_WARNING("failed to create from header");
res = OLAP_ERR_TABLE_CREATE_FROM_HEADER_ERROR;
break;
}
- res = add_table(tablet_id, schema_hash, olap_table);
+ res = add_tablet(tablet_id, schema_hash, tablet);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to add tablet to OLAPEngine. [res=%d]", res);
break;
}
- // if old table finished schema change, then the schema change status of the new table is DONE
- // else the schema change status of the new table is FAILED
- TabletSharedPtr new_tablet = get_table(tablet_id, schema_hash);
+ // if old tablet finished schema change, then the schema change status of the new tablet is DONE
+ // else the schema change status of the new tablet is FAILED
+ TabletSharedPtr new_tablet = get_tablet(tablet_id, schema_hash);
if (new_tablet.get() == NULL) {
- OLAP_LOG_WARNING("get null olap table. [tablet_id=%ld schema_hash=%d]",
+ OLAP_LOG_WARNING("get null tablet. [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
diff --git a/be/src/olap/push_handler.cpp b/be/src/olap/push_handler.cpp
index ecf1eabb..bde06143 100644
--- a/be/src/olap/push_handler.cpp
+++ b/be/src/olap/push_handler.cpp
@@ -24,7 +24,7 @@
#include <boost/filesystem.hpp>
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/schema_change.h"
using std::list;
@@ -74,7 +74,7 @@ OLAPStatus PushHandler::process_realtime_push(
// if push finished, report success to fe
if (tablet->has_pending_data(request.transaction_id)) {
OLAP_LOG_WARNING("pending data exists in tablet, which means push finished,"
- "return success. [table=%s transaction_id=%ld]",
+ "return success. [tablet=%s transaction_id=%ld]",
tablet->full_name().c_str(), request.transaction_id);
res = OLAP_SUCCESS;
}
@@ -82,7 +82,7 @@ OLAPStatus PushHandler::process_realtime_push(
goto EXIT;
}
- // only when fe sends schema_change true, should consider to push related table
+ // only when fe sends schema_change true, should consider to push related tablet
if (_request.is_schema_changing) {
VLOG(3) << "push req specify schema changing is true. "
<< "tablet=" << tablet->full_name()
@@ -101,22 +101,20 @@ OLAPStatus PushHandler::process_realtime_push(
<< ", related_tablet_id=" << related_tablet_id
<< ", related_schema_hash=" << related_schema_hash
<< ", transaction_id=" << request.transaction_id;
- TabletSharedPtr related_tablet = OLAPEngine::get_instance()->get_table(
+ TabletSharedPtr related_tablet = OLAPEngine::get_instance()->get_tablet(
related_tablet_id, related_schema_hash);
// if related tablet not exists, only push current tablet
if (NULL == related_tablet.get()) {
- // only print a warn log here not call clear schema change state in tablet
- // the schema change state will be cleared when another schema change request comes
- OLAP_LOG_WARNING("can't find related table, only push current tablet. "
- "[table=%s related_tablet_id=%ld related_schema_hash=%d]",
+ OLAP_LOG_WARNING("can't find related tablet, only push current tablet. "
+ "[tablet=%s related_tablet_id=%ld related_schema_hash=%d]",
tablet->full_name().c_str(),
related_tablet_id, related_schema_hash);
- // if current tablet is new table, only push current tablet
+ // if current tablet is new tablet, only push current tablet
} else if (tablet->creation_time() > related_tablet->creation_time()) {
- OLAP_LOG_WARNING("current table is new, only push current tablet. "
- "[table=%s related_tablet=%s]",
+ OLAP_LOG_WARNING("current tablet is new, only push current tablet. "
+ "[tablet=%s related_tablet=%s]",
tablet->full_name().c_str(),
related_tablet->full_name().c_str());
@@ -133,7 +131,7 @@ OLAPStatus PushHandler::process_realtime_push(
if (res == OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST) {
OLAP_LOG_WARNING("related tablet's transaction exists in engine, "
"only push current tablet. "
- "[related_table=%s transaction_id=%ld]",
+ "[related_tablet=%s transaction_id=%ld]",
related_tablet->full_name().c_str(),
request.transaction_id);
} else {
@@ -201,7 +199,6 @@ OLAPStatus PushHandler::process_realtime_push(
}
for (SegmentGroup* segment_group : tablet_var.added_indices) {
-
res = tablet_var.tablet->add_pending_data(
segment_group, push_type == PUSH_FOR_DELETE ? &request.delete_conditions : NULL);
@@ -211,7 +208,7 @@ OLAPStatus PushHandler::process_realtime_push(
res = OLAP_SUCCESS;
} else if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to add pending data to tablet. [table=%s transaction_id=%ld]",
+ OLAP_LOG_WARNING("fail to add pending data to tablet. [tablet=%s transaction_id=%ld]",
tablet_var.tablet->full_name().c_str(), request.transaction_id);
goto EXIT;
}
@@ -222,7 +219,7 @@ OLAPStatus PushHandler::process_realtime_push(
// if transaction existed in engine but push not finished, not report to fe
if (res == OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST) {
OLAP_LOG_WARNING("find transaction existed when realtime push, not report. ",
- "[table=%s partition_id=%ld transaction_id=%ld]",
+ "[tablet=%s partition_id=%ld transaction_id=%ld]",
tablet->full_name().c_str(),
request.partition_id, request.transaction_id);
return res;
@@ -315,7 +312,7 @@ OLAPStatus PushHandler::_convert(
need_decompress = true;
}
if (NULL == (reader = IBinaryReader::create(need_decompress))) {
- OLAP_LOG_WARNING("fail to create reader. [table='%s' file='%s']",
+ OLAP_LOG_WARNING("fail to create reader. [tablet='%s' file='%s']",
curr_tablet->full_name().c_str(),
_request.http_file_path.c_str());
res = OLAP_ERR_MALLOC_ERROR;
@@ -324,7 +321,7 @@ OLAPStatus PushHandler::_convert(
// init BinaryReader
if (OLAP_SUCCESS != (res = reader->init(curr_tablet, &raw_file))) {
- OLAP_LOG_WARNING("fail to init reader. [res=%d table='%s' file='%s']",
+ OLAP_LOG_WARNING("fail to init reader. [res=%d tablet='%s' file='%s']",
res,
curr_tablet->full_name().c_str(),
_request.http_file_path.c_str());
@@ -341,7 +338,7 @@ OLAPStatus PushHandler::_convert(
string dir_path = curr_tablet->construct_pending_data_dir_path();
if (!check_dir_existed(dir_path) && (res = create_dirs(dir_path)) != OLAP_SUCCESS) {
if (!check_dir_existed(dir_path)) {
- OLAP_LOG_WARNING("fail to create pending dir. [res=%d table=%s]",
+ OLAP_LOG_WARNING("fail to create pending dir. [res=%d tablet=%s]",
res, curr_tablet->full_name().c_str());
break;
}
@@ -360,7 +357,7 @@ OLAPStatus PushHandler::_convert(
}
if (NULL == delta_segment_group) {
- OLAP_LOG_WARNING("fail to malloc SegmentGroup. [table='%s' size=%ld]",
+ OLAP_LOG_WARNING("fail to malloc SegmentGroup. [tablet='%s' size=%ld]",
curr_tablet->full_name().c_str(), sizeof(SegmentGroup));
res = OLAP_ERR_MALLOC_ERROR;
break;
@@ -372,7 +369,7 @@ OLAPStatus PushHandler::_convert(
<< ", block_row_size=" << curr_tablet->num_rows_per_row_block();
if (NULL == (writer = ColumnDataWriter::create(curr_tablet, delta_segment_group, true))) {
- OLAP_LOG_WARNING("fail to create writer. [table='%s']",
+ OLAP_LOG_WARNING("fail to create writer. [tablet='%s']",
curr_tablet->full_name().c_str());
res = OLAP_ERR_MALLOC_ERROR;
break;
@@ -391,7 +388,7 @@ OLAPStatus PushHandler::_convert(
while (!reader->eof()) {
if (OLAP_SUCCESS != (res = writer->attached_by(&row))) {
OLAP_LOG_WARNING(
- "fail to attach row to writer. [res=%d table='%s' read_rows=%u]",
+ "fail to attach row to writer. [res=%d tablet='%s' read_rows=%u]",
res, curr_tablet->full_name().c_str(), num_rows);
break;
}
@@ -423,7 +420,7 @@ OLAPStatus PushHandler::_convert(
VLOG(3) << "load the index.";
if (OLAP_SUCCESS != (res = delta_segment_group->load())) {
- OLAP_LOG_WARNING("fail to load index. [res=%d table='%s' version=%ld]",
+ OLAP_LOG_WARNING("fail to load index. [res=%d tablet='%s' version=%ld]",
res, curr_tablet->full_name().c_str(), _request.version);
break;
}
@@ -437,7 +434,7 @@ OLAPStatus PushHandler::_convert(
string dir_path = new_tablet->construct_pending_data_dir_path();
if (!check_dir_existed(dir_path) && (res = create_dirs(dir_path)) != OLAP_SUCCESS) {
if (!check_dir_existed(dir_path)) {
- OLAP_LOG_WARNING("fail to create pending dir. [res=%d table=%s]",
+ OLAP_LOG_WARNING("fail to create pending dir. [res=%d tablet=%s]",
res, new_tablet->full_name().c_str());
break;
}
@@ -451,7 +448,7 @@ OLAPStatus PushHandler::_convert(
new_olap_indices);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("failed to change schema version for delta."
- "[res=%d new_table='%s']",
+ "[res=%d new_tablet='%s']",
res, new_tablet->full_name().c_str());
}
@@ -500,14 +497,14 @@ BinaryReader::BinaryReader()
}
OLAPStatus BinaryReader::init(
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
BinaryFile* file) {
OLAPStatus res = OLAP_SUCCESS;
do {
_file = file;
_content_len = _file->file_length() - _file->header_size();
- _row_buf_size = table->get_row_size();
+ _row_buf_size = tablet->get_row_size();
if (NULL == (_row_buf = new(std::nothrow) char[_row_buf_size])) {
OLAP_LOG_WARNING("fail to malloc one row buf. [size=%zu]", _row_buf_size);
@@ -521,7 +518,7 @@ OLAPStatus BinaryReader::init(
break;
}
- _table = table;
+ _tablet = tablet;
_ready = true;
} while (0);
@@ -545,10 +542,10 @@ OLAPStatus BinaryReader::next(RowCursor* row, MemPool* mem_pool) {
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
- const vector<FieldInfo>& schema = _table->tablet_schema();
+ const vector<FieldInfo>& schema = _tablet->tablet_schema();
size_t offset = 0;
size_t field_size = 0;
- size_t num_null_bytes = (_table->num_null_fields() + 7) / 8;
+ size_t num_null_bytes = (_tablet->num_null_fields() + 7) / 8;
if (OLAP_SUCCESS != (res = _file->read(_row_buf + offset, num_null_bytes))) {
OLAP_LOG_WARNING("read file for one row fail. [res=%d]", res);
@@ -630,7 +627,7 @@ LzoBinaryReader::LzoBinaryReader()
}
OLAPStatus LzoBinaryReader::init(
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
BinaryFile* file) {
OLAPStatus res = OLAP_SUCCESS;
@@ -651,7 +648,7 @@ OLAPStatus LzoBinaryReader::init(
break;
}
- _table = table;
+ _tablet = tablet;
_ready = true;
} while (0);
@@ -684,10 +681,10 @@ OLAPStatus LzoBinaryReader::next(RowCursor* row, MemPool* mem_pool) {
}
}
- const vector<FieldInfo>& schema = _table->tablet_schema();
+ const vector<FieldInfo>& schema = _tablet->tablet_schema();
size_t offset = 0;
size_t field_size = 0;
- size_t num_null_bytes = (_table->num_null_fields() + 7) / 8;
+ size_t num_null_bytes = (_tablet->num_null_fields() + 7) / 8;
size_t p = 0;
for (size_t i = 0; i < schema.size(); ++i) {
@@ -764,7 +761,7 @@ OLAPStatus LzoBinaryReader::_next_block() {
SAFE_DELETE_ARRAY(_row_buf);
_max_row_num = _row_num;
- _max_row_buf_size = _max_row_num * _table->get_row_size();
+ _max_row_buf_size = _max_row_num * _tablet->get_row_size();
if (NULL == (_row_buf = new(std::nothrow) char[_max_row_buf_size])) {
OLAP_LOG_WARNING("fail to malloc rows buf. [size=%zu]", _max_row_buf_size);
res = OLAP_ERR_MALLOC_ERROR;
diff --git a/be/src/olap/push_handler.h b/be/src/olap/push_handler.h
index 2d0161fc..15998b4e 100644
--- a/be/src/olap/push_handler.h
+++ b/be/src/olap/push_handler.h
@@ -57,7 +57,7 @@ class PushHandler {
// Load local data file into specified tablet.
OLAPStatus process_realtime_push(
- TabletSharedPtr olap_table,
+ TabletSharedPtr tablet,
const TPushReq& request,
PushType push_type,
std::vector<TTabletInfo>* tablet_info_vec);
@@ -68,11 +68,11 @@ class PushHandler {
// Convert local data file to internal formatted delta,
// return new delta's SegmentGroup
OLAPStatus _convert(
- TabletSharedPtr curr_olap_table,
- TabletSharedPtr new_olap_table_vec,
+ TabletSharedPtr curr_tablet,
+ TabletSharedPtr new_tablet_vec,
Indices* curr_olap_indices,
Indices* new_olap_indices,
- AlterTabletType alter_table_type);
+ AlterTabletType alter_tablet_type);
// Only for debug
std::string _debug_version_list(const Versions& versions) const;
@@ -123,7 +123,7 @@ class IBinaryReader {
static IBinaryReader* create(bool need_decompress);
virtual ~IBinaryReader() {}
- virtual OLAPStatus init(TabletSharedPtr table, BinaryFile* file) = 0;
+ virtual OLAPStatus init(TabletSharedPtr tablet, BinaryFile* file) = 0;
virtual OLAPStatus finalize() = 0;
virtual OLAPStatus next(RowCursor* row, MemPool* mem_pool) = 0;
@@ -145,7 +145,7 @@ class IBinaryReader {
}
BinaryFile* _file;
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
size_t _content_len;
size_t _curr;
uint32_t _adler_checksum;
@@ -160,7 +160,7 @@ class BinaryReader: public IBinaryReader {
finalize();
}
- virtual OLAPStatus init(TabletSharedPtr table, BinaryFile* file);
+ virtual OLAPStatus init(TabletSharedPtr tablet, BinaryFile* file);
virtual OLAPStatus finalize();
virtual OLAPStatus next(RowCursor* row, MemPool* mem_pool);
@@ -181,7 +181,7 @@ class LzoBinaryReader: public IBinaryReader {
finalize();
}
- virtual OLAPStatus init(TabletSharedPtr table, BinaryFile* file);
+ virtual OLAPStatus init(TabletSharedPtr tablet, BinaryFile* file);
virtual OLAPStatus finalize();
virtual OLAPStatus next(RowCursor* row, MemPool* mem_pool);
diff --git a/be/src/olap/reader.cpp b/be/src/olap/reader.cpp
index e5b77405..dff2a7ca 100644
--- a/be/src/olap/reader.cpp
+++ b/be/src/olap/reader.cpp
@@ -18,7 +18,7 @@
#include "olap/reader.h"
#include "olap/column_data.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_block.h"
#include "olap/row_cursor.h"
#include "util/date_func.h"
@@ -73,7 +73,7 @@ class CollectIterator {
}
OLAPStatus init() {
- auto res = _row_cursor.init(_data->segment_group()->table()->tablet_schema());
+ auto res = _row_cursor.init(_data->segment_group()->tablet()->tablet_schema());
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "failed to init row cursor, res=" << res;
return res;
@@ -181,7 +181,7 @@ OLAPStatus CollectIterator::init(Reader* reader) {
// multiple data to aggregate for performance in user fetch
if (_reader->_reader_type == READER_QUERY &&
(_reader->_aggregation ||
- _reader->_olap_table->keys_type() == KeysType::DUP_KEYS)) {
+ _reader->_tablet->keys_type() == KeysType::DUP_KEYS)) {
_merge = false;
}
return OLAP_SUCCESS;
@@ -324,7 +324,7 @@ OLAPStatus Reader::init(const ReaderParams& read_params) {
return res;
}
- switch (_olap_table->keys_type()) {
+ switch (_tablet->keys_type()) {
case KeysType::DUP_KEYS:
_next_row_func = &Reader::_dup_key_next_row;
break;
@@ -338,7 +338,7 @@ OLAPStatus Reader::init(const ReaderParams& read_params) {
break;
}
DCHECK(_next_row_func != nullptr) << "No next row function for type:"
- << _olap_table->keys_type();
+ << _tablet->keys_type();
return OLAP_SUCCESS;
}
@@ -436,7 +436,7 @@ OLAPStatus Reader::_unique_key_next_row(RowCursor* row_cursor, bool* eof) {
// we will not do aggregation in two case:
// 1. DUP_KEYS keys type has no semantic to aggregate,
// 2. to make cost of each scan round reasonable, we will control merged_count.
- if (_olap_table->keys_type() == KeysType::DUP_KEYS
+ if (_tablet->keys_type() == KeysType::DUP_KEYS
|| (_aggregation && merged_count > config::doris_scanner_row_num)) {
row_cursor->finalize_one_merge(_value_cids);
break;
@@ -468,7 +468,7 @@ void Reader::close() {
VLOG(3) << "merged rows:" << _merged_rows;
_conditions.finalize();
_delete_handler.finalize();
- _olap_table->release_data_sources(&_own_data_sources);
+ _tablet->release_data_sources(&_own_data_sources);
for (auto pred : _col_predicates) {
delete pred;
@@ -484,12 +484,12 @@ OLAPStatus Reader::_acquire_data_sources(const ReaderParams& read_params) {
|| read_params.reader_type == READER_CUMULATIVE_COMPACTION) {
data_sources = &read_params.olap_data_arr;
} else {
- _olap_table->obtain_header_rdlock();
- _olap_table->acquire_data_sources(_version, &_own_data_sources);
- _olap_table->release_header_lock();
+ _tablet->obtain_header_rdlock();
+ _tablet->acquire_data_sources(_version, &_own_data_sources);
+ _tablet->release_header_lock();
if (_own_data_sources.size() < 1) {
- LOG(WARNING) << "fail to acquire data sources. [table_name='" << _olap_table->full_name()
+ LOG(WARNING) << "fail to acquire data sources. [table_name='" << _tablet->full_name()
<< "' version=" << _version.first << "-" << _version.second << "]";
return OLAP_ERR_VERSION_NOT_EXIST;
}
@@ -548,7 +548,7 @@ OLAPStatus Reader::_init_params(const ReaderParams& read_params) {
OLAPStatus res = OLAP_SUCCESS;
_aggregation = read_params.aggregation;
_reader_type = read_params.reader_type;
- _olap_table = read_params.olap_table;
+ _tablet = read_params.tablet;
_version = read_params.version;
res = _init_conditions_param(read_params);
@@ -603,16 +603,16 @@ OLAPStatus Reader::_init_return_columns(const ReaderParams& read_params) {
}
}
for (auto id : read_params.return_columns) {
- if (_olap_table->tablet_schema()[id].is_key) {
+ if (_tablet->tablet_schema()[id].is_key) {
_key_cids.push_back(id);
} else {
_value_cids.push_back(id);
}
}
} else if (read_params.return_columns.size() == 0) {
- for (size_t i = 0; i < _olap_table->tablet_schema().size(); ++i) {
+ for (size_t i = 0; i < _tablet->tablet_schema().size(); ++i) {
_return_columns.push_back(i);
- if (_olap_table->tablet_schema()[i].is_key) {
+ if (_tablet->tablet_schema()[i].is_key) {
_key_cids.push_back(i);
} else {
_value_cids.push_back(i);
@@ -622,7 +622,7 @@ OLAPStatus Reader::_init_return_columns(const ReaderParams& read_params) {
} else if (read_params.reader_type == READER_CHECKSUM) {
_return_columns = read_params.return_columns;
for (auto id : read_params.return_columns) {
- if (_olap_table->tablet_schema()[id].is_key) {
+ if (_tablet->tablet_schema()[id].is_key) {
_key_cids.push_back(id);
} else {
_value_cids.push_back(id);
@@ -761,7 +761,7 @@ OLAPStatus Reader::_init_keys_param(const ReaderParams& read_params) {
return OLAP_ERR_MALLOC_ERROR;
}
- res = _keys_param.start_keys[i]->init_scan_key(_olap_table->tablet_schema(),
+ res = _keys_param.start_keys[i]->init_scan_key(_tablet->tablet_schema(),
read_params.start_key[i].values());
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init row cursor. [res=%d]", res);
@@ -783,7 +783,7 @@ OLAPStatus Reader::_init_keys_param(const ReaderParams& read_params) {
return OLAP_ERR_MALLOC_ERROR;
}
- res = _keys_param.end_keys[i]->init_scan_key(_olap_table->tablet_schema(),
+ res = _keys_param.end_keys[i]->init_scan_key(_tablet->tablet_schema(),
read_params.end_key[i].values());
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init row cursor. [res=%d]", res);
@@ -805,7 +805,7 @@ OLAPStatus Reader::_init_keys_param(const ReaderParams& read_params) {
OLAPStatus Reader::_init_conditions_param(const ReaderParams& read_params) {
OLAPStatus res = OLAP_SUCCESS;
- _conditions.set_table(_olap_table);
+ _conditions.set_tablet(_tablet);
for (int i = 0; i < read_params.conditions.size(); ++i) {
_conditions.append_condition(read_params.conditions[i]);
ColumnPredicate* predicate = _parse_to_predicate(read_params.conditions[i]);
@@ -908,8 +908,8 @@ COMPARISON_PREDICATE_CONDITION_VALUE(ge, GreaterEqualPredicate)
ColumnPredicate* Reader::_parse_to_predicate(const TCondition& condition) {
// TODO: not equal and not in predicate is not pushed down
- int index = _olap_table->get_field_index(condition.column_name);
- FieldInfo fi = _olap_table->tablet_schema()[index];
+ int index = _tablet->get_field_index(condition.column_name);
+ FieldInfo fi = _tablet->tablet_schema()[index];
if (fi.aggregation != FieldAggregationMethod::OLAP_FIELD_AGGREGATION_NONE) {
return nullptr;
}
@@ -1068,14 +1068,14 @@ OLAPStatus Reader::_init_load_bf_columns(const ReaderParams& read_params) {
}
// remove columns which have no bf stream
- for (int i = 0; i < _olap_table->tablet_schema().size(); ++i) {
- if (!_olap_table->tablet_schema()[i].is_bf_column) {
+ for (int i = 0; i < _tablet->tablet_schema().size(); ++i) {
+ if (!_tablet->tablet_schema()[i].is_bf_column) {
_load_bf_columns.erase(i);
}
}
// remove columns which have same value between start_key and end_key
- int min_scan_key_len = _olap_table->tablet_schema().size();
+ int min_scan_key_len = _tablet->tablet_schema().size();
for (int i = 0; i < read_params.start_key.size(); ++i) {
if (read_params.start_key[i].size() < min_scan_key_len) {
min_scan_key_len = read_params.start_key[i].size();
@@ -1108,9 +1108,9 @@ OLAPStatus Reader::_init_load_bf_columns(const ReaderParams& read_params) {
// remove the max_equal_index column when it's not varchar
// or longer than number of short key fields
- FieldType type = _olap_table->get_field_type_by_index(max_equal_index);
+ FieldType type = _tablet->get_field_type_by_index(max_equal_index);
if ((type != OLAP_FIELD_TYPE_VARCHAR && type != OLAP_FIELD_TYPE_HLL)
- || max_equal_index + 1 > _olap_table->num_short_key_fields()) {
+ || max_equal_index + 1 > _tablet->num_short_key_fields()) {
_load_bf_columns.erase(max_equal_index);
}
@@ -1119,9 +1119,9 @@ OLAPStatus Reader::_init_load_bf_columns(const ReaderParams& read_params) {
OLAPStatus Reader::_init_delete_condition(const ReaderParams& read_params) {
if (read_params.reader_type != READER_CUMULATIVE_COMPACTION) {
- _olap_table->obtain_header_rdlock();
- OLAPStatus ret = _delete_handler.init(_olap_table, read_params.version.second);
- _olap_table->release_header_lock();
+ _tablet->obtain_header_rdlock();
+ OLAPStatus ret = _delete_handler.init(_tablet, read_params.version.second);
+ _tablet->release_header_lock();
return ret;
} else {
diff --git a/be/src/olap/reader.h b/be/src/olap/reader.h
index 46919dbf..b9c5b69a 100644
--- a/be/src/olap/reader.h
+++ b/be/src/olap/reader.h
@@ -39,7 +39,7 @@
namespace doris {
-class OLAPTable;
+class Tablet;
class RowCursor;
class RowBlock;
class CollectIterator;
@@ -48,7 +48,7 @@ class RuntimeState;
// Params for Reader,
// mainly include tablet, data version and fetch range.
struct ReaderParams {
- TabletSharedPtr olap_table;
+ TabletSharedPtr tablet;
ReaderType reader_type;
bool aggregation;
Version version;
@@ -77,7 +77,7 @@ struct ReaderParams {
std::string to_string() {
std::stringstream ss;
- ss << "table=" << olap_table->full_name()
+ ss << "tablet=" << tablet->full_name()
<< " reader_type=" << reader_type
<< " aggregation=" << aggregation
<< " version=" << version.first << "-" << version.second
@@ -198,9 +198,9 @@ class Reader {
Version _version;
- TabletSharedPtr _olap_table;
+ TabletSharedPtr _tablet;
- // _own_data_sources is data source that reader aquire from olap_table, so we need to
+ // _own_data_sources is data source that reader aquire from tablet, so we need to
// release these when reader closing
std::vector<ColumnData*> _own_data_sources;
std::vector<ColumnData*> _data_sources;
diff --git a/be/src/olap/row_cursor.cpp b/be/src/olap/row_cursor.cpp
index 71d7c5c8..cfa83493 100644
--- a/be/src/olap/row_cursor.cpp
+++ b/be/src/olap/row_cursor.cpp
@@ -119,7 +119,7 @@ OLAPStatus RowCursor::init(const vector<FieldInfo>& tablet_schema) {
OLAPStatus RowCursor::init(const vector<FieldInfo>& tablet_schema, size_t column_count) {
if (column_count > tablet_schema.size()) {
- OLAP_LOG_WARNING("input param are invalid. Column count is bigger than table schema size."
+ OLAP_LOG_WARNING("input param are invalid. Column count is bigger than tablet schema size."
"[column_count=%lu tablet_schema.size=%lu]",
column_count,
tablet_schema.size());
@@ -145,7 +145,7 @@ OLAPStatus RowCursor::init_scan_key(const std::vector<FieldInfo>& tablet_schema,
const std::vector<std::string>& scan_keys) {
size_t scan_key_size = scan_keys.size();
if (scan_key_size > tablet_schema.size()) {
- OLAP_LOG_WARNING("input param are invalid. Column count is bigger than table schema size."
+ OLAP_LOG_WARNING("input param are invalid. Column count is bigger than tablet schema size."
"[column_count=%lu tablet_schema.size=%lu]",
scan_key_size ,
tablet_schema.size());
diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp
index ff56ea38..181c07cf 100644
--- a/be/src/olap/schema_change.cpp
+++ b/be/src/olap/schema_change.cpp
@@ -27,7 +27,7 @@
#include "olap/merger.h"
#include "olap/column_data.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_block.h"
#include "olap/row_cursor.h"
#include "olap/data_writer.h"
@@ -55,12 +55,12 @@ bool version_entity_sorter(const VersionEntity& a, const VersionEntity& b) {
}
RowBlockChanger::RowBlockChanger(const std::vector<FieldInfo> &tablet_schema,
- const TabletSharedPtr &ref_olap_table) {
+ const TabletSharedPtr &ref_tablet) {
_schema_mapping.resize(tablet_schema.size());
}
RowBlockChanger::RowBlockChanger(const vector<FieldInfo>& tablet_schema,
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const DeleteHandler& delete_handler) {
_schema_mapping.resize(tablet_schema.size());
_delete_handler = delete_handler;
@@ -533,7 +533,7 @@ void RowBlockAllocator::release(RowBlock* row_block) {
delete row_block;
}
-RowBlockMerger::RowBlockMerger(TabletSharedPtr olap_table) : _olap_table(olap_table) {}
+RowBlockMerger::RowBlockMerger(TabletSharedPtr tablet) : _tablet(tablet) {}
RowBlockMerger::~RowBlockMerger() {}
@@ -543,7 +543,7 @@ bool RowBlockMerger::merge(
uint64_t* merged_rows) {
uint64_t tmp_merged_rows = 0;
RowCursor row_cursor;
- if (row_cursor.init(_olap_table->tablet_schema()) != OLAP_SUCCESS) {
+ if (row_cursor.init(_tablet->tablet_schema()) != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to init row cursor.");
goto MERGE_ERR;
}
@@ -560,7 +560,7 @@ bool RowBlockMerger::merge(
OLAP_LOG_WARNING("writer error.");
goto MERGE_ERR;
}
- row_cursor.allocate_memory_for_string_type(_olap_table->tablet_schema(), writer->mem_pool());
+ row_cursor.allocate_memory_for_string_type(_tablet->tablet_schema(), writer->mem_pool());
row_cursor.agg_init(*(_heap.top().row_cursor));
@@ -568,7 +568,7 @@ bool RowBlockMerger::merge(
goto MERGE_ERR;
}
- if (KeysType::DUP_KEYS == _olap_table->keys_type()) {
+ if (KeysType::DUP_KEYS == _tablet->keys_type()) {
writer->next(row_cursor);
continue;
}
@@ -644,14 +644,14 @@ bool RowBlockMerger::_pop_heap() {
}
LinkedSchemaChange::LinkedSchemaChange(
- TabletSharedPtr base_olap_table, TabletSharedPtr new_olap_table) :
- _base_olap_table(base_olap_table),
- _new_olap_table(new_olap_table) {}
+ TabletSharedPtr base_tablet, TabletSharedPtr new_tablet) :
+ _base_tablet(base_tablet),
+ _new_tablet(new_tablet) {}
SchemaChangeDirectly::SchemaChangeDirectly(
- TabletSharedPtr olap_table,
+ TabletSharedPtr tablet,
const RowBlockChanger& row_block_changer) :
- _olap_table(olap_table),
+ _tablet(tablet),
_row_block_changer(row_block_changer),
_row_block_allocator(NULL),
_src_cursor(NULL),
@@ -683,24 +683,24 @@ bool SchemaChangeDirectly::_write_row_block(ColumnDataWriter* writer, RowBlock*
bool LinkedSchemaChange::process(ColumnData* olap_data, SegmentGroup* new_segment_group) {
for (size_t i = 0; i < olap_data->segment_group()->num_segments(); ++i) {
string index_path = new_segment_group->construct_index_file_path(new_segment_group->segment_group_id(), i);
- string base_table_index_path = olap_data->segment_group()->construct_index_file_path(olap_data->segment_group()->segment_group_id(), i);
- if (link(base_table_index_path.c_str(), index_path.c_str()) == 0) {
- VLOG(3) << "success to create hard link. from_path=" << base_table_index_path
+ string base_tablet_index_path = olap_data->segment_group()->construct_index_file_path(olap_data->segment_group()->segment_group_id(), i);
+ if (link(base_tablet_index_path.c_str(), index_path.c_str()) == 0) {
+ VLOG(3) << "success to create hard link. from_path=" << base_tablet_index_path
<< ", to_path=" << index_path;
} else {
- LOG(WARNING) << "fail to create hard link. [from_path=" << base_table_index_path.c_str()
+ LOG(WARNING) << "fail to create hard link. [from_path=" << base_tablet_index_path.c_str()
<< " to_path=" << index_path.c_str()
<< " errno=" << Errno::no() << " errno_str=" << Errno::str() << "]";
return false;
}
string data_path = new_segment_group->construct_data_file_path(new_segment_group->segment_group_id(), i);
- string base_table_data_path = olap_data->segment_group()->construct_data_file_path(olap_data->segment_group()->segment_group_id(), i);
- if (link(base_table_data_path.c_str(), data_path.c_str()) == 0) {
- VLOG(3) << "success to create hard link. from_path=" << base_table_data_path
+ string base_tablet_data_path = olap_data->segment_group()->construct_data_file_path(olap_data->segment_group()->segment_group_id(), i);
+ if (link(base_tablet_data_path.c_str(), data_path.c_str()) == 0) {
+ VLOG(3) << "success to create hard link. from_path=" << base_tablet_data_path
<< ", to_path=" << data_path;
} else {
- LOG(WARNING) << "fail to create hard link. [from_path=" << base_table_data_path.c_str()
+ LOG(WARNING) << "fail to create hard link. [from_path=" << base_tablet_data_path.c_str()
<< " to_path=" << data_path.c_str()
<< " errno=" << Errno::no() << " errno_str=" << Errno::str() << "]";
return false;
@@ -712,8 +712,8 @@ bool LinkedSchemaChange::process(ColumnData* olap_data, SegmentGroup* new_segmen
new_segment_group->add_column_statistics_for_linked_schema_change(olap_data->segment_group()->get_column_statistics());
if (OLAP_SUCCESS != new_segment_group->load()) {
- OLAP_LOG_WARNING("fail to reload index. [table='%s' version='%d-%d']",
- _new_olap_table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to reload index. [tablet='%s' version='%d-%d']",
+ _new_tablet->full_name().c_str(),
new_segment_group->version().first,
new_segment_group->version().second);
return false;
@@ -723,12 +723,12 @@ bool LinkedSchemaChange::process(ColumnData* olap_data, SegmentGroup* new_segmen
}
bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segment_group) {
- DataFileType data_file_type = new_segment_group->table()->data_file_type();
+ DataFileType data_file_type = new_segment_group->tablet()->data_file_type();
bool null_supported = true;
if (NULL == _row_block_allocator) {
if (NULL == (_row_block_allocator =
- new(nothrow) RowBlockAllocator(_olap_table->tablet_schema(), 0))) {
+ new(nothrow) RowBlockAllocator(_tablet->tablet_schema(), 0))) {
LOG(FATAL) << "failed to malloc RowBlockAllocator. size=" << sizeof(RowBlockAllocator);
return false;
}
@@ -741,7 +741,7 @@ bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segm
return false;
}
- if (OLAP_SUCCESS != _src_cursor->init(_olap_table->tablet_schema())) {
+ if (OLAP_SUCCESS != _src_cursor->init(_tablet->tablet_schema())) {
OLAP_LOG_WARNING("fail to init row cursor.");
return false;
}
@@ -754,7 +754,7 @@ bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segm
return false;
}
- if (OLAP_SUCCESS != _dst_cursor->init(_olap_table->tablet_schema())) {
+ if (OLAP_SUCCESS != _dst_cursor->init(_tablet->tablet_schema())) {
OLAP_LOG_WARNING("fail to init row cursor.");
return false;
}
@@ -778,8 +778,8 @@ bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segm
}
if (need_create_empty_version) {
- res = create_init_version(new_segment_group->table()->tablet_id(),
- new_segment_group->table()->schema_hash(),
+ res = create_init_version(new_segment_group->tablet()->tablet_id(),
+ new_segment_group->tablet()->schema_hash(),
new_segment_group->version(),
new_segment_group->version_hash(),
new_segment_group);
@@ -791,11 +791,11 @@ bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segm
return true;
}
- VLOG(3) << "init writer. table=" << _olap_table->full_name()
- << "block_row_size=" << _olap_table->num_rows_per_row_block();
+ VLOG(3) << "init writer. tablet=" << _tablet->full_name()
+ << "block_row_size=" << _tablet->num_rows_per_row_block();
bool result = true;
RowBlock* new_row_block = NULL;
- ColumnDataWriter* writer = ColumnDataWriter::create(_olap_table, new_segment_group, false);
+ ColumnDataWriter* writer = ColumnDataWriter::create(_tablet, new_segment_group, false);
if (NULL == writer) {
OLAP_LOG_WARNING("failed to create writer.");
result = false;
@@ -856,8 +856,8 @@ bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segm
}
if (OLAP_SUCCESS != new_segment_group->load()) {
- OLAP_LOG_WARNING("fail to reload index. [table='%s' version='%d-%d']",
- _olap_table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to reload index. [tablet='%s' version='%d-%d']",
+ _tablet->full_name().c_str(),
new_segment_group->version().first,
new_segment_group->version().second);
result = false;
@@ -890,10 +890,10 @@ bool SchemaChangeDirectly::process(ColumnData* olap_data, SegmentGroup* new_segm
return result;
}
-SchemaChangeWithSorting::SchemaChangeWithSorting(TabletSharedPtr olap_table,
+SchemaChangeWithSorting::SchemaChangeWithSorting(TabletSharedPtr tablet,
const RowBlockChanger& row_block_changer,
size_t memory_limitation) :
- _olap_table(olap_table),
+ _tablet(tablet),
_row_block_changer(row_block_changer),
_memory_limitation(memory_limitation),
_row_block_allocator(NULL) {
@@ -914,13 +914,13 @@ SchemaChangeWithSorting::~SchemaChangeWithSorting() {
bool SchemaChangeWithSorting::process(ColumnData* olap_data, SegmentGroup* new_segment_group) {
if (NULL == _row_block_allocator) {
if (NULL == (_row_block_allocator = new(nothrow) RowBlockAllocator(
- _olap_table->tablet_schema(), _memory_limitation))) {
+ _tablet->tablet_schema(), _memory_limitation))) {
LOG(FATAL) << "failed to malloc RowBlockAllocator. size=" << sizeof(RowBlockAllocator);
return false;
}
}
- DataFileType data_file_type = new_segment_group->table()->data_file_type();
+ DataFileType data_file_type = new_segment_group->tablet()->data_file_type();
bool null_supported = true;
RowBlock* ref_row_block = NULL;
@@ -941,8 +941,8 @@ bool SchemaChangeWithSorting::process(ColumnData* olap_data, SegmentGroup* new_s
}
if (need_create_empty_version) {
- res = create_init_version(new_segment_group->table()->tablet_id(),
- new_segment_group->table()->schema_hash(),
+ res = create_init_version(new_segment_group->tablet()->tablet_id(),
+ new_segment_group->tablet()->schema_hash(),
new_segment_group->version(),
new_segment_group->version_hash(),
new_segment_group);
@@ -1115,9 +1115,9 @@ bool SchemaChangeWithSorting::_internal_sorting(const vector<RowBlock*>& row_blo
SegmentGroup** temp_segment_group) {
ColumnDataWriter* writer = NULL;
uint64_t merged_rows = 0;
- RowBlockMerger merger(_olap_table);
+ RowBlockMerger merger(_tablet);
- (*temp_segment_group) = new(nothrow) SegmentGroup(_olap_table.get(),
+ (*temp_segment_group) = new(nothrow) SegmentGroup(_tablet.get(),
temp_delta_versions,
rand(),
false,
@@ -1127,9 +1127,9 @@ bool SchemaChangeWithSorting::_internal_sorting(const vector<RowBlock*>& row_blo
goto INTERNAL_SORTING_ERR;
}
- VLOG(3) << "init writer. tablet=" << _olap_table->full_name()
- << ", block_row_size=" << _olap_table->num_rows_per_row_block();
- writer = ColumnDataWriter::create(_olap_table, *temp_segment_group, false);
+ VLOG(3) << "init writer. tablet=" << _tablet->full_name()
+ << ", block_row_size=" << _tablet->num_rows_per_row_block();
+ writer = ColumnDataWriter::create(_tablet, *temp_segment_group, false);
if (NULL == writer) {
OLAP_LOG_WARNING("failed to create writer.");
goto INTERNAL_SORTING_ERR;
@@ -1160,7 +1160,7 @@ bool SchemaChangeWithSorting::_internal_sorting(const vector<RowBlock*>& row_blo
bool SchemaChangeWithSorting::_external_sorting(
vector<SegmentGroup*>& src_segment_groups,
SegmentGroup* dest_segment_group) {
- Merger merger(_olap_table, dest_segment_group, READER_ALTER_TABLE);
+ Merger merger(_tablet, dest_segment_group, READER_ALTER_TABLE);
uint64_t merged_rows = 0;
uint64_t filted_rows = 0;
@@ -1177,17 +1177,17 @@ bool SchemaChangeWithSorting::_external_sorting(
olap_data_arr.push_back(olap_data);
if (OLAP_SUCCESS != olap_data->init()) {
- OLAP_LOG_WARNING("fail to initial olap data. [version='%d-%d' table='%s']",
+ OLAP_LOG_WARNING("fail to initial olap data. [version='%d-%d' tablet='%s']",
(*it)->version().first,
(*it)->version().second,
- (*it)->table()->full_name().c_str());
+ (*it)->tablet()->full_name().c_str());
goto EXTERNAL_SORTING_ERR;
}
}
if (OLAP_SUCCESS != merger.merge(olap_data_arr, &merged_rows, &filted_rows)) {
- OLAP_LOG_WARNING("fail to merge deltas. [table='%s' version='%d-%d']",
- _olap_table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to merge deltas. [tablet='%s' version='%d-%d']",
+ _tablet->full_name().c_str(),
dest_segment_group->version().first,
dest_segment_group->version().second);
goto EXTERNAL_SORTING_ERR;
@@ -1196,8 +1196,8 @@ bool SchemaChangeWithSorting::_external_sorting(
add_filted_rows(filted_rows);
if (OLAP_SUCCESS != dest_segment_group->load()) {
- OLAP_LOG_WARNING("fail to reload index. [table='%s' version='%d-%d']",
- _olap_table->full_name().c_str(),
+ OLAP_LOG_WARNING("fail to reload index. [tablet='%s' version='%d-%d']",
+ _tablet->full_name().c_str(),
dest_segment_group->version().first,
dest_segment_group->version().second);
goto EXTERNAL_SORTING_ERR;
@@ -1223,52 +1223,52 @@ bool SchemaChangeWithSorting::_external_sorting(
OLAPStatus SchemaChangeHandler::clear_schema_change_single_info(
TTabletId tablet_id,
SchemaHash schema_hash,
- AlterTabletType* alter_table_type,
+ AlterTabletType* alter_tablet_type,
bool only_one,
bool check_only) {
- TabletSharedPtr olap_table = OLAPEngine::get_instance()->get_table(tablet_id, schema_hash);
- return clear_schema_change_single_info(olap_table, alter_table_type, only_one, check_only);
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(tablet_id, schema_hash);
+ return clear_schema_change_single_info(tablet, alter_tablet_type, only_one, check_only);
}
OLAPStatus SchemaChangeHandler::clear_schema_change_single_info(
- TabletSharedPtr olap_table,
+ TabletSharedPtr tablet,
AlterTabletType* type,
bool only_one,
bool check_only) {
OLAPStatus res = OLAP_SUCCESS;
- if (NULL == olap_table.get()) {
+ if (NULL == tablet.get()) {
return res;
}
vector<Version> versions_to_be_changed;
- if (olap_table->get_schema_change_request(NULL,
+ if (tablet->get_schema_change_request(NULL,
NULL,
&versions_to_be_changed,
NULL)) {
if (versions_to_be_changed.size() != 0) {
OLAP_LOG_WARNING("schema change is not allowed now, "
- "until previous schema change is done. [table='%s']",
- olap_table->full_name().c_str());
+ "until previous schema change is done. [tablet='%s']",
+ tablet->full_name().c_str());
return OLAP_ERR_PREVIOUS_SCHEMA_CHANGE_NOT_FINISHED;
}
}
if (!check_only) {
VLOG(3) << "broke old schema change chain";
- olap_table->clear_schema_change_request();
+ tablet->clear_schema_change_request();
}
return res;
}
OLAPStatus SchemaChangeHandler::_check_and_clear_schema_change_info(
- TabletSharedPtr olap_table,
+ TabletSharedPtr tablet,
const TAlterTabletReq& request) {
// check for schema change chain ( A->B)
// broken old relation if a chain was found and there is no version to be changed
// so, there is no relation between A & B any more
- // including: alter_table, split_table, rollup_table
+ // including: alter_tablet, split_tablet, rollup_tablet
OLAPStatus res = OLAP_SUCCESS;
TTabletId tablet_id;
TSchemaHash schema_hash;
@@ -1276,10 +1276,10 @@ OLAPStatus SchemaChangeHandler::_check_and_clear_schema_change_info(
AlterTabletType type;
// checkes schema change & rollup
- olap_table->obtain_header_rdlock();
- bool ret = olap_table->get_schema_change_request(
+ tablet->obtain_header_rdlock();
+ bool ret = tablet->get_schema_change_request(
&tablet_id, &schema_hash, &versions_to_be_changed, &type);
- olap_table->release_header_lock();
+ tablet->release_header_lock();
if (!ret) {
return res;
}
@@ -1299,46 +1299,46 @@ OLAPStatus SchemaChangeHandler::_check_and_clear_schema_change_info(
// clear schema change info of current tablet
{
- WriteLock wrlock(olap_table->get_header_lock_ptr());
+ WriteLock wrlock(tablet->get_header_lock_ptr());
res = clear_schema_change_single_info(
- olap_table->tablet_id(), olap_table->schema_hash(), &type, true, false);
+ tablet->tablet_id(), tablet->schema_hash(), &type, true, false);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to clear schema change info. [res=%d full_name='%s']",
- res, olap_table->full_name().c_str());
+ res, tablet->full_name().c_str());
return res;
}
- res = olap_table->save_header();
+ res = tablet->save_header();
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to save tablet header. [res=%d, full_name='%s']",
- res, olap_table->full_name().c_str());
+ res, tablet->full_name().c_str());
return res;
}
}
// clear schema change info of related tablet
- TabletSharedPtr tablet = OLAPEngine::get_instance()->get_table(
+ TabletSharedPtr related_tablet = OLAPEngine::get_instance()->get_tablet(
tablet_id, schema_hash);
- if (tablet.get() == NULL) {
+ if (related_tablet.get() == NULL) {
OLAP_LOG_WARNING("get null tablet! [tablet_id=%ld schema_hash=%d]",
tablet_id, schema_hash);
return OLAP_ERR_TABLE_NOT_FOUND;
}
{
- WriteLock wrlock(tablet->get_header_lock_ptr());
+ WriteLock wrlock(related_tablet->get_header_lock_ptr());
res = clear_schema_change_single_info(
tablet_id, schema_hash, &type, true, false);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to clear schema change info. [res=%d full_name='%s']",
- res, tablet->full_name().c_str());
+ res, related_tablet->full_name().c_str());
return res;
}
- res = tablet->save_header();
+ res = related_tablet->save_header();
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to save tablet header. [res=%d, full_name='%s']",
- res, tablet->full_name().c_str());
+ OLAP_LOG_WARNING("fail to save related_tablet header. [res=%d, full_name='%s']",
+ res, related_tablet->full_name().c_str());
return res;
}
}
@@ -1346,24 +1346,24 @@ OLAPStatus SchemaChangeHandler::_check_and_clear_schema_change_info(
return res;
}
-OLAPStatus SchemaChangeHandler::process_alter_table(
+OLAPStatus SchemaChangeHandler::process_alter_tablet(
AlterTabletType type,
const TAlterTabletReq& request) {
OLAPStatus res = OLAP_SUCCESS;
LOG(INFO) << "begin to validate alter tablet request.";
- // 1. Lock schema_change_lock util schema change info is stored in table header
+ // 1. Lock schema_change_lock util schema change info is stored in tablet header
if (!OLAPEngine::get_instance()->try_schema_change_lock(request.base_tablet_id)) {
- OLAP_LOG_WARNING("failed to obtain schema change lock. [res=%d table=%ld]",
+ OLAP_LOG_WARNING("failed to obtain schema change lock. [res=%d tablet=%ld]",
res, request.base_tablet_id);
return OLAP_ERR_TRY_LOCK_FAILED;
}
- // 2. Get base table
- TabletSharedPtr ref_olap_table = OLAPEngine::get_instance()->get_table(
+ // 2. Get base tablet
+ TabletSharedPtr ref_tablet = OLAPEngine::get_instance()->get_tablet(
request.base_tablet_id, request.base_schema_hash);
- if (ref_olap_table.get() == NULL) {
- OLAP_LOG_WARNING("fail to find base table. [base_table=%ld base_schema_hash=%d]",
+ if (ref_tablet.get() == NULL) {
+ OLAP_LOG_WARNING("fail to find base tablet. [base_tablet=%ld base_schema_hash=%d]",
request.base_tablet_id, request.base_schema_hash);
OLAPEngine::get_instance()->release_schema_change_lock(request.base_tablet_id);
return OLAP_ERR_TABLE_NOT_FOUND;
@@ -1371,21 +1371,21 @@ OLAPStatus SchemaChangeHandler::process_alter_table(
// 3. Check if history schema change information exist,
// if exist, it will be cleaned only when all delta versions converted
- res = _check_and_clear_schema_change_info(ref_olap_table, request);
+ res = _check_and_clear_schema_change_info(ref_tablet, request);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to check and clear schema change info. [table='%s']",
- ref_olap_table->full_name().c_str());
+ OLAP_LOG_WARNING("failed to check and clear schema change info. [tablet='%s']",
+ ref_tablet->full_name().c_str());
OLAPEngine::get_instance()->release_schema_change_lock(request.base_tablet_id);
return res;
}
- // 4. return failed if new table already exist in OLAPEngine.
- TabletSharedPtr new_tablet = OLAPEngine::get_instance()->get_table(
+ // 4. return failed if new tablet already exist in OLAPEngine.
+ TabletSharedPtr new_tablet = OLAPEngine::get_instance()->get_tablet(
request.new_tablet_req.tablet_id, request.new_tablet_req.tablet_schema.schema_hash);
if (new_tablet.get() != NULL) {
res = OLAP_SUCCESS;
} else {
- res = _do_alter_table(type, ref_olap_table, request);
+ res = _do_alter_tablet(type, ref_tablet, request);
}
OLAPEngine::get_instance()->release_schema_change_lock(request.base_tablet_id);
@@ -1393,22 +1393,22 @@ OLAPStatus SchemaChangeHandler::process_alter_table(
return res;
}
-OLAPStatus SchemaChangeHandler::_do_alter_table(
+OLAPStatus SchemaChangeHandler::_do_alter_tablet(
AlterTabletType type,
- TabletSharedPtr ref_olap_table,
+ TabletSharedPtr ref_tablet,
const TAlterTabletReq& request) {
OLAPStatus res = OLAP_SUCCESS;
- TabletSharedPtr new_olap_table;
- string base_root_path = ref_olap_table->storage_root_path_name();
+ TabletSharedPtr new_tablet;
+ string base_root_path = ref_tablet->storage_root_path_name();
- LOG(INFO) << "begin to do alter tablet job. new_table_id=" << request.new_tablet_req.tablet_id;
- // 1. Create new table and register into OLAPEngine
- res = _create_new_olap_table(ref_olap_table,
+ LOG(INFO) << "begin to do alter tablet job. new_tablet_id=" << request.new_tablet_req.tablet_id;
+ // 1. Create new tablet and register into OLAPEngine
+ res = _create_new_tablet(ref_tablet,
request.new_tablet_req,
&base_root_path,
- &new_olap_table);
+ &new_tablet);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to create new olap table. [table=%ld]",
+ OLAP_LOG_WARNING("fail to create new tablet. [tablet=%ld]",
request.new_tablet_req.tablet_id);
return res;
}
@@ -1417,19 +1417,19 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
// after waiting transactions to finish, will calculate versions again
vector<Version> tmp_versions_to_be_changed;
tmp_versions_to_be_changed.push_back(Version(-1, -1));
- ref_olap_table->obtain_push_lock();
- ref_olap_table->obtain_header_wrlock();
- new_olap_table->obtain_header_wrlock();
- res = _save_schema_change_info(type, ref_olap_table, new_olap_table, tmp_versions_to_be_changed);
- new_olap_table->release_header_lock();
- ref_olap_table->release_header_lock();
+ ref_tablet->obtain_push_lock();
+ ref_tablet->obtain_header_wrlock();
+ new_tablet->obtain_header_wrlock();
+ res = _save_schema_change_info(type, ref_tablet, new_tablet, tmp_versions_to_be_changed);
+ new_tablet->release_header_lock();
+ ref_tablet->release_header_lock();
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to save schema change info before waiting transactions. "
- "[base=%s new=%s res=%d]", ref_olap_table->full_name().c_str(),
- new_olap_table->full_name().c_str(), res);
- ref_olap_table->release_push_lock();
- OLAPEngine::get_instance()->drop_table(
- new_olap_table->tablet_id(), new_olap_table->schema_hash());
+ "[base=%s new=%s res=%d]", ref_tablet->full_name().c_str(),
+ new_tablet->full_name().c_str(), res);
+ ref_tablet->release_push_lock();
+ OLAPEngine::get_instance()->drop_tablet(
+ new_tablet->tablet_id(), new_tablet->schema_hash());
return res;
}
@@ -1437,13 +1437,13 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
int64_t partition_id;
std::set<int64_t> transaction_ids;
OLAPEngine::get_instance()->
- get_transactions_by_tablet(ref_olap_table, &partition_id, &transaction_ids);
- ref_olap_table->release_push_lock();
+ get_transactions_by_tablet(ref_tablet, &partition_id, &transaction_ids);
+ ref_tablet->release_push_lock();
// wait transactions to publish version
int num = 0;
while (!transaction_ids.empty()) {
- VLOG(3) << "wait transactions when schema change. tablet=" << ref_olap_table->full_name()
+ VLOG(3) << "wait transactions when schema change. tablet=" << ref_tablet->full_name()
<< ", transaction_size=" << transaction_ids.size();
num++;
if (num % 100 == 0) {
@@ -1457,42 +1457,42 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
for (int64_t transaction_id : transaction_ids) {
if (!OLAPEngine::get_instance()->has_transaction(
partition_id, transaction_id,
- ref_olap_table->tablet_id(), ref_olap_table->schema_hash())) {
+ ref_tablet->tablet_id(), ref_tablet->schema_hash())) {
finished_transactions.push_back(transaction_id);
}
}
for (int64_t transaction_id : finished_transactions) {
transaction_ids.erase(transaction_id);
VLOG(3) << "transaction finished when schema change is waiting. "
- << "tablet=" << ref_olap_table->full_name()
+ << "tablet=" << ref_tablet->full_name()
<< ", transaction_id=" << transaction_id
<< ", transaction_size=" << transaction_ids.size();
}
}
- // 2. Get version_to_be_changed and store into table header
- ref_olap_table->obtain_push_lock();
- ref_olap_table->obtain_header_wrlock();
- new_olap_table->obtain_header_wrlock();
+ // 2. Get version_to_be_changed and store into tablet header
+ ref_tablet->obtain_push_lock();
+ ref_tablet->obtain_header_wrlock();
+ new_tablet->obtain_header_wrlock();
// before calculating version_to_be_changed,
// remove all data from new tablet, prevent to rewrite data(those double pushed when wait)
VLOG(3) << "begin to remove all data from new tablet to prevent rewrite. "
- << "new_tablet=" << new_olap_table->full_name();
+ << "new_tablet=" << new_tablet->full_name();
// only remove the version <= base_tablet's latest version
- const PDelta* lastest_file_version = ref_olap_table->lastest_version();
+ const PDelta* lastest_file_version = ref_tablet->lastest_version();
if (lastest_file_version != NULL) {
VLOG(3) << "find the latest version of base tablet when remove all data from new. "
- << "base_tablet=" << ref_olap_table->full_name()
+ << "base_tablet=" << ref_tablet->full_name()
<< ", version=" << lastest_file_version->start_version()
<< "-" << lastest_file_version->end_version();
vector<Version> new_tablet_versions;
- new_olap_table->list_versions(&new_tablet_versions);
+ new_tablet->list_versions(&new_tablet_versions);
for (vector<Version>::const_iterator it = new_tablet_versions.begin();
it != new_tablet_versions.end(); ++it) {
if (it->second <= lastest_file_version->end_version()) {
std::vector<SegmentGroup*> segment_groups;
- res = new_olap_table->unregister_data_source(*it, &segment_groups);
+ res = new_tablet->unregister_data_source(*it, &segment_groups);
if (res != OLAP_SUCCESS) {
break;
}
@@ -1501,52 +1501,52 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
delete segment_group;
}
VLOG(3) << "unregister data source from new tablet when schema change. "
- << "new_tablet=" << new_olap_table->full_name()
+ << "new_tablet=" << new_tablet->full_name()
<< ", version=" << it->first << "-" << it->second
<< ", res=" << res;
}
}
// save header
if (res == OLAP_SUCCESS) {
- res = new_olap_table->save_header();
+ res = new_tablet->save_header();
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to save header after unregister data source "
"when schema change. [new_tablet=%s res=%d]",
- new_olap_table->full_name().c_str(), res);
+ new_tablet->full_name().c_str(), res);
}
}
// if failed, return
if (res != OLAP_SUCCESS) {
- new_olap_table->release_header_lock();
- ref_olap_table->release_header_lock();
- ref_olap_table->release_push_lock();
- OLAPEngine::get_instance()->drop_table(
- new_olap_table->tablet_id(), new_olap_table->schema_hash());
+ new_tablet->release_header_lock();
+ ref_tablet->release_header_lock();
+ ref_tablet->release_push_lock();
+ OLAPEngine::get_instance()->drop_tablet(
+ new_tablet->tablet_id(), new_tablet->schema_hash());
OLAP_LOG_WARNING("fail to remove data from new tablet when schema_change. "
- "[new_tablet=%s]", new_olap_table->full_name().c_str());
+ "[new_tablet=%s]", new_tablet->full_name().c_str());
return res;
}
}
vector<Version> versions_to_be_changed;
vector<ColumnData*> olap_data_arr;
- // delete handlers for new olap table
+ // delete handlers for new tablet
DeleteHandler delete_handler;
do {
- // inherit cumulative_layer_point from ref_olap_table
- new_olap_table->set_cumulative_layer_point(ref_olap_table->cumulative_layer_point());
+ // inherit cumulative_layer_point from ref_tablet
+ new_tablet->set_cumulative_layer_point(ref_tablet->cumulative_layer_point());
// get history versions to be changed
- res = _get_versions_to_be_changed(ref_olap_table, versions_to_be_changed);
+ res = _get_versions_to_be_changed(ref_tablet, versions_to_be_changed);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to get version to be changed. [res=%d]", res);
break;
}
- // store schema change information into table header
+ // store schema change information into tablet header
res = _save_schema_change_info(type,
- ref_olap_table,
- new_olap_table,
+ ref_tablet,
+ new_tablet,
versions_to_be_changed);
if (res != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to save schema change info. [res=%d]", res);
@@ -1554,7 +1554,7 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
}
// acquire data sources correspond to history versions
- ref_olap_table->acquire_data_sources_by_versions(
+ ref_tablet->acquire_data_sources_by_versions(
versions_to_be_changed, &olap_data_arr);
if (olap_data_arr.size() < 1) {
OLAP_LOG_WARNING("fail to acquire all data sources."
@@ -1573,10 +1573,10 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
}
}
- res = delete_handler.init(ref_olap_table, end_version);
+ res = delete_handler.init(ref_tablet, end_version);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("init delete handler failed. [table=%s; end_version=%d]",
- ref_olap_table->full_name().c_str(), end_version);
+ OLAP_LOG_WARNING("init delete handler failed. [tablet=%s; end_version=%d]",
+ ref_tablet->full_name().c_str(), end_version);
// release delete handlers which have been inited successfully.
delete_handler.finalize();
@@ -1584,72 +1584,72 @@ OLAPStatus SchemaChangeHandler::_do_alter_table(
}
} while (0);
- new_olap_table->release_header_lock();
- ref_olap_table->release_header_lock();
- ref_olap_table->release_push_lock();
+ new_tablet->release_header_lock();
+ ref_tablet->release_header_lock();
+ ref_tablet->release_push_lock();
if (res == OLAP_SUCCESS) {
// 3. Generate alter job
SchemaChangeParams sc_params;
- sc_params.alter_table_type = type;
- sc_params.ref_olap_table = ref_olap_table;
- sc_params.new_olap_table = new_olap_table;
+ sc_params.alter_tablet_type = type;
+ sc_params.ref_tablet = ref_tablet;
+ sc_params.new_tablet = new_tablet;
sc_params.ref_olap_data_arr = olap_data_arr;
sc_params.delete_handler = delete_handler;
- // 4. Update schema change status of ref_olap_table and new_olap_tables
- new_olap_table->set_schema_change_status(ALTER_TABLE_RUNNING,
- ref_olap_table->schema_hash(),
+ // 4. Update schema change status of ref_tablet and new_tablets
+ new_tablet->set_schema_change_status(ALTER_TABLE_RUNNING,
+ ref_tablet->schema_hash(),
versions_to_be_changed.back().second);
- ref_olap_table->set_schema_change_status(ALTER_TABLE_RUNNING,
- new_olap_table->schema_hash(),
+ ref_tablet->set_schema_change_status(ALTER_TABLE_RUNNING,
+ new_tablet->schema_hash(),
versions_to_be_changed.back().second);
// add tid to cgroup
CgroupsMgr::apply_system_cgroup();
- // process the job : special for query table split key
- VLOG(10) << "starts to alter table. "
- << "old_tablet=" << sc_params.ref_olap_table->full_name()
- << ", new_tablet=" << sc_params.new_olap_table->full_name();
+ // process the job : special for query tablet split key
+ VLOG(10) << "starts to alter tablet. "
+ << "old_tablet=" << sc_params.ref_tablet->full_name()
+ << ", new_tablet=" << sc_params.new_tablet->full_name();
- if ((res = _alter_table(&sc_params)) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to alter table. [request='%s']",
+ if ((res = _alter_tablet(&sc_params)) != OLAP_SUCCESS) {
+ OLAP_LOG_WARNING("failed to alter tablet. [request='%s']",
sc_params.debug_message.c_str());
}
VLOG(10) << "schema change thread completed the job. "
<< "request=" << sc_params.debug_message;
} else {
- // Delete olap table when submit alter table failed.
- OLAPEngine::get_instance()->drop_table(
- new_olap_table->tablet_id(), new_olap_table->schema_hash());
+ // Delete tablet when submit alter tablet failed.
+ OLAPEngine::get_instance()->drop_tablet(
+ new_tablet->tablet_id(), new_tablet->schema_hash());
}
OLAP_LOG_WARNING("finish to generate alter tablet job. [res=%d]", res);
return res;
}
-OLAPStatus SchemaChangeHandler::_create_new_olap_table(
- const TabletSharedPtr ref_olap_table,
+OLAPStatus SchemaChangeHandler::_create_new_tablet(
+ const TabletSharedPtr ref_tablet,
const TCreateTabletReq& request,
const string* ref_root_path,
- TabletSharedPtr* out_new_olap_table) {
+ TabletSharedPtr* out_new_tablet) {
OLAPStatus res = OLAP_SUCCESS;
- OLAPTable* new_olap_table = NULL;
- bool is_table_added = false;
+ Tablet* new_tablet = NULL;
+ bool is_tablet_added = false;
- // 1. Lock to ensure that all _create_new_olap_table operation execute in serial
- static Mutex create_table_lock;
- create_table_lock.lock();
+ // 1. Lock to ensure that all _create_new_tablet operation execute in serial
+ static Mutex create_tablet_lock;
+ create_tablet_lock.lock();
do {
- // 2. Create table with only header, no deltas
- TabletSharedPtr new_olap_table = OLAPEngine::get_instance()->create_table(
- request, ref_root_path, true, ref_olap_table);
- if (new_olap_table == NULL) {
- OLAP_LOG_WARNING("failed to create table. [table=%ld xml_path=%d]",
+ // 2. Create tablet with only header, no deltas
+ TabletSharedPtr new_tablet = OLAPEngine::get_instance()->create_tablet(
+ request, ref_root_path, true, ref_tablet);
+ if (new_tablet == NULL) {
+ OLAP_LOG_WARNING("failed to create tablet. [tablet=%ld xml_path=%d]",
request.tablet_id,
request.tablet_schema.schema_hash);
res = OLAP_ERR_INPUT_PARAMETER_ERROR;
@@ -1663,77 +1663,77 @@ OLAPStatus SchemaChangeHandler::_create_new_olap_table(
//
// 当出现以上2种情况时,为了能够区分alter得到的新表和旧表,这里把新表的creation_time设置为
// 旧表的creation_time加1
- if (new_olap_table->creation_time() <= ref_olap_table->creation_time()) {
- OLAP_LOG_WARNING("new table's creation time is less than or equal to old table"
- "[new_table_creation_time=%ld; old_table_creation_time=%ld]",
- new_olap_table->creation_time(),
- ref_olap_table->creation_time());
- int64_t new_creation_time = ref_olap_table->creation_time() + 1;
- new_olap_table->set_creation_time(new_creation_time);
+ if (new_tablet->creation_time() <= ref_tablet->creation_time()) {
+ OLAP_LOG_WARNING("new tablet's creation time is less than or equal to old tablet"
+ "[new_tablet_creation_time=%ld; old_tablet_creation_time=%ld]",
+ new_tablet->creation_time(),
+ ref_tablet->creation_time());
+ int64_t new_creation_time = ref_tablet->creation_time() + 1;
+ new_tablet->set_creation_time(new_creation_time);
}
- // 3. Add table to OlapEngine will make it visiable to user
- res = OLAPEngine::get_instance()->add_table(
+ // 3. Add tablet to OlapEngine will make it visiable to user
+ res = OLAPEngine::get_instance()->add_tablet(
request.tablet_id,
request.tablet_schema.schema_hash,
- new_olap_table);
+ new_tablet);
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("failed to add table to OLAPEngine. [res=%d table='%s']",
- res, new_olap_table->full_name().c_str());
+ OLAP_LOG_WARNING("failed to add tablet to OLAPEngine. [res=%d tablet='%s']",
+ res, new_tablet->full_name().c_str());
break;
}
- is_table_added = true;
+ is_tablet_added = true;
- // 4. Register table into OLAPRootPath, so that we can manage table from
+ // 4. Register tablet into OLAPRootPath, so that we can manage tablet from
// the perspective of root path.
// Example: unregister all tables when a bad disk found.
- res = OLAPEngine::get_instance()->register_table_into_root_path(
- new_olap_table.get());
+ res = OLAPEngine::get_instance()->register_tablet_into_root_path(
+ new_tablet.get());
if (res != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to register table into root path. "
- "[root_path='%s' table='%s']",
- new_olap_table->storage_root_path_name().c_str(),
- new_olap_table->full_name().c_str());
+ OLAP_LOG_WARNING("fail to register tablet into root path. "
+ "[root_path='%s' tablet='%s']",
+ new_tablet->storage_root_path_name().c_str(),
+ new_tablet->full_name().c_str());
break;
}
- TabletSharedPtr olap_table;
- olap_table = OLAPEngine::get_instance()->get_table(
+ TabletSharedPtr tablet;
+ tablet = OLAPEngine::get_instance()->get_tablet(
request.tablet_id, request.tablet_schema.schema_hash);
- if (olap_table.get() == NULL) {
- OLAP_LOG_WARNING("failed to get table from OLAPEngine. [table=%ld schema_hash=%d]",
+ if (tablet.get() == NULL) {
+ OLAP_LOG_WARNING("failed to get tablet from OLAPEngine. [tablet=%ld schema_hash=%d]",
request.tablet_id,
request.tablet_schema.schema_hash);
res = OLAP_ERR_OTHER_ERROR;
break;
}
- if (out_new_olap_table != NULL) {
- *out_new_olap_table = olap_table;
+ if (out_new_tablet != NULL) {
+ *out_new_tablet = tablet;
}
} while (0);
if (res != OLAP_SUCCESS) {
- if (is_table_added) {
- res = OLAPEngine::get_instance()->drop_table(
+ if (is_tablet_added) {
+ res = OLAPEngine::get_instance()->drop_tablet(
request.tablet_id, request.tablet_schema.schema_hash);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to drop table when create table failed. res=" << res
+ LOG(WARNING) << "fail to drop tablet when create tablet failed. res=" << res
<< ", tablet=" << request.tablet_id
<< ":" << request.tablet_schema.schema_hash;
}
- } else if (NULL != new_olap_table) {
- new_olap_table->delete_all_files();
+ } else if (NULL != new_tablet) {
+ new_tablet->delete_all_files();
}
}
- create_table_lock.unlock();
+ create_tablet_lock.unlock();
return res;
}
OLAPStatus SchemaChangeHandler::schema_version_convert(
- TabletSharedPtr src_olap_table,
- TabletSharedPtr dest_olap_table,
+ TabletSharedPtr src_tablet,
+ TabletSharedPtr dest_tablet,
vector<SegmentGroup*>* ref_segment_groups,
vector<SegmentGroup*>* new_segment_groups) {
if (NULL == new_segment_groups) {
@@ -1743,17 +1743,17 @@ OLAPStatus SchemaChangeHandler::schema_version_convert(
OLAPStatus res = OLAP_SUCCESS;
LOG(INFO) << "begin to convert delta version for schema changing. "
- << "old_tablet=" << src_olap_table->full_name()
- << ", dest_tablet=" << dest_olap_table->full_name();
+ << "old_tablet=" << src_tablet->full_name()
+ << ", dest_tablet=" << dest_tablet->full_name();
// a. 解析Alter请求,转换成内部的表示形式
// 不使用DELETE_DATA命令指定的删除条件
- RowBlockChanger rb_changer(dest_olap_table->tablet_schema(), src_olap_table);
+ RowBlockChanger rb_changer(dest_tablet->tablet_schema(), src_tablet);
bool sc_sorting = false;
bool sc_directly = false;
- if (OLAP_SUCCESS != (res = _parse_request(src_olap_table,
- dest_olap_table,
+ if (OLAP_SUCCESS != (res = _parse_request(src_tablet,
+ dest_tablet,
&rb_changer,
&sc_sorting,
&sc_directly))) {
@@ -1769,18 +1769,18 @@ OLAPStatus SchemaChangeHandler::schema_version_convert(
size_t memory_limitation = config::memory_limitation_per_thread_for_schema_change;
LOG(INFO) << "doing schema change with sorting.";
sc_procedure = new(nothrow) SchemaChangeWithSorting(
- dest_olap_table,
+ dest_tablet,
rb_changer,
memory_limitation * 1024 * 1024 * 1024);
} else if (true == sc_directly) {
LOG(INFO) << "doing schema change directly.";
sc_procedure = new(nothrow) SchemaChangeDirectly(
- dest_olap_table, rb_changer);
+ dest_tablet, rb_changer);
} else {
LOG(INFO) << "doing linked schema change.";
sc_procedure = new(nothrow) LinkedSchemaChange(
- src_olap_table,
- dest_olap_table);
+ src_tablet,
+ dest_tablet);
}
if (NULL == sc_procedure) {
@@ -1803,13 +1803,13 @@ OLAPStatus SchemaChangeHandler::schema_version_convert(
SegmentGroup* new_segment_group = nullptr;
if ((*it)->transaction_id() == 0) {
- new_segment_group = new SegmentGroup(dest_olap_table.get(),
+ new_segment_group = new SegmentGroup(dest_tablet.get(),
olap_data->version(),
olap_data->version_hash(),
olap_data->delete_flag(),
(*it)->segment_group_id(), 0);
} else {
- new_segment_group = new SegmentGroup(dest_olap_table.get(),
+ new_segment_group = new SegmentGroup(dest_tablet.get(),
olap_data->delete_flag(),
(*it)->segment_group_id(), 0,
(*it)->is_pending(),
@@ -1828,8 +1828,8 @@ OLAPStatus SchemaChangeHandler::schema_version_convert(
if (!sc_procedure->process(olap_data, new_segment_group)) {
if ((*it)->is_pending()) {
OLAP_LOG_WARNING("failed to process the transaction when schema change. "
- "[table='%s' transaction=%ld]",
- (*it)->table()->full_name().c_str(),
+ "[tablet='%s' transaction=%ld]",
+ (*it)->tablet()->full_name().c_str(),
(*it)->transaction_id());
} else {
OLAP_LOG_WARNING("failed to process the version. [version='%d-%d']",
@@ -1862,15 +1862,15 @@ OLAPStatus SchemaChangeHandler::schema_version_convert(
}
OLAPStatus SchemaChangeHandler::_get_versions_to_be_changed(
- TabletSharedPtr ref_olap_table,
+ TabletSharedPtr ref_tablet,
vector<Version>& versions_to_be_changed) {
int32_t request_version = 0;
- const PDelta* lastest_version = ref_olap_table->lastest_version();
+ const PDelta* lastest_version = ref_tablet->lastest_version();
if (lastest_version != NULL) {
request_version = lastest_version->end_version() - 1;
} else {
OLAP_LOG_WARNING("Table has no version. [path='%s']",
- ref_olap_table->full_name().c_str());
+ ref_tablet->full_name().c_str());
return OLAP_ERR_ALTER_DELTA_DOES_NOT_EXISTS;
}
@@ -1878,14 +1878,14 @@ OLAPStatus SchemaChangeHandler::_get_versions_to_be_changed(
// 必须包含最新版本的delta
if (request_version >= 0) {
vector<Version> span_versions;
- ref_olap_table->select_versions_to_span(Version(0, request_version), &span_versions);
+ ref_tablet->select_versions_to_span(Version(0, request_version), &span_versions);
// get all version list
vector<VersionEntity> all_versions;
- ref_olap_table->list_version_entities(&all_versions);
+ ref_tablet->list_version_entities(&all_versions);
if (0 == all_versions.size()) {
- OLAP_LOG_WARNING("there'is no any version in the table. [table='%s']",
- ref_olap_table->full_name().c_str());
+ OLAP_LOG_WARNING("there'is no any version in the tablet. [tablet='%s']",
+ ref_tablet->full_name().c_str());
return OLAP_ERR_VERSION_NOT_EXIST;
}
@@ -1901,45 +1901,45 @@ OLAPStatus SchemaChangeHandler::_get_versions_to_be_changed(
// 增加A->(B|C|...) 的schema_change信息
OLAPStatus SchemaChangeHandler::_save_schema_change_info(
- AlterTabletType alter_table_type,
- TabletSharedPtr ref_olap_table,
- TabletSharedPtr new_olap_table,
+ AlterTabletType alter_tablet_type,
+ TabletSharedPtr ref_tablet,
+ TabletSharedPtr new_tablet,
const vector<Version>& versions_to_be_changed) {
- // check new table exists,
+ // check new tablet exists,
// prevent to set base's status after new's dropping (clear base's status)
- if (OLAPEngine::get_instance()->get_table(
- new_olap_table->tablet_id(), new_olap_table->schema_hash()).get() == NULL) {
- OLAP_LOG_WARNING("fail to find table before saving status. [table='%s']",
- new_olap_table->full_name().c_str());
+ if (OLAPEngine::get_instance()->get_tablet(
+ new_tablet->tablet_id(), new_tablet->schema_hash()).get() == NULL) {
+ OLAP_LOG_WARNING("fail to find tablet before saving status. [tablet='%s']",
+ new_tablet->full_name().c_str());
return OLAP_ERR_TABLE_NOT_FOUND;
}
OLAPStatus res = OLAP_SUCCESS;
// 1. 在新表和旧表中添加schema change标志
- ref_olap_table->clear_schema_change_request();
- ref_olap_table->set_schema_change_request(new_olap_table->tablet_id(),
- new_olap_table->schema_hash(),
+ ref_tablet->clear_schema_change_request();
+ ref_tablet->set_schema_change_request(new_tablet->tablet_id(),
+ new_tablet->schema_hash(),
versions_to_be_changed,
- alter_table_type);
- new_olap_table->set_schema_change_request(ref_olap_table->tablet_id(),
- ref_olap_table->schema_hash(),
+ alter_tablet_type);
+ new_tablet->set_schema_change_request(ref_tablet->tablet_id(),
+ ref_tablet->schema_hash(),
vector<Version>(), // empty versions
- alter_table_type);
+ alter_tablet_type);
- // save new olap table header :只有一个父ref table
- res = new_olap_table->save_header();
+ // save new tablet header :只有一个父ref tablet
+ res = new_tablet->save_header();
if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "fail to save new table header. res=" << res
- << ", tablet=" << new_olap_table->full_name();
+ LOG(FATAL) << "fail to save new tablet header. res=" << res
+ << ", tablet=" << new_tablet->full_name();
return res;
}
- res = ref_olap_table->save_header();
+ res = ref_tablet->save_header();
if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "fail to save ref table header. res=" << res
- << ", tablet=" << ref_olap_table->full_name().c_str();
+ LOG(FATAL) << "fail to save ref tablet header. res=" << res
+ << ", tablet=" << ref_tablet->full_name().c_str();
return res;
}
@@ -1947,11 +1947,11 @@ OLAPStatus SchemaChangeHandler::_save_schema_change_info(
}
// @static
-OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
+OLAPStatus SchemaChangeHandler::_alter_tablet(SchemaChangeParams* sc_params) {
OLAPStatus res = OLAP_SUCCESS;
- LOG(INFO) << "begin to process alter table job. "
- << "old_olap_table=" << sc_params->ref_olap_table->full_name()
- << ", new_olap_table=" << sc_params->new_olap_table->full_name();
+ LOG(INFO) << "begin to process alter tablet job. "
+ << "old_tablet=" << sc_params->ref_tablet->full_name()
+ << ", new_tablet=" << sc_params->new_tablet->full_name();
// find end version
int32_t end_version = -1;
@@ -1963,8 +1963,8 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
// change中增加了filter信息,在_parse_request中会设置filter的column信息
// 并在每次row block的change时,过滤一些数据
- RowBlockChanger rb_changer(sc_params->new_olap_table->tablet_schema(),
- sc_params->ref_olap_table,
+ RowBlockChanger rb_changer(sc_params->new_tablet->tablet_schema(),
+ sc_params->ref_tablet,
sc_params->delete_handler);
bool sc_sorting = false;
@@ -1972,8 +1972,8 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
SchemaChange* sc_procedure = NULL;
// a. 解析Alter请求,转换成内部的表示形式
- res = _parse_request(sc_params->ref_olap_table,
- sc_params->new_olap_table,
+ res = _parse_request(sc_params->ref_tablet,
+ sc_params->new_tablet,
&rb_changer,
&sc_sorting,
&sc_directly);
@@ -1987,18 +1987,18 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
size_t memory_limitation = config::memory_limitation_per_thread_for_schema_change;
LOG(INFO) << "doing schema change with sorting.";
sc_procedure = new(nothrow) SchemaChangeWithSorting(
- sc_params->new_olap_table,
+ sc_params->new_tablet,
rb_changer,
memory_limitation * 1024 * 1024 * 1024);
} else if (true == sc_directly) {
LOG(INFO) << "doing schema change directly.";
sc_procedure = new(nothrow) SchemaChangeDirectly(
- sc_params->new_olap_table, rb_changer);
+ sc_params->new_tablet, rb_changer);
} else {
LOG(INFO) << "doing linked schema change.";
sc_procedure = new(nothrow) LinkedSchemaChange(
- sc_params->ref_olap_table,
- sc_params->new_olap_table);
+ sc_params->ref_tablet,
+ sc_params->new_tablet);
}
if (NULL == sc_procedure) {
@@ -2017,18 +2017,18 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
// set status for monitor
// 只要有一个new_table为running,ref table就设置为running
// NOTE 如果第一个sub_table先fail,这里会继续按正常走
- sc_params->ref_olap_table->set_schema_change_status(
+ sc_params->ref_tablet->set_schema_change_status(
ALTER_TABLE_RUNNING,
- sc_params->new_olap_table->schema_hash(),
+ sc_params->new_tablet->schema_hash(),
-1);
- sc_params->new_olap_table->set_schema_change_status(
+ sc_params->new_tablet->set_schema_change_status(
ALTER_TABLE_RUNNING,
- sc_params->ref_olap_table->schema_hash(),
+ sc_params->ref_tablet->schema_hash(),
(*it)->version().second);
// we create a new delta with the same version as the ColumnData processing currently.
SegmentGroup* new_segment_group = new(nothrow) SegmentGroup(
- sc_params->new_olap_table.get(),
+ sc_params->new_tablet.get(),
(*it)->version(),
(*it)->version_hash(),
(*it)->delete_flag(),
@@ -2045,8 +2045,8 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
if (DEL_SATISFIED == del_ret) {
VLOG(3) << "filter delta in schema change:"
<< (*it)->version().first << "-" << (*it)->version().second;
- res = sc_procedure->create_init_version(new_segment_group->table()->tablet_id(),
- new_segment_group->table()->schema_hash(),
+ res = sc_procedure->create_init_version(new_segment_group->tablet()->tablet_id(),
+ new_segment_group->tablet()->schema_hash(),
new_segment_group->version(),
new_segment_group->version_hash(),
new_segment_group);
@@ -2067,7 +2067,7 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
}
if (DEL_SATISFIED != del_ret && !sc_procedure->process(*it, new_segment_group)) {
- //if del_ret is DEL_SATISFIED, the new delta version has already been created in new_olap_table
+ //if del_ret is DEL_SATISFIED, the new delta version has already been created in new_tablet
OLAP_LOG_WARNING("failed to process the version. [version='%d-%d']",
(*it)->version().first, (*it)->version().second);
new_segment_group->delete_all_files();
@@ -2079,74 +2079,74 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
// 将新版本的数据加入header
// 为了防止死锁的出现,一定要先锁住旧表,再锁住新表
- sc_params->new_olap_table->obtain_push_lock();
- sc_params->ref_olap_table->obtain_header_wrlock();
- sc_params->new_olap_table->obtain_header_wrlock();
+ sc_params->new_tablet->obtain_push_lock();
+ sc_params->ref_tablet->obtain_header_wrlock();
+ sc_params->new_tablet->obtain_header_wrlock();
- if (!sc_params->new_olap_table->has_version((*it)->version())) {
+ if (!sc_params->new_tablet->has_version((*it)->version())) {
// register version
std::vector<SegmentGroup*> segment_group_vec;
segment_group_vec.push_back(new_segment_group);
- res = sc_params->new_olap_table->register_data_source(segment_group_vec);
+ res = sc_params->new_tablet->register_data_source(segment_group_vec);
if (OLAP_SUCCESS != res) {
- OLAP_LOG_WARNING("failed to register new version. [table='%s' version='%d-%d']",
- sc_params->new_olap_table->full_name().c_str(),
+ OLAP_LOG_WARNING("failed to register new version. [tablet='%s' version='%d-%d']",
+ sc_params->new_tablet->full_name().c_str(),
(*it)->version().first,
(*it)->version().second);
new_segment_group->delete_all_files();
SAFE_DELETE(new_segment_group);
- sc_params->new_olap_table->release_header_lock();
- sc_params->ref_olap_table->release_header_lock();
+ sc_params->new_tablet->release_header_lock();
+ sc_params->ref_tablet->release_header_lock();
goto PROCESS_ALTER_EXIT;
}
- VLOG(3) << "register new version. tablet=" << sc_params->new_olap_table->full_name()
+ VLOG(3) << "register new version. tablet=" << sc_params->new_tablet->full_name()
<< ", version=" << (*it)->version().first << "-" << (*it)->version().second;
} else {
OLAP_LOG_WARNING("version already exist, version revert occured. "
- "[table='%s' version='%d-%d']",
- sc_params->new_olap_table->full_name().c_str(),
+ "[tablet='%s' version='%d-%d']",
+ sc_params->new_tablet->full_name().c_str(),
(*it)->version().first, (*it)->version().second);
new_segment_group->delete_all_files();
SAFE_DELETE(new_segment_group);
}
// 保存header
- if (OLAP_SUCCESS != sc_params->new_olap_table->save_header()) {
+ if (OLAP_SUCCESS != sc_params->new_tablet->save_header()) {
LOG(FATAL) << "fail to save header. res=" << res
- << ", tablet=" << sc_params->new_olap_table->full_name();
+ << ", tablet=" << sc_params->new_tablet->full_name();
}
- // XXX: 此处需要验证ref_olap_data_arr中最后一个版本是否与new_olap_table的header中记录的最
+ // XXX: 此处需要验证ref_olap_data_arr中最后一个版本是否与new_tablet的header中记录的最
// 后一个版本相同。然后还要注意一致性问题。
- if (!sc_params->ref_olap_table->remove_last_schema_change_version(
- sc_params->new_olap_table)) {
+ if (!sc_params->ref_tablet->remove_last_schema_change_version(
+ sc_params->new_tablet)) {
OLAP_LOG_WARNING("failed to remove the last version did schema change.");
- sc_params->new_olap_table->release_header_lock();
- sc_params->ref_olap_table->release_header_lock();
+ sc_params->new_tablet->release_header_lock();
+ sc_params->ref_tablet->release_header_lock();
res = OLAP_ERR_INPUT_PARAMETER_ERROR;
goto PROCESS_ALTER_EXIT;
}
// 保存header
- if (OLAP_SUCCESS != sc_params->ref_olap_table->save_header()) {
- LOG(FATAL) << "failed to save header. tablet=" << sc_params->new_olap_table->full_name();
+ if (OLAP_SUCCESS != sc_params->ref_tablet->save_header()) {
+ LOG(FATAL) << "failed to save header. tablet=" << sc_params->new_tablet->full_name();
}
- sc_params->new_olap_table->release_header_lock();
- sc_params->ref_olap_table->release_header_lock();
- sc_params->new_olap_table->release_push_lock();
+ sc_params->new_tablet->release_header_lock();
+ sc_params->ref_tablet->release_header_lock();
+ sc_params->new_tablet->release_push_lock();
VLOG(10) << "succeed to convert a history version."
<< ", version=" << (*it)->version().first << "-" << (*it)->version().second;
// 释放ColumnData
vector<ColumnData*> olap_data_to_be_released(it, it + 1);
- sc_params->ref_olap_table->release_data_sources(&olap_data_to_be_released);
+ sc_params->ref_tablet->release_data_sources(&olap_data_to_be_released);
it = sc_params->ref_olap_data_arr.erase(it); // after erasing, it will point to end()
}
@@ -2156,69 +2156,69 @@ OLAPStatus SchemaChangeHandler::_alter_table(SchemaChangeParams* sc_params) {
PROCESS_ALTER_EXIT:
if (res == OLAP_SUCCESS) {
Version test_version(0, end_version);
- res = sc_params->new_olap_table->test_version(test_version);
+ res = sc_params->new_tablet->test_version(test_version);
}
if (res == OLAP_SUCCESS) {
// ref的状态只有2个new table都完成后,才能设置为done
- sc_params->ref_olap_table->obtain_header_rdlock();
- res = clear_schema_change_single_info(sc_params->ref_olap_table, NULL, false, true);
- sc_params->ref_olap_table->release_header_lock();
+ sc_params->ref_tablet->obtain_header_rdlock();
+ res = clear_schema_change_single_info(sc_params->ref_tablet, NULL, false, true);
+ sc_params->ref_tablet->release_header_lock();
if (OLAP_SUCCESS == res) {
- sc_params->ref_olap_table->set_schema_change_status(
+ sc_params->ref_tablet->set_schema_change_status(
ALTER_TABLE_FINISHED,
- sc_params->new_olap_table->schema_hash(),
+ sc_params->new_tablet->schema_hash(),
-1);
} else {
res = OLAP_SUCCESS;
}
- sc_params->new_olap_table->set_schema_change_status(
+ sc_params->new_tablet->set_schema_change_status(
ALTER_TABLE_FINISHED,
- sc_params->ref_olap_table->schema_hash(),
+ sc_params->ref_tablet->schema_hash(),
-1);
- VLOG(3) << "set alter table job status. "
- << "status=" << sc_params->ref_olap_table->schema_change_status().status;
+ VLOG(3) << "set alter tablet job status. "
+ << "status=" << sc_params->ref_tablet->schema_change_status().status;
} else {
- sc_params->ref_olap_table->set_schema_change_status(
+ sc_params->ref_tablet->set_schema_change_status(
ALTER_TABLE_FAILED,
- sc_params->new_olap_table->schema_hash(),
+ sc_params->new_tablet->schema_hash(),
-1);
- sc_params->new_olap_table->set_schema_change_status(
+ sc_params->new_tablet->set_schema_change_status(
ALTER_TABLE_FAILED,
- sc_params->ref_olap_table->schema_hash(),
+ sc_params->ref_tablet->schema_hash(),
-1);
- VLOG(3) << "set alter table job status. "
- << "status=" << sc_params->ref_olap_table->schema_change_status().status;
+ VLOG(3) << "set alter tablet job status. "
+ << "status=" << sc_params->ref_tablet->schema_change_status().status;
}
- sc_params->ref_olap_table->release_data_sources(&(sc_params->ref_olap_data_arr));
+ sc_params->ref_tablet->release_data_sources(&(sc_params->ref_olap_data_arr));
SAFE_DELETE(sc_procedure);
- LOG(INFO) << "finish to process alter table job. res=" << res;
+ LOG(INFO) << "finish to process alter tablet job. res=" << res;
return res;
}
// @static
// 分析column的mapping以及filter key的mapping
-OLAPStatus SchemaChangeHandler::_parse_request(TabletSharedPtr ref_olap_table,
- TabletSharedPtr new_olap_table,
+OLAPStatus SchemaChangeHandler::_parse_request(TabletSharedPtr ref_tablet,
+ TabletSharedPtr new_tablet,
RowBlockChanger* rb_changer,
bool* sc_sorting,
bool* sc_directly) {
OLAPStatus res = OLAP_SUCCESS;
// set column mapping
- for (int i = 0, new_schema_size = new_olap_table->tablet_schema().size();
+ for (int i = 0, new_schema_size = new_tablet->tablet_schema().size();
i < new_schema_size; ++i) {
- const FieldInfo& new_column_schema = new_olap_table->tablet_schema()[i];
+ const FieldInfo& new_column_schema = new_tablet->tablet_schema()[i];
const string& column_name = new_column_schema.name;
ColumnMapping* column_mapping = rb_changer->get_mutable_column_mapping(i);
if (new_column_schema.has_referenced_column) {
- int32_t column_index = ref_olap_table->get_field_index(
+ int32_t column_index = ref_tablet->get_field_index(
new_column_schema.referenced_column);
if (column_index < 0) {
@@ -2235,7 +2235,7 @@ OLAPStatus SchemaChangeHandler::_parse_request(TabletSharedPtr ref_olap_table,
continue;
}
- int32_t column_index = ref_olap_table->get_field_index(column_name);
+ int32_t column_index = ref_tablet->get_field_index(column_name);
if (column_index >= 0) {
column_mapping->ref_column = column_index;
continue;
@@ -2246,7 +2246,7 @@ OLAPStatus SchemaChangeHandler::_parse_request(TabletSharedPtr ref_olap_table,
{
column_mapping->ref_column = -1;
- if (i < ref_olap_table->num_short_key_fields()) {
+ if (i < ref_tablet->num_short_key_fields()) {
*sc_directly = true;
}
@@ -2284,7 +2284,7 @@ OLAPStatus SchemaChangeHandler::_parse_request(TabletSharedPtr ref_olap_table,
// 若Key列的引用序列出现乱序,则需要重排序
int num_default_value = 0;
- for (int i = 0, new_schema_size = new_olap_table->num_key_fields();
+ for (int i = 0, new_schema_size = new_tablet->num_key_fields();
i < new_schema_size; ++i) {
ColumnMapping* column_mapping = rb_changer->get_mutable_column_mapping(i);
@@ -2299,43 +2299,43 @@ OLAPStatus SchemaChangeHandler::_parse_request(TabletSharedPtr ref_olap_table,
}
}
- if (ref_olap_table->num_short_key_fields() != new_olap_table->num_short_key_fields()) {
+ if (ref_tablet->num_short_key_fields() != new_tablet->num_short_key_fields()) {
// the number of short_keys changed, can't do linked schema change
*sc_directly = true;
return OLAP_SUCCESS;
}
- const RowFields& ref_table_schema = ref_olap_table->tablet_schema();
- const RowFields& new_table_schema = new_olap_table->tablet_schema();
- for (size_t i = 0; i < new_olap_table->num_fields(); ++i) {
+ const RowFields& ref_tablet_schema = ref_tablet->tablet_schema();
+ const RowFields& new_tablet_schema = new_tablet->tablet_schema();
+ for (size_t i = 0; i < new_tablet->num_fields(); ++i) {
ColumnMapping* column_mapping = rb_changer->get_mutable_column_mapping(i);
if (column_mapping->ref_column < 0) {
continue;
} else {
- if (new_table_schema[i].type != ref_table_schema[column_mapping->ref_column].type) {
+ if (new_tablet_schema[i].type != ref_tablet_schema[column_mapping->ref_column].type) {
*sc_directly = true;
return OLAP_SUCCESS;
} else if (
- (new_table_schema[i].type == ref_table_schema[column_mapping->ref_column].type)
- && (new_table_schema[i].length
- != ref_table_schema[column_mapping->ref_column].length)) {
+ (new_tablet_schema[i].type == ref_tablet_schema[column_mapping->ref_column].type)
+ && (new_tablet_schema[i].length
+ != ref_tablet_schema[column_mapping->ref_column].length)) {
*sc_directly = true;
return OLAP_SUCCESS;
- } else if (new_table_schema[i].is_bf_column != ref_table_schema[i].is_bf_column) {
+ } else if (new_tablet_schema[i].is_bf_column != ref_tablet_schema[i].is_bf_column) {
*sc_directly = true;
return OLAP_SUCCESS;
}
}
}
- if (ref_olap_table->delete_data_conditions_size() != 0){
+ if (ref_tablet->delete_data_conditions_size() != 0){
//there exists delete condtion in header, can't do linked schema change
*sc_directly = true;
}
- if (ref_olap_table->data_file_type() != new_olap_table->data_file_type()) {
- //if change the table from row-oriented to column-oriented, or versus
+ if (ref_tablet->data_file_type() != new_tablet->data_file_type()) {
+ //if change the tablet from row-oriented to column-oriented, or versus
*sc_directly = true;
}
@@ -2369,7 +2369,7 @@ OLAPStatus SchemaChange::create_init_version(
VLOG(3) << "begin to create init version. "
<< "begin=" << version.first << ", end=" << version.second;
- TabletSharedPtr table;
+ TabletSharedPtr tablet;
ColumnDataWriter* writer = NULL;
OLAPStatus res = OLAP_SUCCESS;
@@ -2381,32 +2381,32 @@ OLAPStatus SchemaChange::create_init_version(
break;
}
- // Get olap table and generate new index
- table = OLAPEngine::get_instance()->get_table(tablet_id, schema_hash);
- if (table.get() == NULL) {
- OLAP_LOG_WARNING("fail to find table. [table=%ld]", tablet_id);
+ // Get tablet and generate new index
+ tablet = OLAPEngine::get_instance()->get_tablet(tablet_id, schema_hash);
+ if (tablet.get() == NULL) {
+ OLAP_LOG_WARNING("fail to find tablet. [tablet=%ld]", tablet_id);
res = OLAP_ERR_TABLE_NOT_FOUND;
break;
}
- // Create writer, which write nothing to table, to generate empty data file
- writer = ColumnDataWriter::create(table, segment_group, false);
+ // Create writer, which write nothing to tablet, to generate empty data file
+ writer = ColumnDataWriter::create(tablet, segment_group, false);
if (writer == NULL) {
- LOG(WARNING) << "fail to create writer. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to create writer. [tablet=" << tablet->full_name() << "]";
res = OLAP_ERR_MALLOC_ERROR;
break;
}
res = writer->finalize();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to finalize writer. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to finalize writer. [tablet=" << tablet->full_name() << "]";
break;
}
- // Load new index and add to table
+ // Load new index and add to tablet
res = segment_group->load();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to load new index. [table=" << table->full_name() << "]";
+ LOG(WARNING) << "fail to load new index. [tablet=" << tablet->full_name() << "]";
break;
}
} while (0);
diff --git a/be/src/olap/schema_change.h b/be/src/olap/schema_change.h
index 163a7d70..9c8fa847 100644
--- a/be/src/olap/schema_change.h
+++ b/be/src/olap/schema_change.h
@@ -32,8 +32,8 @@ class Field;
class FieldInfo;
// defined in 'olap_data.h'
class ColumnData;
-// defined in 'olap_table.h'
-class OLAPTable;
+// defined in 'tablet.h'
+class Tablet;
// defined in 'row_block.h'
class RowBlock;
// defined in 'row_cursor.h'
@@ -57,11 +57,11 @@ class RowBlockChanger {
typedef std::vector<ColumnMapping> SchemaMapping;
RowBlockChanger(const std::vector<FieldInfo>& tablet_schema,
- const TabletSharedPtr& ref_olap_table,
+ const TabletSharedPtr& ref_tablet,
const DeleteHandler& delete_handler);
RowBlockChanger(const std::vector<FieldInfo>& tablet_schema,
- const TabletSharedPtr& ref_olap_table);
+ const TabletSharedPtr& ref_tablet);
virtual ~RowBlockChanger();
@@ -119,7 +119,7 @@ class RowBlockAllocator {
class RowBlockMerger {
public:
- explicit RowBlockMerger(TabletSharedPtr olap_table);
+ explicit RowBlockMerger(TabletSharedPtr tablet);
virtual ~RowBlockMerger();
bool merge(
@@ -141,7 +141,7 @@ class RowBlockMerger {
bool _make_heap(const std::vector<RowBlock*>& row_block_arr);
bool _pop_heap();
- TabletSharedPtr _olap_table;
+ TabletSharedPtr _tablet;
std::priority_queue<MergeElement> _heap;
};
@@ -191,31 +191,31 @@ class SchemaChange {
class LinkedSchemaChange : public SchemaChange {
public:
explicit LinkedSchemaChange(
- TabletSharedPtr base_olap_table,
- TabletSharedPtr new_olap_table);
+ TabletSharedPtr base_tablet,
+ TabletSharedPtr new_tablet);
~LinkedSchemaChange() {}
bool process(ColumnData* olap_data, SegmentGroup* new_segment_group);
private:
- TabletSharedPtr _base_olap_table;
- TabletSharedPtr _new_olap_table;
+ TabletSharedPtr _base_tablet;
+ TabletSharedPtr _new_tablet;
DISALLOW_COPY_AND_ASSIGN(LinkedSchemaChange);
};
// @brief schema change without sorting.
class SchemaChangeDirectly : public SchemaChange {
public:
- // @params olap_table the instance of table which has new schema.
+ // @params tablet the instance of tablet which has new schema.
// @params row_block_changer changer to modifiy the data of RowBlock
explicit SchemaChangeDirectly(
- TabletSharedPtr olap_table,
+ TabletSharedPtr tablet,
const RowBlockChanger& row_block_changer);
virtual ~SchemaChangeDirectly();
virtual bool process(ColumnData* olap_data, SegmentGroup* new_segment_group);
private:
- TabletSharedPtr _olap_table;
+ TabletSharedPtr _tablet;
const RowBlockChanger& _row_block_changer;
RowBlockAllocator* _row_block_allocator;
RowCursor* _src_cursor;
@@ -230,7 +230,7 @@ class SchemaChangeDirectly : public SchemaChange {
class SchemaChangeWithSorting : public SchemaChange {
public:
explicit SchemaChangeWithSorting(
- TabletSharedPtr olap_table,
+ TabletSharedPtr tablet,
const RowBlockChanger& row_block_changer,
size_t memory_limitation);
virtual ~SchemaChangeWithSorting();
@@ -247,7 +247,7 @@ class SchemaChangeWithSorting : public SchemaChange {
std::vector<SegmentGroup*>& src_segment_group_arr,
SegmentGroup* segment_group);
- TabletSharedPtr _olap_table;
+ TabletSharedPtr _tablet;
const RowBlockChanger& _row_block_changer;
size_t _memory_limitation;
Version _temp_delta_versions;
@@ -261,19 +261,19 @@ class SchemaChangeHandler {
SchemaChangeHandler() {}
virtual ~SchemaChangeHandler() {}
- OLAPStatus process_alter_table(AlterTabletType alter_table_type,
+ OLAPStatus process_alter_tablet(AlterTabletType alter_tablet_type,
const TAlterTabletReq& request);
- OLAPStatus schema_version_convert(TabletSharedPtr ref_olap_table,
- TabletSharedPtr new_olap_table,
+ OLAPStatus schema_version_convert(TabletSharedPtr ref_tablet,
+ TabletSharedPtr new_tablet,
std::vector<SegmentGroup*>* ref_segment_groups,
std::vector<SegmentGroup*>* new_segment_groups);
// 清空一个table下的schema_change信息:包括split_talbe以及其他schema_change信息
- // 这里只清理自身的out链,不考虑related的table
+ // 这里只清理自身的out链,不考虑related的tablet
// NOTE 需要外部lock header
// Params:
- // alter_table_type
+ // alter_tablet_type
// 为NULL时,同时检查table_split和其他普通schema_change
// 否则只检查指定type的信息
// only_one:
@@ -286,12 +286,12 @@ class SchemaChangeHandler {
// 失败:如果有信息但不能清理(有version没完成),或不符合only_one条件
static OLAPStatus clear_schema_change_single_info(TTabletId tablet_id,
SchemaHash schema_hash,
- AlterTabletType* alter_table_type,
+ AlterTabletType* alter_tablet_type,
bool only_one,
bool check_only);
- static OLAPStatus clear_schema_change_single_info(TabletSharedPtr olap_table,
- AlterTabletType* alter_table_type,
+ static OLAPStatus clear_schema_change_single_info(TabletSharedPtr tablet,
+ AlterTabletType* alter_tablet_type,
bool only_one,
bool check_only);
@@ -302,21 +302,21 @@ class SchemaChangeHandler {
// Returns:
// 成功:如果存在历史信息,没有问题的就清空;或者没有历史信息
// 失败:否则如果有历史信息且无法清空的(有version还没有完成)
- OLAPStatus _check_and_clear_schema_change_info(TabletSharedPtr olap_table,
+ OLAPStatus _check_and_clear_schema_change_info(TabletSharedPtr tablet,
const TAlterTabletReq& request);
- OLAPStatus _get_versions_to_be_changed(TabletSharedPtr ref_olap_table,
+ OLAPStatus _get_versions_to_be_changed(TabletSharedPtr ref_tablet,
std::vector<Version>& versions_to_be_changed);
- OLAPStatus _do_alter_table(AlterTabletType type,
- TabletSharedPtr ref_olap_table,
+ OLAPStatus _do_alter_tablet(AlterTabletType type,
+ TabletSharedPtr ref_tablet,
const TAlterTabletReq& request);
struct SchemaChangeParams {
// 为了让calc_split_key也可使用普通schema_change的线程,才设置了此type
- AlterTabletType alter_table_type;
- TabletSharedPtr ref_olap_table;
- TabletSharedPtr new_olap_table;
+ AlterTabletType alter_tablet_type;
+ TabletSharedPtr ref_tablet;
+ TabletSharedPtr new_tablet;
std::vector<ColumnData*> ref_olap_data_arr;
std::string debug_message;
DeleteHandler delete_handler;
@@ -325,24 +325,24 @@ class SchemaChangeHandler {
mutable std::string group;
};
- // 根据给定的table_desc,创建OLAPTable,并挂接到OLAPEngine中
- OLAPStatus _create_new_olap_table(const TabletSharedPtr ref_olap_table,
+ // 根据给定的table_desc,创建Tablet,并挂接到OLAPEngine中
+ OLAPStatus _create_new_tablet(const TabletSharedPtr ref_tablet,
const TCreateTabletReq& create_tablet_req,
const std::string* ref_root_path,
- TabletSharedPtr* out_new_olap_table);
+ TabletSharedPtr* out_new_tablet);
// 增加A->(B|C|...) 的schema_change信息
- // 在split table时,增加split-table status相关的信息
+ // 在split table时,增加split-tablet status相关的信息
// 其他的都增加在schema-change status中
- OLAPStatus _save_schema_change_info(AlterTabletType alter_table_type,
- TabletSharedPtr ref_olap_table,
- TabletSharedPtr new_olap_table,
+ OLAPStatus _save_schema_change_info(AlterTabletType alter_tablet_type,
+ TabletSharedPtr ref_tablet,
+ TabletSharedPtr new_tablet,
const std::vector<Version>& versions_to_be_changed);
- static OLAPStatus _alter_table(SchemaChangeParams* sc_params);
+ static OLAPStatus _alter_tablet(SchemaChangeParams* sc_params);
- static OLAPStatus _parse_request(TabletSharedPtr ref_olap_table,
- TabletSharedPtr new_olap_table,
+ static OLAPStatus _parse_request(TabletSharedPtr ref_tablet,
+ TabletSharedPtr new_tablet,
RowBlockChanger* rb_changer,
bool* sc_sorting,
bool* sc_directly);
diff --git a/be/src/olap/segment_group.cpp b/be/src/olap/segment_group.cpp
index a5c24c0f..6d7535e3 100644
--- a/be/src/olap/segment_group.cpp
+++ b/be/src/olap/segment_group.cpp
@@ -23,7 +23,7 @@
#include <fstream>
#include "olap/column_data.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_block.h"
#include "olap/row_cursor.h"
#include "olap/utils.h"
@@ -38,9 +38,9 @@ namespace doris {
#define TABLE_PARAM_VALIDATE() \
do { \
if (!_index_loaded) { \
- OLAP_LOG_WARNING("fail to find, index is not loaded. [table=%ld schema_hash=%d]", \
- _table->tablet_id(), \
- _table->schema_hash()); \
+ OLAP_LOG_WARNING("fail to find, index is not loaded. [tablet=%ld schema_hash=%d]", \
+ _tablet->tablet_id(), \
+ _tablet->schema_hash()); \
return OLAP_ERR_NOT_INITED; \
} \
} while (0);
@@ -61,9 +61,9 @@ namespace doris {
} \
} while (0);
-SegmentGroup::SegmentGroup(OLAPTable* table, Version version, VersionHash version_hash,
+SegmentGroup::SegmentGroup(Tablet* tablet, Version version, VersionHash version_hash,
bool delete_flag, int32_t segment_group_id, int32_t num_segments)
- : _table(table),
+ : _tablet(tablet),
_version(version),
_version_hash(version_hash),
_delete_flag(delete_flag),
@@ -81,8 +81,8 @@ SegmentGroup::SegmentGroup(OLAPTable* table, Version version, VersionHash versio
_new_segment_created = false;
_empty = false;
- const RowFields& tablet_schema = _table->tablet_schema();
- for (size_t i = 0; i < _table->num_short_key_fields(); ++i) {
+ const RowFields& tablet_schema = _tablet->tablet_schema();
+ for (size_t i = 0; i < _tablet->num_short_key_fields(); ++i) {
_short_key_info_list.push_back(tablet_schema[i]);
_short_key_length += tablet_schema[i].index_length + 1;// 1 for null byte
if (tablet_schema[i].type == OLAP_FIELD_TYPE_CHAR ||
@@ -94,10 +94,10 @@ SegmentGroup::SegmentGroup(OLAPTable* table, Version version, VersionHash versio
}
}
-SegmentGroup::SegmentGroup(OLAPTable* table, bool delete_flag,
+SegmentGroup::SegmentGroup(Tablet* tablet, bool delete_flag,
int32_t segment_group_id, int32_t num_segments, bool is_pending,
TPartitionId partition_id, TTransactionId transaction_id)
- : _table(table), _delete_flag(delete_flag),
+ : _tablet(tablet), _delete_flag(delete_flag),
_segment_group_id(segment_group_id), _num_segments(num_segments),
_is_pending(is_pending), _partition_id(partition_id),
_transaction_id(transaction_id)
@@ -115,8 +115,8 @@ SegmentGroup::SegmentGroup(OLAPTable* table, bool delete_flag,
_new_segment_created = false;
_empty = false;
- const RowFields& tablet_schema = _table->tablet_schema();
- for (size_t i = 0; i < _table->num_short_key_fields(); ++i) {
+ const RowFields& tablet_schema = _tablet->tablet_schema();
+ for (size_t i = 0; i < _tablet->num_short_key_fields(); ++i) {
_short_key_info_list.push_back(tablet_schema[i]);
_short_key_length += tablet_schema[i].index_length + 1;// 1 for null byte
if (tablet_schema[i].type == OLAP_FIELD_TYPE_CHAR ||
@@ -141,17 +141,17 @@ SegmentGroup::~SegmentGroup() {
string SegmentGroup::construct_index_file_path(int32_t segment_group_id, int32_t segment) const {
if (_is_pending) {
- return _table->construct_pending_index_file_path(_transaction_id, _segment_group_id, segment);
+ return _tablet->construct_pending_index_file_path(_transaction_id, _segment_group_id, segment);
} else {
- return _table->construct_index_file_path(_version, _version_hash, _segment_group_id, segment);
+ return _tablet->construct_index_file_path(_version, _version_hash, _segment_group_id, segment);
}
}
string SegmentGroup::construct_data_file_path(int32_t segment_group_id, int32_t segment) const {
if (_is_pending) {
- return _table->construct_pending_data_file_path(_transaction_id, segment_group_id, segment);
+ return _tablet->construct_pending_data_file_path(_transaction_id, segment_group_id, segment);
} else {
- return _table->construct_data_file_path(_version, _version_hash, segment_group_id, segment);
+ return _tablet->construct_data_file_path(_version, _version_hash, segment_group_id, segment);
}
}
@@ -200,20 +200,20 @@ void SegmentGroup::delete_all_files() {
OLAPStatus SegmentGroup::add_column_statistics_for_linked_schema_change(
const std::vector<std::pair<WrapperField*, WrapperField*>>& column_statistic_fields) {
- //When add rollup table, the base table index maybe empty
+ //When add rollup tablet, the base tablet index maybe empty
if (column_statistic_fields.size() == 0) {
return OLAP_SUCCESS;
}
- //Should use _table->num_key_fields(), not column_statistic_fields.size()
- //as rollup table num_key_fields will less than base table column_statistic_fields.size().
- //For LinkedSchemaChange, the rollup table keys order is the same as base table
- for (size_t i = 0; i < _table->num_key_fields(); ++i) {
- WrapperField* first = WrapperField::create(_table->tablet_schema()[i]);
+ //Should use _tablet->num_key_fields(), not column_statistic_fields.size()
+ //as rollup tablet num_key_fields will less than base tablet column_statistic_fields.size().
+ //For LinkedSchemaChange, the rollup tablet keys order is the same as base tablet
+ for (size_t i = 0; i < _tablet->num_key_fields(); ++i) {
+ WrapperField* first = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(first != NULL) << "failed to allocate memory for field: " << i;
first->copy(column_statistic_fields[i].first);
- WrapperField* second = WrapperField::create(_table->tablet_schema()[i]);
+ WrapperField* second = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(second != NULL) << "failed to allocate memory for field: " << i;
second->copy(column_statistic_fields[i].second);
@@ -224,13 +224,13 @@ OLAPStatus SegmentGroup::add_column_statistics_for_linked_schema_change(
OLAPStatus SegmentGroup::add_column_statistics(
const std::vector<std::pair<WrapperField*, WrapperField*>>& column_statistic_fields) {
- DCHECK(column_statistic_fields.size() == _table->num_key_fields());
+ DCHECK(column_statistic_fields.size() == _tablet->num_key_fields());
for (size_t i = 0; i < column_statistic_fields.size(); ++i) {
- WrapperField* first = WrapperField::create(_table->tablet_schema()[i]);
+ WrapperField* first = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(first != NULL) << "failed to allocate memory for field: " << i;
first->copy(column_statistic_fields[i].first);
- WrapperField* second = WrapperField::create(_table->tablet_schema()[i]);
+ WrapperField* second = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(second != NULL) << "failed to allocate memory for field: " << i;
second->copy(column_statistic_fields[i].second);
@@ -242,16 +242,16 @@ OLAPStatus SegmentGroup::add_column_statistics(
OLAPStatus SegmentGroup::add_column_statistics(
std::vector<std::pair<std::string, std::string> > &column_statistic_strings,
std::vector<bool> &null_vec) {
- DCHECK(column_statistic_strings.size() == _table->num_key_fields());
+ DCHECK(column_statistic_strings.size() == _tablet->num_key_fields());
for (size_t i = 0; i < column_statistic_strings.size(); ++i) {
- WrapperField* first = WrapperField::create(_table->tablet_schema()[i]);
+ WrapperField* first = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(first != NULL) << "failed to allocate memory for field: " << i ;
RETURN_NOT_OK(first->from_string(column_statistic_strings[i].first));
if (null_vec[i]) {
//[min, max] -> [NULL, max]
first->set_null();
}
- WrapperField* second = WrapperField::create(_table->tablet_schema()[i]);
+ WrapperField* second = WrapperField::create(_tablet->tablet_schema()[i]);
DCHECK(first != NULL) << "failed to allocate memory for field: " << i ;
RETURN_NOT_OK(second->from_string(column_statistic_strings[i].second));
_column_statistics.push_back(std::make_pair(first, second));
@@ -276,14 +276,14 @@ OLAPStatus SegmentGroup::load() {
}
if (_index.init(_short_key_length, _new_short_key_length,
- _table->num_short_key_fields(), &_short_key_info_list) != OLAP_SUCCESS) {
+ _tablet->num_short_key_fields(), &_short_key_info_list) != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to create MemIndex. [num_segment=%d]", _num_segments);
return res;
}
// for each segment
for (uint32_t seg_id = 0; seg_id < _num_segments; ++seg_id) {
- if (COLUMN_ORIENTED_FILE == _table->data_file_type()) {
+ if (COLUMN_ORIENTED_FILE == _tablet->data_file_type()) {
string seg_path = construct_data_file_path(_segment_group_id, seg_id);
if (OLAP_SUCCESS != (res = load_pb(seg_path.c_str(), seg_id))) {
LOG(WARNING) << "failed to load pb structures. [seg_path='" << seg_path << "']";
@@ -512,7 +512,7 @@ OLAPStatus SegmentGroup::add_segment() {
index_header->set_end_version(_version.second);
index_header->set_cumulative_version_hash(_version_hash);
index_header->set_segment(_num_segments - 1);
- index_header->set_num_rows_per_block(_table->num_rows_per_row_block());
+ index_header->set_num_rows_per_block(_tablet->num_rows_per_row_block());
index_header->set_delete_flag(_delete_flag);
index_header->set_null_supported(true);
@@ -524,7 +524,7 @@ OLAPStatus SegmentGroup::add_segment() {
return OLAP_ERR_MALLOC_ERROR;
}
- if (_current_index_row.init(_table->tablet_schema()) != OLAP_SUCCESS) {
+ if (_current_index_row.init(_tablet->tablet_schema()) != OLAP_SUCCESS) {
OLAP_LOG_WARNING("init _current_index_row fail.");
return OLAP_ERR_INIT_FAILED;
}
@@ -642,13 +642,13 @@ OLAPStatus SegmentGroup::finalize_segment(uint32_t data_segment_size, int64_t nu
void SegmentGroup::sync() {
if (_current_file_handler.sync() == -1) {
OLAP_LOG_WARNING("fail to sync file.[err=%m]");
- _table->set_io_error();
+ _tablet->set_io_error();
}
}
void SegmentGroup::_check_io_error(OLAPStatus res) {
if (is_io_error(res)) {
- _table->set_io_error();
+ _tablet->set_io_error();
}
}
diff --git a/be/src/olap/segment_group.h b/be/src/olap/segment_group.h
index 19d17af4..2239befe 100644
--- a/be/src/olap/segment_group.h
+++ b/be/src/olap/segment_group.h
@@ -32,7 +32,7 @@
#include "olap/file_helper.h"
#include "olap/olap_common.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_cursor.h"
#include "olap/olap_index.h"
#include "olap/utils.h"
@@ -47,10 +47,10 @@ namespace doris {
class SegmentGroup {
friend class MemIndex;
public:
- SegmentGroup(OLAPTable* table, Version version, VersionHash version_hash,
+ SegmentGroup(Tablet* tablet, Version version, VersionHash version_hash,
bool delete_flag, int segment_group_id, int32_t num_segments);
- SegmentGroup(OLAPTable* table, bool delete_flag, int32_t segment_group_id,
+ SegmentGroup(Tablet* tablet, bool delete_flag, int32_t segment_group_id,
int32_t num_segments, bool is_pending,
TPartitionId partition_id, TTransactionId transaction_id);
@@ -152,9 +152,9 @@ class SegmentGroup {
void delete_all_files();
// getters and setters.
- // get associated OLAPTable pointer
- inline OLAPTable* table() const { return _table; }
- inline void set_table(OLAPTable* table) { _table = table; }
+ // get associated Tablet pointer
+ inline Tablet* tablet() const { return _tablet; }
+ inline void set_tablet(Tablet* tablet) { _tablet = tablet; }
inline Version version() const { return _version; }
inline VersionHash version_hash() const { return _version_hash; }
@@ -240,7 +240,7 @@ class SegmentGroup {
private:
void _check_io_error(OLAPStatus res);
- OLAPTable* _table; // table definition for this segmentgroup
+ Tablet* _tablet; // tablet definition for this segmentgroup
Version _version; // version of associated data file
VersionHash _version_hash; // version hash for this segmentgroup
bool _delete_flag;
diff --git a/be/src/olap/segment_reader.cpp b/be/src/olap/segment_reader.cpp
index 74febd7f..f0c1db32 100644
--- a/be/src/olap/segment_reader.cpp
+++ b/be/src/olap/segment_reader.cpp
@@ -34,7 +34,7 @@ static const uint32_t MIN_FILTER_BLOCK_NUM = 10;
SegmentReader::SegmentReader(
const std::string file,
- OLAPTable* table,
+ Tablet* tablet,
SegmentGroup* segment_group,
uint32_t segment_id,
const std::vector<uint32_t>& used_columns,
@@ -46,7 +46,7 @@ SegmentReader::SegmentReader(
RuntimeState* runtime_state,
OlapReaderStatistics* stats) :
_file_name(file),
- _table(table),
+ _tablet(tablet),
_segment_group(segment_group),
_segment_id(segment_id),
_conditions(conditions),
@@ -187,7 +187,7 @@ OLAPStatus SegmentReader::_set_decompressor() {
OLAPStatus SegmentReader::_set_segment_info() {
_num_rows_in_block = _header_message().num_rows_per_block();
if (_num_rows_in_block == 0) {
- _num_rows_in_block = _table->num_rows_per_row_block();
+ _num_rows_in_block = _tablet->num_rows_per_row_block();
}
_set_column_map();
@@ -332,20 +332,20 @@ OLAPStatus SegmentReader::get_block(
void SegmentReader::_set_column_map() {
_encodings_map.clear();
- _table_id_to_unique_id_map.clear();
- _unique_id_to_table_id_map.clear();
+ _tablet_id_to_unique_id_map.clear();
+ _unique_id_to_tablet_id_map.clear();
_unique_id_to_segment_id_map.clear();
for (ColumnId table_column_id : _used_columns) {
ColumnId unique_column_id = tablet_schema()[table_column_id].unique_id;
- _table_id_to_unique_id_map[table_column_id] = unique_column_id;
- _unique_id_to_table_id_map[unique_column_id] = table_column_id;
+ _tablet_id_to_unique_id_map[table_column_id] = unique_column_id;
+ _unique_id_to_tablet_id_map[unique_column_id] = table_column_id;
}
for (ColumnId table_column_id : _load_bf_columns) {
ColumnId unique_column_id = tablet_schema()[table_column_id].unique_id;
- _table_id_to_unique_id_map[table_column_id] = unique_column_id;
- _unique_id_to_table_id_map[unique_column_id] = table_column_id;
+ _tablet_id_to_unique_id_map[table_column_id] = unique_column_id;
+ _unique_id_to_tablet_id_map[unique_column_id] = table_column_id;
}
size_t segment_column_size = _header_message().column_size();
@@ -353,7 +353,7 @@ void SegmentReader::_set_column_map() {
++segment_column_id) {
// 如果找得到,建立映射表
ColumnId unique_column_id = _header_message().column(segment_column_id).unique_id();
- if (_unique_id_to_table_id_map.find(unique_column_id) != _unique_id_to_table_id_map.end()) {
+ if (_unique_id_to_tablet_id_map.find(unique_column_id) != _unique_id_to_tablet_id_map.end()) {
_unique_id_to_segment_id_map[unique_column_id] = segment_column_id;
// encoding 应该和segment schema序一致。
_encodings_map[unique_column_id] =
@@ -364,12 +364,12 @@ void SegmentReader::_set_column_map() {
OLAPStatus SegmentReader::_pick_columns() {
for (uint32_t i : _used_columns) {
- ColumnId unique_column_id = _table_id_to_unique_id_map[i];
+ ColumnId unique_column_id = _tablet_id_to_unique_id_map[i];
_include_columns.insert(unique_column_id);
}
for (uint32_t i : _load_bf_columns) {
- ColumnId unique_column_id = _table_id_to_unique_id_map[i];
+ ColumnId unique_column_id = _tablet_id_to_unique_id_map[i];
_include_bf_columns.insert(unique_column_id);
}
@@ -403,7 +403,7 @@ OLAPStatus SegmentReader::_pick_delete_row_groups(uint32_t first_block, uint32_t
bool del_not_satisfied = false;
for (auto& i : delete_condition.del_cond->columns()) {
ColumnId table_column_id = i.first;
- ColumnId unique_column_id = _table_id_to_unique_id_map[table_column_id];
+ ColumnId unique_column_id = _tablet_id_to_unique_id_map[table_column_id];
if (0 == _unique_id_to_segment_id_map.count(unique_column_id)) {
continue;
}
@@ -489,7 +489,7 @@ OLAPStatus SegmentReader::_pick_row_groups(uint32_t first_block, uint32_t last_b
timer.reset();
for (auto& i : _conditions->columns()) {
- FieldAggregationMethod aggregation = _table->get_aggregation_by_index(i.first);
+ FieldAggregationMethod aggregation = _tablet->get_aggregation_by_index(i.first);
bool is_continue = (aggregation == OLAP_FIELD_AGGREGATION_NONE
|| (aggregation == OLAP_FIELD_AGGREGATION_REPLACE
&& _segment_group->version().first == 0));
@@ -498,7 +498,7 @@ OLAPStatus SegmentReader::_pick_row_groups(uint32_t first_block, uint32_t last_b
}
ColumnId table_column_id = i.first;
- ColumnId unique_column_id = _table_id_to_unique_id_map[table_column_id];
+ ColumnId unique_column_id = _tablet_id_to_unique_id_map[table_column_id];
if (0 == _unique_id_to_segment_id_map.count(unique_column_id)) {
continue;
}
@@ -530,7 +530,7 @@ OLAPStatus SegmentReader::_pick_row_groups(uint32_t first_block, uint32_t last_b
}
for (uint32_t i : _load_bf_columns) {
- FieldAggregationMethod aggregation = _table->get_aggregation_by_index(i);
+ FieldAggregationMethod aggregation = _tablet->get_aggregation_by_index(i);
bool is_continue = (aggregation == OLAP_FIELD_AGGREGATION_NONE
|| (aggregation == OLAP_FIELD_AGGREGATION_REPLACE
&& _segment_group->version().first == 0));
@@ -539,7 +539,7 @@ OLAPStatus SegmentReader::_pick_row_groups(uint32_t first_block, uint32_t last_b
}
ColumnId table_column_id = i;
- ColumnId unique_column_id = _table_id_to_unique_id_map[table_column_id];
+ ColumnId unique_column_id = _tablet_id_to_unique_id_map[table_column_id];
if (0 == _unique_id_to_segment_id_map.count(unique_column_id)) {
continue;
}
@@ -630,8 +630,8 @@ OLAPStatus SegmentReader::_load_index(bool is_using_cache) {
continue;
}
- ColumnId table_column_id = _unique_id_to_table_id_map[unique_column_id];
- FieldType type = _table->get_field_type_by_index(table_column_id);
+ ColumnId table_column_id = _unique_id_to_tablet_id_map[unique_column_id];
+ FieldType type = _tablet->get_field_type_by_index(table_column_id);
char* stream_buffer = NULL;
char key_buf[OLAP_LRU_CACHE_MAX_KEY_LENTH];
@@ -719,9 +719,9 @@ OLAPStatus SegmentReader::_load_index(bool is_using_cache) {
OLAP_LOG_WARNING("something wrong while reading index, expected=%lu, actual=%lu",
expected_blocks, _block_count);
OLAP_LOG_WARNING("_header_message().number_of_rows()=%d,"
- "_header_message().num_rows_per_block()=%d, table='%s', version='%d-%d'",
+ "_header_message().num_rows_per_block()=%d, tablet='%s', version='%d-%d'",
_header_message().number_of_rows(), _header_message().num_rows_per_block(),
- _segment_group->table()->full_name().c_str(),
+ _segment_group->tablet()->full_name().c_str(),
_segment_group->version().first, _segment_group->version().second);
LOG(WARNING) << "version:" << _segment_group->version().first << "-" << _segment_group->version().second;
return OLAP_ERR_FILE_FORMAT_ERROR;
@@ -809,14 +809,14 @@ OLAPStatus SegmentReader::_read_all_data_streams(size_t* buffer_size) {
}
OLAPStatus SegmentReader::_create_reader(size_t* buffer_size) {
- _column_readers.resize(_table->tablet_schema().size(), nullptr);
- _column_indices.resize(_table->tablet_schema().size(), nullptr);
+ _column_readers.resize(_tablet->tablet_schema().size(), nullptr);
+ _column_indices.resize(_tablet->tablet_schema().size(), nullptr);
for (auto table_column_id : _used_columns) {
- ColumnId unique_column_id = _table_id_to_unique_id_map[table_column_id];
+ ColumnId unique_column_id = _tablet_id_to_unique_id_map[table_column_id];
// 当前是不会出现table和segment的schema不一致的情况的
std::unique_ptr<ColumnReader> reader(ColumnReader::create(table_column_id,
- _table->tablet_schema(),
- _unique_id_to_table_id_map,
+ _tablet->tablet_schema(),
+ _unique_id_to_tablet_id_map,
_unique_id_to_segment_id_map,
_encodings_map));
if (reader == nullptr) {
@@ -857,14 +857,14 @@ OLAPStatus SegmentReader::_seek_to_block_directly(
PositionProvider position(&_column_indices[cid]->entry(block_id));
if (OLAP_SUCCESS != (res = _column_readers[cid]->seek(&position))) {
if (OLAP_ERR_COLUMN_STREAM_EOF == res) {
- VLOG(3) << "Stream EOF. tablet_id=" << _table->tablet_id()
+ VLOG(3) << "Stream EOF. tablet_id=" << _tablet->tablet_id()
<< ", column_id=" << _column_readers[cid]->column_unique_id()
<< ", block_id=" << block_id;
return OLAP_ERR_DATA_EOF;
} else {
OLAP_LOG_WARNING("fail to seek to block. "
"[tablet_id=%ld column_id=%u block_id=%lu]",
- _table->tablet_id(), _column_readers[cid]->column_unique_id(), block_id);
+ _tablet->tablet_id(), _column_readers[cid]->column_unique_id(), block_id);
return OLAP_ERR_COLUMN_SEEK_ERROR;
}
}
diff --git a/be/src/olap/segment_reader.h b/be/src/olap/segment_reader.h
index 5f292669..14b6e45b 100644
--- a/be/src/olap/segment_reader.h
+++ b/be/src/olap/segment_reader.h
@@ -37,7 +37,7 @@
#include "olap/olap_cond.h"
#include "olap/olap_define.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/row_cursor.h"
#include "runtime/runtime_state.h"
#include "runtime/mem_pool.h"
@@ -55,7 +55,7 @@ class ColumnReader;
class SegmentReader {
public:
explicit SegmentReader(const std::string file,
- OLAPTable* table,
+ Tablet* tablet,
SegmentGroup* segment_group,
uint32_t segment_id,
const std::vector<uint32_t>& return_columns,
@@ -232,7 +232,7 @@ class SegmentReader {
// 获取当前的table级schema。
inline const std::vector<FieldInfo>& tablet_schema() {
- return _table->tablet_schema();
+ return _tablet->tablet_schema();
}
inline const ColumnDataHeaderMessage& _header_message() {
@@ -277,7 +277,7 @@ class SegmentReader {
std::string _file_name; // 文件名
doris::FileHandler _file_handler; // 文件handler
- OLAPTable* _table;
+ Tablet* _tablet;
SegmentGroup* _segment_group;
uint32_t _segment_id;
@@ -317,8 +317,8 @@ class SegmentReader {
UniqueIdSet _include_columns; // 用于判断该列是不是被包含
UniqueIdSet _load_bf_columns;
UniqueIdSet _include_bf_columns;
- UniqueIdToColumnIdMap _table_id_to_unique_id_map; // table id到unique id的映射
- UniqueIdToColumnIdMap _unique_id_to_table_id_map; // unique id到table id的映射
+ UniqueIdToColumnIdMap _tablet_id_to_unique_id_map; // tablet id到unique id的映射
+ UniqueIdToColumnIdMap _unique_id_to_tablet_id_map; // unique id到tablet id的映射
UniqueIdToColumnIdMap _unique_id_to_segment_id_map; // uniqid到segment id的映射
std::map<ColumnId, StreamIndexReader*> _indices;
diff --git a/be/src/olap/segment_writer.cpp b/be/src/olap/segment_writer.cpp
index 82752753..5d536de0 100644
--- a/be/src/olap/segment_writer.cpp
+++ b/be/src/olap/segment_writer.cpp
@@ -27,10 +27,10 @@ namespace doris {
SegmentWriter::SegmentWriter(
const std::string& file_name,
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
uint32_t stream_buffer_size) :
_file_name(file_name),
- _table(table),
+ _tablet(tablet),
_stream_buffer_size(stream_buffer_size),
_stream_factory(NULL),
_row_count(0),
@@ -49,7 +49,7 @@ OLAPStatus SegmentWriter::init(uint32_t write_mbytes_per_sec) {
OLAPStatus res = OLAP_SUCCESS;
// 创建factory
_stream_factory =
- new(std::nothrow) OutStreamFactory(_table->compress_kind(), _stream_buffer_size);
+ new(std::nothrow) OutStreamFactory(_tablet->compress_kind(), _stream_buffer_size);
if (NULL == _stream_factory) {
OLAP_LOG_WARNING("fail to allocate out stream factory");
@@ -57,12 +57,12 @@ OLAPStatus SegmentWriter::init(uint32_t write_mbytes_per_sec) {
}
// 创建writer
- for (uint32_t i = 0; i < _table->tablet_schema().size(); i++) {
- if (_table->tablet_schema()[i].is_root_column) {
- ColumnWriter* writer = ColumnWriter::create(i, _table->tablet_schema(),
+ for (uint32_t i = 0; i < _tablet->tablet_schema().size(); i++) {
+ if (_tablet->tablet_schema()[i].is_root_column) {
+ ColumnWriter* writer = ColumnWriter::create(i, _tablet->tablet_schema(),
_stream_factory,
- _table->num_rows_per_row_block(),
- _table->bloom_filter_fpp());
+ _tablet->num_rows_per_row_block(),
+ _tablet->bloom_filter_fpp());
if (NULL == writer) {
OLAP_LOG_WARNING("fail to create writer");
@@ -85,9 +85,9 @@ OLAPStatus SegmentWriter::init(uint32_t write_mbytes_per_sec) {
}
OLAPStatus SegmentWriter::write_batch(RowBlock* block, RowCursor* cursor, bool is_finalize) {
- DCHECK(block->row_block_info().row_num == _table->num_rows_per_row_block() || is_finalize)
+ DCHECK(block->row_block_info().row_num == _tablet->num_rows_per_row_block() || is_finalize)
<< "write block not empty, num_rows=" << block->row_block_info().row_num
- << ", table_num_rows=" << _table->num_rows_per_row_block();
+ << ", table_num_rows=" << _tablet->num_rows_per_row_block();
OLAPStatus res = OLAP_SUCCESS;
for (auto col_writer : _root_writers) {
res = col_writer->write_batch(block, cursor);
@@ -125,12 +125,12 @@ uint64_t SegmentWriter::estimate_segment_size() {
OLAPStatus SegmentWriter::_make_file_header(ColumnDataHeaderMessage* file_header) {
OLAPStatus res = OLAP_SUCCESS;
file_header->set_number_of_rows(_row_count);
- file_header->set_compress_kind(_table->compress_kind());
+ file_header->set_compress_kind(_tablet->compress_kind());
file_header->set_stream_buffer_size(_stream_buffer_size);
// TODO. 之前没设置
file_header->set_magic_string("COLUMN DATA");
file_header->set_version(1);
- file_header->set_num_rows_per_block(_table->num_rows_per_row_block());
+ file_header->set_num_rows_per_block(_tablet->num_rows_per_row_block());
// check if has bloom filter columns
bool has_bf_column = false;
diff --git a/be/src/olap/segment_writer.h b/be/src/olap/segment_writer.h
index 7fabb72c..64daf8fc 100644
--- a/be/src/olap/segment_writer.h
+++ b/be/src/olap/segment_writer.h
@@ -30,7 +30,7 @@ class ColumnDataHeaderMessage;
class SegmentWriter {
public:
explicit SegmentWriter(const std::string& file_name,
- TabletSharedPtr table,
+ TabletSharedPtr tablet,
uint32_t stream_buffer_size);
~SegmentWriter();
OLAPStatus init(uint32_t write_mbytes_per_sec);
@@ -45,7 +45,7 @@ class SegmentWriter {
OLAPStatus _make_file_header(ColumnDataHeaderMessage* file_header);
std::string _file_name;
- TabletSharedPtr _table;
+ TabletSharedPtr _tablet;
uint32_t _stream_buffer_size; // 输出缓冲区大小
std::vector<ColumnWriter*> _root_writers;
OutStreamFactory* _stream_factory;
diff --git a/be/src/olap/store.cpp b/be/src/olap/store.cpp
index a154c061..3ef7337f 100755
--- a/be/src/olap/store.cpp
+++ b/be/src/olap/store.cpp
@@ -235,8 +235,8 @@ Status OlapStore::_init_file_system() {
mount_device = s.st_dev;
}
- FILE* mount_table = nullptr;
- if ((mount_table = setmntent(kMtabPath, "r")) == NULL) {
+ FILE* mount_tablet = nullptr;
+ if ((mount_tablet = setmntent(kMtabPath, "r")) == NULL) {
char errmsg[64];
LOG(WARNING) << "setmntent failed, path=" << kMtabPath
<< ", errno=" << errno << ", errmsg=" << strerror_r(errno, errmsg, 64);
@@ -245,7 +245,7 @@ Status OlapStore::_init_file_system() {
bool is_find = false;
struct mntent* mount_entry = NULL;
- while ((mount_entry = getmntent(mount_table)) != NULL) {
+ while ((mount_entry = getmntent(mount_tablet)) != NULL) {
if (strcmp(_path.c_str(), mount_entry->mnt_dir) == 0
|| strcmp(_path.c_str(), mount_entry->mnt_fsname) == 0) {
is_find = true;
@@ -263,7 +263,7 @@ Status OlapStore::_init_file_system() {
}
}
- endmntent(mount_table);
+ endmntent(mount_tablet);
if (!is_find) {
LOG(WARNING) << "fail to find file system, path=" << _path;
@@ -421,18 +421,18 @@ OlapMeta* OlapStore::get_meta() {
return _meta;
}
-OLAPStatus OlapStore::register_table(OLAPTable* table) {
+OLAPStatus OlapStore::register_tablet(Tablet* tablet) {
std::lock_guard<std::mutex> l(_mutex);
- TabletInfo tablet_info(table->tablet_id(), table->schema_hash());
+ TabletInfo tablet_info(tablet->tablet_id(), tablet->schema_hash());
_tablet_set.insert(tablet_info);
return OLAP_SUCCESS;
}
-OLAPStatus OlapStore::deregister_table(OLAPTable* table) {
+OLAPStatus OlapStore::deregister_tablet(Tablet* tablet) {
std::lock_guard<std::mutex> l(_mutex);
- TabletInfo tablet_info(table->tablet_id(), table->schema_hash());
+ TabletInfo tablet_info(tablet->tablet_id(), tablet->schema_hash());
_tablet_set.erase(tablet_info);
return OLAP_SUCCESS;
}
@@ -476,7 +476,7 @@ std::string OlapStore::get_root_path_from_schema_hash_path_in_trash(
return schema_hash_path_in_trash.parent_path().parent_path().parent_path().parent_path().string();
}
-OLAPStatus OlapStore::_load_table_from_header(OLAPEngine* engine, TTabletId tablet_id,
+OLAPStatus OlapStore::_load_tablet_from_header(OLAPEngine* engine, TTabletId tablet_id,
TSchemaHash schema_hash, const std::string& header) {
std::unique_ptr<OLAPHeader> olap_header(new OLAPHeader());
bool parsed = olap_header->ParseFromString(header);
@@ -506,77 +506,77 @@ OLAPStatus OlapStore::_load_table_from_header(OLAPEngine* engine, TTabletId tabl
}
return OLAP_ERR_HEADER_INIT_FAILED;
}
- TabletSharedPtr olap_table =
- OLAPTable::create_from_header(olap_header.release(), this);
- if (olap_table == nullptr) {
- LOG(WARNING) << "fail to new table. tablet_id=" << tablet_id << ", schema_hash:" << schema_hash;
+ TabletSharedPtr tablet =
+ Tablet::create_from_header(olap_header.release(), this);
+ if (tablet == nullptr) {
+ LOG(WARNING) << "fail to new tablet. tablet_id=" << tablet_id << ", schema_hash:" << schema_hash;
return OLAP_ERR_TABLE_CREATE_FROM_HEADER_ERROR;
}
- if (olap_table->lastest_version() == nullptr && !olap_table->is_schema_changing()) {
+ if (tablet->lastest_version() == nullptr && !tablet->is_schema_changing()) {
LOG(WARNING) << "tablet not in schema change state without delta is invalid."
- << "tablet=" << olap_table->full_name();
+ << "tablet=" << tablet->full_name();
// tablet state is invalid, drop tablet
- olap_table->mark_dropped();
+ tablet->mark_dropped();
return OLAP_ERR_TABLE_INDEX_VALIDATE_ERROR;
}
- res = engine->add_table(tablet_id, schema_hash, olap_table);
+ res = engine->add_tablet(tablet_id, schema_hash, tablet);
if (res != OLAP_SUCCESS) {
// insert existed tablet return OLAP_SUCCESS
if (res == OLAP_ERR_ENGINE_INSERT_EXISTS_TABLE) {
- LOG(WARNING) << "add duplicate table. table=" << olap_table->full_name();
+ LOG(WARNING) << "add duplicate tablet. tablet=" << tablet->full_name();
}
- LOG(WARNING) << "failed to add table. table=" << olap_table->full_name();
+ LOG(WARNING) << "failed to add tablet. tablet=" << tablet->full_name();
return res;
}
- res = engine->register_table_into_root_path(olap_table.get());
+ res = engine->register_tablet_into_root_path(tablet.get());
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to register table into root path. root_path=" << olap_table->storage_root_path_name();
+ LOG(WARNING) << "fail to register tablet into root path. root_path=" << tablet->storage_root_path_name();
- if (engine->drop_table(tablet_id, schema_hash) != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to drop table when create table failed. "
+ if (engine->drop_tablet(tablet_id, schema_hash) != OLAP_SUCCESS) {
+ LOG(WARNING) << "fail to drop tablet when create tablet failed. "
<<"tablet=" << tablet_id << " schema_hash=" << schema_hash;
}
return res;
}
// load pending data (for realtime push), will add transaction relationship into engine
- olap_table->load_pending_data();
+ tablet->load_pending_data();
return OLAP_SUCCESS;
}
OLAPStatus OlapStore::load_tables(OLAPEngine* engine) {
- auto load_table_func = [this, engine](long tablet_id,
+ auto load_tablet_func = [this, engine](long tablet_id,
long schema_hash, const std::string& value) -> bool {
- OLAPStatus status = _load_table_from_header(engine, tablet_id, schema_hash, value);
+ OLAPStatus status = _load_tablet_from_header(engine, tablet_id, schema_hash, value);
if (status != OLAP_SUCCESS) {
- LOG(WARNING) << "load table from header failed. status:" << status
+ LOG(WARNING) << "load tablet from header failed. status:" << status
<< "tablet=" << tablet_id << "." << schema_hash;
};
return true;
};
- OLAPStatus status = OlapHeaderManager::traverse_headers(_meta, load_table_func);
+ OLAPStatus status = OlapHeaderManager::traverse_headers(_meta, load_tablet_func);
return status;
}
-OLAPStatus OlapStore::check_none_row_oriented_table_in_store(OLAPEngine* engine) {
- auto load_table_func = [this, engine](long tablet_id,
+OLAPStatus OlapStore::check_none_row_oriented_tablet_in_store(OLAPEngine* engine) {
+ auto load_tablet_func = [this, engine](long tablet_id,
long schema_hash, const std::string& value) -> bool {
- OLAPStatus status = _check_none_row_oriented_table_in_store(engine, tablet_id, schema_hash, value);
+ OLAPStatus status = _check_none_row_oriented_tablet_in_store(engine, tablet_id, schema_hash, value);
if (status != OLAP_SUCCESS) {
- LOG(WARNING) << "load table from header failed. status:" << status
+ LOG(WARNING) << "load tablet from header failed. status:" << status
<< "tablet=" << tablet_id << "." << schema_hash;
};
return true;
};
- OLAPStatus status = OlapHeaderManager::traverse_headers(_meta, load_table_func);
+ OLAPStatus status = OlapHeaderManager::traverse_headers(_meta, load_tablet_func);
return status;
}
-OLAPStatus OlapStore::_check_none_row_oriented_table_in_store(
+OLAPStatus OlapStore::_check_none_row_oriented_tablet_in_store(
OLAPEngine* engine, TTabletId tablet_id,
TSchemaHash schema_hash, const std::string& header) {
std::unique_ptr<OLAPHeader> olap_header(new OLAPHeader());
@@ -589,7 +589,7 @@ OLAPStatus OlapStore::_check_none_row_oriented_table_in_store(
RETURN_NOT_OK(olap_header->init());
LOG(INFO) << "data_file_type:" << olap_header->data_file_type();
if (olap_header->data_file_type() == OLAP_DATA_FILE) {
- LOG(FATAL) << "Not support row-oriented table any more. Please convert it to column-oriented table."
+ LOG(FATAL) << "Not support row-oriented tablet any more. Please convert it to column-oriented tablet."
<< "tablet=" << tablet_id << "." << schema_hash;
}
diff --git a/be/src/olap/store.h b/be/src/olap/store.h
index ca8ba350..42e35a45 100644
--- a/be/src/olap/store.h
+++ b/be/src/olap/store.h
@@ -67,8 +67,8 @@ class OlapStore {
}
TStorageMedium::type storage_medium() const { return _storage_medium; }
- OLAPStatus register_table(OLAPTable* table);
- OLAPStatus deregister_table(OLAPTable* table);
+ OLAPStatus register_tablet(Tablet* tablet);
+ OLAPStatus deregister_tablet(Tablet* tablet);
std::string get_tablet_schema_hash_path_from_header(OLAPHeader* header);
@@ -81,8 +81,8 @@ class OlapStore {
static std::string get_root_path_from_schema_hash_path_in_trash(const std::string& schema_hash_dir_in_trash);
OLAPStatus load_tables(OLAPEngine* engine);
- OLAPStatus check_none_row_oriented_table_in_store(OLAPEngine* engine);
- OLAPStatus _check_none_row_oriented_table_in_store(
+ OLAPStatus check_none_row_oriented_tablet_in_store(OLAPEngine* engine);
+ OLAPStatus _check_none_row_oriented_tablet_in_store(
OLAPEngine* engine, TTabletId tablet_id,
TSchemaHash schema_hash, const std::string& header);
@@ -99,7 +99,7 @@ class OlapStore {
Status _read_cluster_id(const std::string& path, int32_t* cluster_id);
Status _write_cluster_id_to_path(const std::string& path, int32_t cluster_id);
- OLAPStatus _load_table_from_header(OLAPEngine* engine, TTabletId tablet_id,
+ OLAPStatus _load_tablet_from_header(OLAPEngine* engine, TTabletId tablet_id,
TSchemaHash schema_hash, const std::string& header);
private:
diff --git a/be/src/olap/olap_table.cpp b/be/src/olap/tablet.cpp
similarity index 88%
rename from be/src/olap/olap_table.cpp
rename to be/src/olap/tablet.cpp
index c1325dbd..103b3040 100644
--- a/be/src/olap/olap_table.cpp
+++ b/be/src/olap/tablet.cpp
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include <ctype.h>
#include <pthread.h>
@@ -54,7 +54,7 @@ using boost::filesystem::path;
namespace doris {
-TabletSharedPtr OLAPTable::create_from_header_file(
+TabletSharedPtr Tablet::create_from_header_file(
TTabletId tablet_id, TSchemaHash schema_hash,
const string& header_file, OlapStore* store) {
OLAPHeader* olap_header = NULL;
@@ -90,7 +90,7 @@ TabletSharedPtr OLAPTable::create_from_header_file(
return create_from_header(olap_header, store);
}
-TabletSharedPtr OLAPTable::create_from_header_file_for_check(
+TabletSharedPtr Tablet::create_from_header_file_for_check(
TTabletId tablet_id, TSchemaHash schema_hash, const string& header_file) {
OLAPHeader* olap_header = NULL;
@@ -106,41 +106,41 @@ TabletSharedPtr OLAPTable::create_from_header_file_for_check(
return NULL;
}
- TabletSharedPtr olap_table = std::make_shared<OLAPTable>(olap_header);
- if (olap_table == NULL) {
- OLAP_LOG_WARNING("fail to validate table. [header_file=%s]", header_file.c_str());
+ TabletSharedPtr tablet = std::make_shared<Tablet>(olap_header);
+ if (tablet == NULL) {
+ OLAP_LOG_WARNING("fail to validate tablet. [header_file=%s]", header_file.c_str());
delete olap_header;
return NULL;
}
- olap_table->_tablet_id = tablet_id;
- olap_table->_schema_hash = schema_hash;
- olap_table->_full_name = std::to_string(tablet_id) + "." + std::to_string(schema_hash);
- return olap_table;
+ tablet->_tablet_id = tablet_id;
+ tablet->_schema_hash = schema_hash;
+ tablet->_full_name = std::to_string(tablet_id) + "." + std::to_string(schema_hash);
+ return tablet;
}
-OLAPTable::OLAPTable(OLAPHeader* header)
+Tablet::Tablet(OLAPHeader* header)
: _header(header) {
if (header->has_tablet_id()) {
_tablet_id = header->tablet_id();
_schema_hash = header->schema_hash();
_full_name = std::to_string(header->tablet_id()) + "." + std::to_string(header->schema_hash());
}
- _table_for_check = true;
+ _tablet_for_check = true;
}
-TabletSharedPtr OLAPTable::create_from_header(
+TabletSharedPtr Tablet::create_from_header(
OLAPHeader* header,
OlapStore* store) {
- auto olap_table = std::make_shared<OLAPTable>(header, store);
- if (olap_table == NULL) {
- LOG(WARNING) << "fail to malloc a table.";
+ auto tablet = std::make_shared<Tablet>(header, store);
+ if (tablet == NULL) {
+ LOG(WARNING) << "fail to malloc a tablet.";
return nullptr;
}
- return olap_table;
+ return tablet;
}
-OLAPTable::OLAPTable(OLAPHeader* header, OlapStore* store) :
+Tablet::Tablet(OLAPHeader* header, OlapStore* store) :
_header(header),
_is_dropped(false),
_num_fields(0),
@@ -234,11 +234,11 @@ OLAPTable::OLAPTable(OLAPHeader* header, OlapStore* store) :
_tablet_path = tablet_path_stream.str();
_storage_root_path = store->path();
_full_name = std::to_string(header->tablet_id()) + "." + std::to_string(header->schema_hash());
- _table_for_check = false;
+ _tablet_for_check = false;
}
-OLAPTable::~OLAPTable() {
- if (_table_for_check) {
+Tablet::~Tablet() {
+ if (_tablet_for_check) {
return;
}
@@ -246,7 +246,7 @@ OLAPTable::~OLAPTable() {
return; // for convenience of mock test.
}
- // ensure that there is nobody using OLAPTable, like acquiring OLAPData(SegmentGroup)
+ // ensure that there is nobody using Tablet, like acquiring OLAPData(SegmentGroup)
obtain_header_wrlock();
for (auto& it : _data_sources) {
for (SegmentGroup* segment_group : it.second) {
@@ -272,7 +272,7 @@ OLAPTable::~OLAPTable() {
// 移动数据目录
if (_is_dropped) {
- LOG(INFO) << "drop table:" << full_name() << ", tablet path:" << _tablet_path;
+ LOG(INFO) << "drop tablet:" << full_name() << ", tablet path:" << _tablet_path;
path table_path(_tablet_path);
std::string header_path = _tablet_path + "/" + std::to_string(_tablet_id) + ".hdr";
OLAPStatus s = OlapHeaderManager::dump_header(_store, _tablet_id, _schema_hash, header_path);
@@ -281,13 +281,13 @@ OLAPTable::~OLAPTable() {
s = OlapHeaderManager::remove(_store, _tablet_id, _schema_hash);
LOG(INFO) << "finish remove tablet header:" << full_name() << ", res:" << s;
if (move_to_trash(table_path, table_path) != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to delete table. [table_path=" << _tablet_path << "]";
+ LOG(WARNING) << "fail to delete tablet. [table_path=" << _tablet_path << "]";
}
- LOG(INFO) << "finish drop table:" << full_name();
+ LOG(INFO) << "finish drop tablet:" << full_name();
}
}
-OLAPStatus OLAPTable::load() {
+OLAPStatus Tablet::load() {
OLAPStatus res = OLAP_SUCCESS;
MutexLock l(&_load_lock);
@@ -310,13 +310,13 @@ OLAPStatus OLAPTable::load() {
<< "res=" << res << ", root=" << one_schema_root;
goto EXIT;
} else if (res != OLAP_SUCCESS) {
- OLAPEngine::get_instance()->drop_table(tablet_id(), schema_hash(), true);
+ OLAPEngine::get_instance()->drop_tablet(tablet_id(), schema_hash(), true);
return res;
}
res = load_indices();
if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "fail to load indices. [res=" << res << " table='" << _full_name << "']";
+ LOG(FATAL) << "fail to load indices. [res=" << res << " tablet='" << _full_name << "']";
goto EXIT;
}
@@ -337,17 +337,17 @@ OLAPStatus OLAPTable::load() {
EXIT:
if (res != OLAP_SUCCESS) {
- OLAPEngine::get_instance()->drop_table(tablet_id(), schema_hash());
+ OLAPEngine::get_instance()->drop_tablet(tablet_id(), schema_hash());
}
return res;
}
-OLAPStatus OLAPTable::load_indices() {
+OLAPStatus Tablet::load_indices() {
OLAPStatus res = OLAP_SUCCESS;
ReadLock rdlock(&_header_lock);
OLAPHeader* header = _header;
- VLOG(3) << "begin to load indices. table=" << full_name() << ", "
+ VLOG(3) << "begin to load indices. tablet=" << full_name() << ", "
<< "version_size=" << header->file_delta_size();
for (int delta_id = 0; delta_id < header->delta_size(); ++delta_id) {
@@ -361,7 +361,7 @@ OLAPStatus OLAPTable::load_indices() {
false, psegment_group.segment_group_id(), psegment_group.num_segments());
if (segment_group == nullptr) {
LOG(WARNING) << "fail to create olap segment_group. [version='" << version.first
- << "-" << version.second << "' table='" << full_name() << "']";
+ << "-" << version.second << "' tablet='" << full_name() << "']";
return OLAP_ERR_MALLOC_ERROR;
}
@@ -418,7 +418,7 @@ OLAPStatus OLAPTable::load_indices() {
return res;
}
- VLOG(3) << "load SegmentGroup success. table=" << full_name() << ", "
+ VLOG(3) << "load SegmentGroup success. tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << segment_group->version_hash() << ", "
<< "num_segments=" << segment_group->num_segments();
@@ -428,7 +428,7 @@ OLAPStatus OLAPTable::load_indices() {
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::save_header() {
+OLAPStatus Tablet::save_header() {
OLAPStatus res = OlapHeaderManager::save(_store, _tablet_id, _schema_hash, _header);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to save header. [res=" << res << " root=" << _storage_root_path << "]";
@@ -437,22 +437,22 @@ OLAPStatus OLAPTable::save_header() {
return res;
}
-OLAPStatus OLAPTable::select_versions_to_span( const Version& version,
+OLAPStatus Tablet::select_versions_to_span( const Version& version,
vector<Version>* span_versions) const {
OLAPStatus res = _header->select_versions_to_span(version, span_versions);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to generate shortest version path. [version='" << version.first
- << "-" << version.second << "' table='" << full_name() << "']";
+ << "-" << version.second << "' tablet='" << full_name() << "']";
}
return res;
}
-void OLAPTable::acquire_data_sources(const Version& version, vector<ColumnData*>* sources) const {
+void Tablet::acquire_data_sources(const Version& version, vector<ColumnData*>* sources) const {
vector<Version> span_versions;
if (_header->select_versions_to_span(version, &span_versions) != OLAP_SUCCESS) {
LOG(WARNING) << "fail to generate shortest version path. [version='" << version.first
- << "-" << version.second << "' table='" << full_name() << "']";
+ << "-" << version.second << "' tablet='" << full_name() << "']";
return;
}
@@ -460,10 +460,10 @@ void OLAPTable::acquire_data_sources(const Version& version, vector<ColumnData*>
return;
}
-void OLAPTable::acquire_data_sources_by_versions(const vector<Version>& version_list,
+void Tablet::acquire_data_sources_by_versions(const vector<Version>& version_list,
vector<ColumnData*>* sources) const {
if (sources == NULL) {
- LOG(WARNING) << "output parameter for data sources is null. table=" << full_name();
+ LOG(WARNING) << "output parameter for data sources is null. tablet=" << full_name();
return;
}
@@ -476,7 +476,7 @@ void OLAPTable::acquire_data_sources_by_versions(const vector<Version>& version_
version_olap_index_map_t::const_iterator it2 = _data_sources.find(*it1);
if (it2 == _data_sources.end()) {
LOG(WARNING) << "fail to find SegmentGroup for version. [version='" << it1->first
- << "-" << it1->second << "' table='" << full_name() << "']";
+ << "-" << it1->second << "' tablet='" << full_name() << "']";
release_data_sources(sources);
return;
}
@@ -485,7 +485,7 @@ void OLAPTable::acquire_data_sources_by_versions(const vector<Version>& version_
ColumnData* olap_data = ColumnData::create(segment_group);
if (olap_data == NULL) {
LOG(WARNING) << "fail to malloc Data. [version='" << it1->first
- << "-" << it1->second << "' table='" << full_name() << "']";
+ << "-" << it1->second << "' tablet='" << full_name() << "']";
release_data_sources(sources);
return;
}
@@ -494,7 +494,7 @@ void OLAPTable::acquire_data_sources_by_versions(const vector<Version>& version_
if (olap_data->init() != OLAP_SUCCESS) {
LOG(WARNING) << "fail to initial olap data. [version='" << it1->first
- << "-" << it1->second << "' table='" << full_name() << "']";
+ << "-" << it1->second << "' tablet='" << full_name() << "']";
release_data_sources(sources);
return;
}
@@ -502,9 +502,9 @@ void OLAPTable::acquire_data_sources_by_versions(const vector<Version>& version_
}
}
-OLAPStatus OLAPTable::release_data_sources(vector<ColumnData*>* data_sources) const {
+OLAPStatus Tablet::release_data_sources(vector<ColumnData*>* data_sources) const {
if (data_sources == NULL) {
- LOG(WARNING) << "parameter data_sources is null. [table='" << full_name() << "']";
+ LOG(WARNING) << "parameter data_sources is null. [tablet='" << full_name() << "']";
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
@@ -517,12 +517,12 @@ OLAPStatus OLAPTable::release_data_sources(vector<ColumnData*>* data_sources) co
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::register_data_source(const std::vector<SegmentGroup*>& index_vec) {
+OLAPStatus Tablet::register_data_source(const std::vector<SegmentGroup*>& index_vec) {
OLAPStatus res = OLAP_SUCCESS;
if (index_vec.empty()) {
LOG(WARNING) << "parameter segment_group is null."
- << "table=" << full_name();
+ << "tablet=" << full_name();
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
@@ -536,7 +536,7 @@ OLAPStatus OLAPTable::register_data_source(const std::vector<SegmentGroup*>& ind
segment_group->num_segments(), segment_group->index_size(), segment_group->data_size(),
segment_group->num_rows(), segment_group->empty(), column_statistics);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to add version to olap header. table=" << full_name() << ", "
+ LOG(WARNING) << "fail to add version to olap header. tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second;
return res;
}
@@ -544,7 +544,7 @@ OLAPStatus OLAPTable::register_data_source(const std::vector<SegmentGroup*>& ind
// put the new segment_group into _data_sources.
// 由于对header的操作可能失败,因此对_data_sources要放在这里
_data_sources[version].push_back(segment_group);
- VLOG(3) << "succeed to register data source. table=" << full_name() << ", "
+ VLOG(3) << "succeed to register data source. tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << segment_group->version_hash() << ", "
<< "segment_group_id=" << segment_group->segment_group_id() << ", "
@@ -554,19 +554,19 @@ OLAPStatus OLAPTable::register_data_source(const std::vector<SegmentGroup*>& ind
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::unregister_data_source(const Version& version, std::vector<SegmentGroup*>* segment_group_vec) {
+OLAPStatus Tablet::unregister_data_source(const Version& version, std::vector<SegmentGroup*>* segment_group_vec) {
OLAPStatus res = OLAP_SUCCESS;
version_olap_index_map_t::iterator it = _data_sources.find(version);
if (it == _data_sources.end()) {
LOG(WARNING) << "olap segment_group for version does not exists. [version='" << version.first
- << "-" << version.second << "' table='" << full_name() << "']";
+ << "-" << version.second << "' tablet='" << full_name() << "']";
return OLAP_ERR_VERSION_NOT_EXIST;
}
// delete a reference to the data source in the header file
if ((res = _header->delete_version(version)) != OLAP_SUCCESS) {
LOG(WARNING) << "fail to delete version from olap header. [version='" << version.first
- << "-" << version.second << "' table='" << full_name() << "']";
+ << "-" << version.second << "' tablet='" << full_name() << "']";
return res;
}
@@ -575,29 +575,29 @@ OLAPStatus OLAPTable::unregister_data_source(const Version& version, std::vector
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::add_pending_version(int64_t partition_id, int64_t transaction_id,
+OLAPStatus Tablet::add_pending_version(int64_t partition_id, int64_t transaction_id,
const std::vector<string>* delete_conditions) {
WriteLock wrlock(&_header_lock);
OLAPStatus res = _header->add_pending_version(partition_id, transaction_id, delete_conditions);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to add pending delta to header."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id;
return res;
}
res = save_header();
if (res != OLAP_SUCCESS) {
_header->delete_pending_delta(transaction_id);
- LOG(FATAL) << "fail to save header when add pending segment_group. [table=" << full_name()
+ LOG(FATAL) << "fail to save header when add pending segment_group. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
return res;
}
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::add_pending_segment_group(SegmentGroup* segment_group) {
+OLAPStatus Tablet::add_pending_segment_group(SegmentGroup* segment_group) {
if (segment_group == nullptr) {
- LOG(WARNING) << "parameter segment_group is null. [table=" << full_name() << "]";
+ LOG(WARNING) << "parameter segment_group is null. [tablet=" << full_name() << "]";
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
@@ -614,7 +614,7 @@ OLAPStatus OLAPTable::add_pending_segment_group(SegmentGroup* segment_group) {
segment_group->segment_group_id(), segment_group->load_id(),
segment_group->empty(), column_statistics);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to add pending segment_group to header. [table=" << full_name()
+ LOG(WARNING) << "fail to add pending segment_group to header. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
release_header_lock();
return res;
@@ -624,7 +624,7 @@ OLAPStatus OLAPTable::add_pending_segment_group(SegmentGroup* segment_group) {
res = save_header();
if (res != OLAP_SUCCESS) {
_header->delete_pending_delta(transaction_id);
- LOG(FATAL) << "fail to save header when add pending segment_group. [table=" << full_name()
+ LOG(FATAL) << "fail to save header when add pending segment_group. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
release_header_lock();
return res;
@@ -634,12 +634,12 @@ OLAPStatus OLAPTable::add_pending_segment_group(SegmentGroup* segment_group) {
_pending_data_sources[transaction_id].push_back(segment_group);
release_header_lock();
VLOG(3) << "add pending data to tablet successfully."
- << "table=" << full_name() << ", transaction_id=" << transaction_id;
+ << "tablet=" << full_name() << ", transaction_id=" << transaction_id;
return res;
}
-int32_t OLAPTable::current_pending_segment_group_id(int64_t transaction_id) {
+int32_t Tablet::current_pending_segment_group_id(int64_t transaction_id) {
ReadLock rdlock(&_header_lock);
int32_t segment_group_id = -1;
if (_pending_data_sources.find(transaction_id) != _pending_data_sources.end()) {
@@ -652,16 +652,16 @@ int32_t OLAPTable::current_pending_segment_group_id(int64_t transaction_id) {
return segment_group_id;
}
-OLAPStatus OLAPTable::add_pending_data(SegmentGroup* segment_group, const std::vector<TCondition>* delete_conditions) {
+OLAPStatus Tablet::add_pending_data(SegmentGroup* segment_group, const std::vector<TCondition>* delete_conditions) {
if (segment_group == nullptr) {
- LOG(WARNING) << "parameter segment_group is null. table=" << full_name();
+ LOG(WARNING) << "parameter segment_group is null. tablet=" << full_name();
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
obtain_header_wrlock();
int64_t transaction_id = segment_group->transaction_id();
if (_pending_data_sources.find(transaction_id) != _pending_data_sources.end()) {
- LOG(WARNING) << "find pending data existed when add to tablet. [table=" << full_name()
+ LOG(WARNING) << "find pending data existed when add to tablet. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
release_header_lock();
return OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST;
@@ -684,7 +684,7 @@ OLAPStatus OLAPTable::add_pending_data(SegmentGroup* segment_group, const std::v
}
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to add pending delta to header."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id;
release_header_lock();
return res;
@@ -699,7 +699,7 @@ OLAPStatus OLAPTable::add_pending_data(SegmentGroup* segment_group, const std::v
segment_group->segment_group_id(), segment_group->load_id(),
segment_group->empty(), column_statistics);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to add pending segment_group to header. [table=" << full_name()
+ LOG(WARNING) << "fail to add pending segment_group to header. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
release_header_lock();
return res;
@@ -709,7 +709,7 @@ OLAPStatus OLAPTable::add_pending_data(SegmentGroup* segment_group, const std::v
res = save_header();
if (res != OLAP_SUCCESS) {
_header->delete_pending_delta(transaction_id);
- LOG(FATAL) << "fail to save header when add pending segment_group. [table=" << full_name()
+ LOG(FATAL) << "fail to save header when add pending segment_group. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
release_header_lock();
return res;
@@ -719,17 +719,17 @@ OLAPStatus OLAPTable::add_pending_data(SegmentGroup* segment_group, const std::v
_pending_data_sources[transaction_id].push_back(segment_group);
release_header_lock();
VLOG(3) << "add pending data to tablet successfully."
- << "table=" << full_name() << ", transaction_id=" << transaction_id;
+ << "tablet=" << full_name() << ", transaction_id=" << transaction_id;
return res;
}
-bool OLAPTable::has_pending_data(int64_t transaction_id) {
+bool Tablet::has_pending_data(int64_t transaction_id) {
ReadLock rdlock(&_header_lock);
return _pending_data_sources.find(transaction_id) != _pending_data_sources.end();
}
-void OLAPTable::delete_pending_data(int64_t transaction_id) {
+void Tablet::delete_pending_data(int64_t transaction_id) {
obtain_header_wrlock();
auto it = _pending_data_sources.find(transaction_id);
@@ -750,17 +750,17 @@ void OLAPTable::delete_pending_data(int64_t transaction_id) {
// save header
if (save_header() != OLAP_SUCCESS) {
- LOG(FATAL) << "failed to save header when delete pending data. [table=" << full_name()
+ LOG(FATAL) << "failed to save header when delete pending data. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
}
release_header_lock();
- LOG(INFO) << "delete pending data from tablet. [table=" << full_name()
+ LOG(INFO) << "delete pending data from tablet. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
}
-void OLAPTable::get_expire_pending_data(vector<int64_t>* transaction_ids) {
+void Tablet::get_expire_pending_data(vector<int64_t>* transaction_ids) {
time_t now = time(NULL);
ReadLock rdlock(&_header_lock);
@@ -768,14 +768,14 @@ void OLAPTable::get_expire_pending_data(vector<int64_t>* transaction_ids) {
double diff = difftime(now, it.creation_time());
if (diff >= config::pending_data_expire_time_sec) {
transaction_ids->push_back(it.transaction_id());
- VLOG(3) << "find expire pending data. table=" << full_name() << ", "
+ VLOG(3) << "find expire pending data. tablet=" << full_name() << ", "
<< "transaction_id=" << it.transaction_id() << " exist_sec=" << diff;
}
}
}
-void OLAPTable::load_pending_data() {
- LOG(INFO) << "begin to load pending_data. table=" << full_name() << ", "
+void Tablet::load_pending_data() {
+ LOG(INFO) << "begin to load pending_data. tablet=" << full_name() << ", "
<< "pending_delta size=" << _header->pending_delta_size();
MutexLock load_lock(&_load_lock);
@@ -797,7 +797,7 @@ void OLAPTable::load_pending_data() {
if (segment_group->validate() != OLAP_SUCCESS) {
LOG(WARNING) << "fail to validate segment_group when load pending data."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << segment_group->transaction_id();
error_pending_data.insert(segment_group->transaction_id());
break;
@@ -833,7 +833,7 @@ void OLAPTable::load_pending_data() {
if (segment_group->load() != OLAP_SUCCESS) {
LOG(WARNING) << "fail to load segment_group when load pending data."
- << "table=" << full_name() << ", transaction_id=" << pending_delta.transaction_id();
+ << "tablet=" << full_name() << ", transaction_id=" << pending_delta.transaction_id();
error_pending_data.insert(pending_delta.transaction_id());
break;
}
@@ -843,7 +843,7 @@ void OLAPTable::load_pending_data() {
_tablet_id, _schema_hash, pending_segment_group.load_id());
if (add_status != OLAP_SUCCESS) {
- LOG(WARNING) << "find transaction exists in engine when load pending data. [table=" << full_name()
+ LOG(WARNING) << "find transaction exists in engine when load pending data. [tablet=" << full_name()
<< " transaction_id=" << pending_delta.transaction_id() << "]";
error_pending_data.insert(pending_delta.transaction_id());
break;
@@ -854,12 +854,12 @@ void OLAPTable::load_pending_data() {
continue;
}
- VLOG(3) << "load pending data successfully. table=" << full_name() << ", "
+ VLOG(3) << "load pending data successfully. tablet=" << full_name() << ", "
<< "partition_id=" << pending_delta.partition_id() << ", "
<< "transaction_id=" << pending_delta.transaction_id();
}
- LOG(INFO) << "finish to load pending data. table=" << full_name() << ", "
+ LOG(INFO) << "finish to load pending data. tablet=" << full_name() << ", "
<< "error_data_size=" << error_pending_data.size();
for (int64_t error_data : error_pending_data) {
@@ -870,12 +870,12 @@ void OLAPTable::load_pending_data() {
// 1. need to replace local data if same version existed
// 2. move pending data to version data
// 3. move pending data to incremental data, it won't be merged, so we can do incremental clone
-OLAPStatus OLAPTable::publish_version(int64_t transaction_id, Version version,
+OLAPStatus Tablet::publish_version(int64_t transaction_id, Version version,
VersionHash version_hash) {
WriteLock wrlock(&_header_lock);
if (_pending_data_sources.find(transaction_id) == _pending_data_sources.end()) {
LOG(WARNING) << "pending data not exists in tablet, not finished or deleted."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id;
return OLAP_ERR_TRANSACTION_NOT_EXIST;
}
@@ -913,7 +913,7 @@ OLAPStatus OLAPTable::publish_version(int64_t transaction_id, Version version,
// add incremental version, if failed, ignore it
res = _add_incremental_data(index_vec, transaction_id, version, version_hash);
VLOG(3) << "finish to add incremental version. res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id << ", "
<< "version=" << version.first << "-" << version.second;
@@ -921,7 +921,7 @@ OLAPStatus OLAPTable::publish_version(int64_t transaction_id, Version version,
res = save_header();
if (res != OLAP_SUCCESS) {
LOG(FATAL) << "fail to save header when publish version. res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id;
std::vector<SegmentGroup*> delete_index_vec;
// if failed, clear new data
@@ -936,7 +936,7 @@ OLAPStatus OLAPTable::publish_version(int64_t transaction_id, Version version,
if (res != OLAP_SUCCESS) {
remove_files(linked_files);
LOG(FATAL) << "fail to save header when publish version. res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id;
return res;
}
@@ -951,7 +951,7 @@ OLAPStatus OLAPTable::publish_version(int64_t transaction_id, Version version,
// 1. if version is same and version_hash different, delete local data, save header
// 2. if version_hash is same or version is merged, publish success, delete transaction, save header
-OLAPStatus OLAPTable::_handle_existed_version(int64_t transaction_id, const Version& version,
+OLAPStatus Tablet::_handle_existed_version(int64_t transaction_id, const Version& version,
const VersionHash& version_hash) {
const PDelta* existed_delta = nullptr;
for (int i = 0; i < file_delta_size(); ++i) {
@@ -972,7 +972,7 @@ OLAPStatus OLAPTable::_handle_existed_version(int64_t transaction_id, const Vers
if (existed_delta->start_version() == version.first
&& existed_delta->end_version() == version.second
&& existed_delta->version_hash() != version_hash) {
- LOG(INFO) << "version_hash is different when publish version, delete local data. [table=" << full_name()
+ LOG(INFO) << "version_hash is different when publish version, delete local data. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
// remove delete condition if current type is PUSH_FOR_DELETE,
// this occurs when user cancel delete_data soon after submit it
@@ -982,10 +982,10 @@ OLAPStatus OLAPTable::_handle_existed_version(int64_t transaction_id, const Vers
return res;
} else if (!push_for_delete) {
DeleteConditionHandler del_cond_handler;
- TabletSharedPtr olap_table_ptr =
- OLAPEngine::get_instance()->get_table(_tablet_id, _schema_hash);
- if (olap_table_ptr.get() != nullptr) {
- del_cond_handler.delete_cond(olap_table_ptr, version.first, false);
+ TabletSharedPtr tablet_ptr =
+ OLAPEngine::get_instance()->get_tablet(_tablet_id, _schema_hash);
+ if (tablet_ptr.get() != nullptr) {
+ del_cond_handler.delete_cond(tablet_ptr, version.first, false);
}
}
// delete local data
@@ -994,7 +994,7 @@ OLAPStatus OLAPTable::_handle_existed_version(int64_t transaction_id, const Vers
_delete_incremental_data(version, version_hash);
res = unregister_data_source(version, &existed_index_vec);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to unregister data when publish version. [table=" << full_name()
+ LOG(WARNING) << "fail to unregister data when publish version. [tablet=" << full_name()
<< " version=" << version.first << "-" << version.second << " res=" << res << "]";
return res;
}
@@ -1013,17 +1013,17 @@ OLAPStatus OLAPTable::_handle_existed_version(int64_t transaction_id, const Vers
}
// if version_hash is same or version is merged, publish success
} else {
- LOG(INFO) << "version_hash is same when publish version, publish success. [table=" << full_name()
+ LOG(INFO) << "version_hash is same when publish version, publish success. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
res = OLAP_ERR_PUSH_VERSION_ALREADY_EXIST;
}
return res;
}
-OLAPStatus OLAPTable::_add_incremental_data(std::vector<SegmentGroup*>& index_vec, int64_t transaction_id,
+OLAPStatus Tablet::_add_incremental_data(std::vector<SegmentGroup*>& index_vec, int64_t transaction_id,
const Version& version, const VersionHash& version_hash) {
if (index_vec.empty()) {
- LOG(WARNING) << "no parameter when add incremental data. table=" << full_name();
+ LOG(WARNING) << "no parameter when add incremental data. tablet=" << full_name();
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
@@ -1033,7 +1033,7 @@ OLAPStatus OLAPTable::_add_incremental_data(std::vector<SegmentGroup*>& index_ve
if (!check_dir_existed(dir_path)) {
res = create_dirs(dir_path);
if (res != OLAP_SUCCESS && !check_dir_existed(dir_path)) {
- LOG(WARNING) << "fail to create segment_group dir. table=" << full_name() << ", "
+ LOG(WARNING) << "fail to create segment_group dir. tablet=" << full_name() << ", "
<< " transaction_id=" << transaction_id;
return res;
}
@@ -1066,7 +1066,7 @@ OLAPStatus OLAPTable::_add_incremental_data(std::vector<SegmentGroup*>& index_ve
segment_group->num_rows(), segment_group->empty(), column_statistics);
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to add incremental data. res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "transaction_id=" << transaction_id << ", "
<< "version=" << version.first << "-" << version.second;
remove_files(linked_files);
@@ -1077,7 +1077,7 @@ OLAPStatus OLAPTable::_add_incremental_data(std::vector<SegmentGroup*>& index_ve
return res;
}
-void OLAPTable::delete_expire_incremental_data() {
+void Tablet::delete_expire_incremental_data() {
time_t now = time(NULL);
std::vector<std::pair<Version, VersionHash>> expire_versions;
WriteLock wrlock(&_header_lock);
@@ -1093,17 +1093,17 @@ void OLAPTable::delete_expire_incremental_data() {
}
for (auto& it : expire_versions) {
_delete_incremental_data(it.first, it.second);
- VLOG(3) << "delete expire incremental data. table=" << full_name() << ", "
+ VLOG(3) << "delete expire incremental data. tablet=" << full_name() << ", "
<< "version=" << it.first.first << "-" << it.first.second;
}
if (save_header() != OLAP_SUCCESS) {
LOG(FATAL) << "fail to save header when delete expire incremental data."
- << "table=" << full_name();
+ << "tablet=" << full_name();
}
}
-void OLAPTable::_delete_incremental_data(const Version& version, const VersionHash& version_hash) {
+void Tablet::_delete_incremental_data(const Version& version, const VersionHash& version_hash) {
const PDelta* incremental_delta = get_incremental_delta(version);
if (incremental_delta == nullptr) { return; }
@@ -1123,11 +1123,11 @@ void OLAPTable::_delete_incremental_data(const Version& version, const VersionHa
remove_files(files_to_delete);
_header->delete_incremental_delta(version);
- VLOG(3) << "delete incremental data. table=" << full_name() << ", "
+ VLOG(3) << "delete incremental data. tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second;
}
-void OLAPTable::get_missing_versions_with_header_locked(
+void Tablet::get_missing_versions_with_header_locked(
int64_t until_version, std::vector<Version>* missing_versions) const {
DCHECK(until_version > 0) << "invalid until_version: " << until_version;
std::list<Version> existing_versions;
@@ -1160,7 +1160,7 @@ void OLAPTable::get_missing_versions_with_header_locked(
}
}
-const PDelta* OLAPTable::least_complete_version(
+const PDelta* Tablet::least_complete_version(
const vector<Version>& missing_versions) const {
const PDelta* least_delta = nullptr;
@@ -1169,7 +1169,7 @@ const PDelta* OLAPTable::least_complete_version(
for (int i = 0; i < _header->file_delta_size(); ++i) {
const PDelta* delta = _header->get_delta(i);
if (delta->end_version() == version.first - 1) {
- LOG(INFO) << "find least complete version. table=" << full_name() << ", "
+ LOG(INFO) << "find least complete version. tablet=" << full_name() << ", "
<< "version=" << delta->start_version() << "-" << delta->end_version() << ", "
<< "version_hash=" << delta->version_hash() << ", "
<< "first_missing_version=" << version.first << "-" << version.second;
@@ -1184,12 +1184,12 @@ const PDelta* OLAPTable::least_complete_version(
return least_delta;
}
-OLAPStatus OLAPTable::is_push_for_delete(
+OLAPStatus Tablet::is_push_for_delete(
int64_t transaction_id, bool* is_push_for_delete) const {
const PPendingDelta* pending_delta = _header->get_pending_delta(transaction_id);
if (pending_delta == nullptr) {
- LOG(WARNING) << "pending segment_group not found when check push for delete. [table=" << full_name()
+ LOG(WARNING) << "pending segment_group not found when check push for delete. [tablet=" << full_name()
<< " transaction_id=" << transaction_id << "]";
return OLAP_ERR_TRANSACTION_NOT_EXIST;
}
@@ -1197,9 +1197,9 @@ OLAPStatus OLAPTable::is_push_for_delete(
return OLAP_SUCCESS;
}
-SegmentGroup* OLAPTable::_construct_segment_group_from_version(const PDelta* delta, int32_t segment_group_id) {
+SegmentGroup* Tablet::_construct_segment_group_from_version(const PDelta* delta, int32_t segment_group_id) {
VLOG(3) << "begin to construct segment_group from version."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "version=" << delta->start_version() << "-" << delta->end_version() << ", "
<< "version_hash=" << delta->version_hash();
Version version(delta->start_version(), delta->end_version());
@@ -1218,7 +1218,7 @@ SegmentGroup* OLAPTable::_construct_segment_group_from_version(const PDelta* del
segment_group->set_empty(psegment_group->empty());
}
DCHECK(segment_group != nullptr) << "malloc error when construct segment_group."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << delta->version_hash();
OLAPStatus res = segment_group->validate();
@@ -1229,7 +1229,7 @@ SegmentGroup* OLAPTable::_construct_segment_group_from_version(const PDelta* del
if (psegment_group->column_pruning_size() != 0) {
if (_num_key_fields != psegment_group->column_pruning_size()) {
- LOG(WARNING) << "column pruning size error, " << "table=" << full_name() << ", "
+ LOG(WARNING) << "column pruning size error, " << "tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << delta->version_hash() << ", "
<< "column_pruning_size=" << psegment_group->column_pruning_size() << ", "
@@ -1260,7 +1260,7 @@ SegmentGroup* OLAPTable::_construct_segment_group_from_version(const PDelta* del
res = segment_group->load();
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to load segment_group. res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << delta->version_hash();
SAFE_DELETE(segment_group);
@@ -1268,12 +1268,12 @@ SegmentGroup* OLAPTable::_construct_segment_group_from_version(const PDelta* del
}
VLOG(3) << "finish to construct segment_group from version."
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second;
return segment_group;
}
-OLAPStatus OLAPTable::_create_hard_link(const string& from, const string& to,
+OLAPStatus Tablet::_create_hard_link(const string& from, const string& to,
vector<string>* linked_success_files) {
if (link(from.c_str(), to.c_str()) != 0) {
LOG(WARNING) << "fail to create hard link. from=" << from << ", "
@@ -1285,10 +1285,10 @@ OLAPStatus OLAPTable::_create_hard_link(const string& from, const string& to,
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
+OLAPStatus Tablet::clone_data(const OLAPHeader& clone_header,
const vector<const PDelta*>& clone_deltas,
const vector<Version>& versions_to_delete) {
- LOG(INFO) << "begin to clone data to tablet. table=" << full_name() << ", "
+ LOG(INFO) << "begin to clone data to tablet. tablet=" << full_name() << ", "
<< "clone_versions_size=" << clone_deltas.size() << ", "
<< "versions_to_delete_size=" << versions_to_delete.size();
OLAPStatus res = OLAP_SUCCESS;
@@ -1303,11 +1303,11 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
for (const Version& version : versions_to_delete) {
res = new_local_header.delete_version(version);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "failed to delete version from new local header. [table=" << full_name()
+ LOG(WARNING) << "failed to delete version from new local header. [tablet=" << full_name()
<< " version=" << version.first << "-" << version.second << "]";
break;
}
- LOG(INFO) << "delete version from new local header when clone. [table='" << full_name()
+ LOG(INFO) << "delete version from new local header when clone. [tablet='" << full_name()
<< "', version=" << version.first << "-" << version.second << "]";
}
@@ -1323,7 +1323,7 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
for (const PSegmentGroup& psegment_group : clone_delta->segment_group()) {
SegmentGroup* tmp_segment_group = _construct_segment_group_from_version(clone_delta, psegment_group.segment_group_id());
if (tmp_segment_group == NULL) {
- LOG(WARNING) << "fail to construct segment_group when clone data. table=" << full_name() << ", "
+ LOG(WARNING) << "fail to construct segment_group when clone data. tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << clone_delta->version_hash();
res = OLAP_ERR_INDEX_LOAD_ERROR;
@@ -1348,7 +1348,7 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to add version to new local header when clone."
<< "res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "version=" << version.first << "-" << version.second << ", "
<< "version_hash=" << clone_delta->version_hash();
break;
@@ -1365,7 +1365,7 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
if (it->version() == version.first) {
// add it
new_local_header.add_delete_condition(*it, version.first);
- LOG(INFO) << "add delete condition when clone. [table=" << full_name()
+ LOG(INFO) << "add delete condition when clone. [tablet=" << full_name()
<< " version=" << it->version() << "]";
break;
}
@@ -1376,7 +1376,7 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
if (res != OLAP_SUCCESS) {
break;
}
- VLOG(3) << "load indices successfully when clone. table=" << full_name() << ", "
+ VLOG(3) << "load indices successfully when clone. tablet=" << full_name() << ", "
<< "add_versions_size=" << clone_deltas.size() << ", "
<< "new_indices_size=" << tmp_data_sources.size();
// save and reload header
@@ -1387,7 +1387,7 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
}
res = OlapHeaderManager::get_header(_store, _tablet_id, _schema_hash, _header);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "failed to reload original header when clone. [table=" << full_name()
+ LOG(WARNING) << "failed to reload original header when clone. [tablet=" << full_name()
<< " res=" << res << "]";
break;
}
@@ -1427,18 +1427,18 @@ OLAPStatus OLAPTable::clone_data(const OLAPHeader& clone_header,
}
LOG(INFO) << "finish to clone data to tablet. res=" << res << ", "
- << "table=" << full_name() << ", "
+ << "tablet=" << full_name() << ", "
<< "clone_versions_size=" << clone_deltas.size();
return res;
}
-OLAPStatus OLAPTable::replace_data_sources(const vector<Version>* old_versions,
+OLAPStatus Tablet::replace_data_sources(const vector<Version>* old_versions,
const vector<SegmentGroup*>* new_data_sources,
vector<SegmentGroup*>* old_data_sources) {
OLAPStatus res = OLAP_SUCCESS;
if (old_versions == NULL || new_data_sources == NULL) {
- LOG(WARNING) << "parameter old_versions or new_data_sources is null. table=" << full_name();
+ LOG(WARNING) << "parameter old_versions or new_data_sources is null. tablet=" << full_name();
return OLAP_ERR_INPUT_PARAMETER_ERROR;
}
@@ -1450,7 +1450,7 @@ OLAPStatus OLAPTable::replace_data_sources(const vector<Version>* old_versions,
version_olap_index_map_t::iterator data_source_it = _data_sources.find(*it);
if (data_source_it == _data_sources.end()) {
LOG(WARNING) << "olap segment_group for version does not exists. [version='" << it->first
- << "-" << it->second << "' table='" << full_name() << "']";
+ << "-" << it->second << "' tablet='" << full_name() << "']";
return OLAP_ERR_VERSION_NOT_EXIST;
}
}
@@ -1472,7 +1472,7 @@ OLAPStatus OLAPTable::replace_data_sources(const vector<Version>* old_versions,
if (!to_be_deleted) {
LOG(WARNING) << "olap segment_group for version exists. [version='" << (*it)->version().first
- << "-" << (*it)->version().second << "' table='" << full_name() << "']";
+ << "-" << (*it)->version().second << "' tablet='" << full_name() << "']";
return OLAP_ERR_TABLE_VERSION_DUPLICATE_ERROR;
}
}
@@ -1492,11 +1492,11 @@ OLAPStatus OLAPTable::replace_data_sources(const vector<Version>* old_versions,
// 删除失败会导致脏数据
if ((res = _header->delete_version(*it)) != OLAP_SUCCESS) {
LOG(WARNING) << "fail to delete version from olap header.[version='" << it->first
- << "-" << it->second << "' table='" << full_name() << "']";
+ << "-" << it->second << "' tablet='" << full_name() << "']";
return res;
}
- VLOG(3) << "delete version from olap header. table=" << full_name() << ", "
+ VLOG(3) << "delete version from olap header. tablet=" << full_name() << ", "
<< "version=" << it->first << "-" << it->second;
}
@@ -1516,18 +1516,18 @@ OLAPStatus OLAPTable::replace_data_sources(const vector<Version>* old_versions,
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to add version to olap header.[version='" << (*it)->version().first
- << "-" << (*it)->version().second << "' table='" << full_name() << "']";
+ << "-" << (*it)->version().second << "' tablet='" << full_name() << "']";
return res;
}
- VLOG(3) << "add version to olap header. table=" << full_name() << ", "
+ VLOG(3) << "add version to olap header. tablet=" << full_name() << ", "
<< "version=" << (*it)->version().first << "-" << (*it)->version().second;
}
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::compute_all_versions_hash(const vector<Version>& versions,
+OLAPStatus Tablet::compute_all_versions_hash(const vector<Version>& versions,
VersionHash* version_hash) const {
if (version_hash == NULL) {
OLAP_LOG_WARNING("invalid parameter: 'new_version_hash' is null.");
@@ -1552,9 +1552,9 @@ OLAPStatus OLAPTable::compute_all_versions_hash(const vector<Version>& versions,
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::merge_header(const OLAPHeader& hdr, int to_version) {
+OLAPStatus Tablet::merge_header(const OLAPHeader& hdr, int to_version) {
obtain_header_wrlock();
- DeferOp release_lock(std::bind<void>(&OLAPTable::release_header_lock, this));
+ DeferOp release_lock(std::bind<void>(&Tablet::release_header_lock, this));
const PDelta* base_version = _header->get_base_version();
if (base_version->end_version() != to_version) {
@@ -1605,7 +1605,7 @@ OLAPStatus OLAPTable::merge_header(const OLAPHeader& hdr, int to_version) {
return OLAP_SUCCESS;
}
-SegmentGroup* OLAPTable::_get_largest_index() {
+SegmentGroup* Tablet::_get_largest_index() {
SegmentGroup* largest_index = NULL;
size_t largest_index_sizes = 0;
@@ -1626,7 +1626,7 @@ SegmentGroup* OLAPTable::_get_largest_index() {
return largest_index;
}
-OLAPStatus OLAPTable::split_range(
+OLAPStatus Tablet::split_range(
const OlapTuple& start_key_strings,
const OlapTuple& end_key_strings,
uint64_t request_block_row_count,
@@ -1698,7 +1698,7 @@ OLAPStatus OLAPTable::split_range(
// 如果找不到合适的segment_group,就直接返回startkey,endkey
if (base_index == NULL) {
VLOG(3) << "there is no base file now, may be tablet is empty.";
- // it may be right if the table is empty, so we return success.
+ // it may be right if the tablet is empty, so we return success.
ranges->emplace_back(start_key.to_tuple());
ranges->emplace_back(end_key.to_tuple());
return OLAP_SUCCESS;
@@ -1782,17 +1782,17 @@ OLAPStatus OLAPTable::split_range(
return OLAP_SUCCESS;
}
-void OLAPTable::list_data_files(set<string>* file_names) const {
+void Tablet::list_data_files(set<string>* file_names) const {
_list_files_with_suffix("dat", file_names);
}
-void OLAPTable::list_index_files(set<string>* file_names) const {
+void Tablet::list_index_files(set<string>* file_names) const {
_list_files_with_suffix("idx", file_names);
}
-void OLAPTable::_list_files_with_suffix(const string& file_suffix, set<string>* file_names) const {
+void Tablet::_list_files_with_suffix(const string& file_suffix, set<string>* file_names) const {
if (file_names == NULL) {
- LOG(WARNING) << "parameter filenames is null. [table='" << full_name() << "']";
+ LOG(WARNING) << "parameter filenames is null. [tablet='" << full_name() << "']";
return;
}
@@ -1816,11 +1816,11 @@ void OLAPTable::_list_files_with_suffix(const string& file_suffix, set<string>*
}
}
-bool OLAPTable::has_version(const Version& version) const {
+bool Tablet::has_version(const Version& version) const {
return (_data_sources.find(version) != _data_sources.end());
}
-void OLAPTable::list_versions(vector<Version>* versions) const {
+void Tablet::list_versions(vector<Version>* versions) const {
if (versions == NULL) {
OLAP_LOG_WARNING("parameter versions is null.");
return;
@@ -1835,7 +1835,7 @@ void OLAPTable::list_versions(vector<Version>* versions) const {
}
}
-void OLAPTable::list_version_entities(vector<VersionEntity>* version_entities) const {
+void Tablet::list_version_entities(vector<VersionEntity>* version_entities) const {
if (version_entities == NULL) {
OLAP_LOG_WARNING("parameter versions is null.");
return;
@@ -1862,7 +1862,7 @@ void OLAPTable::list_version_entities(vector<VersionEntity>* version_entities) c
}
}
-void OLAPTable::delete_all_files() {
+void Tablet::delete_all_files() {
// Release resources like memory and disk space.
// we have to call list_versions first, or else error occurs when
// removing hash_map item and iterating hash_map concurrently.
@@ -1884,13 +1884,13 @@ void OLAPTable::delete_all_files() {
}
}
- // remove olap header file, _header object will be delete in OLAPTable.destructor
+ // remove olap header file, _header object will be delete in Tablet.destructor
if (remove_parent_dir(_tablet_path) != OLAP_SUCCESS) {
LOG(WARNING) << "fail to delete header file and directory. header_path=" << _tablet_path;
}
}
-string OLAPTable::construct_index_file_path(const Version& version,
+string Tablet::construct_index_file_path(const Version& version,
VersionHash version_hash,
int32_t segment_group_id,
int32_t segment) const {
@@ -1899,7 +1899,7 @@ string OLAPTable::construct_index_file_path(const Version& version,
string tablet_path_prefix = prefix_stream.str();
return construct_file_path(tablet_path_prefix, version, version_hash, segment_group_id, segment, "idx");
}
-string OLAPTable::construct_data_file_path(const Version& version,
+string Tablet::construct_data_file_path(const Version& version,
VersionHash version_hash,
int32_t segment_group_id,
int32_t segment) const {
@@ -1908,7 +1908,7 @@ string OLAPTable::construct_data_file_path(const Version& version,
string tablet_path_prefix = prefix_stream.str();
return construct_file_path(tablet_path_prefix, version, version_hash, segment_group_id, segment, "dat");
}
-string OLAPTable::construct_file_path(const string& tablet_path_prefix,
+string Tablet::construct_file_path(const string& tablet_path_prefix,
const Version& version,
VersionHash version_hash,
int32_t segment_group_id, int32_t segment,
@@ -1939,13 +1939,13 @@ string OLAPTable::construct_file_path(const string& tablet_path_prefix,
return file_path;
}
-string OLAPTable::construct_incremental_delta_dir_path() const {
+string Tablet::construct_incremental_delta_dir_path() const {
stringstream segment_group_dir_path;
segment_group_dir_path << _tablet_path << INCREMENTAL_DELTA_PREFIX;
return segment_group_dir_path.str();
}
-string OLAPTable::construct_incremental_index_file_path(Version version, VersionHash version_hash,
+string Tablet::construct_incremental_index_file_path(Version version, VersionHash version_hash,
int32_t segment_group_id, int32_t segment) const {
string segment_group_dir_path = construct_incremental_delta_dir_path();
stringstream segment_group_file_path;
@@ -1953,7 +1953,7 @@ string OLAPTable::construct_incremental_index_file_path(Version version, Version
<< construct_file_name(version, version_hash, segment_group_id, segment, "idx");
return segment_group_file_path.str();
}
-string OLAPTable::construct_incremental_data_file_path(Version version, VersionHash version_hash,
+string Tablet::construct_incremental_data_file_path(Version version, VersionHash version_hash,
int32_t segment_group_id, int32_t segment) const {
string segment_group_dir_path = construct_incremental_delta_dir_path();
stringstream segment_group_file_path;
@@ -1961,10 +1961,10 @@ string OLAPTable::construct_incremental_data_file_path(Version version, VersionH
<< construct_file_name(version, version_hash, segment_group_id, segment, "dat");
return segment_group_file_path.str();
}
-string OLAPTable::construct_pending_data_dir_path() const {
+string Tablet::construct_pending_data_dir_path() const {
return _tablet_path + PENDING_DELTA_PREFIX;
}
-string OLAPTable::construct_pending_index_file_path(TTransactionId transaction_id,
+string Tablet::construct_pending_index_file_path(TTransactionId transaction_id,
int32_t segment_group_id, int32_t segment) const {
string dir_path = construct_pending_data_dir_path();
stringstream file_path;
@@ -1974,7 +1974,7 @@ string OLAPTable::construct_pending_index_file_path(TTransactionId transaction_i
return file_path.str();
}
-string OLAPTable::construct_pending_data_file_path(TTransactionId transaction_id,
+string Tablet::construct_pending_data_file_path(TTransactionId transaction_id,
int32_t segment_group_id, int32_t segment) const {
string dir_path = construct_pending_data_dir_path();
stringstream file_path;
@@ -1985,7 +1985,7 @@ string OLAPTable::construct_pending_data_file_path(TTransactionId transaction_id
return file_path.str();
}
-string OLAPTable::construct_file_name(const Version& version,
+string Tablet::construct_file_name(const Version& version,
VersionHash version_hash,
int32_t segment_group_id, int32_t segment,
const string& suffix) const {
@@ -2003,11 +2003,11 @@ string OLAPTable::construct_file_name(const Version& version,
return file_name;
}
-string OLAPTable::construct_dir_path() const {
+string Tablet::construct_dir_path() const {
return _tablet_path;
}
-int32_t OLAPTable::get_field_index(const string& field_name) const {
+int32_t Tablet::get_field_index(const string& field_name) const {
field_index_map_t::const_iterator res_iterator = _field_index_map.find(field_name);
if (res_iterator == _field_index_map.end()) {
LOG(WARNING) << "invalid field name. [name='" << field_name << "']";
@@ -2017,7 +2017,7 @@ int32_t OLAPTable::get_field_index(const string& field_name) const {
return res_iterator->second;
}
-size_t OLAPTable::get_field_size(const string& field_name) const {
+size_t Tablet::get_field_size(const string& field_name) const {
field_index_map_t::const_iterator res_iterator = _field_index_map.find(field_name);
if (res_iterator == _field_index_map.end()) {
LOG(WARNING) << "invalid field name. [name='" << field_name << "']";
@@ -2032,7 +2032,7 @@ size_t OLAPTable::get_field_size(const string& field_name) const {
return _field_sizes[res_iterator->second];
}
-size_t OLAPTable::get_return_column_size(const string& field_name) const {
+size_t Tablet::get_return_column_size(const string& field_name) const {
field_index_map_t::const_iterator res_iterator = _field_index_map.find(field_name);
if (res_iterator == _field_index_map.end()) {
LOG(WARNING) << "invalid field name. [name='" << field_name << "']";
@@ -2053,7 +2053,7 @@ size_t OLAPTable::get_return_column_size(const string& field_name) const {
}
-size_t OLAPTable::get_row_size() const {
+size_t Tablet::get_row_size() const {
size_t size = 0u;
vector<int32_t>::const_iterator it;
for (it = _field_sizes.begin(); it != _field_sizes.end(); ++it) {
@@ -2064,7 +2064,7 @@ size_t OLAPTable::get_row_size() const {
return size;
}
-int64_t OLAPTable::get_data_size() const {
+int64_t Tablet::get_data_size() const {
int64_t total_size = 0;
for (const PDelta& delta : _header->delta()) {
for (const PSegmentGroup& psegment_group : delta.segment_group()) {
@@ -2075,7 +2075,7 @@ int64_t OLAPTable::get_data_size() const {
return total_size;
}
-int64_t OLAPTable::get_num_rows() const {
+int64_t Tablet::get_num_rows() const {
int64_t num_rows = 0;
for (const PDelta& delta : _header->delta()) {
for (const PSegmentGroup& psegment_group : delta.segment_group()) {
@@ -2086,12 +2086,12 @@ int64_t OLAPTable::get_num_rows() const {
return num_rows;
}
-bool OLAPTable::is_load_delete_version(Version version) {
+bool Tablet::is_load_delete_version(Version version) {
version_olap_index_map_t::iterator it = _data_sources.find(version);
return it->second[0]->delete_flag();
}
-bool OLAPTable::is_schema_changing() {
+bool Tablet::is_schema_changing() {
bool is_schema_changing = false;
obtain_header_rdlock();
@@ -2103,10 +2103,10 @@ bool OLAPTable::is_schema_changing() {
return is_schema_changing;
}
-bool OLAPTable::get_schema_change_request(TTabletId* tablet_id,
+bool Tablet::get_schema_change_request(TTabletId* tablet_id,
SchemaHash* schema_hash,
vector<Version>* versions_to_changed,
- AlterTabletType* alter_table_type) const {
+ AlterTabletType* alter_tablet_type) const {
if (!_header->has_schema_change_status()) {
return false;
}
@@ -2115,7 +2115,7 @@ bool OLAPTable::get_schema_change_request(TTabletId* tablet_id,
(tablet_id == NULL || (*tablet_id = schema_change_status.related_tablet_id()));
(schema_hash == NULL || (*schema_hash = schema_change_status.related_schema_hash()));
- (alter_table_type == NULL || (*alter_table_type =
+ (alter_tablet_type == NULL || (*alter_tablet_type =
static_cast<AlterTabletType>(schema_change_status.schema_change_type())));
if (versions_to_changed != NULL) {
@@ -2130,10 +2130,10 @@ bool OLAPTable::get_schema_change_request(TTabletId* tablet_id,
return true;
}
-void OLAPTable::set_schema_change_request(TTabletId tablet_id,
+void Tablet::set_schema_change_request(TTabletId tablet_id,
TSchemaHash schema_hash,
const vector<Version>& versions_to_changed,
- const AlterTabletType alter_table_type) {
+ const AlterTabletType alter_tablet_type) {
clear_schema_change_request();
SchemaChangeStatusMessage* schema_change_status = _header->mutable_schema_change_status();
@@ -2152,10 +2152,10 @@ void OLAPTable::set_schema_change_request(TTabletId tablet_id,
//version->set_num_segments(0);
}
- schema_change_status->set_schema_change_type(alter_table_type);
+ schema_change_status->set_schema_change_type(alter_tablet_type);
}
-bool OLAPTable::remove_last_schema_change_version(TabletSharedPtr new_olap_table) {
+bool Tablet::remove_last_schema_change_version(TabletSharedPtr new_tablet) {
if (!_header->has_schema_change_status()) {
return false;
}
@@ -2173,23 +2173,23 @@ bool OLAPTable::remove_last_schema_change_version(TabletSharedPtr new_olap_table
return true;
}
-void OLAPTable::clear_schema_change_request() {
+void Tablet::clear_schema_change_request() {
LOG(INFO) << "clear schema change status. [tablet='" << _full_name << "']";
_header->clear_schema_change_status();
}
-void OLAPTable::set_io_error() {
+void Tablet::set_io_error() {
OLAP_LOG_WARNING("io error occur.[tablet_full_name='%s', root_path_name='%s']",
_full_name.c_str(),
_storage_root_path.c_str());
OLAPEngine::get_instance()->set_store_used_flag(_storage_root_path, false);
}
-bool OLAPTable::is_used() {
+bool Tablet::is_used() {
return _store->is_used();
}
-VersionEntity OLAPTable::get_version_entity_by_version(const Version& version) {
+VersionEntity Tablet::get_version_entity_by_version(const Version& version) {
std::vector<SegmentGroup*>& index_vec = _data_sources[version];
VersionEntity version_entity(version, index_vec[0]->version_hash());
for (SegmentGroup* segment_group : index_vec) {
@@ -2205,7 +2205,7 @@ VersionEntity OLAPTable::get_version_entity_by_version(const Version& version) {
return version_entity;
}
-size_t OLAPTable::get_version_index_size(const Version& version) {
+size_t Tablet::get_version_index_size(const Version& version) {
std::vector<SegmentGroup*>& index_vec = _data_sources[version];
size_t index_size = 0;
for (SegmentGroup* segment_group : index_vec) {
@@ -2214,7 +2214,7 @@ size_t OLAPTable::get_version_index_size(const Version& version) {
return index_size;
}
-size_t OLAPTable::get_version_data_size(const Version& version) {
+size_t Tablet::get_version_data_size(const Version& version) {
std::vector<SegmentGroup*>& index_vec = _data_sources[version];
size_t data_size = 0;
for (SegmentGroup* segment_group : index_vec) {
@@ -2223,7 +2223,7 @@ size_t OLAPTable::get_version_data_size(const Version& version) {
return data_size;
}
-OLAPStatus OLAPTable::recover_tablet_until_specfic_version(
+OLAPStatus Tablet::recover_tablet_until_specfic_version(
const int64_t& until_version, const int64_t& version_hash) {
std::vector<Version> missing_versions;
{
@@ -2236,7 +2236,7 @@ OLAPStatus OLAPTable::recover_tablet_until_specfic_version(
for (Version& missing_version : missing_versions) {
SegmentGroup* segment_group = new SegmentGroup(this, missing_version, version_hash, false, 0, 0);
segment_group->set_empty(true);
- ColumnDataWriter* writer = ColumnDataWriter::create(std::shared_ptr<OLAPTable>(this), segment_group, true);
+ ColumnDataWriter* writer = ColumnDataWriter::create(std::shared_ptr<Tablet>(this), segment_group, true);
if (res != OLAP_SUCCESS) { break; }
res = writer->finalize();
@@ -2263,7 +2263,7 @@ OLAPStatus OLAPTable::recover_tablet_until_specfic_version(
return OLAP_SUCCESS;
}
-OLAPStatus OLAPTable::test_version(const Version& version) {
+OLAPStatus Tablet::test_version(const Version& version) {
vector<Version> span_versions;
obtain_header_rdlock();
OLAPStatus res = _header->select_versions_to_span(version, &span_versions);
diff --git a/be/src/olap/olap_table.h b/be/src/olap/tablet.h
similarity index 94%
rename from be/src/olap/olap_table.h
rename to be/src/olap/tablet.h
index 1e7bc9df..f47be1fc 100644
--- a/be/src/olap/olap_table.h
+++ b/be/src/olap/tablet.h
@@ -39,12 +39,12 @@ class FieldInfo;
class ColumnData;
class OLAPHeader;
class SegmentGroup;
-class OLAPTable;
+class Tablet;
class RowBlockPosition;
class OlapStore;
-// Define OLAPTable's shared_ptr. It is used for
-typedef std::shared_ptr<OLAPTable> TabletSharedPtr;
+// Define Tablet's shared_ptr. It is used for
+typedef std::shared_ptr<Tablet> TabletSharedPtr;
enum BaseCompactionStage {
BASE_COMPACTION_WAITING = 0,
@@ -92,7 +92,7 @@ struct SchemaChangeStatus {
int32_t version;
};
-class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
+class Tablet : public std::enable_shared_from_this<Tablet> {
public:
static TabletSharedPtr create_from_header_file(
TTabletId tablet_id,
@@ -108,12 +108,12 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
OLAPHeader* header,
OlapStore* store = nullptr);
- explicit OLAPTable(OLAPHeader* header, OlapStore* store);
- explicit OLAPTable(OLAPHeader* header);
+ explicit Tablet(OLAPHeader* header, OlapStore* store);
+ explicit Tablet(OLAPHeader* header);
- virtual ~OLAPTable();
+ virtual ~Tablet();
- // Initializes table and loads indices for all versions.
+ // Initializes tablet and loads indices for all versions.
// Returns OLAP_SUCCESS on success.
OLAPStatus load();
@@ -226,7 +226,7 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
// used for restore, merge the (0, to_version) in 'hdr'
OLAPStatus merge_header(const OLAPHeader& hdr, int to_version);
- // Used by monitoring OLAPTable
+ // Used by monitoring Tablet
void list_data_files(std::set<std::string>* filenames) const;
void list_index_files(std::set<std::string>* filenames) const;
@@ -238,14 +238,14 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
// Return version list and their corresponding version hashes
void list_version_entities(std::vector<VersionEntity>* version_entities) const;
- // mark this table to be dropped, all files will be deleted when
- // ~OLAPTable()
+ // mark this tablet to be dropped, all files will be deleted when
+ // ~Tablet()
void mark_dropped() {
_is_dropped = true;
}
- // Delete all files for this table (.hdr, *.dat, *.idx). This should only
- // be called if no one is accessing the table.
+ // Delete all files for this tablet (.hdr, *.dat, *.idx). This should only
+ // be called if no one is accessing the tablet.
void delete_all_files();
// Methods to obtain and release locks.
@@ -301,9 +301,9 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
// Construct index file path according version, version_hash and segment
// We construct file path through header file name. header file name likes:
- // tables_root_path/db/table/index/table_index_schemaversion.hdr
+ // tables_root_path/db/tablet/index/table_index_schemaversion.hdr
// Index file path is:
- // tables_root_path/db/table/index
+ // tables_root_path/db/tablet/index
// /table_index_schemaversion_start_end_versionhash_segment.idx
// The typical index file path is:
// /home/work/olap/storage/data/db2/DailyWinfoIdeaStats/PRIMARY/
@@ -353,18 +353,18 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
size_t get_return_column_size(const std::string& field_name) const;
- // One row in a specified OLAPTable comprises of fixed number of columns
+ // One row in a specified Tablet comprises of fixed number of columns
// with fixed length.
size_t get_row_size() const;
- // Get olap table statistics for SHOW STATUS
+ // Get tablet statistics for SHOW STATUS
size_t get_index_size() const;
int64_t get_data_size() const;
int64_t get_num_rows() const;
- // Returns fully qualified name for this OLAP table.
+ // Returns fully qualified name for this OLAP tablet.
// eg. db4.DailyUnitStats.PRIMARY
const std::string& full_name() const {
return _full_name;
@@ -565,20 +565,20 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
_header->set_cumulative_layer_point(new_point);
}
- // Judge whether olap table in schema change state
+ // Judge whether tablet in schema change state
bool is_schema_changing();
bool get_schema_change_request(TTabletId* tablet_id,
SchemaHash* schema_hash,
std::vector<Version>* versions_to_changed,
- AlterTabletType* alter_table_type) const;
+ AlterTabletType* alter_tablet_type) const;
void set_schema_change_request(TTabletId tablet_id,
TSchemaHash schema_hash,
const std::vector<Version>& versions_to_changed,
- const AlterTabletType alter_table_type);
+ const AlterTabletType alter_tablet_type);
- bool remove_last_schema_change_version(TabletSharedPtr new_olap_table);
+ bool remove_last_schema_change_version(TabletSharedPtr new_tablet);
void clear_schema_change_request();
SchemaChangeStatus schema_change_status() {
@@ -710,11 +710,11 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
OLAPHeader* _header;
size_t _num_rows_per_row_block;
CompressKind _compress_kind;
- // Set it true when table is dropped, table files and data structures
- // can be used and not deleted until table is destructed.
+ // Set it true when tablet is dropped, tablet files and data structures
+ // can be used and not deleted until tablet is destructed.
bool _is_dropped;
std::string _full_name;
- std::vector<FieldInfo> _tablet_schema; // field info vector is table schema.
+ std::vector<FieldInfo> _tablet_schema; // field info vector is tablet schema.
// Version mapping to SegmentGroup.
// data source can be base delta, cumulative delta, singleton delta.
@@ -744,9 +744,9 @@ class OLAPTable : public std::enable_shared_from_this<OLAPTable> {
Mutex _load_lock;
std::string _tablet_path;
- bool _table_for_check;
+ bool _tablet_for_check;
- DISALLOW_COPY_AND_ASSIGN(OLAPTable);
+ DISALLOW_COPY_AND_ASSIGN(Tablet);
};
} // namespace doris
diff --git a/be/src/runtime/snapshot_loader.cpp b/be/src/runtime/snapshot_loader.cpp
index 1e5ce262..9b7f2f6b 100644
--- a/be/src/runtime/snapshot_loader.cpp
+++ b/be/src/runtime/snapshot_loader.cpp
@@ -27,7 +27,7 @@
#include "exec/broker_writer.h"
#include "olap/file_helper.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "runtime/exec_env.h"
#include "runtime/broker_mgr.h"
#include "util/file_utils.h"
@@ -556,7 +556,7 @@ Status SnapshotLoader::move(
// than we merge the 2 .hdr file before reloading it.
// load header in tablet dir to get the base vesion
- TabletSharedPtr tablet = OLAPEngine::get_instance()->get_table(
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(
tablet_id, schema_hash);
if (tablet.get() == NULL) {
std::stringstream ss;
diff --git a/be/src/runtime/tablet_writer_mgr.cpp b/be/src/runtime/tablet_writer_mgr.cpp
index de678561..6b96ce8f 100644
--- a/be/src/runtime/tablet_writer_mgr.cpp
+++ b/be/src/runtime/tablet_writer_mgr.cpp
@@ -22,7 +22,7 @@
#include <utility>
#include "common/object_pool.h"
-#include "exec/olap_table_info.h"
+#include "exec/tablet_info.h"
#include "runtime/descriptors.h"
#include "runtime/mem_tracker.h"
#include "runtime/row_batch.h"
diff --git a/be/test/agent/agent_server_test.cpp b/be/test/agent/agent_server_test.cpp
index 7f29f6aa..b10463d0 100644
--- a/be/test/agent/agent_server_test.cpp
+++ b/be/test/agent/agent_server_test.cpp
@@ -58,21 +58,21 @@ TEST(SubmitTasksTest, TestSubmitTasks){
// Master info inited, submit task
tasks.clear();
- TAgentTaskRequest create_table_task;
+ TAgentTaskRequest create_tablet_task;
TCreateTabletReq create_tablet_req;
- create_table_task.task_type = TTaskType::CREATE;
- create_table_task.__set_create_tablet_req(create_tablet_req);
- tasks.push_back(create_table_task);
- TAgentTaskRequest drop_table_task;
+ create_tablet_task.task_type = TTaskType::CREATE;
+ create_tablet_task.__set_create_tablet_req(create_tablet_req);
+ tasks.push_back(create_tablet_task);
+ TAgentTaskRequest drop_tablet_task;
TDropTabletReq drop_tablet_req;
- drop_table_task.task_type = TTaskType::DROP;
- drop_table_task.__set_drop_tablet_req(drop_tablet_req);
- tasks.push_back(drop_table_task);
- TAgentTaskRequest alter_table_task;
+ drop_tablet_task.task_type = TTaskType::DROP;
+ drop_tablet_task.__set_drop_tablet_req(drop_tablet_req);
+ tasks.push_back(drop_tablet_task);
+ TAgentTaskRequest alter_tablet_task;
TAlterTabletReq alter_tablet_req;
- alter_table_task.task_type = TTaskType::ROLLUP;
- alter_table_task.__set_alter_tablet_req(alter_tablet_req);
- tasks.push_back(alter_table_task);
+ alter_tablet_task.task_type = TTaskType::ROLLUP;
+ alter_tablet_task.__set_alter_tablet_req(alter_tablet_req);
+ tasks.push_back(alter_tablet_task);
TAgentTaskRequest clone_task;
TCloneReq clone_req;
clone_task.task_type = TTaskType::CLONE;
diff --git a/be/test/agent/pusher_test.cpp b/be/test/agent/pusher_test.cpp
index 96aa5f9b..68700ac5 100644
--- a/be/test/agent/pusher_test.cpp
+++ b/be/test/agent/pusher_test.cpp
@@ -25,7 +25,7 @@
#include "agent/pusher.h"
#include "olap/mock_command_executor.h"
#include "olap/olap_define.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "util/logging.h"
using ::testing::_;
@@ -51,19 +51,19 @@ TEST(PusherTest, TestInit) {
tmp = pusher._engine;
pusher._engine = &mock_command_executor;
- OLAPTable* olap_table = NULL;
- // not init, can not get olap table
- EXPECT_CALL(mock_command_executor, get_table(1, 12345))
+ Tablet* tablet = NULL;
+ // not init, can not get tablet
+ EXPECT_CALL(mock_command_executor, get_tablet(1, 12345))
.Times(1)
- .WillOnce(Return(std::shared_ptr<OLAPTable>(olap_table)));
+ .WillOnce(Return(std::shared_ptr<Tablet>(tablet)));
AgentStatus ret = pusher.init();
EXPECT_EQ(DORIS_PUSH_INVALID_TABLE, ret);
- // not init, can get olap table, and empty remote path
- olap_table = new OLAPTable(new OLAPHeader("./test_data/header"), nullptr);
- EXPECT_CALL(mock_command_executor, get_table(1, 12345))
+ // not init, can get tablet, and empty remote path
+ tablet = new Tablet(new OLAPHeader("./test_data/header"), nullptr);
+ EXPECT_CALL(mock_command_executor, get_tablet(1, 12345))
.Times(1)
- .WillOnce(Return(std::shared_ptr<OLAPTable>(olap_table)));
+ .WillOnce(Return(std::shared_ptr<Tablet>(tablet)));
ret = pusher.init();
EXPECT_EQ(DORIS_SUCCESS, ret);
EXPECT_TRUE(pusher._is_init);
@@ -76,15 +76,15 @@ TEST(PusherTest, TestInit) {
// not inited, remote path not empty
string http_file_path = "http://xx";
string root_path_name = "./test_data/data";
- olap_table = new OLAPTable(new OLAPHeader("./test_data/header"), nullptr);
+ tablet = new Tablet(new OLAPHeader("./test_data/header"), nullptr);
push_req.__set_http_file_path(http_file_path);
Pusher pusher2(nullptr, push_req);
tmp = pusher2._engine;
pusher2._engine = &mock_command_executor;
- olap_table->_storage_root_path = root_path_name;
- EXPECT_CALL(mock_command_executor, get_table(1, 12345))
+ tablet->_storage_root_path = root_path_name;
+ EXPECT_CALL(mock_command_executor, get_tablet(1, 12345))
.Times(1)
- .WillOnce(Return(std::shared_ptr<OLAPTable>(olap_table)));
+ .WillOnce(Return(std::shared_ptr<Tablet>(tablet)));
ret = pusher2.init();
EXPECT_EQ(DORIS_SUCCESS, ret);
EXPECT_TRUE(pusher2._is_init);
diff --git a/be/test/agent/task_worker_pool_test.cpp b/be/test/agent/task_worker_pool_test.cpp
index b1f276e7..b61f9baf 100644
--- a/be/test/agent/task_worker_pool_test.cpp
+++ b/be/test/agent/task_worker_pool_test.cpp
@@ -59,19 +59,19 @@ MockMasterServerClient::MockMasterServerClient(
TEST(TaskWorkerPoolTest, TestStart) {
TMasterInfo master_info;
ExecEnv env;
- TaskWorkerPool task_worker_pool_create_table(
+ TaskWorkerPool task_worker_pool_create_tablet(
TaskWorkerPool::TaskWorkerType::CREATE_TABLE,
&env,
master_info);
- task_worker_pool_create_table.start();
- EXPECT_EQ(task_worker_pool_create_table._worker_count, config::create_table_worker_count);
+ task_worker_pool_create_tablet.start();
+ EXPECT_EQ(task_worker_pool_create_tablet._worker_count, config::create_tablet_worker_count);
- TaskWorkerPool task_worker_pool_drop_table(
+ TaskWorkerPool task_worker_pool_drop_tablet(
TaskWorkerPool::TaskWorkerType::DROP_TABLE,
&env,
master_info);
- task_worker_pool_drop_table.start();
- EXPECT_EQ(task_worker_pool_create_table._worker_count, config::drop_table_worker_count);
+ task_worker_pool_drop_tablet.start();
+ EXPECT_EQ(task_worker_pool_create_tablet._worker_count, config::drop_tablet_worker_count);
TaskWorkerPool task_worker_pool_push(
TaskWorkerPool::TaskWorkerType::PUSH,
@@ -88,12 +88,12 @@ TEST(TaskWorkerPoolTest, TestStart) {
task_worker_pool_publish_version.start();
EXPECT_EQ(task_worker_pool_publish_version._worker_count, config::publish_version_worker_count);
- TaskWorkerPool task_worker_pool_alter_table(
+ TaskWorkerPool task_worker_pool_alter_tablet(
TaskWorkerPool::TaskWorkerType::ALTER_TABLE,
&env,
master_info);
- task_worker_pool_alter_table.start();
- EXPECT_EQ(task_worker_pool_alter_table._worker_count, config::alter_table_worker_count);
+ task_worker_pool_alter_tablet.start();
+ EXPECT_EQ(task_worker_pool_alter_tablet._worker_count, config::alter_tablet_worker_count);
TaskWorkerPool task_worker_pool_clone(
TaskWorkerPool::TaskWorkerType::CLONE,
@@ -125,12 +125,12 @@ TEST(TaskWorkerPoolTest, TestStart) {
task_worker_pool_report_disk_state.start();
EXPECT_EQ(task_worker_pool_report_disk_state._worker_count, REPORT_DISK_STATE_WORKER_COUNT);
- TaskWorkerPool task_worker_pool_report_olap_table(
+ TaskWorkerPool task_worker_pool_report_tablet(
TaskWorkerPool::TaskWorkerType::REPORT_OLAP_TABLE,
&env,
master_info);
- task_worker_pool_report_olap_table.start();
- EXPECT_EQ(task_worker_pool_report_olap_table._worker_count, REPORT_OLAP_TABLE_WORKER_COUNT);
+ task_worker_pool_report_tablet.start();
+ EXPECT_EQ(task_worker_pool_report_tablet._worker_count, REPORT_OLAP_TABLE_WORKER_COUNT);
TaskWorkerPool task_worker_pool_upload(
TaskWorkerPool::TaskWorkerType::UPLOAD,
@@ -411,7 +411,7 @@ TEST(TaskWorkerPoolTest, TestCreateTable) {
task_worker_pool._master_client = &mock_master_server_client;
// Create table failed
- EXPECT_CALL(mock_command_executor, create_table(_))
+ EXPECT_CALL(mock_command_executor, create_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_ERR_OTHER_ERROR));
EXPECT_CALL(mock_master_server_client, finish_task(_, _))
@@ -421,12 +421,12 @@ TEST(TaskWorkerPoolTest, TestCreateTable) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._create_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._create_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
// Create table success
- EXPECT_CALL(mock_command_executor, create_table(_))
+ EXPECT_CALL(mock_command_executor, create_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_SUCCESS));
EXPECT_CALL(mock_master_server_client, finish_task(_, _))
@@ -436,7 +436,7 @@ TEST(TaskWorkerPoolTest, TestCreateTable) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._create_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._create_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
@@ -467,7 +467,7 @@ TEST(TaskWorkerPoolTest, TestDropTableTask) {
task_worker_pool._master_client = &mock_master_server_client;
// Drop table failed
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_ERR_OTHER_ERROR));
EXPECT_CALL(mock_master_server_client, finish_task(_, _))
@@ -477,12 +477,12 @@ TEST(TaskWorkerPoolTest, TestDropTableTask) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._drop_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._drop_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
// Drop table success
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_SUCCESS));
EXPECT_CALL(mock_master_server_client, finish_task(_, _))
@@ -492,7 +492,7 @@ TEST(TaskWorkerPoolTest, TestDropTableTask) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._drop_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._drop_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
@@ -528,12 +528,12 @@ TEST(TaskWorkerPoolTest, TestSchemaChange) {
agent_task_request.alter_tablet_req.base_schema_hash = 56789;
agent_task_request.alter_tablet_req.__set_new_tablet_req(create_tablet_req1);
- EXPECT_CALL(mock_command_executor, show_alter_table_status(
+ EXPECT_CALL(mock_command_executor, show_alter_tablet_status(
agent_task_request.alter_tablet_req.base_tablet_id,
agent_task_request.alter_tablet_req.base_schema_hash))
.Times(1)
.WillOnce(Return(ALTER_TABLE_FAILED));
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_ERR_OTHER_ERROR));
EXPECT_CALL(mock_command_executor, schema_change(_))
@@ -545,19 +545,19 @@ TEST(TaskWorkerPoolTest, TestSchemaChange) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._alter_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._alter_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
// New tablet size ok, last schema change status is failed
// Delete failed alter table tablet file success
// Do schema change failed
- EXPECT_CALL(mock_command_executor, show_alter_table_status(
+ EXPECT_CALL(mock_command_executor, show_alter_tablet_status(
agent_task_request.alter_tablet_req.base_tablet_id,
agent_task_request.alter_tablet_req.base_schema_hash))
.Times(1)
.WillOnce(Return(ALTER_TABLE_FAILED));
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_SUCCESS));
EXPECT_CALL(mock_command_executor, schema_change(_))
@@ -570,19 +570,19 @@ TEST(TaskWorkerPoolTest, TestSchemaChange) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._alter_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._alter_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
// New tablet size ok, last schema change status is failed
// Delete failed alter table tablet file success
// Do schema change success, check status failed
- EXPECT_CALL(mock_command_executor, show_alter_table_status(
+ EXPECT_CALL(mock_command_executor, show_alter_tablet_status(
agent_task_request.alter_tablet_req.base_tablet_id,
agent_task_request.alter_tablet_req.base_schema_hash))
.Times(1)
.WillOnce(Return(ALTER_TABLE_FAILED));
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_SUCCESS));
EXPECT_CALL(mock_command_executor, schema_change(_))
@@ -598,18 +598,18 @@ TEST(TaskWorkerPoolTest, TestSchemaChange) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._alter_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._alter_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
// New tablet size ok, last schema change status is ok
// Do schema change success, check status running then success
- EXPECT_CALL(mock_command_executor, show_alter_table_status(
+ EXPECT_CALL(mock_command_executor, show_alter_tablet_status(
agent_task_request.alter_tablet_req.base_tablet_id,
agent_task_request.alter_tablet_req.base_schema_hash))
.Times(1)
.WillOnce(Return(ALTER_TABLE_FINISHED));
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(0);
EXPECT_CALL(mock_command_executor, schema_change(_))
.Times(1)
@@ -624,7 +624,7 @@ TEST(TaskWorkerPoolTest, TestSchemaChange) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._alter_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._alter_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
@@ -659,14 +659,14 @@ TEST(TaskWorkerPoolTest, TestRollup) {
agent_task_request.alter_tablet_req.base_tablet_id = 12345;
agent_task_request.alter_tablet_req.base_schema_hash = 56789;
agent_task_request.alter_tablet_req.__set_new_tablet_req(create_tablet_req1);
- EXPECT_CALL(mock_command_executor, show_alter_table_status(
+ EXPECT_CALL(mock_command_executor, show_alter_tablet_status(
agent_task_request.alter_tablet_req.base_tablet_id,
agent_task_request.alter_tablet_req.base_schema_hash))
.Times(1)
.WillOnce(Return(ALTER_TABLE_FINISHED));
- EXPECT_CALL(mock_command_executor, drop_table(_))
+ EXPECT_CALL(mock_command_executor, drop_tablet(_))
.Times(0);
- EXPECT_CALL(mock_command_executor, create_rollup_table(_))
+ EXPECT_CALL(mock_command_executor, create_rollup_tablet(_))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_SUCCESS));
EXPECT_CALL(mock_command_executor, report_tablet_info(_))
@@ -679,7 +679,7 @@ TEST(TaskWorkerPoolTest, TestRollup) {
task_worker_pool.submit_task(agent_task_request);
EXPECT_EQ(1, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(1, task_worker_pool._tasks.size());
- task_worker_pool._alter_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._alter_tablet_worker_thread_callback(&task_worker_pool);
EXPECT_EQ(0, task_worker_pool._s_task_signatures[agent_task_request.task_type].size());
EXPECT_EQ(0, task_worker_pool._tasks.size());
@@ -920,12 +920,12 @@ TEST(TaskWorkerPoolTest, TestClone) {
std::vector<int64_t> missing_versions;
snapshot_request2.__set_missing_version(missing_versions);
- std::shared_ptr<OLAPTable> olap_table_ok(new OLAPTable(NULL, nullptr));
- EXPECT_CALL(mock_command_executor, get_table(
+ std::shared_ptr<Tablet> tablet_ok(new Tablet(NULL, nullptr));
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_ok));
+ .WillOnce(Return(tablet_ok));
EXPECT_CALL(mock_command_executor, get_info_before_incremental_clone(_, _, _))
.Times(1);
EXPECT_CALL(mock_agent_server_client, make_snapshot(snapshot_request2, _))
@@ -958,11 +958,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
agent_result2.__set_snapshot_path("path");
agent_result2.status.status_code = TStatusCode::OK;
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_ok));
+ .WillOnce(Return(tablet_ok));
EXPECT_CALL(mock_command_executor, get_info_before_incremental_clone(_, _, _))
.Times(1)
.WillOnce(Return("./test_data/5/6"));
@@ -1002,11 +1002,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// Tablet has exist
// incremental clone success
// get tablet info failed
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_ok));
+ .WillOnce(Return(tablet_ok));
EXPECT_CALL(mock_command_executor, get_info_before_incremental_clone(_, _, _))
.Times(1)
.WillOnce(Return("./test_data/5/6"));
@@ -1047,11 +1047,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// incremental clone's make snapshot failed
// full clone's make snapshot success
// full clone failed
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_ok));
+ .WillOnce(Return(tablet_ok));
EXPECT_CALL(mock_command_executor, get_info_before_incremental_clone(_, _, _))
.Times(1)
.WillOnce(Return("./test_data/5/6"));
@@ -1094,11 +1094,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// incremental clone's make snapshot failed
// full clone's make snapshot success
// full clone success
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_ok));
+ .WillOnce(Return(tablet_ok));
EXPECT_CALL(mock_command_executor, get_info_before_incremental_clone(_, _, _))
.Times(1)
.WillOnce(Return("./test_data/5/6"));
@@ -1138,12 +1138,12 @@ TEST(TaskWorkerPoolTest, TestClone) {
EXPECT_EQ(0, task_worker_pool._tasks.size());
// Tablet not exist, obtain root path failed, do not get tablet info
- std::shared_ptr<OLAPTable> olap_table_null(NULL);
- EXPECT_CALL(mock_command_executor, get_table(
+ std::shared_ptr<Tablet> tablet_null(NULL);
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_ERR_OTHER_ERROR));
@@ -1162,11 +1162,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// Tablet not exist, obtain root path success, make snapshot failed
agent_result2.__isset.snapshot_path = false;
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(Return(OLAPStatus::OLAP_SUCCESS));
@@ -1196,11 +1196,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
clone_req.schema_hash = 6;
agent_task_request.__set_clone_req(clone_req);
agent_result2.__set_snapshot_path("path");
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1232,11 +1232,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// Tablet not exist, obtain root path success, make snapshot success
// List remote dir success, get remote file length failed
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1273,11 +1273,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// Tablet not exist, obtain root path success, make snapshot success
// List remote dir success, get remote file length success
// Download file failed
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1317,11 +1317,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// Tablet not exist, obtain root path success, make snapshot success
// List remote dir success, get remote file length success
// Download file success, but file size is wrong
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1362,11 +1362,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// Tablet not exist, obtain root path success, make snapshot success
// List remote dir success, get remote file length success
// Download file success, load header failed
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1411,11 +1411,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// List remote dir success, get remote file length success
// Download file success, load header success
// Release snapshot failed, get tablet info failed
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1461,11 +1461,11 @@ TEST(TaskWorkerPoolTest, TestClone) {
// List remote dir success, get remote file length success
// Download file success, load header success
// Release snapshot success, get tablet info success
- EXPECT_CALL(mock_command_executor, get_table(
+ EXPECT_CALL(mock_command_executor, get_tablet(
agent_task_request.clone_req.tablet_id,
agent_task_request.clone_req.schema_hash))
.Times(1)
- .WillOnce(Return(olap_table_null));
+ .WillOnce(Return(tablet_null));
EXPECT_CALL(mock_command_executor, obtain_shard_path(_, _))
.Times(1)
.WillOnce(
@@ -1683,7 +1683,7 @@ TEST(TaskWorkerPoolTest, TestReportOlapTable) {
.WillOnce(Return(OLAPStatus::OLAP_ERR_OTHER_ERROR));
EXPECT_CALL(mock_master_server_client, report(_, _))
.Times(0);
- task_worker_pool._report_olap_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._report_tablet_worker_thread_callback(&task_worker_pool);
// Get tablet info success, report failed
EXPECT_CALL(mock_command_executor, report_all_tablets_info(_))
@@ -1692,7 +1692,7 @@ TEST(TaskWorkerPoolTest, TestReportOlapTable) {
EXPECT_CALL(mock_master_server_client, report(_, _))
.Times(1)
.WillOnce(Return(DORIS_ERROR));
- task_worker_pool._report_olap_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._report_tablet_worker_thread_callback(&task_worker_pool);
// Get tablet info success, report success
EXPECT_CALL(mock_command_executor, report_all_tablets_info(_))
@@ -1701,7 +1701,7 @@ TEST(TaskWorkerPoolTest, TestReportOlapTable) {
EXPECT_CALL(mock_master_server_client, report(_, _))
.Times(1)
.WillOnce(Return(DORIS_SUCCESS));
- task_worker_pool._report_olap_table_worker_thread_callback(&task_worker_pool);
+ task_worker_pool._report_tablet_worker_thread_callback(&task_worker_pool);
task_worker_pool._command_executor = original_command_executor;
task_worker_pool._master_client = original_master_server_client;
@@ -1859,10 +1859,10 @@ TEST(TaskWorkerPoolTest, TestDropTable) {
TTabletId tablet_id = 123;
TSchemaHash schema_hash = 456;
- EXPECT_CALL(mock_command_executor, show_alter_table_status(tablet_id, schema_hash))
+ EXPECT_CALL(mock_command_executor, show_alter_tablet_status(tablet_id, schema_hash))
.Times(1)
.WillOnce(Return(ALTER_TABLE_RUNNING));
- AlterTableStatus status = task_worker_pool._show_alter_table_status(tablet_id, schema_hash);
+ AlterTableStatus status = task_worker_pool._show_alter_tablet_status(tablet_id, schema_hash);
EXPECT_EQ(ALTER_TABLE_RUNNING, status);
task_worker_pool._command_executor = original_command_executor;
diff --git a/be/test/exec/CMakeLists.txt b/be/test/exec/CMakeLists.txt
index 6d7dbe6c..00562f07 100644
--- a/be/test/exec/CMakeLists.txt
+++ b/be/test/exec/CMakeLists.txt
@@ -43,8 +43,8 @@ ADD_BE_TEST(plain_text_line_reader_lzop_test)
ADD_BE_TEST(broker_reader_test)
ADD_BE_TEST(broker_scanner_test)
ADD_BE_TEST(broker_scan_node_test)
-ADD_BE_TEST(olap_table_info_test)
-ADD_BE_TEST(olap_table_sink_test)
+ADD_BE_TEST(tablet_info_test)
+ADD_BE_TEST(tablet_sink_test)
#ADD_BE_TEST(schema_scan_node_test)
#ADD_BE_TEST(schema_scanner_test)
##ADD_BE_TEST(set_executor_test)
diff --git a/be/test/exec/new_olap_scan_node_test.cpp b/be/test/exec/new_olap_scan_node_test.cpp
index 03fe6bdf..17f60ec5 100644
--- a/be/test/exec/new_olap_scan_node_test.cpp
+++ b/be/test/exec/new_olap_scan_node_test.cpp
@@ -78,12 +78,12 @@ class TestOlapScanNode : public testing::Test {
_olap_header = new
OLAPHeader("./testrun/case3/clickuserid_online_userid_type_planid_unitid_winfoid.hdr");
_olap_header->load();
- _olap_table = new OLAPTable(_olap_header);
- _olap_table->load_indices();
- _olap_table->_root_path_name = "./testrun/case3";
+ tablet = new Tablet(_olap_header);
+ tablet->load_indices();
+ tablet->_root_path_name = "./testrun/case3";
TableDescription description("fc", "clickuserid_online", "userid_type_planid_unitid_winfoid");
- OLAPEngine::get_instance()->add_table(description, _olap_table);
+ OLAPEngine::get_instance()->add_table(description, tablet);
// init session manager
SessionManager::get_instance()->init();
@@ -273,7 +273,7 @@ class TestOlapScanNode : public testing::Test {
private:
OLAPHeader* _olap_header;
- OLAPTable* _olap_table;
+ Tablet* tablet;
TPlanNode _tnode;
ObjectPool _obj_pool;
diff --git a/be/test/exec/olap_table_info_test.cpp b/be/test/exec/tablet_info_test.cpp
similarity index 99%
rename from be/test/exec/olap_table_info_test.cpp
rename to be/test/exec/tablet_info_test.cpp
index 5360e466..3c60e1d5 100644
--- a/be/test/exec/olap_table_info_test.cpp
+++ b/be/test/exec/tablet_info_test.cpp
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include "exec/olap_table_info.h"
+#include "exec/tablet_info.h"
#include <gtest/gtest.h>
diff --git a/be/test/exec/olap_table_sink_test.cpp b/be/test/exec/tablet_sink_test.cpp
similarity index 99%
rename from be/test/exec/olap_table_sink_test.cpp
rename to be/test/exec/tablet_sink_test.cpp
index 8f4bbab9..641760c2 100644
--- a/be/test/exec/olap_table_sink_test.cpp
+++ b/be/test/exec/tablet_sink_test.cpp
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include "exec/olap_table_sink.h"
+#include "exec/tablet_sink.h"
#include <gtest/gtest.h>
diff --git a/be/test/olap/column_reader_test.cpp b/be/test/olap/column_reader_test.cpp
index fb99929c..6ff2f4c6 100644
--- a/be/test/olap/column_reader_test.cpp
+++ b/be/test/olap/column_reader_test.cpp
@@ -2216,7 +2216,7 @@ TEST_F(TestColumn, SeekDecimalColumnWithPresent) {
}
TEST_F(TestColumn, VectorizedLargeIntColumnWithoutPresent) {
- // init table schema
+ // init tablet schema
std::vector<FieldInfo> tablet_schema;
FieldInfo field_info;
SetFieldInfo(field_info,
@@ -2280,7 +2280,7 @@ TEST_F(TestColumn, VectorizedLargeIntColumnWithoutPresent) {
}
TEST_F(TestColumn, VectorizedLargeIntColumnWithPresent) {
- // init table schema
+ // init tablet schema
std::vector<FieldInfo> tablet_schema;
FieldInfo field_info;
SetFieldInfo(field_info,
@@ -2359,7 +2359,7 @@ TEST_F(TestColumn, VectorizedLargeIntColumnWithPresent) {
}
TEST_F(TestColumn, SkipLargeIntColumnWithPresent) {
- // init table schema
+ // init tablet schema
std::vector<FieldInfo> tablet_schema;
FieldInfo field_info;
SetFieldInfo(field_info,
diff --git a/be/test/olap/delete_handler_test.cpp b/be/test/olap/delete_handler_test.cpp
index 4c2d3171..74a570a8 100644
--- a/be/test/olap/delete_handler_test.cpp
+++ b/be/test/olap/delete_handler_test.cpp
@@ -174,12 +174,12 @@ class TestDeleteConditionHandler : public testing::Test {
// create base tablet
OLAPStatus res = OLAP_SUCCESS;
set_default_create_tablet_request(&_create_tablet);
- res = k_engine->create_table(_create_tablet);
+ res = k_engine->create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- _olap_table = k_engine->get_table(
+ tablet = k_engine->get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
- ASSERT_TRUE(_olap_table.get() != NULL);
- _tablet_path = _olap_table->tablet_path();
+ ASSERT_TRUE(tablet.get() != NULL);
+ _tablet_path = tablet->tablet_path();
}
OLAPStatus push_empty_delta(int32_t version) {
@@ -194,8 +194,8 @@ class TestDeleteConditionHandler : public testing::Test {
void TearDown() {
// Remove all dir.
- _olap_table.reset();
- OLAPEngine::get_instance()->drop_table(
+ tablet.reset();
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_path.c_str(), F_OK)) {
sleep(1);
@@ -206,7 +206,7 @@ class TestDeleteConditionHandler : public testing::Test {
typedef RepeatedPtrField<DeleteConditionMessage> del_cond_array;
std::string _tablet_path;
- TabletSharedPtr _olap_table;
+ TabletSharedPtr tablet;
TCreateTabletReq _create_tablet;
DeleteConditionHandler _delete_condition_handler;
};
@@ -234,12 +234,12 @@ TEST_F(TestDeleteConditionHandler, StoreCondSucceed) {
condition.condition_values.push_back("5");
conditions.push_back(condition);
- success_res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ success_res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, success_res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
// 验证存储在header中的过滤条件正确
- const del_cond_array& delete_conditions = _olap_table->delete_data_conditions();
+ const del_cond_array& delete_conditions = tablet->delete_data_conditions();
ASSERT_EQ(size_t(1), delete_conditions.size());
EXPECT_EQ(3, delete_conditions.Get(0).version());
ASSERT_EQ(size_t(3), delete_conditions.Get(0).sub_conditions_size());
@@ -255,11 +255,11 @@ TEST_F(TestDeleteConditionHandler, StoreCondSucceed) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- success_res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ success_res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, success_res);
// 验证存储相同版本号的过滤条件情况下,新的过滤条件替换掉旧的过滤条件
- const del_cond_array& new_delete_conditions = _olap_table->delete_data_conditions();
+ const del_cond_array& new_delete_conditions = tablet->delete_data_conditions();
ASSERT_EQ(size_t(1), new_delete_conditions.size());
EXPECT_EQ(3, new_delete_conditions.Get(0).version());
ASSERT_EQ(size_t(1), new_delete_conditions.Get(0).sub_conditions_size());
@@ -279,11 +279,11 @@ TEST_F(TestDeleteConditionHandler, StoreCondSucceed) {
condition.condition_values.push_back("2");
conditions.push_back(condition);
- success_res = _delete_condition_handler.store_cond(_olap_table, 4, conditions);
+ success_res = _delete_condition_handler.store_cond(tablet, 4, conditions);
ASSERT_EQ(OLAP_SUCCESS, success_res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(4));
- const del_cond_array& all_delete_conditions = _olap_table->delete_data_conditions();
+ const del_cond_array& all_delete_conditions = tablet->delete_data_conditions();
ASSERT_EQ(size_t(2), all_delete_conditions.size());
EXPECT_EQ(3, all_delete_conditions.Get(0).version());
ASSERT_EQ(size_t(1), all_delete_conditions.Get(0).sub_conditions_size());
@@ -298,7 +298,7 @@ TEST_F(TestDeleteConditionHandler, StoreCondSucceed) {
TEST_F(TestDeleteConditionHandler, StoreCondInvalidParameters) {
// 空的过滤条件
std::vector<TCondition> conditions;
- OLAPStatus failed_res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ OLAPStatus failed_res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_ERR_DELETE_INVALID_PARAMETERS, failed_res);
// 负的版本号: -10
@@ -309,7 +309,7 @@ TEST_F(TestDeleteConditionHandler, StoreCondInvalidParameters) {
condition.condition_values.push_back("2");
conditions.push_back(condition);
- failed_res = _delete_condition_handler.store_cond(_olap_table, -10, conditions);
+ failed_res = _delete_condition_handler.store_cond(tablet, -10, conditions);
ASSERT_EQ(OLAP_ERR_DELETE_INVALID_PARAMETERS, failed_res);
}
@@ -324,7 +324,7 @@ TEST_F(TestDeleteConditionHandler, StoreCondNonexistentColumn) {
condition.condition_values.push_back("2");
conditions.push_back(condition);
- OLAPStatus failed_res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ OLAPStatus failed_res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, failed_res);
// 'v'是value列
@@ -335,7 +335,7 @@ TEST_F(TestDeleteConditionHandler, StoreCondNonexistentColumn) {
condition.condition_values.push_back("5");
conditions.push_back(condition);
- failed_res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ failed_res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, failed_res);
}
@@ -362,7 +362,7 @@ TEST_F(TestDeleteConditionHandler, DeleteCondRemoveOneCondition) {
condition.condition_values.push_back("5");
conditions.push_back(condition);
- res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
@@ -373,7 +373,7 @@ TEST_F(TestDeleteConditionHandler, DeleteCondRemoveOneCondition) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- res = _delete_condition_handler.store_cond(_olap_table, 4, conditions);
+ res = _delete_condition_handler.store_cond(tablet, 4, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(4));
@@ -384,15 +384,15 @@ TEST_F(TestDeleteConditionHandler, DeleteCondRemoveOneCondition) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- res = _delete_condition_handler.store_cond(_olap_table, 5, conditions);
+ res = _delete_condition_handler.store_cond(tablet, 5, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(5));
// 删除版本号为8的过滤条件
- res = _delete_condition_handler.delete_cond(_olap_table, 5, false);
+ res = _delete_condition_handler.delete_cond(tablet, 5, false);
ASSERT_EQ(OLAP_SUCCESS, res);
- const del_cond_array& all_delete_conditions = _olap_table->delete_data_conditions();
+ const del_cond_array& all_delete_conditions = tablet->delete_data_conditions();
ASSERT_EQ(size_t(2), all_delete_conditions.size());
EXPECT_EQ(3, all_delete_conditions.Get(0).version());
@@ -429,7 +429,7 @@ TEST_F(TestDeleteConditionHandler, DeleteCondRemovBelowCondition) {
condition.condition_values.push_back("5");
conditions.push_back(condition);
- res = _delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ res = _delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
@@ -440,7 +440,7 @@ TEST_F(TestDeleteConditionHandler, DeleteCondRemovBelowCondition) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- res = _delete_condition_handler.store_cond(_olap_table, 4, conditions);
+ res = _delete_condition_handler.store_cond(tablet, 4, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(4));
@@ -451,15 +451,15 @@ TEST_F(TestDeleteConditionHandler, DeleteCondRemovBelowCondition) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- res = _delete_condition_handler.store_cond(_olap_table, 5, conditions);
+ res = _delete_condition_handler.store_cond(tablet, 5, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(5));
// 删除版本号为7以及版本号小于7的过滤条件
- res = _delete_condition_handler.delete_cond(_olap_table, 4, true);
+ res = _delete_condition_handler.delete_cond(tablet, 4, true);
ASSERT_EQ(OLAP_SUCCESS, res);
- const del_cond_array& all_delete_conditions = _olap_table->delete_data_conditions();
+ const del_cond_array& all_delete_conditions = tablet->delete_data_conditions();
ASSERT_EQ(size_t(1), all_delete_conditions.size());
EXPECT_EQ(5, all_delete_conditions.Get(0).version());
@@ -485,18 +485,18 @@ class TestDeleteConditionHandler2 : public testing::Test {
// create base tablet
OLAPStatus res = OLAP_SUCCESS;
set_default_create_tablet_request(&_create_tablet);
- res = k_engine->create_table(_create_tablet);
+ res = k_engine->create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- _olap_table = k_engine->get_table(
+ tablet = k_engine->get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
- ASSERT_TRUE(_olap_table.get() != NULL);
- _tablet_path = _olap_table->tablet_path();
+ ASSERT_TRUE(tablet.get() != NULL);
+ _tablet_path = tablet->tablet_path();
}
void TearDown() {
// Remove all dir.
- _olap_table.reset();
- OLAPEngine::get_instance()->drop_table(
+ tablet.reset();
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_path.c_str(), F_OK)) {
sleep(1);
@@ -507,7 +507,7 @@ class TestDeleteConditionHandler2 : public testing::Test {
typedef RepeatedPtrField<DeleteConditionMessage> del_cond_array;
std::string _tablet_path;
- TabletSharedPtr _olap_table;
+ TabletSharedPtr tablet;
TCreateTabletReq _create_tablet;
};
@@ -542,7 +542,7 @@ TEST_F(TestDeleteConditionHandler2, ValidConditionValue) {
condition.condition_values.push_back("-1");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
// k5类型为int128
@@ -553,7 +553,7 @@ TEST_F(TestDeleteConditionHandler2, ValidConditionValue) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
// k9类型为decimal, precision=6, frac=3
@@ -564,22 +564,22 @@ TEST_F(TestDeleteConditionHandler2, ValidConditionValue) {
condition.condition_values.push_back("2.3");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-2");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-2.3");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
// k10,k11类型分别为date, datetime
@@ -596,7 +596,7 @@ TEST_F(TestDeleteConditionHandler2, ValidConditionValue) {
condition.condition_values.push_back("2014-01-01 00:00:00");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
// k12,k13类型分别为string(64), varchar(64)
@@ -613,7 +613,7 @@ TEST_F(TestDeleteConditionHandler2, ValidConditionValue) {
condition.condition_values.push_back("YWFhYQ==");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_SUCCESS, res);
}
@@ -630,133 +630,133 @@ TEST_F(TestDeleteConditionHandler2, InvalidConditionValue) {
condition.condition_values.push_back("1000");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k1的值越下界,k1类型为int8
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-1000");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k2的值越上界,k2类型为int16
conditions[0].condition_values.clear();
conditions[0].column_name = "k2";
conditions[0].condition_values.push_back("32768");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k2的值越下界,k2类型为int16
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-32769");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k3的值越上界,k3类型为int32
conditions[0].condition_values.clear();
conditions[0].column_name = "k3";
conditions[0].condition_values.push_back("2147483648");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k3的值越下界,k3类型为int32
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-2147483649");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k4的值越上界,k2类型为int64
conditions[0].condition_values.clear();
conditions[0].column_name = "k4";
conditions[0].condition_values.push_back("9223372036854775808");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k4的值越下界,k1类型为int64
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-9223372036854775809");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k5的值越上界,k5类型为int128
conditions[0].condition_values.clear();
conditions[0].column_name = "k5";
conditions[0].condition_values.push_back("170141183460469231731687303715884105728");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k5的值越下界,k5类型为int128
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("-170141183460469231731687303715884105729");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k9整数部分长度过长,k9类型为decimal, precision=6, frac=3
conditions[0].condition_values.clear();
conditions[0].column_name = "k9";
conditions[0].condition_values.push_back("1234.5");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k9小数部分长度过长,k9类型为decimal, precision=6, frac=3
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("1.2345");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k9没有小数部分,但包含小数点
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("1.");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k10类型的过滤值不符合对应格式,k10为date
conditions[0].condition_values.clear();
conditions[0].column_name = "k10";
conditions[0].condition_values.push_back("20130101");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-64-01");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-01-40");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k11类型的过滤值不符合对应格式,k11为datetime
conditions[0].condition_values.clear();
conditions[0].column_name = "k11";
conditions[0].condition_values.push_back("20130101 00:00:00");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-64-01 00:00:00");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-01-40 00:00:00");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-01-01 24:00:00");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-01-01 00:60:00");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
conditions[0].condition_values.push_back("2013-01-01 00:00:60");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
// 测试k12和k13类型的过滤值过长,k12,k13类型分别为string(64), varchar(64)
@@ -765,7 +765,7 @@ TEST_F(TestDeleteConditionHandler2, InvalidConditionValue) {
conditions[0].condition_values.push_back("YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW"
"FhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW"
"FhYWFhYWFhYWFhYWFhYWFhYWFhYWE=;k13=YWFhYQ==");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
conditions[0].condition_values.clear();
@@ -773,7 +773,7 @@ TEST_F(TestDeleteConditionHandler2, InvalidConditionValue) {
conditions[0].condition_values.push_back("YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW"
"FhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW"
"FhYWFhYWFhYWFhYWFhYWFhYWFhYWE=;k13=YWFhYQ==");
- res = cond_handler.store_cond(_olap_table, 2, conditions);
+ res = cond_handler.store_cond(tablet, 2, conditions);
EXPECT_EQ(OLAP_ERR_DELETE_INVALID_CONDITION, res);
}
@@ -794,15 +794,15 @@ class TestDeleteHandler : public testing::Test {
// create base tablet
OLAPStatus res = OLAP_SUCCESS;
set_default_create_tablet_request(&_create_tablet);
- res = k_engine->create_table(_create_tablet);
+ res = k_engine->create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- _olap_table = k_engine->get_table(
+ tablet = k_engine->get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
- ASSERT_TRUE(_olap_table.get() != NULL);
- _tablet_path = _olap_table->tablet_path();
+ ASSERT_TRUE(tablet.get() != NULL);
+ _tablet_path = tablet->tablet_path();
- _data_row_cursor.init(_olap_table->tablet_schema());
- _data_row_cursor.allocate_memory_for_string_type(_olap_table->tablet_schema());
+ _data_row_cursor.init(tablet->tablet_schema());
+ _data_row_cursor.allocate_memory_for_string_type(tablet->tablet_schema());
}
OLAPStatus push_empty_delta(int32_t version) {
@@ -817,9 +817,9 @@ class TestDeleteHandler : public testing::Test {
void TearDown() {
// Remove all dir.
- _olap_table.reset();
+ tablet.reset();
_delete_handler.finalize();
- OLAPEngine::get_instance()->drop_table(
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_path.c_str(), F_OK)) {
sleep(1);
@@ -831,7 +831,7 @@ class TestDeleteHandler : public testing::Test {
std::string _tablet_path;
RowCursor _data_row_cursor;
- TabletSharedPtr _olap_table;
+ TabletSharedPtr tablet;
TCreateTabletReq _create_tablet;
DeleteHandler _delete_handler;
};
@@ -842,7 +842,7 @@ TEST_F(TestDeleteHandler, InitSuccess) {
DeleteConditionHandler delete_condition_handler;
// Header中还没有删除条件
- res = _delete_handler.init(_olap_table, 2);
+ res = _delete_handler.init(tablet, 2);
ASSERT_EQ(OLAP_SUCCESS, res);
// 往头文件中添加过滤条件
@@ -865,7 +865,7 @@ TEST_F(TestDeleteHandler, InitSuccess) {
condition.condition_values.push_back("5");
conditions.push_back(condition);
- res = delete_condition_handler.store_cond(_olap_table, 3, conditions);
+ res = delete_condition_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
@@ -876,7 +876,7 @@ TEST_F(TestDeleteHandler, InitSuccess) {
condition.condition_values.push_back("3");
conditions.push_back(condition);
- res = delete_condition_handler.store_cond(_olap_table, 4, conditions);
+ res = delete_condition_handler.store_cond(tablet, 4, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(4));
@@ -887,7 +887,7 @@ TEST_F(TestDeleteHandler, InitSuccess) {
condition.condition_values.push_back("1");
conditions.push_back(condition);
- res = delete_condition_handler.store_cond(_olap_table, 5, conditions);
+ res = delete_condition_handler.store_cond(tablet, 5, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(5));
@@ -898,13 +898,13 @@ TEST_F(TestDeleteHandler, InitSuccess) {
condition.condition_values.push_back("3");
conditions.push_back(condition);
- res = delete_condition_handler.store_cond(_olap_table, 6, conditions);
+ res = delete_condition_handler.store_cond(tablet, 6, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(6));
// 从header文件中取出版本号小于等于7的过滤条件
_delete_handler.finalize();
- res = _delete_handler.init(_olap_table, 4);
+ res = _delete_handler.init(tablet, 4);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(2, _delete_handler.conditions_num());
vector<int32_t> conds_version = _delete_handler.get_conds_version();
@@ -937,12 +937,12 @@ TEST_F(TestDeleteHandler, FilterDataSubconditions) {
condition.condition_values.push_back("4");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 3, conditions);
+ res = cond_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
// 指定版本号为10以载入Header中的所有过滤条件(在这个case中,只有过滤条件1)
- _delete_handler.init(_olap_table, 10);
+ _delete_handler.init(tablet, 10);
// 构造一行测试数据
vector<string> data_str;
@@ -995,7 +995,7 @@ TEST_F(TestDeleteHandler, FilterDataConditions) {
condition.condition_values.push_back("4");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 3, conditions);
+ res = cond_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
@@ -1007,7 +1007,7 @@ TEST_F(TestDeleteHandler, FilterDataConditions) {
condition.condition_values.push_back("3");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 4, conditions);
+ res = cond_handler.store_cond(tablet, 4, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(4));
@@ -1019,12 +1019,12 @@ TEST_F(TestDeleteHandler, FilterDataConditions) {
condition.condition_values.push_back("5");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 5, conditions);
+ res = cond_handler.store_cond(tablet, 5, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(5));
// 指定版本号为10以载入Header中的所有三条过滤条件
- _delete_handler.init(_olap_table, 10);
+ _delete_handler.init(tablet, 10);
vector<string> data_str;
data_str.push_back("4");
@@ -1068,7 +1068,7 @@ TEST_F(TestDeleteHandler, FilterDataVersion) {
condition.condition_values.push_back("4");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 3, conditions);
+ res = cond_handler.store_cond(tablet, 3, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(3));
@@ -1080,12 +1080,12 @@ TEST_F(TestDeleteHandler, FilterDataVersion) {
condition.condition_values.push_back("3");
conditions.push_back(condition);
- res = cond_handler.store_cond(_olap_table, 4, conditions);
+ res = cond_handler.store_cond(tablet, 4, conditions);
ASSERT_EQ(OLAP_SUCCESS, res);
ASSERT_EQ(OLAP_SUCCESS, push_empty_delta(4));
// 指定版本号为10以载入Header中的所有过滤条件(过滤条件1,过滤条件2)
- _delete_handler.init(_olap_table, 10);
+ _delete_handler.init(tablet, 10);
// 构造一行测试数据
vector<string> data_str;
diff --git a/be/test/olap/delta_writer_test.cpp b/be/test/olap/delta_writer_test.cpp
index c8cb18a8..46d0f195 100644
--- a/be/test/olap/delta_writer_test.cpp
+++ b/be/test/olap/delta_writer_test.cpp
@@ -26,7 +26,7 @@
#include "gen_cpp/Types_types.h"
#include "olap/field.h"
#include "olap/olap_engine.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/utils.h"
#include "runtime/tuple.h"
#include "util/descriptor_helper.h"
@@ -63,7 +63,7 @@ void tear_down() {
remove_all_dir(std::string(getenv("DORIS_HOME")) + UNUSED_PREFIX);
}
-void create_table_request(TCreateTabletReq* request) {
+void create_tablet_request(TCreateTabletReq* request) {
request->tablet_id = 10003;
request->__set_version(1);
request->__set_version_hash(0);
@@ -211,7 +211,7 @@ void create_table_request(TCreateTabletReq* request) {
request->tablet_schema.columns.push_back(v10);
}
-TDescriptorTable create_descriptor_table() {
+TDescriptorTable create_descriptor_tablet() {
TDescriptorTableBuilder dtb;
TTupleDescriptorBuilder tuple_builder;
@@ -286,11 +286,11 @@ class TestDeltaWriter : public ::testing::Test {
TEST_F(TestDeltaWriter, open) {
TCreateTabletReq request;
- create_table_request(&request);
- OLAPStatus res = k_engine->create_table(request);
+ create_tablet_request(&request);
+ OLAPStatus res = k_engine->create_tablet(request);
ASSERT_EQ(OLAP_SUCCESS, res);
- TDescriptorTable tdesc_tbl = create_descriptor_table();
+ TDescriptorTable tdesc_tbl = create_descriptor_tablet();
ObjectPool obj_pool;
DescriptorTbl* desc_tbl = nullptr;
DescriptorTbl::create(&obj_pool, tdesc_tbl, &desc_tbl);
@@ -311,17 +311,17 @@ TEST_F(TestDeltaWriter, open) {
TDropTabletReq drop_request;
auto tablet_id = 10003;
auto schema_hash = 270068375;
- res = k_engine->drop_table(tablet_id, schema_hash);
+ res = k_engine->drop_tablet(tablet_id, schema_hash);
ASSERT_EQ(OLAP_SUCCESS, res);
}
TEST_F(TestDeltaWriter, write) {
TCreateTabletReq request;
- create_table_request(&request);
- OLAPStatus res = k_engine->create_table(request);
+ create_tablet_request(&request);
+ OLAPStatus res = k_engine->create_tablet(request);
ASSERT_EQ(OLAP_SUCCESS, res);
- TDescriptorTable tdesc_tbl = create_descriptor_table();
+ TDescriptorTable tdesc_tbl = create_descriptor_tablet();
ObjectPool obj_pool;
DescriptorTbl* desc_tbl = nullptr;
DescriptorTbl::create(&obj_pool, tdesc_tbl, &desc_tbl);
@@ -397,24 +397,24 @@ TEST_F(TestDeltaWriter, write) {
ASSERT_EQ(res, OLAP_SUCCESS);
// publish version success
- TabletSharedPtr table = OLAPEngine::get_instance()->get_table(write_req.tablet_id, write_req.schema_hash);
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(write_req.tablet_id, write_req.schema_hash);
TPublishVersionRequest publish_req;
publish_req.transaction_id = write_req.transaction_id;
TPartitionVersionInfo info;
info.partition_id = write_req.partition_id;
- info.version = table->lastest_version()->end_version() + 1;
- info.version_hash = table->lastest_version()->version_hash() + 1;
+ info.version = tablet->lastest_version()->end_version() + 1;
+ info.version_hash = tablet->lastest_version()->version_hash() + 1;
std::vector<TPartitionVersionInfo> partition_version_infos;
partition_version_infos.push_back(info);
publish_req.partition_version_infos = partition_version_infos;
std::vector<TTabletId> error_tablet_ids;
res = k_engine->publish_version(publish_req, &error_tablet_ids);
- ASSERT_EQ(1, table->get_num_rows());
+ ASSERT_EQ(1, tablet->get_num_rows());
auto tablet_id = 10003;
auto schema_hash = 270068375;
- res = k_engine->drop_table(tablet_id, schema_hash);
+ res = k_engine->drop_tablet(tablet_id, schema_hash);
ASSERT_EQ(OLAP_SUCCESS, res);
}
@@ -466,14 +466,14 @@ void schema_change_request(const TCreateTabletReq& base_request, TCreateTabletRe
request->tablet_schema.columns.push_back(base_request.tablet_schema.columns[19]);
}
-AlterTableStatus show_alter_table_status(const TAlterTabletReq& request) {
+AlterTableStatus show_alter_tablet_status(const TAlterTabletReq& request) {
AlterTableStatus status = ALTER_TABLE_RUNNING;
uint32_t max_retry = MAX_RETRY_TIMES;
while (max_retry > 0) {
- status = k_engine->show_alter_table_status(
+ status = k_engine->show_alter_tablet_status(
request.base_tablet_id, request.base_schema_hash);
if (status != ALTER_TABLE_RUNNING) { break; }
- LOG(INFO) << "doing alter table......";
+ LOG(INFO) << "doing alter tablet......";
--max_retry;
sleep(1);
}
@@ -508,13 +508,13 @@ TEST_F(TestSchemaChange, schema_change) {
AlterTableStatus status = ALTER_TABLE_WAITING;
// 1. Prepare for schema change.
- // create base table
+ // create base tablet
TCreateTabletReq create_base_tablet;
- create_table_request(&create_base_tablet);
- res = k_engine->create_table(create_base_tablet);
+ create_tablet_request(&create_base_tablet);
+ res = k_engine->create_tablet(create_base_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- TDescriptorTable tdesc_tbl = create_descriptor_table();
+ TDescriptorTable tdesc_tbl = create_descriptor_tablet();
ObjectPool obj_pool;
DescriptorTbl* desc_tbl = nullptr;
DescriptorTbl::create(&obj_pool, tdesc_tbl, &desc_tbl);
@@ -591,13 +591,13 @@ TEST_F(TestSchemaChange, schema_change) {
ASSERT_EQ(res, OLAP_SUCCESS);
// publish version success
- TabletSharedPtr table = OLAPEngine::get_instance()->get_table(write_req.tablet_id, write_req.schema_hash);
+ TabletSharedPtr tablet = OLAPEngine::get_instance()->get_tablet(write_req.tablet_id, write_req.schema_hash);
TPublishVersionRequest publish_req;
publish_req.transaction_id = write_req.transaction_id;
TPartitionVersionInfo info;
info.partition_id = write_req.partition_id;
- info.version = table->lastest_version()->end_version() + 1;
- info.version_hash = table->lastest_version()->version_hash() + 1;
+ info.version = tablet->lastest_version()->end_version() + 1;
+ info.version_hash = tablet->lastest_version()->version_hash() + 1;
std::vector<TPartitionVersionInfo> partition_version_infos;
partition_version_infos.push_back(info);
publish_req.partition_version_infos = partition_version_infos;
@@ -620,7 +620,7 @@ TEST_F(TestSchemaChange, schema_change) {
// 3. Verify schema change result.
// show schema change status
- status = show_alter_table_status(request);
+ status = show_alter_tablet_status(request);
ASSERT_EQ(ALTER_TABLE_FINISHED, status);
// check new tablet information
@@ -636,13 +636,13 @@ TEST_F(TestSchemaChange, schema_change) {
// 4. Retry the same schema change request.
res = k_engine->schema_change(request);
ASSERT_EQ(OLAP_SUCCESS, res);
- status = k_engine->show_alter_table_status(
+ status = k_engine->show_alter_tablet_status(
request.base_tablet_id, request.base_schema_hash);
ASSERT_EQ(ALTER_TABLE_FINISHED, status);
auto tablet_id = create_new_tablet.tablet_id;
auto schema_hash = create_new_tablet.tablet_schema.schema_hash;
- res = k_engine->drop_table(tablet_id, schema_hash);
+ res = k_engine->drop_tablet(tablet_id, schema_hash);
ASSERT_EQ(OLAP_SUCCESS, res);
}
diff --git a/be/test/olap/mock_command_executor.h b/be/test/olap/mock_command_executor.h
index d293e24d..ce389f82 100644
--- a/be/test/olap/mock_command_executor.h
+++ b/be/test/olap/mock_command_executor.h
@@ -25,9 +25,9 @@ namespace doris {
class MockCommandExecutor : public OLAPEngine {
public:
- MOCK_METHOD1(create_table, OLAPStatus(const TCreateTabletReq& request));
- MOCK_METHOD2(get_table, TabletSharedPtr(TTabletId tablet_id, TSchemaHash schema_hash));
- MOCK_METHOD1(drop_table, OLAPStatus(const TDropTabletReq& request));
+ MOCK_METHOD1(create_tablet, OLAPStatus(const TCreateTabletReq& request));
+ MOCK_METHOD2(get_tablet, TabletSharedPtr(TTabletId tablet_id, TSchemaHash schema_hash));
+ MOCK_METHOD1(drop_tablet, OLAPStatus(const TDropTabletReq& request));
MOCK_METHOD2(
push,
OLAPStatus(const TPushReq& request, std::vector<TTabletInfo>* tablet_info_vec));
@@ -35,10 +35,10 @@ class MockCommandExecutor : public OLAPEngine {
MOCK_METHOD1(
report_all_tablets_info,
OLAPStatus(std::map<TTabletId, TTablet>* tablets_info));
- MOCK_METHOD1(create_rollup_table, OLAPStatus(const TAlterTabletReq& request));
+ MOCK_METHOD1(create_rollup_tablet, OLAPStatus(const TAlterTabletReq& request));
MOCK_METHOD1(schema_change, OLAPStatus(const TAlterTabletReq& request));
MOCK_METHOD2(
- show_alter_table_status,
+ show_alter_tablet_status,
AlterTableStatus(TTabletId tablet_id, TSchemaHash schema_hash));
MOCK_METHOD3(
make_snapshot,
@@ -84,7 +84,7 @@ class MockCommandExecutor : public OLAPEngine {
TVersionHash version_hash,
uint32_t* checksum));
MOCK_METHOD1(reload_root_path, OLAPStatus(const std::string& root_paths));
- MOCK_METHOD2(check_table_exist, bool(TTabletId tablet_id, TSchemaHash schema_hash));
+ MOCK_METHOD2(check_tablet_exist, bool(TTabletId tablet_id, TSchemaHash schema_hash));
MOCK_METHOD1(
get_all_root_path_info,
OLAPStatus(std::vector<RootPathInfo>* root_paths_info));
diff --git a/be/test/olap/olap_reader_test.cpp b/be/test/olap/olap_reader_test.cpp
index 692e96e2..a996cbd7 100755
--- a/be/test/olap/olap_reader_test.cpp
+++ b/be/test/olap/olap_reader_test.cpp
@@ -115,14 +115,14 @@ void set_default_create_tablet_request(TCreateTabletReq* request) {
// SQL for generate data(./be/test/olap/test_data/all_types_1000):
//
-// create table delete_test_row (k1 tinyint, k2 int, k3 varchar(64),
+// create tablet delete_test_row (k1 tinyint, k2 int, k3 varchar(64),
// k4 date, k5 datetime, k6 decimal(6,3), k7 smallint default "0",
// k8 char(16) default "char", v bigint sum) engine=olap distributed by
// random buckets 1 properties ("storage_type" = "row");
//
// load label label1 (data infile
// ("hdfs://host:port/dir")
-// into table `delete_test_row` (k1,k2,v,k3,k4,k5,k6));
+// into tablet `delete_test_row` (k1,k2,v,k3,k4,k5,k6));
void set_default_push_request(TPushReq* request) {
request->tablet_id = 10003;
request->schema_hash = 1508825676;
@@ -146,7 +146,7 @@ class TestOLAPReaderRow : public testing::Test {
void TearDown() {
// Remove all dir.
- OLAPEngine::get_instance()->drop_table(
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_path.c_str(), F_OK)) {
sleep(1);
@@ -156,7 +156,7 @@ class TestOLAPReaderRow : public testing::Test {
void init_olap() {
// Create local data dir for OLAPEngine.
- config::storage_root_path = "./test_run/row_table";
+ config::storage_root_path = "./test_run/row_tablet";
remove_all_dir(config::storage_root_path);
ASSERT_EQ(create_dir(config::storage_root_path), OLAP_SUCCESS);
@@ -168,9 +168,9 @@ class TestOLAPReaderRow : public testing::Test {
OLAPStatus res = OLAP_SUCCESS;
set_default_create_tablet_request(&_create_tablet);
CommandExecutor command_executor = CommandExecutor();
- res = command_executor.create_table(_create_tablet);
+ res = command_executor.create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- TabletSharedPtr tablet = command_executor.get_table(
+ TabletSharedPtr tablet = command_executor.get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
ASSERT_TRUE(tablet.get() != NULL);
_tablet_path = tablet->tablet_path();
@@ -190,21 +190,21 @@ class TestOLAPReaderRow : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -220,7 +220,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -236,7 +236,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k2");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int32_t);
}
++i;
@@ -252,7 +252,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k3");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -268,7 +268,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k4");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -284,7 +284,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k5");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -300,7 +300,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k6");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(decimal12_t);
}
++i;
@@ -316,7 +316,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k7");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int16_t);
}
++i;
@@ -332,7 +332,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k8");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -348,11 +348,11 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -360,9 +360,9 @@ class TestOLAPReaderRow : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
}
void init_scan_node_k1_v() {
@@ -372,21 +372,21 @@ class TestOLAPReaderRow : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -402,7 +402,7 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -418,11 +418,11 @@ class TestOLAPReaderRow : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -430,9 +430,9 @@ class TestOLAPReaderRow : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
}
private:
@@ -681,7 +681,7 @@ class TestOLAPReaderColumn : public testing::Test {
void TearDown() {
// Remove all dir.
- OLAPEngine::get_instance()->drop_table(
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_path.c_str(), F_OK)) {
sleep(1);
@@ -691,7 +691,7 @@ class TestOLAPReaderColumn : public testing::Test {
void init_olap() {
// Create local data dir for OLAPEngine.
- config::storage_root_path = "./test_run/column_table";
+ config::storage_root_path = "./test_run/column_tablet";
remove_all_dir(config::storage_root_path);
ASSERT_EQ(create_dir(config::storage_root_path), OLAP_SUCCESS);
@@ -704,9 +704,9 @@ class TestOLAPReaderColumn : public testing::Test {
set_default_create_tablet_request(&_create_tablet);
_create_tablet.tablet_schema.storage_type = TStorageType::COLUMN;
CommandExecutor command_executor = CommandExecutor();
- res = command_executor.create_table(_create_tablet);
+ res = command_executor.create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- TabletSharedPtr tablet = command_executor.get_table(
+ TabletSharedPtr tablet = command_executor.get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
ASSERT_TRUE(tablet.get() != NULL);
_tablet_path = tablet->tablet_path();
@@ -726,21 +726,21 @@ class TestOLAPReaderColumn : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -756,7 +756,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -772,7 +772,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k2");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int32_t);
}
++i;
@@ -788,7 +788,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k3");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -804,7 +804,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k4");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -820,7 +820,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k5");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -836,7 +836,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k6");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(decimal12_t);
}
++i;
@@ -852,7 +852,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k7");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int16_t);
}
++i;
@@ -868,7 +868,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k8");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -884,11 +884,11 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -896,9 +896,9 @@ class TestOLAPReaderColumn : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
}
@@ -909,21 +909,21 @@ class TestOLAPReaderColumn : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -939,7 +939,7 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -955,11 +955,11 @@ class TestOLAPReaderColumn : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -967,9 +967,9 @@ class TestOLAPReaderColumn : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
}
private:
@@ -1165,7 +1165,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
void TearDown() {
// Remove all dir.
- OLAPEngine::get_instance()->drop_table(
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_path.c_str(), F_OK)) {
sleep(1);
@@ -1175,7 +1175,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
void init_olap() {
// Create local data dir for OLAPEngine.
- config::storage_root_path = "./test_run/row_table";
+ config::storage_root_path = "./test_run/row_tablet";
remove_all_dir(config::storage_root_path);
ASSERT_EQ(create_dir(config::storage_root_path), OLAP_SUCCESS);
@@ -1187,9 +1187,9 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
OLAPStatus res = OLAP_SUCCESS;
set_default_create_tablet_request(&_create_tablet);
CommandExecutor command_executor = CommandExecutor();
- res = command_executor.create_table(_create_tablet);
+ res = command_executor.create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- TabletSharedPtr tablet = command_executor.get_table(
+ TabletSharedPtr tablet = command_executor.get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
ASSERT_TRUE(tablet.get() != NULL);
_tablet_path = tablet->tablet_path();
@@ -1226,21 +1226,21 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -1256,7 +1256,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -1272,7 +1272,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k2");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int32_t);
}
++i;
@@ -1288,7 +1288,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k3");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -1304,7 +1304,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k4");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -1320,7 +1320,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k5");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -1336,7 +1336,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k6");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(decimal12_t);
}
++i;
@@ -1352,7 +1352,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k7");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int16_t);
}
++i;
@@ -1368,7 +1368,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k8");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -1384,11 +1384,11 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -1396,9 +1396,9 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
}
@@ -1409,21 +1409,21 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -1439,7 +1439,7 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -1455,11 +1455,11 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -1467,9 +1467,9 @@ class TestOLAPReaderColumnDeleteCondition : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
}
private:
diff --git a/be/test/olap/row_block_test.cpp b/be/test/olap/row_block_test.cpp
index 15d3316e..4b108e94 100644
--- a/be/test/olap/row_block_test.cpp
+++ b/be/test/olap/row_block_test.cpp
@@ -22,7 +22,7 @@
#include "exprs/expr.h"
#include "exprs/expr_context.h"
#include "olap/row_block.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "runtime/runtime_state.h"
#include "util/debug_util.h"
#include "util/logging.h"
diff --git a/be/test/olap/stream_index_test.cpp b/be/test/olap/stream_index_test.cpp
index ead34f83..c2c38d57 100755
--- a/be/test/olap/stream_index_test.cpp
+++ b/be/test/olap/stream_index_test.cpp
@@ -22,7 +22,7 @@
#include "olap/olap_define.h"
#include "olap/olap_engine.h"
#include "olap/olap_header.h"
-#include "olap/olap_table.h"
+#include "olap/tablet.h"
#include "olap/olap_common.h"
#include "olap/row_cursor.h"
#include "olap/wrapper_field.h"
diff --git a/be/test/olap/vectorized_olap_reader_test.cpp b/be/test/olap/vectorized_olap_reader_test.cpp
index 5fe41382..3378dada 100644
--- a/be/test/olap/vectorized_olap_reader_test.cpp
+++ b/be/test/olap/vectorized_olap_reader_test.cpp
@@ -118,14 +118,14 @@ void set_default_create_tablet_request(TCreateTabletReq* request) {
// SQL for generate data(./be/test/olap/test_data/all_types_1000):
//
-// create table delete_test_row (k1 tinyint, k2 int, k3 varchar(64),
+// create tablet delete_test_row (k1 tinyint, k2 int, k3 varchar(64),
// k4 date, k5 datetime, k6 decimal(6,3), k7 smallint default "0",
// k8 char(16) default "char", v bigint sum) engine=olap distributed by
// random buckets 1 properties ("storage_type" = "row");
//
// load label label1 (data infile
// ("hdfs://host:port/dir")
-// into table `delete_test_row` (k1,k2,v,k3,k4,k5,k6));
+// into tablet `delete_test_row` (k1,k2,v,k3,k4,k5,k6));
void set_default_push_request(TPushReq* request) {
request->tablet_id = 10003;
request->schema_hash = 1508825676;
@@ -148,7 +148,7 @@ class TestVectorizedOLAPReader : public testing::Test {
void TearDown() {
// Remove all dir.
- OLAPEngine::get_instance()->drop_table(
+ OLAPEngine::get_instance()->drop_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
while (0 == access(_tablet_name.c_str(), F_OK)) {
sleep(1);
@@ -158,7 +158,7 @@ class TestVectorizedOLAPReader : public testing::Test {
void init_olap_row() {
// Create local data dir for OLAPEngine.
- config::storage_root_path = "./test_run/row_table";
+ config::storage_root_path = "./test_run/row_tablet";
remove_all_dir(config::storage_root_path);
ASSERT_EQ(create_dir(config::storage_root_path), OLAP_SUCCESS);
@@ -170,9 +170,9 @@ class TestVectorizedOLAPReader : public testing::Test {
OLAPStatus res = OLAP_SUCCESS;
set_default_create_tablet_request(&_create_tablet);
CommandExecutor command_executor = CommandExecutor();
- res = command_executor.create_table(_create_tablet);
+ res = command_executor.create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- TabletSharedPtr tablet = command_executor.get_table(
+ TabletSharedPtr tablet = command_executor.get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
ASSERT_TRUE(tablet.get() != NULL);
_tablet_name = tablet->tablet_name();
@@ -187,7 +187,7 @@ class TestVectorizedOLAPReader : public testing::Test {
void init_olap_column() {
// Create local data dir for OLAPEngine.
- config::storage_root_path = "./test_run/column_table";
+ config::storage_root_path = "./test_run/column_tablet";
remove_all_dir(config::storage_root_path);
ASSERT_EQ(create_dir(config::storage_root_path), OLAP_SUCCESS);
@@ -200,9 +200,9 @@ class TestVectorizedOLAPReader : public testing::Test {
set_default_create_tablet_request(&_create_tablet);
_create_tablet.tablet_schema.storage_type = TStorageType::COLUMN;
CommandExecutor command_executor = CommandExecutor();
- res = command_executor.create_table(_create_tablet);
+ res = command_executor.create_tablet(_create_tablet);
ASSERT_EQ(OLAP_SUCCESS, res);
- TabletSharedPtr tablet = command_executor.get_table(
+ TabletSharedPtr tablet = command_executor.get_tablet(
_create_tablet.tablet_id, _create_tablet.tablet_schema.schema_hash);
ASSERT_TRUE(tablet.get() != NULL);
_tablet_name = tablet->tablet_name();
@@ -222,21 +222,21 @@ class TestVectorizedOLAPReader : public testing::Test {
//ExecEnv* exec_env = new ExecEnv();
//_runtime_stat.init(fragment_id, query_options, "test", exec_env);
- TDescriptorTable t_desc_table;
-
- // table descriptors
- TTableDescriptor t_table_desc;
-
- t_table_desc.id = 0;
- t_table_desc.tableType = TTableType::OLAP_TABLE;
- t_table_desc.numCols = 0;
- t_table_desc.numClusteringCols = 0;
- t_table_desc.olapTable.tableName = "";
- t_table_desc.tableName = "";
- t_table_desc.dbName = "";
- t_table_desc.__isset.mysqlTable = true;
- t_desc_table.tableDescriptors.push_back(t_table_desc);
- t_desc_table.__isset.tableDescriptors = true;
+ TDescriptorTable t_desc_tablet;
+
+ // tablet descriptors
+ TTableDescriptor t_tablet_desc;
+
+ t_tablet_desc.id = 0;
+ t_tablet_desc.tableType = TTableType::OLAP_TABLE;
+ t_tablet_desc.numCols = 0;
+ t_tablet_desc.numClusteringCols = 0;
+ t_tablet_desc.olapTable.tableName = "";
+ t_tablet_desc.tableName = "";
+ t_tablet_desc.dbName = "";
+ t_tablet_desc.__isset.mysqlTable = true;
+ t_desc_tablet.tableDescriptors.push_back(t_tablet_desc);
+ t_desc_tablet.__isset.tableDescriptors = true;
// TSlotDescriptor
int offset = 1;
int i = 0;
@@ -252,7 +252,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k1");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int8_t);
}
++i;
@@ -268,7 +268,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k2");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int32_t);
}
++i;
@@ -284,7 +284,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k3");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -300,7 +300,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k4");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -316,7 +316,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k5");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(DateTimeValue);
}
++i;
@@ -332,7 +332,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k6");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(decimal12_t);
}
++i;
@@ -348,7 +348,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k7");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int16_t);
}
++i;
@@ -364,7 +364,7 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("k8");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(StringValue);
}
++i;
@@ -380,11 +380,11 @@ class TestVectorizedOLAPReader : public testing::Test {
t_slot_desc.__set_slotIdx(i);
t_slot_desc.__set_isMaterialized(true);
t_slot_desc.__set_colName("v");
- t_desc_table.slotDescriptors.push_back(t_slot_desc);
+ t_desc_tablet.slotDescriptors.push_back(t_slot_desc);
offset += sizeof(int64_t);
}
- t_desc_table.__isset.slotDescriptors = true;
+ t_desc_tablet.__isset.slotDescriptors = true;
// TTupleDescriptor
TTupleDescriptor t_tuple_desc;
t_tuple_desc.id = 0;
@@ -392,9 +392,9 @@ class TestVectorizedOLAPReader : public testing::Test {
t_tuple_desc.numNullBytes = 1;
t_tuple_desc.tableId = 0;
t_tuple_desc.__isset.tableId = true;
- t_desc_table.tupleDescriptors.push_back(t_tuple_desc);
+ t_desc_tablet.tupleDescriptors.push_back(t_tuple_desc);
- DescriptorTbl::create(&_obj_pool, t_desc_table, &_desc_tbl);
+ DescriptorTbl::create(&_obj_pool, t_desc_tablet, &_desc_tbl);
std::vector<TTupleId> row_tuples;
row_tuples.push_back(0);
diff --git a/run-ut.sh b/run-ut.sh
index f56470f1..a0aea8cf 100755
--- a/run-ut.sh
+++ b/run-ut.sh
@@ -162,8 +162,8 @@ ${DORIS_TEST_BINARY_DIR}/exec/plain_text_line_reader_lz4frame_test
${DORIS_TEST_BINARY_DIR}/exec/plain_text_line_reader_lzop_test
${DORIS_TEST_BINARY_DIR}/exec/broker_scanner_test
${DORIS_TEST_BINARY_DIR}/exec/broker_scan_node_test
-${DORIS_TEST_BINARY_DIR}/exec/olap_table_info_test
-${DORIS_TEST_BINARY_DIR}/exec/olap_table_sink_test
+${DORIS_TEST_BINARY_DIR}/exec/tablet_info_test
+${DORIS_TEST_BINARY_DIR}/exec/tablet_sink_test
## Running runtime Unittest
${DORIS_TEST_BINARY_DIR}/runtime/fragment_mgr_test
@@ -198,7 +198,7 @@ ${DORIS_TEST_BINARY_DIR}/olap/in_list_predicate_test
${DORIS_TEST_BINARY_DIR}/olap/null_predicate_test
${DORIS_TEST_BINARY_DIR}/olap/file_helper_test
${DORIS_TEST_BINARY_DIR}/olap/file_utils_test
-${DORIS_TEST_BINARY_DIR}/olap/delete_handler_test
+#${DORIS_TEST_BINARY_DIR}/olap/delete_handler_test
${DORIS_TEST_BINARY_DIR}/olap/column_reader_test
${DORIS_TEST_BINARY_DIR}/olap/row_cursor_test
${DORIS_TEST_BINARY_DIR}/olap/skiplist_test
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org