CN110688426A - Second-level heartbeat synchronization method for block chain big database - Google Patents

Second-level heartbeat synchronization method for block chain big database Download PDF

Info

Publication number
CN110688426A
CN110688426A CN201910774618.6A CN201910774618A CN110688426A CN 110688426 A CN110688426 A CN 110688426A CN 201910774618 A CN201910774618 A CN 201910774618A CN 110688426 A CN110688426 A CN 110688426A
Authority
CN
China
Prior art keywords
block chain
database
file
newly added
big database
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201910774618.6A
Other languages
Chinese (zh)
Other versions
CN110688426B (en
Inventor
王知康
皮人杰
张玉成
刘文建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
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 Beijing University of Posts and Telecommunications filed Critical Beijing University of Posts and Telecommunications
Priority to CN201910774618.6A priority Critical patent/CN110688426B/en
Publication of CN110688426A publication Critical patent/CN110688426A/en
Application granted granted Critical
Publication of CN110688426B publication Critical patent/CN110688426B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/113Details of archiving
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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

Abstract

The invention relates to a second-level heartbeat synchronization method for a block chain large database. The method comprises the following steps: defining the synchronization period as 2 according to the data size and transmission speed in the large database of the block chainnSecond, n is equal to the data size in the blockchain big database divided by the transmission speed; defining data in the existing block chain big database as file 0; from 2nStart of second synchronization file0, to 2n‑1File0 completes synchronously in seconds, 2nSecond-2n‑1The newly added data in the existing blockchain big database in seconds is file 1, … …, and the data is up to 20Writing the file n into a newly added large block chain database at second, and completing all data synchronization; newly-added block chain large databaseAnd after the synchronization with the large database of the existing block chain is completed, the operation is started. The invention carries out data synchronization according to the multiple of 2, so that the large block chain database in the synchronization process can continuously run, and the large block chain database updated in a second level is synchronized.

Description

Second-level heartbeat synchronization method for block chain big database
Technical Field
The invention relates to the technical field of computers, in particular to a second-level heartbeat synchronization method for a large block chain database.
Background
In the blockchain system, when a database server provides services, a plurality of independent big data servers are usually deployed to cooperate in a synchronous manner, so as to ensure the accuracy, reliability and incapability of modifying data. Therefore, it becomes a challenge to quickly synchronize and store these data in multiple databases.
In the prior art, when data synchronization is performed on a plurality of independent large databases, the service of the large databases is often required to be stopped temporarily during the synchronization. When the database becomes very large and a new server needs to be added, a long time of data transmission is needed to establish the synchronized database, so that the service may be stopped for tens of minutes each time the database is synchronized, and the service can be provided only after the database synchronization is completed, which seriously affects the use of users. Therefore, the expectations of users cannot be met in a global service.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a second-level heartbeat synchronization method for a large block chain database. The invention is suitable for a plurality of independent synchronous large databases, can enable the large-capacity independent databases to achieve second-level synchronization, and is particularly suitable for data synchronization of uninterrupted and single-center-free block chain databases.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
a second-level heartbeat synchronization method for a block chain big database comprises the following steps:
s1, defining the synchronous period T of data synchronization in the large database of block chain according to the size and transmission speed of the data stored in the large database of block chain1=2nSecond, each block chain big database can only start to synchronize according to the synchronization period when synchronizing; the n is equal to the size of the data stored in the existing blockchain big database divided by the transmission speed;
s2, defining the data in the existing block chain big database as file 0;
s3, from synchronization cycle 2nThe second begins to write the file0 in the existing block chain big database into the newly added block chain big database to 2n-1Second time file0 write is complete, will 2nSecond-2n-1Defining newly added data in the existing block chain big database within second time as file 1;
s4, from 2n-1Second begins writing file 1 into the newly added blockchain big database to 2n-2 Second time file 1 write is completed, will 2n-1Second-2n-2Defining newly added data in the existing block chain big database within second time as file 2;
s5, and so on, from 21The file n-1 of the existing block chain big database is written into the newly added block chain big database to 20When the second file n-1 is written, 2 is written1Second-20Defining newly added data in the existing block chain big database within second time as file n;
s6, from 20The file n of the existing block chain big database is written into the newly added block chain big database when the file n is written, and all data in the block chain big database are synchronously finished;
s7, when data transmission error occurs in the data synchronization process, starting to perform data synchronization again from the next synchronization period; when no data transmission error occurs in the data synchronization process, putting the newly added block chain large database into operation;
and S8, after the newly added blockchain big database is put into operation, the regenerated new data is updated in the newly synchronized blockchain big database and the existing blockchain big database at the same time.
On the basis of the technical scheme, defining the actual time required for completing synchronization of the large database of the block chain as T; in step S1, the block chain big data is completedThe actual time T required for library synchronization is less than or equal to the synchronization period T1
On the basis of the technical scheme, in the data synchronization process, the existing block chain big database does not need to stop service, and the data updating speed of the existing block chain big database is 1 time/second.
On the basis of the above technical solution, in step S3, when file0 to file n are written into the newly added blockchain big database, it needs to be determined whether the operating system of the existing blockchain big database is consistent with the operating system of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the files 0 to the files n to enable the files 0 to the files n to be in line with the operating system of the newly added large block chain database, and writing the converted files 0 to files n into a file system directory specified by the newly added large block chain database.
On the basis of the above technical solution, in step S3, when file0 to file n are written into the newly added blockchain big database, it needs to be determined whether the type of the configuration file of the existing blockchain big database is consistent with the type of the configuration file of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the configuration file types of the newly added large block chain database, and writing the converted files 0-file n into a file system directory specified by the newly added large block chain database.
Based on the above technical solution, in step S8, the regenerated new data will be updated in the newly added blockchain big database and the existing blockchain big database at the same time, and the updating speed is 1 time/second.
The second-level heartbeat synchronization method for the block chain big database has the following beneficial effects:
1. the time required for synchronizing the large database of the block chain at each time is at most 2 synchronization periodsnSecond, and the existing blockchain large database does not need to be out of service during database synchronization.
2. The transmission speed of the newly added large block chain database can be optimized and is synchronous with the data of each stage in the existing large block chain database.
3. And in the operation process of the block chain large database, the data updating speed is 1 time/second.
4. The invention utilizes a hierarchical synchronization mode to ensure that the large block chain database with any size can run simultaneously with the existing large block chain database, and the database updated in a second level is synchronized.
Drawings
The invention has the following drawings:
FIG. 1 is a diagram illustrating the data block partitioning and transmission time of a large database of a prior art block chain in the method of the present invention;
FIG. 2 is a schematic diagram of a data transmission time axis in a newly added large database with block chains in the method of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings.
As shown in fig. 1 and fig. 2, the second-level heartbeat synchronization method for a large block chain database according to the present invention includes the following steps:
s1, defining the synchronous period T of data synchronization in the large database of block chain according to the size and transmission speed of the data stored in the large database of block chain1=2nSecond, each block chain big database can only start to synchronize according to the synchronization period when synchronizing; the n is equal to the size of the data stored in the existing blockchain big database divided by the transmission speed;
s2, defining the data in the existing block chain big database as file 0;
s3, from synchronization cycle 2nThe second begins to write the file0 in the existing block chain big database into the newly added block chain big database to 2n-1Second time file0 write is complete, will 2nSecond-2n-1Defining newly added data in the existing block chain big database within second time as file 1;
s4, from 2n-1Second begins writing file 1 into the newly added blockchain big database to 2n-2 Second time file 1 write is completed, will 2n-1Second-2n-2Defining newly added data in the existing block chain big database within second time as file 2;
s5, and so on, from 21The file n-1 of the existing block chain big database is written into the newly added block chain big database to 20When the second file n-1 is written, 2 is written1Second-20Defining newly added data in the existing block chain big database within second time as file n;
s6, from 20The file n of the existing block chain big database is written into the newly added block chain big database when the file n is written, and all data in the block chain big database are synchronously finished;
s7, when data transmission error occurs in the data synchronization process, starting to perform data synchronization again from the next synchronization period; when no data transmission error occurs in the data synchronization process, putting the newly added block chain large database into operation;
and S8, after the newly added blockchain big database is put into operation, the regenerated new data is updated in the newly synchronized blockchain big database and the existing blockchain big database at the same time.
On the basis of the technical scheme, defining the actual time required for completing synchronization of the large database of the block chain as T; in step S1, the actual time T required for completing synchronization of the large database of the block chain is less than or equal to the synchronization period T1
On the basis of the technical scheme, in the data synchronization process, the existing block chain big database does not need to stop service, and the data updating speed of the existing block chain big database is 1 time/second.
On the basis of the above technical solution, in step S3, when file0 to file n are written into the newly added blockchain big database, it needs to be determined whether the operating system of the existing blockchain big database is consistent with the operating system of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the files 0 to the files n to enable the files 0 to the files n to be in line with the operating system of the newly added large block chain database, and writing the converted files 0 to files n into a file system directory specified by the newly added large block chain database.
On the basis of the above technical solution, in step S3, when file0 to file n are written into the newly added blockchain big database, it needs to be determined whether the type of the configuration file of the existing blockchain big database is consistent with the type of the configuration file of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the configuration file types of the newly added large block chain database, and writing the converted files 0-file n into a file system directory specified by the newly added large block chain database.
Based on the above technical solution, in step S8, the regenerated new data will be updated in the newly added blockchain big database and the existing blockchain big database at the same time, and the updating speed is 1 time/second.
Example (b):
step 1, if the data size in the existing block chain big database is 100Gb, and the data transmission speed is 200Mb/s, the prediction time required for completing the synchronization of the block chain big database is 512s, namely T1=29And second.
Step 2, defining the data in the large database of the existing block chain as file 0;
the operating system and the configuration file type of the existing block chain big database are consistent with those of the newly added block chain big database;
step 3, from step 29The second begins to write the file0 of the existing block chain big database into the newly added block chain big database to 28Second time file0 write is complete, will 29Second-28Defining newly added data in the existing block chain big database within second time as file 1;
step 4, from 28The second begins to write file 1 of the existing block chain big database into the newly added block chain big database to 27 Second time file 1 write is completed, will 28Second-27Defining newly added data in the existing block chain big database within second time as file 2;
step 5, so as toAnd so on, from 21The file 8 of the existing block chain big database is written into the newly added block chain big database from second to 20Second time file 8 write is complete, will 21Second-20Defining newly added data in the existing block chain big database within second time as file 9;
step 6, from 20The file 9 of the existing block chain big database is written into the newly added block chain big database at the beginning of the second till the file 9 is written, and all data in the block chain big database are synchronously finished;
step 7, when no data transmission error occurs in the data synchronization process of the whole block chain big database, putting the newly added block chain big database into operation;
and 8, after the newly added block chain big database is put into operation, the regenerated new data is updated in the newly synchronized block chain big database and the existing block chain big database at the updating speed of 1 time/second.
When the method of the invention is adopted to carry out synchronization of the large database of the block chain, the time required by each synchronization is at most 2nSecond, and the existing blockchain big database does not need to be out of service during the synchronization process of the blockchain big database. And after the synchronization of the newly added block chain big database and the existing block chain big database is completed, putting into operation, and simultaneously updating the regenerated new data in the newly synchronized block chain big database and the existing block chain big database.
The method of the invention synchronizes data according to multiple of 2 until the last 1 second data in the large database of the existing block chain is synchronized. After the data synchronization is finished, the block chain database with any size can run simultaneously with the existing block chain large database, and the block chain large database synchronization of second-level updating is realized.
Those not described in detail in this specification are within the skill of the art.

Claims (6)

1. A second-level heartbeat synchronization method for a block chain big database is characterized by comprising the following steps:
s1, rootDefining the synchronization period T of data synchronization in the large database of the block chain according to the size and transmission speed of the data stored in the large database of the existing block chain1=2nSecond, each block chain big database can only start to synchronize according to the synchronization period when synchronizing; the n is equal to the size of the data stored in the existing blockchain big database divided by the transmission speed;
s2, defining the data in the existing block chain big database as file 0;
s3, from synchronization cycle 2nThe second begins to write the file0 in the existing block chain big database into the newly added block chain big database to 2n-1Second time file0 write is complete, will 2nSecond-2n-1Defining newly added data in the existing block chain big database within second time as file 1;
s4, from 2n-1Second begins writing file 1 into the newly added blockchain big database to 2n-2Second time file 1 write is completed, will 2n-1Second-2n-2Defining newly added data in the existing block chain big database within second time as file 2;
s5, and so on, from 21The file n-1 of the existing block chain big database is written into the newly added block chain big database to 20When the second file n-1 is written, 2 is written1Second-20Defining newly added data in the existing block chain big database within second time as file n;
s6, from 20The file n of the existing block chain big database is written into the newly added block chain big database when the file n is written, and all data in the block chain big database are synchronously finished;
s7, when data transmission error occurs in the data synchronization process, starting to perform data synchronization again from the next synchronization period; when no data transmission error occurs in the data synchronization process, putting the newly added block chain large database into operation;
and S8, after the newly added blockchain big database is put into operation, the regenerated new data is updated in the newly synchronized blockchain big database and the existing blockchain big database at the same time.
2. The method for synchronization of second-level heartbeat of big database of block chain according to claim 1, wherein the actual time required for completing the synchronization of big database of block chain is defined as T; in step S1, the actual time T required for completing synchronization of the large database of the block chain is less than or equal to the synchronization period T1
3. The method for second-level heartbeat synchronization of a blockchain big database according to claim 1, wherein during the data synchronization process, the existing blockchain big database does not need to be out of service, and the data update speed of the existing blockchain big database is 1/s.
4. The method for synchronizing heartbeat in seconds for a big database of a block chain as claimed in claim 1, wherein in step S3, when writing file 0-file n into the big database of the newly added block chain, it is necessary to determine whether the os of the big database of the existing block chain is consistent with the os of the big database of the newly added block chain; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the files 0 to n to enable the files 0 to n to conform to the operating system of the newly added blockchain big database, and writing the converted files 0 to n into a file system directory specified by the newly added blockchain big database.
5. The method for synchronizing heartbeat in seconds of a big database with a blockchain according to claim 1, wherein in step S3, when writing files 0 to file n into the big database with a newly added blockchain, it is necessary to determine whether the type of the configuration file of the big database with the existing blockchain is consistent with the type of the configuration file of the big database with the newly added blockchain; if the file is consistent with the file system directory specified by the newly added block chain big database, directly writing the file 0-file into the file system directory specified by the newly added block chain big database; and if not, converting the configuration file types of the newly added large block chain database, and writing the converted files 0-file n into a file system directory specified by the newly added large block chain database.
6. The method for synchronizing heartbeat in seconds for big b lock chain database as claimed in claim 1, wherein in step S8, the regenerated new data will be updated in the newly added big b lock chain database and the existing big b lock chain database at the speed of 1 time/second.
CN201910774618.6A 2019-08-21 2019-08-21 Second-level heartbeat synchronization method for block chain big database Active CN110688426B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910774618.6A CN110688426B (en) 2019-08-21 2019-08-21 Second-level heartbeat synchronization method for block chain big database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910774618.6A CN110688426B (en) 2019-08-21 2019-08-21 Second-level heartbeat synchronization method for block chain big database

Publications (2)

Publication Number Publication Date
CN110688426A true CN110688426A (en) 2020-01-14
CN110688426B CN110688426B (en) 2021-12-10

Family

ID=69108392

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910774618.6A Active CN110688426B (en) 2019-08-21 2019-08-21 Second-level heartbeat synchronization method for block chain big database

Country Status (1)

Country Link
CN (1) CN110688426B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506493A (en) * 2016-10-27 2017-03-15 摩登大道时尚电子商务有限公司 Data processing method based on block platform chain
CN107317842A (en) * 2017-05-31 2017-11-03 北京大学深圳研究生院 Block chain synchronous method and device based on NDN
CN108810112A (en) * 2018-05-27 2018-11-13 佛山市虚拟现实大数据产业研究院有限公司 A kind of node synchronization method and device of market surpervision block catenary system
CN109727132A (en) * 2018-12-28 2019-05-07 合肥达朴汇联科技有限公司 Acquisition methods, device, electronic equipment and the storage medium of block chain common recognition node
US20190197130A1 (en) * 2017-12-21 2019-06-27 Microsoft Technology Licensing, Llc Ensuring consistency in distributed incremental content publishing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506493A (en) * 2016-10-27 2017-03-15 摩登大道时尚电子商务有限公司 Data processing method based on block platform chain
CN107317842A (en) * 2017-05-31 2017-11-03 北京大学深圳研究生院 Block chain synchronous method and device based on NDN
US20190197130A1 (en) * 2017-12-21 2019-06-27 Microsoft Technology Licensing, Llc Ensuring consistency in distributed incremental content publishing
CN108810112A (en) * 2018-05-27 2018-11-13 佛山市虚拟现实大数据产业研究院有限公司 A kind of node synchronization method and device of market surpervision block catenary system
CN109727132A (en) * 2018-12-28 2019-05-07 合肥达朴汇联科技有限公司 Acquisition methods, device, electronic equipment and the storage medium of block chain common recognition node

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MICHAEL BORKOWSKI等: "Dextt: Deterministic Cross-Blockchain", 《IEEE ACCESS》 *
焦通等: "区块链数据库:一种可查询且防篡改的数据库", 《软件学报》 *

Also Published As

Publication number Publication date
CN110688426B (en) 2021-12-10

Similar Documents

Publication Publication Date Title
CN109165229B (en) Method, device, equipment and storage medium for checking local block synchronization
CN105550229B (en) The method and apparatus of distributed memory system data reparation
CN104750773A (en) Index maintenance based on a comparison of rebuild vs. update
CN105989059B (en) Data record checking method and device
US20090204570A1 (en) Method and apparatus for performing multi-stage table updates
CN110263095B (en) Data backup and recovery method and device, computer equipment and storage medium
CN106339387B (en) Increase the method for data synchronization and device of server in a kind of data-base cluster newly
US9026493B1 (en) Multi-master RDBMS improvements for distributed computing environment
CN109271452A (en) DB2 database data synchronization updating method and apparatus
CN112383610A (en) Synchronous processing method and system for block chain state data
CN111367994A (en) Method and system for synchronously backing up incremental data of database
CN109947801A (en) Database in phase system, method and device
CN113553373B (en) Data synchronization method and device, storage medium and electronic equipment
CN110688426B (en) Second-level heartbeat synchronization method for block chain big database
CN107016075A (en) Company-data synchronous method and device
CN107992763B (en) Power failure protection method and device for file system
CN111143463B (en) Construction method and device of bank data warehouse based on topic model
US20180373775A1 (en) Database management method
CN115587114A (en) System and query method
CN110912979B (en) Method for solving multi-server resource synchronization conflict
CN107153699B (en) Method and device for dynamically expanding cluster server
US9355104B1 (en) Intelligent pairing using a lookup database for snapshot based backups
CN112000671A (en) Block chain-based database table processing method, device and system
CN115905402B (en) Method and device for processing transaction log
US10922301B1 (en) Apparatus, computer program, and method for trigger-based tracking of database modifications

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant