A real-time database and model construction, loading, data subscription, synchronization method
Patent Information
- Application Number
- CN202311659079.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2043-12-05
AI Technical Summary
但是,该方法仅涉及系间数据的同步,并未能提供一种统一的管理方式
[0043]1、本发明实现了安全平台数据的统一组织和管理,避免了分散管理的混乱,以及数据结构定义不合理导致的内存资源浪费;
Smart Images

Figure CN117851509B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to train signal control systems, and more particularly to a real-time database and a method for model construction, loading, data subscription, and synchronization. Background Technology
[0002] Traditional two-out-of-two security platform software typically consists of multiple functional modules, with data scattered and independent across modules. Data sharing between modules is extremely inconvenient. Furthermore, loading platform configuration data and performing critical functions such as consistency comparison of dual-system configurations and master-slave data synchronization require repeated implementation by each module. This not only increases repetitive development workload but also hinders data maintenance. Therefore, a unified method for organizing and managing two-out-of-two security platforms is lacking.
[0003] CN116436765A discloses a data synchronization method, device, and medium for a secure platform based on a 2x2-out-of-2 approach. The method includes: 100, performing an output data consistency comparison; if the output data between systems is inconsistent, proceed to step 102; otherwise, proceed to step 101; 101, performing a synchronization data consistency comparison; if the synchronization data between systems is inconsistent, proceed to step 104; otherwise, proceed to step 103; 102, the primary system needs to send all protocol synchronization data and application synchronization data to the backup system; the backup system needs to receive and learn all protocol synchronization data and application synchronization data from the primary system; 103, the primary system does not need to send any synchronization data to the backup system; the backup system does not need to receive and learn any synchronization data from the primary system; 104, the primary system sends synchronization data of CRC inconsistency type to the backup system based on the CRC consistency comparison result; the backup system needs to learn all synchronization data of inconsistency type. However, this method only involves inter-system data synchronization and does not provide a unified management approach. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the existing technology and provide a real-time database and model construction, loading, data subscription, and synchronization method. Based on this real-time database system, it is convenient to realize some key functions commonly found in security platforms, such as data sharing, configuration loading and reading, configuration consistency comparison, master-slave data synchronization, master-slave status interaction, and input-output consistency comparison between modules of a two-out-of-two security platform.
[0005] The objective of this invention can be achieved through the following technical solutions:
[0006] According to a first aspect of the present invention, a real-time database suitable for a two-out-of-two security platform is provided, wherein the real-time database is an independent functional module in the two-out-of-two security platform, provides an external interface, and realizes data interaction.
[0007] As a preferred technical solution, the real-time database includes:
[0008] Database model customization module: used to customize the real-time database model through XML files, including the definition of tablespaces, real-time tables and data columns;
[0009] Data loading module: Used to create tablespaces, real-time tables, and index tables associated with real-time tables based on the database model. Based on the association between real-time tables set by the user in the database model and the platform configuration, it loads relevant configuration data from the platform configuration file into the corresponding real-time tables and generates index tables based on the keywords of each table.
[0010] Real-time data subscription module: The data to be subscribed is specified by the user when building the database model. At different stages of each main cycle, the user calls the interface to obtain subscription data on different topics from the real-time database and sends the subscription data to the peer system through the bus. After receiving the subscription data, the peer system calls the interface to write the subscription data into the real-time database and queries the subscribed data through the query interface provided by the real-time database.
[0011] Real-time data query module: Used to open a real-time table by calling the interface. After successful opening, it returns a real-time table handle and allows data to be queried sequentially or by keyword from the real-time table by calling the corresponding interface.
[0012] Real-time data addition and modification module: After opening the real-time table, it is used to call the corresponding interface to modify the data of the corresponding record row or the corresponding keyword row in the real-time table as needed. If the data to be modified is found to be keyword column data, the data modification failure will be indicated. At the same time, it is used to add data to the real-time table by calling the corresponding interface. If the keyword of the data to be added already exists in the real-time table, the data of the corresponding keyword row in the table will be modified according to the data to be added. Otherwise, a new data will be added to the real-time table.
[0013] Real-time data deletion module: Used to call the corresponding interface to delete the data of the corresponding record row or the corresponding keyword row in the real-time table after opening the real-time table;
[0014] Real-time data synchronization module: After the output processing of the primary system and the backup system is completed in each primary cycle, the corresponding interface is called to obtain the check code of all dirty data in this cycle, and the check code is sent to the backup system through the bus. After the primary system obtains the check code of the backup system, it checks whether the check code of the backup system is consistent with that of the primary system. If they are inconsistent, the primary system obtains all data to be synchronized and sends the synchronization data to the backup system through the bus. After receiving the synchronization data, the backup system writes the synchronization data into the real-time database.
[0015] Real-time data persistence module: Based on the persistent data specified by the user when building the database model, the real-time data is persisted to the permanent storage medium during platform operation or when the platform crashes.
[0016] As a preferred technical solution, the definition of the tablespace includes the tablespace name and the location of the tablespace in memory. For data that requires strong isolation, the tablespace is defined in different memory regions.
[0017] As a preferred technical solution, in the database model customization module, the definition of the real-time table includes the table name, maximum number of records, data source, and whether persistence is required. The maximum number of records indicates the maximum number of rows that the table can hold, used to calculate the memory space used by the table. The data source indicates whether the initial data of the table is loaded from the corresponding configuration file. Whether persistence is required indicates whether the data of the table needs to be written to a permanent storage medium after the platform crashes.
[0018] As a preferred technical solution, in the database model customization module, the definition of data columns includes column name, column number, column data type, key column, whether synchronization is required, whether subscription is required, the associated topic, and whether it is a parameter column or a data column. Among them, the data in the key column cannot be duplicated, and an index table will be generated based on the key column; whether synchronization is required indicates that the data in this column participates in the master-slave data synchronization; whether subscription is required indicates that the data in this column participates in the data interaction between systems; the parameter column indicates that the data in this column is loaded from the configuration file and cannot be changed after loading; the data column indicates that the data in this column can be dynamically modified during runtime.
[0019] As a preferred technical solution, the index table is generated using a hash algorithm.
[0020] As a preferred technical solution, the data loading module also provides a consistency comparison function. After the real-time database is successfully initialized, the user can obtain the data information in the current real-time database by calling the corresponding interface, including the data check code information and the data version information, and send the data information to the counterpart system through the bus. After receiving the data information, the counterpart system performs a consistency comparison of the dual-system configuration.
[0021] As a preferred technical solution, in the real-time data addition and modification module, if the data column to be modified or added is set as a synchronous data column, then after the modification or addition operation is performed, the data in that column will be marked as dirty data and will be included in the calculation of the synchronous data CRC. If the CRC of the synchronous data of the primary and backup systems are inconsistent, the data in that column will be packaged by the primary system and sent to the backup system.
[0022] As a preferred technical solution, in the real-time data deletion module, the deleted data rows are only marked as deleted, and when the user adds data to the real-time table, the deleted data rows will be overwritten.
[0023] According to a second aspect of the present invention, a database model construction method is provided, applicable to real-time databases as described above, the method comprising the following steps:
[0024] Step 100: Create a tablespace model, where tablespace = {name, memory location};
[0025] Step 101: Establish a real-time table model. Real-time table = {table name, maximum number of records, data source, whether persistence is required}.
[0026] Step 102: Establish the data column model. Data column = {column name, column number, column data type, key column, whether synchronization is required, whether subscription is required and the associated topic, whether it is a parameter column or a data column}.
[0027] According to a third aspect of the present invention, a method for loading a database is provided, applicable to the real-time database described above, the method comprising the following steps:
[0028] Step 201: After the security platform is powered on and started, the user initializes the real-time database, and the real-time database builds a database model according to the configuration.
[0029] Step 202: The real-time database loads configuration data from the corresponding configuration file into the real-time table according to the model configuration;
[0030] Step 203: The primary and backup system users obtain configuration data information and send it to the counterpart system via the bus;
[0031] Step 204: After receiving the configuration data information, the system performs an inter-system configuration consistency comparison. If the comparison passes, the system continues to run; otherwise, it crashes.
[0032] According to a fourth aspect of the present invention, a data subscription method for a database is provided, applicable to real-time databases as described above, the method comprising the following steps:
[0033] Step 301: The primary and backup system users obtain the subscription data of the specified Topic and send the subscription data to the peer system via the bus;
[0034] Step 302: After receiving the subscription data, the system writes the subscription data into the real-time table;
[0035] Step 303: The user calls the real-time data reading interface to retrieve the subscribed data from the real-time table.
[0036] According to a fifth aspect of the present invention, a data synchronization method for a database is provided, applicable to real-time databases as described above, the method comprising the following steps:
[0037] Step 401: The two systems simultaneously process input data and output data. During the processing, adding, modifying, or deleting data in the real-time database will generate dirty data.
[0038] Step 402: After the output processing is completed, the user obtains all dirty data information generated in this cycle and sends it to the system via the bus;
[0039] Step 403: After receiving the dirty data information from the backup system, the primary system compares it with the local dirty data information;
[0040] Step 404: If the comparison results are inconsistent, the primary system retrieves all data to be synchronized from the real-time database and sends it to the backup system via the bus.
[0041] Step 405: After receiving the synchronization data from the master system, the backup system writes the synchronization data into the real-time database, thus completing the synchronization of data between systems.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] 1. This invention achieves unified organization and management of security platform data, avoiding the chaos of decentralized management and the waste of memory resources caused by unreasonable data structure definitions;
[0044] 2. This invention designs a unified configuration loading method, which makes it easier to achieve consistency comparison and configuration reading;
[0045] 3. This invention simplifies the data exchange between systems and makes the exchanged data content clearer through a subscription method;
[0046] 4. The synchronization method designed in this invention, which only targets changing data, makes inter-system data synchronization more efficient and reduces bus bandwidth usage. Attached Figure Description
[0047] Figure 1 This is an architecture diagram of the security platform software.
[0048] Figure 2 This is a schematic diagram of the structure of a real-time database;
[0049] Figure 3 Flowchart for configuring loading and consistency comparison for real-time databases;
[0050] Figure 4 Flowchart for real-time data subscription;
[0051] Figure 5 This is a flowchart of the real-time data synchronization process. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0053] Example 1
[0054] This embodiment provides a real-time database suitable for a two-out-of-two safety platform in the rail transit field, such as... Figure 1 As shown, the real-time database is an independent functional module in the two-out-of-two security platform, providing external interfaces to realize data interaction. The ASW, MIDWARE, and CORE modules can read configuration and share data through the real-time database; the CORE module uses the interface provided by the real-time database to perform inter-department configuration consistency comparison, inter-department data subscription, and inter-department data synchronization.
[0055] like Figure 2 As shown, the real-time database includes:
[0056] (1) Database model custom module 100
[0057] The database model customization module provides users with a way to customize real-time database models via XML files. This module specifically includes the definition of tablespaces, real-time tables, and data columns.
[0058] The definition of a tablespace includes the tablespace name and its location in memory. For data that requires strong isolation, tablespaces can be defined in different memory regions.
[0059] The definition of a real-time table includes the table name, maximum number of records, data source, and whether persistence is required. The maximum number of records indicates the maximum number of rows the table can hold, used to calculate the memory space used by the table. The data source indicates whether the table's initialization data is loaded from the corresponding configuration file. Whether persistence is required indicates whether the table's data needs to be written to permanent storage media after a platform crash.
[0060] The definition of a data column includes column name, column number, column data type, key column, whether synchronization is required, whether subscription is required, the associated topic, and whether it is a parameter column or a data column. Among them, the data in the key column cannot be duplicated, and an index table will be generated based on the key column; whether synchronization is required indicates that the data in this column participates in the master-slave data synchronization; whether subscription is required indicates that the data in this column participates in the data interaction between systems; the parameter column indicates that the data in this column is loaded from the configuration file and cannot be changed after loading; the data column indicates that the data in this column can be dynamically modified during runtime.
[0061] (2) Data loading module 200
[0062] The real-time database provides the following interfaces:
[0063] bool initDatabase();
[0064] int getDatabaseInfo(void*dbInfo);
[0065] int cmpDatabaseInfo(void*dbInfo,int size);
[0066] Users can call the `initDatabase` interface to initialize the real-time database. The real-time database first creates tablespaces, real-time tables, and associated index tables based on the database model. Then, according to the association between the real-time tables set by the user in the database model and the platform configuration, it loads relevant configuration data from the platform configuration file into the corresponding real-time tables and generates an index table based on the key of each table. In this embodiment, due to the real-time requirements of the security platform, the index table is generated using a hash algorithm.
[0067] After the real-time database is successfully initialized, users can call the getDatabaseInfo interface to obtain the data information in the current real-time database, including the data checksum information, data version information, etc., and then send the data information to the peer system through the bus. After receiving the data information, the peer system calls the cmpDatabaseInfo interface to perform a consistency comparison of the dual system configuration.
[0068] (3) Real-time data subscription module 300
[0069] The real-time database provides the following interfaces:
[0070] int getSubscribedData(int topic,void*buffer,int maxSize);
[0071] bool setSubscribedData(int topic,void*buffer,int size);
[0072] The subscribed data is specified by the user when building the database model. At different stages of each main cycle, the user calls the getSubscribedData interface to retrieve subscription data for different topics from the real-time database and sends the subscription data to the peer system through the bus. After receiving the subscription data, the peer system calls the setSubscribedData interface to write the subscription data into the real-time database and queries the subscribed data through the query interface provided by the real-time database.
[0073] (4) Real-time data query module 400
[0074] The real-time database provides the following interfaces:
[0075] HANDLE openTable(char*tableName);
[0076] int getRecordNum(HANDLE handle);
[0077] void*getRecord(HANDLE handle,int index);
[0078] void*getRecordByKey(HANDLE handle,void*key);
[0079] This is used to open a real-time table by calling the `openTable` interface. Upon successful opening, it returns a handle to the real-time table. Data can be retrieved sequentially from the real-time table using the `getRecordNum` and `getRecord` interfaces, or by keyword using the `getRecordByKey` interface. The real-time table can be opened and queried by multiple modules simultaneously, thus enabling data sharing between modules.
[0080] (5) Real-time data addition and modification module 500
[0081] The real-time database provides the following interfaces:
[0082] bool modifyRecord(HANDLE handle,int index,void*record);
[0083] bool modifyRecordByKey(HANDLE handle,void*key,void*record);
[0084] bool addRecord(HANDLE handle,void*record);
[0085] After opening the real-time table, users can modify the data in the real-time table. They can call the modifyRecord interface to modify the data of the corresponding record row, or call the modifyRecordByKey interface to modify the data of the corresponding key row. When modifying data, it is not allowed to modify the data of the key column, because it will cause index disorder. Therefore, when modifying data, the real-time database will check whether the key has been modified. If it has been modified, it will prompt that the data modification failed.
[0086] Users can call the addRecord interface to add data to the real-time table. If the key of the data to be added already exists in the real-time table, it will actually modify the data in the corresponding key row of the table. Otherwise, a new data will be added to the real-time table, and the real-time database will update the index table based on the key of the new data.
[0087] If a modified or added data column is set as a synchronous data column, the data in that column will be marked as dirty data after the modification or addition operation is performed, and will be included in the calculation of the synchronous data CRC. If the synchronous data CRC of the primary and backup systems are inconsistent, the data in that column will be packaged by the primary system and sent to the backup system.
[0088] (6) Real-time data deletion module 600
[0089] The real-time database provides the following interfaces:
[0090] bool deleteRecord(HANDLE handle,int index);
[0091] bool deleteRecordByKey(HANDLE handle,void*key);
[0092] After opening the real-time table, users can delete data in the real-time table. They can call the deleteRecord interface to delete the data of the corresponding record row, or call the deleteRecordByKey interface to delete the data of the corresponding key row. To prevent index reordering after data deletion and to improve deletion efficiency, the deleted data rows are only marked as deleted. When users add data to the real-time table, the deleted data rows will be overwritten.
[0093] (7) Real-time data synchronization module 700
[0094] int getDirtyInfo();
[0095] int getDirtyData(void*buffer,int maxSize);
[0096] bool setDirtyData(void*data,int size);
[0097] After the primary and backup systems finish processing the output of each primary cycle, the user calls the getDirtyInfo interface to obtain the checksum of all dirty data in this cycle and sends the checksum to the backup system via the bus. After the primary system obtains the checksum of the backup system, it checks whether the checksum of the backup system is consistent with that of the primary system. If they are inconsistent, the primary system calls the getDirtyData interface to obtain all data to be synchronized and sends the synchronization data to the backup system via the bus. After receiving the synchronization data, the backup system calls the setDirtyData interface to write the synchronization data into the real-time database.
[0098] (8) Real-time data persistence module 800
[0099] The real-time database provides the following interfaces:
[0100] bool dataPersistence();
[0101] The real-time data persistence module persists real-time data to permanent storage media based on the persistent data specified by the user when building the database model, during platform operation or when the platform crashes.
[0102] The above is an introduction to the database structure embodiments. The following method embodiments will further illustrate the solution of the present invention.
[0103] Example 2
[0104] This embodiment provides a database model construction method, applicable to the real-time database as described in Embodiment 1 above. The method includes the following steps:
[0105] Step 100: Create a tablespace model, where tablespace = {name, memory location};
[0106] Step 101: Establish a real-time table model. Real-time table = {table name, maximum number of records, data source, whether persistence is required}.
[0107] Step 102: Establish the data column model. Data column = {column name, column number, column data type, key column, whether synchronization is required, whether subscription is required and the associated topic, whether it is a parameter column or a data column}.
[0108] Example 3
[0109] like Figure 3 As shown, this embodiment provides a database loading method applicable to the real-time database described in Embodiment 1 above. The method includes the following steps:
[0110] Step 201: After the security platform powers on and starts up, the user calls the initDatabase interface to initialize the real-time database, and the real-time database builds a database model according to the configuration.
[0111] Step 202: The real-time database loads configuration data from the corresponding configuration file into the real-time table according to the model configuration;
[0112] Step 203: The primary and backup system users call the getDatabaseInfo interface to obtain configuration data information and send it to the peer system via the bus;
[0113] Step 204: After receiving the configuration data information, the system calls the cmpDatabaseInfo interface to compare the configuration consistency between systems. If the comparison passes, the system continues to run; otherwise, it crashes.
[0114] Example 4
[0115] like Figure 4 As shown, this embodiment provides a data subscription method for a database, applicable to the real-time database described in Embodiment 1 above. The method includes the following steps:
[0116] Step 301: The primary and backup system users call the getSubscribedData interface to obtain the subscription data of the specified Topic, and send the subscription data to the peer system through the bus;
[0117] Step 302: After receiving the subscription data, the system calls the setSubscribedData interface to write the subscription data into the real-time table;
[0118] Step 303: The user calls the real-time data reading interface to retrieve the subscribed data from the real-time table.
[0119] Example 5
[0120] like Figure 5 As shown, this embodiment provides a database data synchronization method, applicable to real-time databases as described in Embodiment 1 above. The method includes the following steps:
[0121] Step 401: The two systems simultaneously process input data and output data. During the processing, adding, modifying, or deleting data in the real-time database will generate dirty data.
[0122] Step 402: After the output processing is completed, the user calls the getDirtyInfo interface to obtain all dirty data information generated in this cycle and sends it to the system via the bus.
[0123] Step 403: After receiving the dirty data information from the backup system, the primary system compares it with the local dirty data information;
[0124] Step 404: If the comparison results are inconsistent, the primary system calls the getDirtyData interface to retrieve all data to be synchronized from the real-time library and sends it to the backup system via the bus.
[0125] Step 405: After receiving the synchronization data from the primary system, the backup system calls the setDirtyData interface to write the synchronization data into the real-time database, thus completing the synchronization of data between systems.
[0126] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A real-time database suitable for a two-out-of-two security platform, characterized in that, The real-time database is an independent functional module in the two-out-of-two security platform, providing external interfaces to enable data interaction; The real-time database includes: Database model customization module: used to customize the real-time database model through XML files, including the definition of tablespaces, real-time tables and data columns; Data loading module: Used to create tablespaces, real-time tables, and index tables associated with real-time tables based on the database model. Based on the association between real-time tables set by the user in the database model and the platform configuration, it loads relevant configuration data from the platform configuration file into the corresponding real-time tables and generates index tables based on the keywords of each table. Real-time data subscription module: The data to be subscribed is specified by the user when building the database model. At different stages of each main cycle, the user calls the interface to obtain subscription data on different topics from the real-time database and sends the subscription data to the peer system through the bus. After receiving the subscription data, the peer system calls the interface to write the subscription data into the real-time database and queries the subscribed data through the query interface provided by the real-time database. Real-time data query module: Used to open a real-time table by calling the interface. After successful opening, it returns a real-time table handle and allows data to be queried sequentially or by keyword from the real-time table by calling the corresponding interface. Real-time data addition and modification module: After opening the real-time table, it is used to call the corresponding interface to modify the data of the corresponding record row or the corresponding keyword row in the real-time table as needed. If the data to be modified is found to be keyword column data, the data modification failure will be indicated. At the same time, it is used to add data to the real-time table by calling the corresponding interface. If the keyword of the data to be added already exists in the real-time table, the data of the corresponding keyword row in the table will be modified according to the data to be added. Otherwise, a new data will be added to the real-time table. Real-time data deletion module: Used to call the corresponding interface to delete the data of the corresponding record row or the corresponding keyword row in the real-time table after opening the real-time table; Real-time data synchronization module: After the output processing of the primary system and the backup system is completed in each primary cycle, the corresponding interface is called to obtain the check code of all dirty data in this cycle, and the check code is sent to the backup system through the bus. After the primary system obtains the check code of the backup system, it checks whether the check code of the backup system is consistent with that of the primary system. If they are inconsistent, the primary system obtains all data to be synchronized and sends the synchronization data to the backup system through the bus. After receiving the synchronization data, the backup system writes the synchronization data into the real-time database. Real-time data persistence module: Based on the persistent data specified by the user when building the database model, the real-time data is persisted to the permanent storage medium during platform operation or when the platform crashes.
2. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, The definition of a tablespace includes the tablespace name and its location in memory. For data that requires strong isolation, the tablespace is defined in different memory regions.
3. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, In the database model customization module, the definition of a real-time table includes the table name, maximum number of records, data source, and whether persistence is required. The maximum number of records indicates the maximum number of rows that the table can hold, used to calculate the memory space used by the table. The data source indicates whether the initial data of the table is loaded from the corresponding configuration file. Whether persistence is required indicates whether the data of the table needs to be written to permanent storage media after the platform crashes.
4. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, In the database model customization module, the definition of a data column includes column name, column number, column data type, key column, whether synchronization is required, whether subscription is required, the associated topic, and whether it is a parameter column or a data column. The key column data cannot be duplicated, and an index table will be generated based on the key column. Whether synchronization is required indicates that the column data participates in master-slave data synchronization; whether subscription is required indicates that the column data participates in inter-system data interaction; the parameter column indicates that the data in this column is loaded from a configuration file and cannot be changed after loading; the data column indicates that the data in this column can be dynamically modified during runtime.
5. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, The index table is generated using a hash algorithm.
6. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, The data loading module also provides a consistency comparison function. After the real-time database is successfully initialized, the user can obtain the data information in the current real-time database by calling the corresponding interface, including the data check code information and the data version information, and send the data information to the counterpart system through the bus. After receiving the data information, the counterpart system performs a consistency comparison of the dual-system configuration.
7. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, In the real-time data addition and modification module, if the data column to be modified or added is set as a synchronous data column, the data in that column will be marked as dirty data after the modification or addition operation is performed, and will be included in the calculation of the synchronous data CRC. If the CRC of the synchronous data of the primary and backup systems are inconsistent, the data in that column will be packaged by the primary system and sent to the backup system.
8. A real-time database suitable for a two-out-of-two security platform according to claim 1, characterized in that, In the real-time data deletion module, deleted data rows are only marked as deleted. When a user adds data to the real-time table, the deleted data rows will be overwritten.
9. A database model construction method, characterized in that, Applicable to any of the real-time databases described in claims 1-8, the method includes the following steps: Step 100: Create a tablespace model, where tablespace = {name, memory location}; Step 101: Establish a real-time table model, where the real-time table = {table name, maximum number of records, data source, and whether persistence is required}. Step 102: Establish the data column model. Data column = {column name, column number, column data type, key column, whether synchronization is required, whether subscription is required and the associated topic, whether it is a parameter column or a data column}.
10. A method for loading a database, characterized in that, Applicable to any of the real-time databases described in claims 1-8, the method includes the following steps: Step 201: After the security platform is powered on and started, the user initializes the real-time database, and the real-time database builds a database model according to the configuration. Step 202: The real-time database loads configuration data from the corresponding configuration file into the real-time table according to the model configuration; Step 203: The primary and backup system users obtain configuration data information and send it to the counterpart system via the bus; Step 204: After receiving the configuration data information, the system performs an inter-system configuration consistency comparison. If the comparison passes, the system continues to run; otherwise, it crashes.
11. A data subscription method for a database, characterized in that, Applicable to any of the real-time databases described in claims 1-9, the method includes the following steps: Step 301: The primary and backup system users obtain the subscription data of the specified Topic and send the subscription data to the peer system via the bus; Step 302: After receiving the subscription data, the system writes the subscription data into the real-time table; Step 303: The user calls the real-time data reading interface to retrieve the subscribed data from the real-time table.
12. A database data synchronization method, characterized in that, Applicable to any of the real-time databases described in claims 1-9, the method includes the following steps: Step 401: The two systems simultaneously process input data and output data. During the processing, adding, modifying, or deleting data in the real-time database will generate dirty data. Step 402: After the output processing is completed, the user obtains all dirty data information generated in this cycle and sends it to the system via the bus; Step 403: After receiving the dirty data information from the backup system, the primary system compares it with the local dirty data information; Step 404: If the comparison results are inconsistent, the primary system retrieves all data to be synchronized from the real-time database and sends it to the backup system via the bus. Step 405: After receiving the synchronization data from the master system, the backup system writes the synchronization data into the real-time database, thus completing the synchronization of data between systems.
Citation Information
Patent Citations
Security database and security data processing system and method
CN114281748A