WO2020024797A1 - 一种时序数据库表结构改变处理方法 - Google Patents

一种时序数据库表结构改变处理方法 Download PDF

Info

Publication number
WO2020024797A1
WO2020024797A1 PCT/CN2019/096450 CN2019096450W WO2020024797A1 WO 2020024797 A1 WO2020024797 A1 WO 2020024797A1 CN 2019096450 W CN2019096450 W CN 2019096450W WO 2020024797 A1 WO2020024797 A1 WO 2020024797A1
Authority
WO
WIPO (PCT)
Prior art keywords
schema
data
column
version
new
Prior art date
Application number
PCT/CN2019/096450
Other languages
English (en)
French (fr)
Inventor
程洪泽
关胜亮
廖浩均
陶建辉
Original Assignee
北京涛思数据科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京涛思数据科技有限公司 filed Critical 北京涛思数据科技有限公司
Priority to EP19843691.7A priority Critical patent/EP3832478A4/en
Priority to US17/265,278 priority patent/US11586605B2/en
Publication of WO2020024797A1 publication Critical patent/WO2020024797A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2477Temporal data queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • G06F16/213Schema design and management with details for schema evolution support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity

Definitions

  • the invention relates to the field of data processing, and in particular, to a method for processing a structure change of a time-series database table.
  • a data collection point often collects multiple parameters at the same time point, and the number of parameters may change with software or firmware updates.
  • an existing method is to store each collected parameter as an independent time series, which is very flexible, but each sequence needs to save its own time stamp, wasting storage space, and does not Facilitate calculation operations between different parameters collected.
  • Another way is to use the traditional relational database method.
  • Each parameter is a column, and multiple parameters are multiple columns. The advantage of this is that multiple columns share a timestamp. But the disadvantage is obvious. Adding a new parameter requires adding a new column. For a table with a large number of records, it will be an extremely inefficient operation because all existing data must be updated.
  • the purpose of the present invention is to overcome the shortcomings of the prior art and provide a method for changing the structure of a time-series database table.
  • the structure of a table can be changed instantaneously without changing historical data.
  • the definition of new and old structures can be used in parallel, which can increase flexibility. Sex.
  • the invention provides a processing method for changing the structure of a time series database table, which includes the following steps:
  • Each data table has a unique table name ID, and the schema version and column ID are added to the table structure definition;
  • the data node When data is inserted, the data node maintains the schema of each collection point. The application's data insertion request needs to use the version of the schema used. The data node compares the saved schema version with the version of the schema passed by the application. Way to deal with.
  • the increased version of the schema starts from 0 or a certain number, and the schema is modified each time, and the schema version is increased by 1.
  • the column ID starts from 0 or a certain number, and naturally grows.
  • the corresponding column ID is not reused.
  • each column can define a default value.
  • the column name can be modified arbitrarily after being guaranteed to be unique within a table.
  • the data node takes the following steps:
  • a data block and corresponding index block information are created, and a schema definition is stored in the data block or the index block.
  • the method further includes a query step: during the query, the application informs the system of the columns to be processed by the query, the system needs to convert these columns into column IDs, and then sends the query request to the corresponding data node.
  • the method further includes a data node determining a data block that satisfies the condition according to the query condition. If the column to be queried is defined in the data block, it is processed normally, otherwise the default value is returned.
  • the processing method for changing the structure of a time series database table of the present invention can realize:
  • the present invention provides a method for changing the structure of a time-series database table. The method is specifically described below.
  • the definition of the table structure needs a schema version, starting from 0 or a certain number, and modifying the schema each time, adding 1
  • the column ID In addition to the column name and data type of the table structure, the column ID needs a column ID.
  • the column ID starts from 0 or a certain number and grows naturally. Even if a column is deleted, its column ID cannot be reused.
  • Each column can define a default value. If you collect time series data without this column, you can set the default value.
  • Each index block needs to include schema information, including
  • Schema parameters can also be placed in data blocks of data files.
  • the new column needs to be assigned a new column ID according to the principle of increasing, and a default value needs to be provided;
  • the data node maintains a schema for each collection point
  • the data node compares the saved schema version with the schema version passed by the application. If they are consistent, proceed normally. If the application's schema version is small, handle it as an error. However, if the application's schema version is large, it means that the application has been updated and has the latest schema. At this time, the data node needs to take the following steps:
  • the data node first determines the data blocks that meet the conditions according to the query conditions

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种时序数据库表结构改变处理方法,包括每个数据表有唯一的表名ID,表结构中增加schema版本和列ID;每次应用修改表的schema时,将schema版本增加,新增的列按递增的原则分配新的列ID,并提供一缺省值;数据插入时,数据节点维持有每个采集点的schema,应用的数据插入请求需要带所使用的schema的版本,数据节点对保存的schema版本与应用传过来的schema版本进行比较后按照预设的方式进行处理,通过该方法改变表的结构可瞬时完成,无需改变历史数据,新老结构定义可并行使用,能够提高灵活性。

Description

一种时序数据库表结构改变处理方法 技术领域
本发明涉及数据处理领域,具体涉及一种时序数据库表结构改变处理方法。
背景技术
一个数据采集点在同一个时间点往往采集多个参数,而且参数的个数可能随着软件或固件的更新发生改变。为应对这种改变,现有的一种方式是将每个采集的参数作为一个独立的时间序列进行存储,这样十分灵活,但是每个序列都需要保存自己的时间戳,浪费存储空间,而且不便于采集的不同参数之间的计算操作。另外一种方式就是采用传统关系型数据库的方式,每个参数是一列,多个参数就是多列,这样的好处就是多列共享了一个时间戳。但是缺点很明显,增加一新的参数,需要增加新的一列。而对于记录条数海量的表而言,将是极其低效的操作,因为要更新所有现有的数据。
发明内容
本发明的目的在于克服现有技术的不足,提供一种时序数据库表结构改变处理方法,通过该方法改变表的结构可瞬时完成,无需改变历史数据,新老结构定义可并行使用,能够提高灵活性。
本发明提供了一种时序数据库表结构改变处理方法,包括如下步骤:
每个数据表有唯一的表名ID,表结构定义中增加schema版本和列ID;
每次应用修改表的schema时,将schema版本增加,新增的列按递增的原则分配新的列ID,并提供一缺省值;
数据插入时,数据节点维持有每个采集点的schema,应用的数据插入请求需要带所使用的schema的版本,数据节点对保存的schema版本与应用传过来的schema版本进行比较后按照预设的方式进行处理。
进一步地,增加的schema版本从0或某个数开始,每次修改一次schema,schema版本加1。
进一步地,列ID从0或某个数开始,自然增长,某列被删除时对应的列ID也不重复使用。
进一步地,每列能够定义缺省值。
进一步地,如果是删除列,将其从schema中直接删除。
进一步地,修改列的名字时,保证列名字在一张表内的唯一性后可任意修改。
进一步地,进行比较的具体方式为:
如果一致,就正常处理;
如果应用的schema版本小,按出错处理;
如果应用的schema版本大,数据节点采取如下步骤:
a.将该采集点在内存缓存区的数据全部落盘;
b.去元数据节点获取该采集点最新的schema定义;
c.获取最新schema定义后,重新分配新的内存缓存区,将数据写入。
进一步地,数据从缓存区写入磁盘时,创建一数据块和对应的索引块信息,数据块里或者索引块里保存有schema的定义。
进一步地,还包括查询步骤:查询时,应用告知系统需要查询处理的列,系统需要将这些列转换为列ID,然后将查询请求发往相应的数据节点。
进一步地,还包括数据节点根据查询条件,确定满足条件的数据块,如果要查询的列在数据块里有定义,就正常处理,否则返回缺省值。
本发明的时序数据库表结构改变处理方法,可以实现:
1)修改schema瞬间完成,无需修改数据节点上的历史数据,灵活性高;
2)对于插入和查询流程,与传统方式相比,增加的检查所消耗的CPU微不足道,保证功耗的同时,效率提高;
3)应用即使没有更新最新的schema,可继续工作,新旧schema可并行存在,应用性强。
具体实施方式
下面详细说明本发明的具体实施,有必要在此指出的是,以下实施只是用于本发明的进一步说明,不能理解为对本发明保护范围的限制,该领域技术熟练人员根据上述本发明内容对本发明做出的一些非本质的改进和调整,仍然属于本发明的保护范围。
本发明提供了一种时序数据库表结构改变处理方法,下面对该方法进行具体的介绍。
一、表结构(schema)的调整
表结构的定义里需要有schema版本,从0或某个数开始,每次修改一次schema,加1
表结构,列的定义除列名、数据类型外,需要有列ID,列ID从0或某个数开始,自然增长,即使某列被删除,它的列ID不能被重复使用。每列可以定义缺省值,如果采集的时序数据不带此列时,可以设置的缺省值。
二、索引文件里索引块的调整
每个索引块里需要包含schema信息,包括
o数据类型
o字节数
o列ID
Schema参数也可以放在数据文件的数据块里。
三、修改Schema的流程
应用修改表的schema,递交后,维护采集点schema的元数据节点Meta Node只有简单三点,没有其他操作。
1)需要将schema版本增一;
2)新增的列需要按递增的原则分配一新的列ID,而且需要提供一缺省值;
3)如果是删除列,就简单将其从schema中删除。
4)对于修改表或列的名字,只要保证名字的唯一性,可任意修改
四、数据插入流程的调整
1)数据节点维持有每个采集点的schema
2)应用的插入请求需要带所使用的schema的版本
3)数据节点对保存的schema版本与应用传过来的schema版本进行比较。如果一致,就正常处理。如果应用的schema版本小,按出错处理。但如果应用的schema版本大,意味着应用已经更新,已经有最新的schema。这时数据节点需要采取如下步骤:
a.将该采集点在内存缓存区的数据全部落盘;
b.去元数据节点获取该采集点最新的schema定义;
c.获取最新schema后,重新分配新的内存缓存区,将数据写入;
4)数据从缓存区写入磁盘时,需要检查schema版本是否改变,如果已经改变,老的数据块需要关闭,而需要建立一新的数据块,新的数据块里带有新的schema的定义;
五、数据查询流程的调整
1)查询时,应用需要告知系统哪些列需要查询处理,系统需要将这些列换为列ID,然后将查询请求发往相应的数据节点;
2)数据节点根据查询条件,先确定满足条件的数据块;
3)如果要查询的列在数据块里有定义,就正常处理。如果查询的列在数据块里没有定义,就返回缺省值。
尽管为了说明的目的,已描述了本发明的示例性实施方式,但是本领域的技术人员将理解,不脱离所附权利要求中公开的发明的范围和精神的情况下,可以在形式和细节上进行各种修改、添加和替换等的改变,而所有这些改变都应属于本发明所附权利要求的保护范围,并且本发明要求保护的产品各个部门和方法中的各个步骤,可以以任意组合的形式组合在一起。因此,对本发明中所公开的实施方式的描述并非为了限制本发明的范围,而是用于描述本发明。相应地,本发明的范围不受以上实施方式的限制,而是由权利要求或其等同物进行限定。

Claims (9)

  1. 一种时序数据库表结构改变处理方法,其特征在于,包括如下步骤:
    每个数据表有唯一的表名ID,表结构定义中增加schema版本和列ID;
    每次应用修改表的schema时,将schema版本增加,新增的列按递增的原则分配新的列ID,并提供一缺省值;
    数据插入时,数据节点维持有每个采集点的schema,应用的数据插入请求需要带所使用的schema的版本,数据节点对保存的schema版本与应用传过来的schema版本进行比较后按照预设的方式进行处理。
  2. 如权利要求1所述的方法,其特征在于:增加的schema版本从0或某个数开始,每次修改一次schema,schema版本加1。
  3. 如权利要求1所述的方法,其特征在于:列ID从0或某个数开始,自然增长,某列被删除时对应的列ID也不重复使用。
  4. 如权利要求1所述的方法,其特征在于:如果是删除列,将其从schema中直接删除。
  5. 如权利要求1-4任一项所述的方法,其特征在于:修改列的名字时,保证列名字在一张表里的唯一性后可任意修改。
  6. 如权利要求1所述的方法,其特征在于:进行比较的具体方式为:
    如果一致,就正常处理;
    如果应用的schema版本小,按出错处理;
    如果应用的schema版本大,数据节点采取如下步骤:
    a.将该采集点在内存缓存区的数据全部落盘;
    b.去元数据节点获取该采集点最新的schema定义;
    c.获取最新schema定义后,重新分配新的内存缓存区,将数据写入。
  7. 如权利要求6所述的方法,其特征在于:数据从缓存区写入磁盘时,建立一新的数据块和对应的索引块信息,新的数据块里或者索引块里保存有其schema的定义。
  8. 如权利要求1所述的方法,其特征在于:还包括查询步骤:查询时,应用告知系统需要查询处理的列,系统需要将这些列转换为列ID,然后将查询请求发往相应的数据节点。
  9. 如权利要求8所述的方法,其特征在于:还包括数据节点根据查询条件,确定满足条件的数据块,如果要查询的列在数据块里有定义,就正常处理,否则返回缺省值。
PCT/CN2019/096450 2018-08-03 2019-07-18 一种时序数据库表结构改变处理方法 WO2020024797A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP19843691.7A EP3832478A4 (en) 2018-08-03 2019-07-18 TIME SEQUENCE DATABASE TABLE STRUCTURE CHANGE PROCESSING METHOD
US17/265,278 US11586605B2 (en) 2018-08-03 2019-07-18 Processing method for changing time-series database table structure

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810879113.1A CN109189783B (zh) 2018-08-03 2018-08-03 一种时序数据库表结构改变处理方法
CN201810879113.1 2018-08-03

Publications (1)

Publication Number Publication Date
WO2020024797A1 true WO2020024797A1 (zh) 2020-02-06

Family

ID=64920075

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/096450 WO2020024797A1 (zh) 2018-08-03 2019-07-18 一种时序数据库表结构改变处理方法

Country Status (4)

Country Link
US (1) US11586605B2 (zh)
EP (1) EP3832478A4 (zh)
CN (1) CN109189783B (zh)
WO (1) WO2020024797A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189783B (zh) 2018-08-03 2023-10-03 北京涛思数据科技有限公司 一种时序数据库表结构改变处理方法
CN114185914B (zh) * 2022-02-16 2022-04-29 西安热工研究院有限公司 计算标签数据的补算方法、系统、设备及存储介质
CN116226222B (zh) * 2022-12-02 2023-11-07 清华大学 基于时序数据库的数据段标记处理方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070088766A1 (en) * 2005-10-17 2007-04-19 Oracle International Corporation Method and system for capturing and storing multiple versions of data item definitions
CN101167053A (zh) * 2005-04-18 2008-04-23 捷讯研究有限公司 实现基于数据兼容性的版本计划
CN101256522A (zh) * 2007-02-28 2008-09-03 上海西门子医疗器械有限公司 用于医疗设备计算机系统的数据备份/恢复方法
CN102098342A (zh) * 2011-01-31 2011-06-15 华为技术有限公司 一种基于事务级的数据同步方法、装置及系统
CN109189783A (zh) * 2018-08-03 2019-01-11 北京涛思数据科技有限公司 一种时序数据库表结构改变处理方法

