From 0192967f0f8692a2b5638ffc9f295cf3382c1759 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Tue, 2 Aug 2022 18:39:03 +0800 Subject: [PATCH] docs: add a example for how subtable name is generated --- docs/en/14-reference/13-schemaless/13-schemaless.md | 8 ++++++++ docs/zh/14-reference/13-schemaless/13-schemaless.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md index acbbb1cd3c..815a2123a3 100644 --- a/docs/en/14-reference/13-schemaless/13-schemaless.md +++ b/docs/en/14-reference/13-schemaless/13-schemaless.md @@ -67,6 +67,14 @@ Schemaless writes process row data according to the following principles. Note that tag_key1, tag_key2 are not the original order of the tags entered by the user but the result of using the tag names in ascending order of the strings. Therefore, tag_key1 is not the first tag entered in the line protocol. The string's MD5 hash value "md5_val" is calculated after the ranking is completed. The calculation result is then combined with the string to generate the table name: "t_md5_val". "t*" is a fixed prefix that every table generated by this mapping relationship has. +>Example for how subtable name is generated: +> +> - Format super table name, tag name and tag value to a new string: "`measurement`,`tag_key1`=3i64,`tag_key2`=3i64" +> - Encrypt above string with MD5 to following string: "68e766edd3747cdeec5a96caeaed7721" +> - Split encrypted string from the middle into two new strings and reverse both strings: "de7c74d3ed66e768","2177edeaca965aec" +> - Combine above strings with prefix t_ and get a new string which is the subtable name: "t_de7c74d3ed66e7682177edeaca965aec" + + 2. If the super table obtained by parsing the line protocol does not exist, this super table is created. If the subtable obtained by the parse line protocol does not exist, Schemaless creates the sub-table according to the subtable name determined in steps 1 or 2. 4. If the specified tag or regular column in the data row does not exist, the corresponding tag or regular column is added to the super table (only incremental). diff --git a/docs/zh/14-reference/13-schemaless/13-schemaless.md b/docs/zh/14-reference/13-schemaless/13-schemaless.md index f2712f2814..068c00afe4 100644 --- a/docs/zh/14-reference/13-schemaless/13-schemaless.md +++ b/docs/zh/14-reference/13-schemaless/13-schemaless.md @@ -71,6 +71,14 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000 需要注意的是,这里的 tag_key1, tag_key2 并不是用户输入的标签的原始顺序,而是使用了标签名称按照字符串升序排列后的结果。所以,tag_key1 并不是在行协议中输入的第一个标签。 排列完成以后计算该字符串的 MD5 散列值 "md5_val"。然后将计算的结果与字符串组合生成表名:“t_md5_val”。其中的 “t\*” 是固定的前缀,每个通过该映射关系自动生成的表都具有该前缀。 +>子表名生成规则示例: +> +> - 格式化超级表名,标签名以及标签值组成字符串:"`measurement`,`tag_key1`=3i64,`tag_key2`=3i64" +> - 对上面的字符串进行 md5 加密,加密后的字符串为: "68e766edd3747cdeec5a96caeaed7721" +> - 将加密的字符串冲中间分成两部分,然后分别倒置:"de7c74d3ed66e768","2177edeaca965aec" +> - 将倒置后的字符串与前缀 t_ 组成一个新的字符串,新的字符串就是子表名:"t_de7c74d3ed66e7682177edeaca965aec" + + 2. 如果解析行协议获得的超级表不存在,则会创建这个超级表。 3. 如果解析行协议获得子表不存在,则 Schemaless 会按照步骤 1 或 2 确定的子表名来创建子表。 4. 如果数据行中指定的标签列或普通列不存在,则在超级表中增加对应的标签列或普通列(只增不减)。 -- GitLab