From ed1f9b173b662737e603b16ffe710acfce03523e Mon Sep 17 00:00:00 2001 From: yaphet <4414314+darionyaphet@users.noreply.github.com> Date: Wed, 26 Jan 2022 18:41:52 +0800 Subject: [PATCH] disable meta upgrade from v1 (#3798) (#3827) --- src/daemons/CMakeLists.txt | 2 - src/daemons/MetaDaemonInit.cpp | 9 +- src/meta/CMakeLists.txt | 2 - src/meta/MetaVersionMan.cpp | 277 -------------- src/meta/MetaVersionMan.h | 4 - src/meta/upgrade/CMakeLists.txt | 3 - src/meta/upgrade/MetaDataUpgrade.cpp | 404 --------------------- src/meta/upgrade/MetaDataUpgrade.h | 24 -- src/meta/upgrade/v1/CMakeLists.txt | 24 -- src/meta/upgrade/v1/MetaServiceUtilsV1.cpp | 122 ------- src/meta/upgrade/v1/MetaServiceUtilsV1.h | 73 ---- src/meta/upgrade/v1/meta.thrift | 134 ------- src/storage/test/CMakeLists.txt | 1 - src/tools/db-dump/CMakeLists.txt | 1 - src/tools/db-upgrade/CMakeLists.txt | 1 - src/tools/meta-dump/CMakeLists.txt | 1 - src/tools/simple-kv-verify/CMakeLists.txt | 1 - src/tools/storage-perf/CMakeLists.txt | 1 - 18 files changed, 2 insertions(+), 1082 deletions(-) delete mode 100644 src/meta/upgrade/v1/CMakeLists.txt delete mode 100644 src/meta/upgrade/v1/MetaServiceUtilsV1.cpp delete mode 100644 src/meta/upgrade/v1/MetaServiceUtilsV1.h delete mode 100644 src/meta/upgrade/v1/meta.thrift diff --git a/src/daemons/CMakeLists.txt b/src/daemons/CMakeLists.txt index 26dce0e30b4..2bc9e8fe659 100644 --- a/src/daemons/CMakeLists.txt +++ b/src/daemons/CMakeLists.txt @@ -101,7 +101,6 @@ nebula_add_executable( $ $ $ - $ ${common_deps} ${storage_meta_deps} LIBRARIES @@ -243,7 +242,6 @@ nebula_add_executable( $ $ $ - $ ${storage_meta_deps} ${common_deps} LIBRARIES diff --git a/src/daemons/MetaDaemonInit.cpp b/src/daemons/MetaDaemonInit.cpp index 4f004933682..87166ada3b8 100644 --- a/src/daemons/MetaDaemonInit.cpp +++ b/src/daemons/MetaDaemonInit.cpp @@ -145,13 +145,8 @@ std::unique_ptr initKV(std::vector p LOG(ERROR) << "Meta version is invalid"; return nullptr; } else if (version == nebula::meta::MetaVersion::V1) { - auto ret = nebula::meta::MetaVersionMan::updateMetaV1ToV2(engine); - if (!ret.ok()) { - LOG(ERROR) << "Update meta from V1 to V2 failed " << ret; - return nullptr; - } - - nebula::meta::MetaVersionMan::setMetaVersionToKV(engine, nebula::meta::MetaVersion::V2); + LOG(ERROR) << "Can't upgrade meta from V1 to V3"; + return nullptr; } else if (version == nebula::meta::MetaVersion::V2) { auto ret = nebula::meta::MetaVersionMan::updateMetaV2ToV3(engine); if (!ret.ok()) { diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index 2ff62fc1fe5..27745cf4759 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -113,7 +113,6 @@ nebula_add_library( add_dependencies( meta_version_man_obj - meta_v1_thrift_obj meta_v2_thrift_obj ) @@ -122,7 +121,6 @@ set(meta_test_deps $ $ $ - $ $ $ $ diff --git a/src/meta/MetaVersionMan.cpp b/src/meta/MetaVersionMan.cpp index 97a6f8c1276..eca3c03b0cb 100644 --- a/src/meta/MetaVersionMan.cpp +++ b/src/meta/MetaVersionMan.cpp @@ -10,7 +10,6 @@ #include "meta/processors/job/JobDescription.h" #include "meta/processors/job/JobUtils.h" #include "meta/upgrade/MetaDataUpgrade.h" -#include "meta/upgrade/v1/MetaServiceUtilsV1.h" #include "meta/upgrade/v2/MetaServiceUtilsV2.h" DEFINE_bool(null_type, true, "set schema to support null type"); @@ -60,39 +59,6 @@ bool MetaVersionMan::setMetaVersionToKV(kvstore::KVEngine* engine, MetaVersion v return code == nebula::cpp2::ErrorCode::SUCCEEDED; } -// static -Status MetaVersionMan::updateMetaV1ToV2(kvstore::KVEngine* engine) { - CHECK_NOTNULL(engine); - auto snapshot = folly::sformat("META_UPGRADE_SNAPSHOT_{}", MetaKeyUtils::genTimestampStr()); - - std::string path = folly::sformat("{}/checkpoints/{}", engine->getDataRoot(), snapshot); - if (!fs::FileUtils::exist(path) && !fs::FileUtils::makeDir(path)) { - LOG(ERROR) << "Make checkpoint dir: " << path << " failed"; - return Status::Error("Create snapshot file failed"); - } - - std::string dataPath = folly::sformat("{}/data", path); - auto code = engine->createCheckpoint(dataPath); - if (code != nebula::cpp2::ErrorCode::SUCCEEDED) { - LOG(ERROR) << "Create snapshot failed: " << snapshot; - return Status::Error("Create snapshot failed"); - } - - auto status = doUpgradeV1ToV2(engine); - if (!status.ok()) { - // rollback by snapshot - return status; - } - - // delete snapshot file - auto checkpointPath = folly::sformat("{}/checkpoints/{}", engine->getDataRoot(), snapshot); - - if (fs::FileUtils::exist(checkpointPath) && !fs::FileUtils::remove(checkpointPath.data(), true)) { - LOG(ERROR) << "Delete snapshot: " << snapshot << " failed, You need to delete it manually"; - } - return Status::OK(); -} - Status MetaVersionMan::updateMetaV2ToV3(kvstore::KVEngine* engine) { CHECK_NOTNULL(engine); auto snapshot = folly::format("META_UPGRADE_SNAPSHOT_{}", MetaKeyUtils::genTimestampStr()).str(); @@ -124,249 +90,6 @@ Status MetaVersionMan::updateMetaV2ToV3(kvstore::KVEngine* engine) { return Status::OK(); } -// static -Status MetaVersionMan::doUpgradeV1ToV2(kvstore::KVEngine* engine) { - MetaDataUpgrade upgrader(engine); - { - // kSpacesTable - auto prefix = nebula::meta::v1::kSpacesTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printSpacesV1(iter->val()); - } - status = upgrader.rewriteSpaces(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kPartsTable - auto prefix = nebula::meta::v1::kPartsTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printParts(iter->key(), iter->val()); - } - status = upgrader.rewriteParts(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kHostsTable - auto prefix = nebula::meta::v1::kHostsTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printHost(iter->key(), iter->val()); - } - status = upgrader.rewriteHosts(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kLeadersTable - auto prefix = nebula::meta::v1::kLeadersTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printLeaders(iter->key()); - } - status = upgrader.rewriteLeaders(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kTagsTable - auto prefix = nebula::meta::v1::kTagsTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printSchemas(iter->val()); - } - status = upgrader.rewriteSchemas(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kEdgesTable - auto prefix = nebula::meta::v1::kEdgesTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printSchemas(iter->val()); - } - status = upgrader.rewriteSchemas(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kIndexesTable - auto prefix = nebula::meta::v1::kIndexesTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printIndexes(iter->val()); - } - status = upgrader.rewriteIndexes(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kConfigsTable - auto prefix = nebula::meta::v1::kConfigsTable; - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (FLAGS_print_info) { - upgrader.printConfigs(iter->key(), iter->val()); - } - status = upgrader.rewriteConfigs(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - - { - // kJob - auto prefix = JobUtil::jobPrefix(); - std::unique_ptr iter; - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (JobDescription::isJobKey(iter->key())) { - if (FLAGS_print_info) { - upgrader.printJobDesc(iter->key(), iter->val()); - } - status = upgrader.rewriteJobDesc(iter->key(), iter->val()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - } else { - // the job key format is change, need to delete the old format - status = upgrader.deleteKeyVal(iter->key()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - } - iter->next(); - } - } - } - - // delete - { - std::vector prefixes({nebula::meta::v1::kIndexStatusTable, - nebula::meta::v1::kDefaultTable, - nebula::meta::v1::kCurrJob, - nebula::meta::v1::kJobArchive}); - std::unique_ptr iter; - for (auto& prefix : prefixes) { - auto ret = engine->prefix(prefix, &iter); - if (ret == nebula::cpp2::ErrorCode::SUCCEEDED) { - Status status = Status::OK(); - while (iter->valid()) { - if (prefix == nebula::meta::v1::kIndexesTable) { - if (FLAGS_print_info) { - upgrader.printIndexes(iter->val()); - } - auto oldItem = meta::v1::MetaServiceUtilsV1::parseIndex(iter->val()); - auto spaceId = MetaKeyUtils::parseIndexesKeySpaceID(iter->key()); - status = upgrader.deleteKeyVal( - MetaKeyUtils::indexIndexKey(spaceId, oldItem.get_index_name())); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - } - status = upgrader.deleteKeyVal(iter->key()); - if (!status.ok()) { - LOG(ERROR) << status; - return status; - } - iter->next(); - } - } - } - } - if (!setMetaVersionToKV(engine, MetaVersion::V2)) { - return Status::Error("Persist meta version failed"); - } else { - return Status::OK(); - } -} - Status MetaVersionMan::doUpgradeV2ToV3(kvstore::KVEngine* engine) { MetaDataUpgrade upgrader(engine); // Step 1: Upgrade HeartBeat into machine list diff --git a/src/meta/MetaVersionMan.h b/src/meta/MetaVersionMan.h index 07d7331f906..8ff45d91bfc 100644 --- a/src/meta/MetaVersionMan.h +++ b/src/meta/MetaVersionMan.h @@ -32,15 +32,11 @@ class MetaVersionMan final { static bool setMetaVersionToKV(kvstore::KVEngine* engine, MetaVersion version); - static Status updateMetaV1ToV2(kvstore::KVEngine* engine); - static Status updateMetaV2ToV3(kvstore::KVEngine* engine); private: static MetaVersion getVersionByHost(kvstore::KVStore* kv); - static Status doUpgradeV1ToV2(kvstore::KVEngine* engine); - static Status doUpgradeV2ToV3(kvstore::KVEngine* engine); }; diff --git a/src/meta/upgrade/CMakeLists.txt b/src/meta/upgrade/CMakeLists.txt index b0700952b86..bd6c0e02715 100644 --- a/src/meta/upgrade/CMakeLists.txt +++ b/src/meta/upgrade/CMakeLists.txt @@ -5,15 +5,12 @@ nebula_add_library( meta_data_upgrade_obj OBJECT MetaDataUpgrade.cpp - v1/MetaServiceUtilsV1.cpp v2/MetaServiceUtilsV2.cpp ) add_dependencies( meta_data_upgrade_obj - meta_v1_thrift_obj meta_v2_thrift_obj ) -nebula_add_subdirectory(v1) nebula_add_subdirectory(v2) diff --git a/src/meta/upgrade/MetaDataUpgrade.cpp b/src/meta/upgrade/MetaDataUpgrade.cpp index e25e2ffb236..bbdd567771b 100644 --- a/src/meta/upgrade/MetaDataUpgrade.cpp +++ b/src/meta/upgrade/MetaDataUpgrade.cpp @@ -18,7 +18,6 @@ #include "kvstore/Common.h" #include "meta/ActiveHostsMan.h" #include "meta/MetaServiceUtils.h" -#include "meta/upgrade/v1/MetaServiceUtilsV1.h" #include "meta/upgrade/v2/MetaServiceUtilsV2.h" DECLARE_bool(null_type); @@ -27,42 +26,6 @@ DECLARE_uint32(string_index_limit); namespace nebula { namespace meta { -Status MetaDataUpgrade::rewriteHosts(const folly::StringPiece &key, const folly::StringPiece &val) { - auto host = meta::v1::MetaServiceUtilsV1::parseHostKey(key); - auto info = HostInfo::decodeV1(val); - auto newVal = HostInfo::encodeV2(info); - auto newKey = - MetaKeyUtils::hostKeyV2(network::NetworkUtils::intToIPv4(host.get_ip()), host.get_port()); - NG_LOG_AND_RETURN_IF_ERROR(put(newKey, newVal)); - NG_LOG_AND_RETURN_IF_ERROR(remove(key)); - return Status::OK(); -} - -Status MetaDataUpgrade::rewriteLeaders(const folly::StringPiece &key, - const folly::StringPiece &val) { - auto host = meta::v1::MetaServiceUtilsV1::parseLeaderKey(key); - auto newKey = - MetaKeyUtils::leaderKey(network::NetworkUtils::intToIPv4(host.get_ip()), host.get_port()); - NG_LOG_AND_RETURN_IF_ERROR(put(newKey, val)); - NG_LOG_AND_RETURN_IF_ERROR(remove(key)); - return Status::OK(); -} - -Status MetaDataUpgrade::rewriteSpaces(const folly::StringPiece &key, - const folly::StringPiece &val) { - auto oldProps = meta::v1::MetaServiceUtilsV1::parseSpace(val); - cpp2::SpaceDesc spaceDesc; - spaceDesc.space_name_ref() = oldProps.get_space_name(); - spaceDesc.partition_num_ref() = oldProps.get_partition_num(); - spaceDesc.replica_factor_ref() = oldProps.get_replica_factor(); - spaceDesc.charset_name_ref() = oldProps.get_charset_name(); - spaceDesc.collate_name_ref() = oldProps.get_collate_name(); - (*spaceDesc.vid_type_ref()).type_length_ref() = 8; - (*spaceDesc.vid_type_ref()).type_ref() = nebula::cpp2::PropertyType::INT64; - NG_LOG_AND_RETURN_IF_ERROR(put(key, MetaKeyUtils::spaceVal(spaceDesc))); - return Status::OK(); -} - Status MetaDataUpgrade::rewriteSpacesV2ToV3(const folly::StringPiece &key, const folly::StringPiece &val) { auto oldProps = meta::v2::MetaServiceUtilsV2::parseSpace(val); @@ -125,222 +88,11 @@ Status MetaDataUpgrade::rewriteSpacesV2ToV3(const folly::StringPiece &key, return Status::OK(); } -Status MetaDataUpgrade::rewriteParts(const folly::StringPiece &key, const folly::StringPiece &val) { - auto oldHosts = meta::v1::MetaServiceUtilsV1::parsePartVal(val); - std::vector newHosts; - for (auto &host : oldHosts) { - HostAddr hostAddr; - hostAddr.host = network::NetworkUtils::intToIPv4(host.get_ip()); - hostAddr.port = host.get_port(); - newHosts.emplace_back(std::move(hostAddr)); - } - NG_LOG_AND_RETURN_IF_ERROR(put(key, MetaKeyUtils::partVal(newHosts))); - return Status::OK(); -} - -Status MetaDataUpgrade::rewriteSchemas(const folly::StringPiece &key, - const folly::StringPiece &val) { - auto oldSchema = meta::v1::MetaServiceUtilsV1::parseSchema(val); - cpp2::Schema newSchema; - cpp2::SchemaProp newSchemaProps; - auto &schemaProp = oldSchema.get_schema_prop(); - if (schemaProp.ttl_duration_ref().has_value()) { - newSchemaProps.ttl_duration_ref() = *schemaProp.get_ttl_duration(); - } - if (schemaProp.ttl_col_ref().has_value()) { - newSchemaProps.ttl_col_ref() = *schemaProp.get_ttl_col(); - } - newSchema.schema_prop_ref() = std::move(newSchemaProps); - NG_LOG_AND_RETURN_IF_ERROR( - convertToNewColumns((*oldSchema.columns_ref()), (*newSchema.columns_ref()))); - - auto nameLen = *reinterpret_cast(val.data()); - auto schemaName = val.subpiece(sizeof(int32_t), nameLen).str(); - auto encodeVal = MetaKeyUtils::schemaVal(schemaName, newSchema); - NG_LOG_AND_RETURN_IF_ERROR(put(key, encodeVal)); - return Status::OK(); -} - -Status MetaDataUpgrade::rewriteIndexes(const folly::StringPiece &key, - const folly::StringPiece &val) { - auto oldItem = meta::v1::MetaServiceUtilsV1::parseIndex(val); - cpp2::IndexItem newItem; - newItem.index_id_ref() = oldItem.get_index_id(); - newItem.index_name_ref() = oldItem.get_index_name(); - nebula::cpp2::SchemaID schemaId; - if (oldItem.get_schema_id().getType() == meta::v1::cpp2::SchemaID::Type::tag_id) { - schemaId.tag_id_ref() = oldItem.get_schema_id().get_tag_id(); - } else { - schemaId.edge_type_ref() = oldItem.get_schema_id().get_edge_type(); - } - newItem.schema_id_ref() = schemaId; - NG_LOG_AND_RETURN_IF_ERROR( - convertToNewIndexColumns((*oldItem.fields_ref()), (*newItem.fields_ref()))); - NG_LOG_AND_RETURN_IF_ERROR(put(key, MetaKeyUtils::indexVal(newItem))); - return Status::OK(); -} - -Status MetaDataUpgrade::rewriteConfigs(const folly::StringPiece &key, - const folly::StringPiece &val) { - auto item = meta::v1::MetaServiceUtilsV1::parseConfigValue(val); - - Value configVal; - switch (item.get_type()) { - case meta::v1::cpp2::ConfigType::INT64: { - auto value = *reinterpret_cast(item.get_value().data()); - configVal.setInt(boost::get(value)); - break; - } - case meta::v1::cpp2::ConfigType::DOUBLE: { - auto value = *reinterpret_cast(item.get_value().data()); - configVal.setFloat(boost::get(value)); - break; - } - case meta::v1::cpp2::ConfigType::BOOL: { - auto value = *reinterpret_cast(item.get_value().data()); - configVal.setBool(boost::get(value) ? "True" : "False"); - break; - } - case meta::v1::cpp2::ConfigType::STRING: { - configVal.setStr(boost::get(item.get_value())); - break; - } - case meta::v1::cpp2::ConfigType::NESTED: { - auto value = item.get_value(); - // transform to map value - conf::Configuration conf; - auto status = conf.parseFromString(boost::get(value)); - if (!status.ok()) { - LOG(ERROR) << "Parse value: " << value << " failed: " << status; - return Status::Error("Parse value: %s failed", value.c_str()); - } - Map map; - conf.forEachItem([&map](const folly::StringPiece &confKey, const folly::dynamic &confVal) { - map.kvs.emplace(confKey, confVal.asString()); - }); - configVal.setMap(std::move(map)); - break; - } - } - auto newVal = - MetaKeyUtils::configValue(static_cast(item.get_mode()), configVal); - NG_LOG_AND_RETURN_IF_ERROR(put(key, newVal)); - return Status::OK(); -} - -Status MetaDataUpgrade::rewriteJobDesc(const folly::StringPiece &key, - const folly::StringPiece &val) { - auto jobDesc = meta::v1::MetaServiceUtilsV1::parseJobDesc(val); - auto cmdStr = std::get<0>(jobDesc); - nebula::meta::cpp2::AdminCmd adminCmd; - if (cmdStr.find("flush") == 0) { - adminCmd = nebula::meta::cpp2::AdminCmd::FLUSH; - } else if (cmdStr.find("compact") == 0) { - adminCmd = nebula::meta::cpp2::AdminCmd::COMPACT; - } else { - return Status::Error("Wrong job cmd: %s", cmdStr.c_str()); - } - auto paras = std::get<1>(jobDesc); - auto status = std::get<2>(jobDesc); - auto startTime = std::get<3>(jobDesc); - auto stopTime = std::get<4>(jobDesc); - std::string str; - str.reserve(256); - // use a big num to avoid possible conflict - int32_t dataVersion = INT_MAX - 1; - str.append(reinterpret_cast(&dataVersion), sizeof(dataVersion)) - .append(reinterpret_cast(&adminCmd), sizeof(adminCmd)); - auto paraSize = paras.size(); - str.append(reinterpret_cast(¶Size), sizeof(size_t)); - for (auto ¶ : paras) { - auto len = para.length(); - str.append(reinterpret_cast(&len), sizeof(len)) - .append(reinterpret_cast(¶[0]), len); - } - str.append(reinterpret_cast(&status), sizeof(nebula::meta::cpp2::JobStatus)) - .append(reinterpret_cast(&startTime), sizeof(int64_t)) - .append(reinterpret_cast(&stopTime), sizeof(int64_t)); - - NG_LOG_AND_RETURN_IF_ERROR(put(key, str)); - return Status::OK(); -} - Status MetaDataUpgrade::deleteKeyVal(const folly::StringPiece &key) { NG_LOG_AND_RETURN_IF_ERROR(remove(key)); return Status::OK(); } -Status MetaDataUpgrade::convertToNewColumns(const std::vector &oldCols, - std::vector &newCols) { - ObjectPool objPool; - auto pool = &objPool; - for (auto &colDef : oldCols) { - cpp2::ColumnDef columnDef; - columnDef.name_ref() = colDef.get_name(); - columnDef.type.type_ref() = - static_cast(colDef.get_type().get_type()); - if (colDef.default_value_ref().has_value()) { - std::string encodeStr; - switch (colDef.get_type().get_type()) { - case meta::v1::cpp2::SupportedType::BOOL: - encodeStr = Expression::encode( - *ConstantExpression::make(pool, colDef.get_default_value()->get_bool_value())); - break; - case meta::v1::cpp2::SupportedType::INT: - encodeStr = Expression::encode( - *ConstantExpression::make(pool, colDef.get_default_value()->get_int_value())); - break; - case meta::v1::cpp2::SupportedType::DOUBLE: - encodeStr = Expression::encode( - *ConstantExpression::make(pool, colDef.get_default_value()->get_double_value())); - break; - case meta::v1::cpp2::SupportedType::STRING: - encodeStr = Expression::encode( - *ConstantExpression::make(pool, colDef.get_default_value()->get_string_value())); - break; - case meta::v1::cpp2::SupportedType::TIMESTAMP: - encodeStr = Expression::encode( - *ConstantExpression::make(pool, colDef.get_default_value()->get_timestamp())); - break; - default: - return Status::Error( - "Wrong default type: %s", - apache::thrift::util::enumNameSafe(colDef.get_type().get_type()).c_str()); - } - - columnDef.default_value_ref() = std::move(encodeStr); - } - if (FLAGS_null_type) { - columnDef.nullable_ref() = true; - } - newCols.emplace_back(std::move(columnDef)); - } - return Status::OK(); -} - -Status MetaDataUpgrade::convertToNewIndexColumns( - const std::vector &oldCols, std::vector &newCols) { - for (auto &colDef : oldCols) { - cpp2::ColumnDef columnDef; - columnDef.name_ref() = colDef.get_name(); - if (colDef.get_type().get_type() == meta::v1::cpp2::SupportedType::STRING) { - cpp2::ColumnTypeDef type; - type.type_ref() = nebula::cpp2::PropertyType::FIXED_STRING; - type.type_length_ref() = FLAGS_string_index_limit; - columnDef.type_ref() = std::move(type); - } else { - columnDef.type.type_ref() = - static_cast(colDef.get_type().get_type()); - } - DCHECK(!colDef.default_value_ref().has_value()); - if (FLAGS_null_type) { - columnDef.nullable_ref() = true; - } - newCols.emplace_back(std::move(columnDef)); - } - return Status::OK(); -} - nebula::cpp2::PropertyType MetaDataUpgrade::convertToPropertyType( nebula::meta::v2::cpp2::PropertyType type) { switch (type) { @@ -395,25 +147,6 @@ nebula::meta::cpp2::GeoShape MetaDataUpgrade::convertToGeoShape( } } -void MetaDataUpgrade::printHost(const folly::StringPiece &key, const folly::StringPiece &val) { - auto host = meta::v1::MetaServiceUtilsV1::parseHostKey(key); - auto info = HostInfo::decodeV1(val); - LOG(INFO) << "Host ip: " << network::NetworkUtils::intToIPv4(host.get_ip()); - LOG(INFO) << "Host port: " << host.get_port(); - LOG(INFO) << "Host info: lastHBTimeInMilliSec: " << info.lastHBTimeInMilliSec_; - LOG(INFO) << "Host info: role_: " << apache::thrift::util::enumNameSafe(info.role_); - LOG(INFO) << "Host info: gitInfoSha_: " << info.gitInfoSha_; -} - -void MetaDataUpgrade::printSpacesV1(const folly::StringPiece &val) { - auto oldProps = meta::v1::MetaServiceUtilsV1::parseSpace(val); - LOG(INFO) << "Space name: " << oldProps.get_space_name(); - LOG(INFO) << "Partition num: " << oldProps.get_partition_num(); - LOG(INFO) << "Replica factor: " << oldProps.get_replica_factor(); - LOG(INFO) << "Charset name: " << oldProps.get_charset_name(); - LOG(INFO) << "Collate name: " << oldProps.get_collate_name(); -} - void MetaDataUpgrade::printSpacesV2(const folly::StringPiece &val) { auto oldProps = meta::v2::MetaServiceUtilsV2::parseSpace(val); LOG(INFO) << "Space name: " << oldProps.get_space_name(); @@ -426,143 +159,6 @@ void MetaDataUpgrade::printSpacesV2(const folly::StringPiece &val) { } } -void MetaDataUpgrade::printParts(const folly::StringPiece &key, const folly::StringPiece &val) { - auto spaceId = meta::v1::MetaServiceUtilsV1::parsePartKeySpaceId(key); - auto partId = meta::v1::MetaServiceUtilsV1::parsePartKeyPartId(key); - auto oldHosts = meta::v1::MetaServiceUtilsV1::parsePartVal(val); - LOG(INFO) << "Part spaceId: " << spaceId; - LOG(INFO) << "Part id: " << partId; - for (auto &host : oldHosts) { - LOG(INFO) << "Part host ip: " << network::NetworkUtils::intToIPv4(host.get_ip()); - LOG(INFO) << "Part host port: " << host.get_port(); - } -} - -void MetaDataUpgrade::printLeaders(const folly::StringPiece &key) { - auto host = meta::v1::MetaServiceUtilsV1::parseLeaderKey(key); - LOG(INFO) << "Leader host ip: " << network::NetworkUtils::intToIPv4(host.get_ip()); - LOG(INFO) << "Leader host port: " << host.get_port(); -} - -void MetaDataUpgrade::printSchemas(const folly::StringPiece &val) { - auto oldSchema = meta::v1::MetaServiceUtilsV1::parseSchema(val); - auto nameLen = *reinterpret_cast(val.data()); - auto schemaName = val.subpiece(sizeof(int32_t), nameLen).str(); - LOG(INFO) << "Schema name: " << schemaName; - for (auto &colDef : oldSchema.get_columns()) { - LOG(INFO) << "Schema column name: " << colDef.get_name(); - LOG(INFO) << "Schema column type: " - << apache::thrift::util::enumNameSafe(colDef.get_type().get_type()); - Value defaultValue; - if (colDef.default_value_ref().has_value()) { - switch (colDef.get_type().get_type()) { - case meta::v1::cpp2::SupportedType::BOOL: - defaultValue = colDef.get_default_value()->get_bool_value(); - break; - case meta::v1::cpp2::SupportedType::INT: - defaultValue = colDef.get_default_value()->get_int_value(); - break; - case meta::v1::cpp2::SupportedType::DOUBLE: - defaultValue = colDef.get_default_value()->get_double_value(); - break; - case meta::v1::cpp2::SupportedType::STRING: - defaultValue = colDef.get_default_value()->get_string_value(); - break; - case meta::v1::cpp2::SupportedType::TIMESTAMP: - defaultValue = colDef.get_default_value()->get_timestamp(); - break; - default: - LOG(ERROR) << "Wrong default type: " - << apache::thrift::util::enumNameSafe(colDef.get_type().get_type()); - } - LOG(INFO) << "Schema default value: " << defaultValue; - } - } -} - -void MetaDataUpgrade::printIndexes(const folly::StringPiece &val) { - auto oldItem = meta::v1::MetaServiceUtilsV1::parseIndex(val); - LOG(INFO) << "Index id: " << oldItem.get_index_id(); - LOG(INFO) << "Index name: " << oldItem.get_index_name(); - if (oldItem.get_schema_id().getType() == meta::v1::cpp2::SchemaID::Type::tag_id) { - LOG(INFO) << "Index on tag id: " << oldItem.get_schema_id().get_tag_id(); - } else { - LOG(INFO) << "Index on edgetype: " << oldItem.get_schema_id().get_edge_type(); - } - for (auto &colDef : oldItem.get_fields()) { - LOG(INFO) << "Index field name: " << colDef.get_name(); - LOG(INFO) << "Index field type: " - << apache::thrift::util::enumNameSafe(colDef.get_type().get_type()); - } -} - -void MetaDataUpgrade::printConfigs(const folly::StringPiece &key, const folly::StringPiece &val) { - auto item = meta::v1::MetaServiceUtilsV1::parseConfigValue(val); - auto configName = meta::v1::MetaServiceUtilsV1::parseConfigKey(key); - Value configVal; - switch (item.get_type()) { - case meta::v1::cpp2::ConfigType::INT64: { - auto value = *reinterpret_cast(item.get_value().data()); - configVal.setInt(boost::get(value)); - break; - } - case meta::v1::cpp2::ConfigType::DOUBLE: { - auto value = *reinterpret_cast(item.get_value().data()); - configVal.setFloat(boost::get(value)); - break; - } - case meta::v1::cpp2::ConfigType::BOOL: { - auto value = *reinterpret_cast(item.get_value().data()); - configVal.setBool(boost::get(value) ? "True" : "False"); - break; - } - case meta::v1::cpp2::ConfigType::STRING: { - configVal.setStr(boost::get(item.get_value())); - break; - } - case meta::v1::cpp2::ConfigType::NESTED: { - auto value = item.get_value(); - // transform to map value - conf::Configuration conf; - auto status = conf.parseFromString(boost::get(value)); - if (!status.ok()) { - LOG(ERROR) << "Parse value: " << value << " failed: " << status; - return; - } - Map map; - conf.forEachItem([&map](const folly::StringPiece &confKey, const folly::dynamic &confVal) { - map.kvs.emplace(confKey, confVal.asString()); - }); - configVal.setMap(std::move(map)); - break; - } - } - LOG(INFO) << "Config name: " << configName.second; - LOG(INFO) << "Config module: " << apache::thrift::util::enumNameSafe(configName.first); - LOG(INFO) << "Config mode: " << apache::thrift::util::enumNameSafe(item.get_mode()); - LOG(INFO) << "Config value: " << configVal; -} - -void MetaDataUpgrade::printJobDesc(const folly::StringPiece &key, const folly::StringPiece &val) { - auto jobId = meta::v1::MetaServiceUtilsV1::parseJobId(key); - LOG(INFO) << "JobDesc id: " << jobId; - auto jobDesc = meta::v1::MetaServiceUtilsV1::parseJobDesc(val); - auto cmdStr = std::get<0>(jobDesc); - auto paras = std::get<1>(jobDesc); - auto status = std::get<2>(jobDesc); - auto startTime = std::get<3>(jobDesc); - auto stopTime = std::get<4>(jobDesc); - - LOG(INFO) << "JobDesc id: " << jobId; - LOG(INFO) << "JobDesc cmd: " << cmdStr; - for (auto ¶ : paras) { - LOG(INFO) << "JobDesc para: " << para; - } - LOG(INFO) << "JobDesc status: " << apache::thrift::util::enumNameSafe(status); - LOG(INFO) << "JobDesc startTime: " << startTime; - LOG(INFO) << "JobDesc stopTime: " << stopTime; -} - Status MetaDataUpgrade::saveMachineAndZone(std::vector data) { NG_LOG_AND_RETURN_IF_ERROR(put(data)); return Status::OK(); diff --git a/src/meta/upgrade/MetaDataUpgrade.h b/src/meta/upgrade/MetaDataUpgrade.h index e62cac8ba47..39c11eb03b3 100644 --- a/src/meta/upgrade/MetaDataUpgrade.h +++ b/src/meta/upgrade/MetaDataUpgrade.h @@ -12,7 +12,6 @@ #include "kvstore/KVEngine.h" #include "kvstore/KVStore.h" #include "meta/processors/Common.h" -#include "meta/upgrade/v1/gen-cpp2/meta_types.h" #include "meta/upgrade/v2/gen-cpp2/meta_types.h" namespace nebula { @@ -24,30 +23,13 @@ class MetaDataUpgrade final { ~MetaDataUpgrade() = default; - Status rewriteHosts(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteSpaces(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteParts(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteLeaders(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteSchemas(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteIndexes(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteConfigs(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteJobDesc(const folly::StringPiece &key, const folly::StringPiece &val); - Status rewriteSpacesV2ToV3(const folly::StringPiece &key, const folly::StringPiece &val); Status deleteKeyVal(const folly::StringPiece &key); Status saveMachineAndZone(std::vector data); - void printHost(const folly::StringPiece &key, const folly::StringPiece &val); - void printSpacesV1(const folly::StringPiece &val); void printSpacesV2(const folly::StringPiece &val); - void printParts(const folly::StringPiece &key, const folly::StringPiece &val); - void printLeaders(const folly::StringPiece &key); - void printSchemas(const folly::StringPiece &val); - void printIndexes(const folly::StringPiece &val); - void printConfigs(const folly::StringPiece &key, const folly::StringPiece &val); - void printJobDesc(const folly::StringPiece &key, const folly::StringPiece &val); private: Status put(const folly::StringPiece &key, const folly::StringPiece &val) { @@ -74,12 +56,6 @@ class MetaDataUpgrade final { return Status::OK(); } - Status convertToNewColumns(const std::vector &oldCols, - std::vector &newCols); - - Status convertToNewIndexColumns(const std::vector &oldCols, - std::vector &newCols); - nebula::cpp2::PropertyType convertToPropertyType(nebula::meta::v2::cpp2::PropertyType type); nebula::meta::cpp2::GeoShape convertToGeoShape(nebula::meta::v2::cpp2::GeoShape shape); diff --git a/src/meta/upgrade/v1/CMakeLists.txt b/src/meta/upgrade/v1/CMakeLists.txt deleted file mode 100644 index 36321c81cf8..00000000000 --- a/src/meta/upgrade/v1/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2021 vesoft inc. All rights reserved. -# -# This source code is licensed under Apache 2.0 License. - -set(THRIFT1 ${Fbthrift_BIN}) - -set(meta_v1_sources - gen-cpp2/meta_constants.cpp - gen-cpp2/meta_data.cpp - gen-cpp2/meta_metadata.cpp - gen-cpp2/meta_types.cpp - ) - -add_custom_command( - OUTPUT ${meta_v1_sources} - COMMAND "${THRIFT1}" "--strict" "--allow-neg-enum-vals" "--gen" "mstch_cpp2:include_prefix=\"meta/upgrade/v1\",process_in_event_base,stack_arguments" "-o" "." "${CMAKE_CURRENT_SOURCE_DIR}/meta.thrift" - DEPENDS meta.thrift - ) - -nebula_add_library(meta_v1_thrift_obj OBJECT ${meta_v1_sources}) - -target_compile_options(meta_v1_thrift_obj PRIVATE "-Wno-pedantic") -target_compile_options(meta_v1_thrift_obj PRIVATE "-Wno-extra") -target_compile_options(meta_v1_thrift_obj PRIVATE "-Wno-deprecated-declarations") diff --git a/src/meta/upgrade/v1/MetaServiceUtilsV1.cpp b/src/meta/upgrade/v1/MetaServiceUtilsV1.cpp deleted file mode 100644 index 70f22ef6e17..00000000000 --- a/src/meta/upgrade/v1/MetaServiceUtilsV1.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#include "meta/upgrade/v1/MetaServiceUtilsV1.h" - -#include -#include - -#include "meta/processors/job/JobUtils.h" - -namespace nebula::meta::v1 { - -cpp2::SpaceProperties MetaServiceUtilsV1::parseSpace(folly::StringPiece rawData) { - cpp2::SpaceProperties properties; - apache::thrift::CompactSerializer::deserialize(rawData, properties); - return properties; -} - -GraphSpaceID MetaServiceUtilsV1::parsePartKeySpaceId(folly::StringPiece key) { - return *reinterpret_cast(key.data() + kPartsTable.size()); -} - -PartitionID MetaServiceUtilsV1::parsePartKeyPartId(folly::StringPiece key) { - return *reinterpret_cast(key.data() + kPartsTable.size() + - sizeof(GraphSpaceID)); -} - -std::vector MetaServiceUtilsV1::parsePartVal(folly::StringPiece val) { - std::vector hosts; - static const size_t unitSize = sizeof(int32_t) * 2; - auto hostsNum = val.size() / unitSize; - hosts.reserve(hostsNum); - VLOG(3) << "Total size:" << val.size() << ", host size:" << unitSize << ", host num:" << hostsNum; - for (decltype(hostsNum) i = 0; i < hostsNum; i++) { - cpp2::HostAddr h; - h.ip_ref() = *reinterpret_cast(val.data() + i * unitSize); - h.port_ref() = *reinterpret_cast(val.data() + i * unitSize + sizeof(int32_t)); - hosts.emplace_back(std::move(h)); - } - return hosts; -} - -cpp2::HostAddr MetaServiceUtilsV1::parseHostKey(folly::StringPiece key) { - cpp2::HostAddr host; - memcpy(reinterpret_cast(&host), key.data() + kHostsTable.size(), sizeof(host)); - return host; -} - -cpp2::HostAddr MetaServiceUtilsV1::parseLeaderKey(folly::StringPiece key) { - cpp2::HostAddr host; - memcpy(reinterpret_cast(&host), key.data() + kLeadersTable.size(), sizeof(host)); - return host; -} - -cpp2::Schema MetaServiceUtilsV1::parseSchema(folly::StringPiece rawData) { - cpp2::Schema schema; - int32_t offset = sizeof(int32_t) + *reinterpret_cast(rawData.begin()); - auto schval = rawData.subpiece(offset, rawData.size() - offset); - apache::thrift::CompactSerializer::deserialize(schval, schema); - return schema; -} - -cpp2::IndexItem MetaServiceUtilsV1::parseIndex(const folly::StringPiece& rawData) { - cpp2::IndexItem item; - apache::thrift::CompactSerializer::deserialize(rawData, item); - return item; -} - -ConfigName MetaServiceUtilsV1::parseConfigKey(folly::StringPiece rawKey) { - std::string key; - auto offset = kConfigsTable.size(); - auto module = *reinterpret_cast(rawKey.data() + offset); - offset += sizeof(cpp2::ConfigModule); - int32_t nSize = *reinterpret_cast(rawKey.data() + offset); - offset += sizeof(int32_t); - auto name = rawKey.subpiece(offset, nSize); - return {module, name.str()}; -} - -cpp2::ConfigItem MetaServiceUtilsV1::parseConfigValue(folly::StringPiece rawData) { - int32_t offset = 0; - cpp2::ConfigType type = *reinterpret_cast(rawData.data() + offset); - offset += sizeof(cpp2::ConfigType); - cpp2::ConfigMode mode = *reinterpret_cast(rawData.data() + offset); - offset += sizeof(cpp2::ConfigMode); - auto value = rawData.subpiece(offset, rawData.size() - offset); - - cpp2::ConfigItem item; - item.type_ref() = type; - item.mode_ref() = mode; - item.value_ref() = value.str(); - return item; -} - -int32_t MetaServiceUtilsV1::parseJobId(const folly::StringPiece& rawKey) { - auto offset = nebula::meta::JobUtil::jobPrefix().size(); - return *reinterpret_cast(rawKey.begin() + offset); -} - -std::tuple, nebula::meta::cpp2::JobStatus, int64_t, int64_t> -MetaServiceUtilsV1::parseJobDesc(const folly::StringPiece& rawVal) { - size_t offset = 0; - - std::string cmd = nebula::meta::JobUtil::parseString(rawVal, offset); - offset += sizeof(size_t) + cmd.length(); - - std::vector paras = nebula::meta::JobUtil::parseStrVector(rawVal, &offset); - - auto status = nebula::meta::JobUtil::parseFixedVal(rawVal, offset); - offset += sizeof(nebula::meta::cpp2::JobStatus); - - auto tStart = nebula::meta::JobUtil::parseFixedVal(rawVal, offset); - offset += sizeof(int64_t); - - auto tStop = nebula::meta::JobUtil::parseFixedVal(rawVal, offset); - - return std::make_tuple(cmd, paras, status, tStart, tStop); -} - -} // namespace nebula::meta::v1 diff --git a/src/meta/upgrade/v1/MetaServiceUtilsV1.h b/src/meta/upgrade/v1/MetaServiceUtilsV1.h deleted file mode 100644 index 189a7dcab25..00000000000 --- a/src/meta/upgrade/v1/MetaServiceUtilsV1.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (c) 2018 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -#ifndef TOOLS_METADATAUPDATETOOL_OLDTHRIFT_METADATAUPDATE_H_ -#define TOOLS_METADATAUPDATETOOL_OLDTHRIFT_METADATAUPDATE_H_ - -#include "common/base/Base.h" -#include "common/base/Status.h" -#include "common/thrift/ThriftTypes.h" -#include "interface/gen-cpp2/meta_types.h" -#include "kvstore/Common.h" -#include "meta/upgrade/v1/gen-cpp2/meta_types.h" - -namespace nebula::meta::v1 { - -const std::string kSpacesTable = "__spaces__"; // NOLINT -const std::string kPartsTable = "__parts__"; // NOLINT -const std::string kHostsTable = "__hosts__"; // NOLINT -const std::string kTagsTable = "__tags__"; // NOLINT -const std::string kEdgesTable = "__edges__"; // NOLINT -const std::string kIndexesTable = "__indexes__"; // NOLINT -const std::string kIndexTable = "__index__"; // NOLINT -const std::string kIndexStatusTable = "__index_status__"; // NOLINT -const std::string kUsersTable = "__users__"; // NOLINT -const std::string kRolesTable = "__roles__"; // NOLINT -const std::string kConfigsTable = "__configs__"; // NOLINT -const std::string kDefaultTable = "__default__"; // NOLINT -const std::string kSnapshotsTable = "__snapshots__"; // NOLINT -const std::string kLastUpdateTimeTable = "__last_update_time__"; // NOLINT -const std::string kLeadersTable = "__leaders__"; // NOLINT -const std::string kCurrJob = "__job_mgr____id"; // NOLINT -const std::string kJob = "__job_mgr_"; // NOLINT -const std::string kJobArchive = "__job_mgr_archive_"; // NOLINT - -using ConfigName = std::pair; - -class MetaServiceUtilsV1 final { - public: - MetaServiceUtilsV1() = delete; - - static std::string spaceVal(const cpp2::SpaceProperties& properties); - - static cpp2::SpaceProperties parseSpace(folly::StringPiece rawData); - - static GraphSpaceID parsePartKeySpaceId(folly::StringPiece key); - - static PartitionID parsePartKeyPartId(folly::StringPiece key); - - static std::vector parsePartVal(folly::StringPiece val); - - static cpp2::HostAddr parseHostKey(folly::StringPiece key); - - static cpp2::HostAddr parseLeaderKey(folly::StringPiece key); - - static cpp2::Schema parseSchema(folly::StringPiece rawData); - - static cpp2::IndexItem parseIndex(const folly::StringPiece& rawData); - - static ConfigName parseConfigKey(folly::StringPiece rawData); - - static cpp2::ConfigItem parseConfigValue(folly::StringPiece rawData); - - static int32_t parseJobId(const folly::StringPiece& rawKey); - - static std:: - tuple, nebula::meta::cpp2::JobStatus, int64_t, int64_t> - parseJobDesc(const folly::StringPiece& rawVal); -}; - -} // namespace nebula::meta::v1 -#endif // TOOLS_METADATAUPDATETOOL_OLDTHRIFT_METADATAUPDATE_H_ diff --git a/src/meta/upgrade/v1/meta.thrift b/src/meta/upgrade/v1/meta.thrift deleted file mode 100644 index 89fb4c1c322..00000000000 --- a/src/meta/upgrade/v1/meta.thrift +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (c) 2020 vesoft inc. All rights reserved. - * - * This source code is licensed under Apache 2.0 License. - */ - -namespace cpp nebula.meta.v1 - -cpp_include "common/thrift/ThriftTypes.h" - -typedef i32 (cpp.type = "nebula::GraphSpaceID") GraphSpaceID -typedef i32 (cpp.type = "nebula::PartitionID") PartitionID -typedef i32 (cpp.type = "nebula::TagID") TagID -typedef i32 (cpp.type = "nebula::EdgeType") EdgeType -typedef i64 (cpp.type = "nebula::EdgeRanking") EdgeRanking -typedef i64 (cpp.type = "nebula::VertexID") VertexID -typedef i32 (cpp.type = "nebula::IndexID") IndexID - -typedef i32 IPv4 -typedef i32 (cpp.type = "nebula::Port") Port - -typedef i64 (cpp.type = "nebula::SchemaVer") SchemaVer - -// These are all data types supported in the graph properties -enum SupportedType { - UNKNOWN = 0, - - // Simple types - BOOL = 1, - INT = 2, - VID = 3, - FLOAT = 4, - DOUBLE = 5, - STRING = 6, - - // Date time - TIMESTAMP = 21, - YEAR = 22, - YEARMONTH = 23, - DATE = 24, - DATETIME = 25, - - // Graph specific - PATH = 41, -} (cpp.enum_strict) - - -struct ValueType { - 1: SupportedType type; - // vtype only exists when the type is a LIST, SET, or MAP - 2: optional ValueType value_type (cpp.ref = true); - // When the type is STRUCT, schema defines the struct - 3: optional Schema schema (cpp.ref = true); -} (cpp.virtual) - -union Value { - 1: i64 int_value; - 2: bool bool_value; - 3: double double_value; - 4: string string_value; - 5: i64 timestamp; -} - -struct ColumnDef { - 1: required string name, - 2: required ValueType type, - 3: optional Value default_value, -} - -struct SchemaProp { - 1: optional i64 ttl_duration, - 2: optional string ttl_col, -} - -struct Schema { - 1: list columns, - 2: SchemaProp schema_prop, -} - -union SchemaID { - 1: TagID tag_id, - 2: EdgeType edge_type, -} - -struct IndexItem { - 1: IndexID index_id, - 2: string index_name, - 3: SchemaID schema_id - 4: string schema_name, - 5: list fields, -} - -struct HostAddr { - 1: IPv4 ip, - 2: Port port, -} - -struct SpaceProperties { - 1: string space_name, - 2: i32 partition_num, - 3: i32 replica_factor, - 4: string charset_name, - 5: string collate_name, -} - -enum ConfigModule { - UNKNOWN = 0x00, - ALL = 0x01, - GRAPH = 0x02, - META = 0x03, - STORAGE = 0x04, -} (cpp.enum_strict) - -enum ConfigType { - INT64 = 0x00, - DOUBLE = 0x01, - BOOL = 0x02, - STRING = 0x03, - NESTED = 0x04, -} (cpp.enum_strict) - -enum ConfigMode { - IMMUTABLE = 0x00, - REBOOT = 0x01, - MUTABLE = 0x02, - IGNORED = 0x03, -} (cpp.enum_strict) - -struct ConfigItem { - 1: ConfigModule module, - 2: string name, - 3: ConfigType type, - 4: ConfigMode mode, - 5: binary value, -} diff --git a/src/storage/test/CMakeLists.txt b/src/storage/test/CMakeLists.txt index 38d59a24f93..b880fd232dd 100644 --- a/src/storage/test/CMakeLists.txt +++ b/src/storage/test/CMakeLists.txt @@ -3,7 +3,6 @@ set(storage_test_deps $ $ $ - $ $ $ $ diff --git a/src/tools/db-dump/CMakeLists.txt b/src/tools/db-dump/CMakeLists.txt index c489c751a6f..423a2070fd7 100644 --- a/src/tools/db-dump/CMakeLists.txt +++ b/src/tools/db-dump/CMakeLists.txt @@ -2,7 +2,6 @@ set(tools_test_deps $ $ $ - $ $ $ $ diff --git a/src/tools/db-upgrade/CMakeLists.txt b/src/tools/db-upgrade/CMakeLists.txt index 674b8973910..48064583506 100644 --- a/src/tools/db-upgrade/CMakeLists.txt +++ b/src/tools/db-upgrade/CMakeLists.txt @@ -11,7 +11,6 @@ nebula_add_executable( $ $ $ - $ $ $ $ diff --git a/src/tools/meta-dump/CMakeLists.txt b/src/tools/meta-dump/CMakeLists.txt index 1e827f5dfce..2394d47eafe 100644 --- a/src/tools/meta-dump/CMakeLists.txt +++ b/src/tools/meta-dump/CMakeLists.txt @@ -7,7 +7,6 @@ nebula_add_executable( $ $ $ - $ $ $ $ diff --git a/src/tools/simple-kv-verify/CMakeLists.txt b/src/tools/simple-kv-verify/CMakeLists.txt index 01e01040542..f37647239cc 100644 --- a/src/tools/simple-kv-verify/CMakeLists.txt +++ b/src/tools/simple-kv-verify/CMakeLists.txt @@ -7,7 +7,6 @@ nebula_add_executable( $ $ $ - $ $ $ $ diff --git a/src/tools/storage-perf/CMakeLists.txt b/src/tools/storage-perf/CMakeLists.txt index bdde2f7bcdb..8ac30954c05 100644 --- a/src/tools/storage-perf/CMakeLists.txt +++ b/src/tools/storage-perf/CMakeLists.txt @@ -2,7 +2,6 @@ set(perf_test_deps $ $ $ - $ $ $ $