Family Cites Families (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5347653A (en) * 1991-06-28 1994-09-13 Digital Equipment Corporation System for reconstructing prior versions of indexes using records indicating changes between successive versions of the indexes
US6865697B2 (en) * 2002-01-18 2005-03-08 International Business Machines Corporation Method and apparatus for reduced error checking of data received by a server from a client
FR2844372B1 (fr) * 2002-09-11 2005-01-14 Michel Zamfiroiu Procede d'organisation d'une base de donnees numeriques sous une forme tracable
US7251669B1 (en) * 2003-03-31 2007-07-31 Microsoft Corporation System and method for database versioning
US7562357B2 (en) * 2004-03-08 2009-07-14 Microsoft Corporation Relational database schema version management
US7707165B1 (en) * 2004-12-09 2010-04-27 Netapp, Inc. System and method for managing data versions in a file system
US20060248182A1 (en) * 2005-05-02 2006-11-02 Polycentric Networks Corporation Formatted and/or tunable QoS data publication, subscription, and/or distribution including dynamic network formation
US8571882B1 (en) * 2006-07-05 2013-10-29 Ronald J. Teitelbaum Peer to peer database
US20100121839A1 (en) * 2007-03-15 2010-05-13 Scott Meyer Query optimization
CN101499069B (zh) * 2008-02-02 2013-06-05 中兴通讯股份有限公司 内存数据库文件的更新方法及更新装置
US10698923B2 (en) * 2009-06-11 2020-06-30 Talari Networks, Inc. Methods and apparatus for providing adaptive private network database schema migration and management processes
US8244698B2 (en) * 2010-07-23 2012-08-14 Google Inc. Encoding a schema version in table names
US9229960B2 (en) * 2013-02-11 2016-01-05 International Business Machines Corporation Database management delete efficiency
US9569468B2 (en) * 2013-05-07 2017-02-14 Red Hat Israel, Ltd. Deploying database upgrades to multiple environments in a different order
CN103810257B (zh) * 2014-01-24 2018-07-13 华为技术有限公司 一种升级软件数据库的方法、装置及设备
US10002372B2 (en) * 2015-09-15 2018-06-19 Sap Se Duplicate check based on generated hash value
CN105630898A (zh) * 2015-12-18 2016-06-01 国云科技股份有限公司 一种适用于应用程序数据库表数据版本切换的方法
CN105868396A (zh) * 2016-04-19 2016-08-17 上海交通大学 内存文件系统的多版本控制方法
US10503727B2 (en) * 2016-04-26 2019-12-10 Servicenow, Inc. System and method for mapping database changes
CN108241724A (zh) * 2017-05-11 2018-07-03 新华三大数据技术有限公司 一种元数据管理方法和装置
CN107861737A (zh) * 2017-11-06 2018-03-30 国云科技股份有限公司 一种大型系统的数据库版本迁移方法
CN108255925B (zh) * 2017-11-10 2021-12-10 平安普惠企业管理有限公司 一种数据表结构变更情况的显示方法及其终端

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101167053A (zh) * 2005-04-18 2008-04-23 捷讯研究有限公司 实现基于数据兼容性的版本计划
US20070088766A1 (en) * 2005-10-17 2007-04-19 Oracle International Corporation Method and system for capturing and storing multiple versions of data item definitions
CN101256522A (zh) * 2007-02-28 2008-09-03 上海西门子医疗器械有限公司 用于医疗设备计算机系统的数据备份/恢复方法
CN102098342A (zh) * 2011-01-31 2011-06-15 华为技术有限公司 一种基于事务级的数据同步方法、装置及系统
CN109189783A (zh) * 2018-08-03 2019-01-11 北京涛思数据科技有限公司 一种时序数据库表结构改变处理方法

Also Published As

Publication number Publication date
EP3832478A4 (en) 2022-04-06
CN109189783A (zh) 2019-01-11
CN109189783B (zh) 2023-10-03
US11586605B2 (en) 2023-02-21
EP3832478A1 (en) 2021-06-09
US20210279223A1 (en) 2021-09-09

Similar Documents

Publication Publication Date Title
US20200257669A1 (en) Kvs tree
US20200334295A1 (en) Merge tree garbage metrics
US20200410005A1 (en) Heterogenous key-value sets in tree database
WO2020024797A1 (zh) 一种时序数据库表结构改变处理方法
US20200334294A1 (en) Merge tree modifications for maintenance operations
US20180225316A1 (en) Stream selection for multi-stream storage devices
EP3196781A1 (en) Method and apparatus for deleting duplicate data
WO2017096939A1 (zh) 一种在基于HDFS的spark-sql大数据处理系统上建立索引的方法
WO2017092470A1 (zh) 数据存储方法和装置
US20140122022A1 (en) Processing time series data from multiple sensors
US20130254240A1 (en) Method of processing database, database processing apparatus, computer program product
JP2008533612A5 (zh)
US11269954B2 (en) Data searching method of database, apparatus and computer program for the same
CN108170815B (zh) 一种数据处理方法、装置及存储介质
WO2010084754A1 (ja) データベースシステム、データベース管理方法、データベース構造および記憶媒体
CN110263057B (zh) 一种rowid映射表的存储和查询方法及装置
JP6361199B2 (ja) 情報記憶システム
CN104731716A (zh) 一种数据存储方法
JP2018526740A5 (zh)
JP6020582B2 (ja) 情報処理装置
Lam et al. Garbage collection for multi-version index on flash memory
RU2011137977A (ru) Реляционная база данных и способ управления реляционной базой данных
TWI460598B (zh) 分支映射編碼處理方法
CN114579624A (zh) 数据处理方法、设备、存储介质及计算机程序产品
JP2000057046A (ja) データ管理方法及び装置、データ管理システム、記録媒体

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19843691

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2019843691

Country of ref document: EP

Effective date: 20210303