From b612d693f8cdd6e1faa55633e505a0c5ce652bbf Mon Sep 17 00:00:00 2001 From: huangkangping Date: Wed, 8 May 2019 17:09:48 +0800 Subject: [PATCH 1/2] Recover be --- be/src/olap/olap_table.cpp | 5 +++-- be/src/olap/store.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/be/src/olap/olap_table.cpp b/be/src/olap/olap_table.cpp index 2a52a2c2883d3e..08d2ed002cf688 100644 --- a/be/src/olap/olap_table.cpp +++ b/be/src/olap/olap_table.cpp @@ -316,8 +316,8 @@ OLAPStatus OLAPTable::load() { res = load_indices(); if (res != OLAP_SUCCESS) { - LOG(FATAL) << "fail to load indices. [res=" << res << " table='" << _full_name << "']"; - goto EXIT; + LOG(WARNING) << "fail to load indices. [res=" << res << " table='" << _full_name << "']"; + return res; } // delete unused files @@ -337,6 +337,7 @@ OLAPStatus OLAPTable::load() { EXIT: if (res != OLAP_SUCCESS) { + LOG(WARNING) << "tablet load failed. drop tablet:" << _full_name; OLAPEngine::get_instance()->drop_table(tablet_id(), schema_hash()); } diff --git a/be/src/olap/store.cpp b/be/src/olap/store.cpp index b5a801f83bf1e1..1410f29876d3e0 100755 --- a/be/src/olap/store.cpp +++ b/be/src/olap/store.cpp @@ -557,6 +557,13 @@ OLAPStatus OlapStore::_load_table_from_header(OLAPEngine* engine, TTabletId tabl return OLAP_ERR_TABLE_INDEX_VALIDATE_ERROR; } + res = olap_table->load(); + if (res != OLAP_SUCCESS) { + LOG(WARNING) << "load tablet failed: tablet:" << olap_table->full_name() << ", res:" << res; + olap_table->mark_dropped(); + return OLAP_ERR_TABLE_INDEX_VALIDATE_ERROR; + } + res = engine->add_table(tablet_id, schema_hash, olap_table); if (res != OLAP_SUCCESS) { // insert existed tablet return OLAP_SUCCESS From ce633bee66a1b17875df0dad464942c27afeaf61 Mon Sep 17 00:00:00 2001 From: huangkangping Date: Wed, 8 May 2019 19:03:39 +0800 Subject: [PATCH 2/2] remove drop tablet --- be/src/olap/segment_group.cpp | 12 ++++++++++++ be/src/olap/store.cpp | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/be/src/olap/segment_group.cpp b/be/src/olap/segment_group.cpp index fdabc9bc2fd705..7b689e26af7601 100644 --- a/be/src/olap/segment_group.cpp +++ b/be/src/olap/segment_group.cpp @@ -365,12 +365,24 @@ OLAPStatus SegmentGroup::validate() { string data_path = construct_data_file_path(_segment_group_id, seg_id); // 检查index文件头 + if (!boost::filesystem::exists(index_path)) { + LOG(WARNING) << "tmp index_path not exist:" << index_path + << ", tablet_id:" << _table->tablet_id() + << ", schema_hash:" << _table->schema_hash(); + } + if ((res = index_file_header.validate(index_path)) != OLAP_SUCCESS) { LOG(WARNING) << "validate index file error. [file='" << index_path << "']"; _check_io_error(res); return res; } + if (!boost::filesystem::exists(data_path)) { + LOG(WARNING) << "tmp data_path not exist:" << data_path + << ", tablet_id:" << _table->tablet_id() + << ", schema_hash:" << _table->schema_hash(); + } + // 检查data文件头 if ((res = data_file_header.validate(data_path)) != OLAP_SUCCESS) { LOG(WARNING) << "validate data file error. [file='" << data_path << "']"; diff --git a/be/src/olap/store.cpp b/be/src/olap/store.cpp index 1410f29876d3e0..4d15ff4ee729ef 100755 --- a/be/src/olap/store.cpp +++ b/be/src/olap/store.cpp @@ -560,7 +560,6 @@ OLAPStatus OlapStore::_load_table_from_header(OLAPEngine* engine, TTabletId tabl res = olap_table->load(); if (res != OLAP_SUCCESS) { LOG(WARNING) << "load tablet failed: tablet:" << olap_table->full_name() << ", res:" << res; - olap_table->mark_dropped(); return OLAP_ERR_TABLE_INDEX_VALIDATE_ERROR; }