创建tag index时遇到[ERROR (-8)]: invalid parm!

  • nebula 版本:2.0-preview
  • 部署方式(分布式 / 单机 / Docker / DBaaS):docker
  • 硬件信息
    • 磁盘( 必须为 SSD ,不支持 HDD)
    • CPU、内存信息:
  • 出问题的 Space 的创建方式:执行 describe space xxx;
(root@nebula) [full_kg]> describe space full_kg
+----+-----------+------------------+----------------+---------+------------+-------------------+
| ID | Name      | Partition Number | Replica Factor | Charset | Collate    | Vid Type          |
+----+-----------+------------------+----------------+---------+------------+-------------------+
| 70 | "full_kg" | 100              | 1              | "utf8"  | "utf8_bin" | "FIXED_STRING(8)" |
+----+-----------+------------------+----------------+---------+------------+-------------------+
Got 1 rows (time spent 647/1094 us)

Mon, 23 Nov 2020 10:04:26 UTC
  • 问题的具体描述

如果有日志或者代码,记得用 Markdown 语法(下面语法)包裹它们提高阅读体验,让回复者更快解决问题哟~~

终端下创建tag index时遇到 [ERROR (-8)]: invalid parm! 错误。

终端显示如下:


(root@nebula) [full_kg]> CREATE TAG IF NOT EXISTS VTag(name string);
Execution succeeded (time spent 1326/1717 us)

Mon, 23 Nov 2020 09:48:43 UTC

(root@nebula) [full_kg]> describe tag VTag;
+--------+----------+-------+---------+
| Field  | Type     | Null  | Default |
+--------+----------+-------+---------+
| "name" | "string" | "YES" |         |
+--------+----------+-------+---------+
Got 1 rows (time spent 1331/1727 us)

Mon, 23 Nov 2020 09:48:53 UTC

(root@nebula) [full_kg]> CREATE TAG INDEX IF NOT EXISTS VTag_Index on VTag(name); 
[ERROR (-8)]: invalid parm!

Mon, 23 Nov 2020 09:49:02 UTC

metad日志如下:

E1123 09:26:06.494920   121 CreateTagIndexProcessor.cpp:119] No type length set : name

metad代码段(链接):

...
    for (auto &field : fields) {
        auto iter = std::find_if(schemaCols.begin(), schemaCols.end(),
                                 [field](const auto& col) {
                                     return field.get_name() == col.get_name();
                                 });
        if (iter == schemaCols.end()) {
            LOG(ERROR) << "Field " << field.get_name() << " not found in Tag " << tagName;
            handleErrorCode(cpp2::ErrorCode::E_NOT_FOUND);
            onFinished();
            return;
        }
        cpp2::ColumnDef col = *iter;
        if (col.type.get_type() == meta::cpp2::PropertyType::STRING) {
            if (!field.__isset.type_length) {
                LOG(ERROR) << "No type length set : " << field.get_name();  /******<-----This line*******/
                handleErrorCode(cpp2::ErrorCode::E_INVALID_PARM);
                onFinished();
                return;
            }
            col.type.set_type(meta::cpp2::PropertyType::FIXED_STRING);
            col.type.set_type_length(*field.get_type_length());
        } else if (field.__isset.type_length) {
            LOG(ERROR) << "No need to set type length : " << field.get_name();
            handleErrorCode(cpp2::ErrorCode::E_INVALID_PARM);
            onFinished();
            return;
        }
        columns.emplace_back(col);
    }
...

对字符串类型的属性创建索引要指定长度。文档:
https://docs.nebula-graph.io/2.0/3.ngql-guide/14.index-statements/1.create-index/#create_single-property_index

4 个赞

已解决