[go: up one dir, main page]

CN109857727A - A kind of local data base reconstructing method, equipment and storage medium - Google Patents

A kind of local data base reconstructing method, equipment and storage medium Download PDF

Info

Publication number
CN109857727A
CN109857727A CN201910157804.5A CN201910157804A CN109857727A CN 109857727 A CN109857727 A CN 109857727A CN 201910157804 A CN201910157804 A CN 201910157804A CN 109857727 A CN109857727 A CN 109857727A
Authority
CN
China
Prior art keywords
data base
local data
block
transaction
rebuild
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
CN201910157804.5A
Other languages
Chinese (zh)
Other versions
CN109857727B (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.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei Technology Co Ltd
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 Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN201910157804.5A priority Critical patent/CN109857727B/en
Publication of CN109857727A publication Critical patent/CN109857727A/en
Application granted granted Critical
Publication of CN109857727B publication Critical patent/CN109857727B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a kind of local data base reconstructing method, equipment and storage medium, this method comprises: whether the version of detection local data base updates: being to re-execute the transaction of all blocks on the first block chain using block height as sequence then to rebuild local data base.The present invention is by for local data base configuration version number, whether Test database version number has update, if there is updating, the transaction in block then is re-executed to reconstruct local data base according to the sequence of block height from low to high, to guarantee to be the actual result of current block chain version in local data base while substantially increasing the efficiency for rebuilding database.

Description

A kind of local data base reconstructing method, equipment and storage medium
Technical field
This application involves block chain technical fields, and in particular to a kind of local data base reconstructing method, equipment and storage are situated between Matter.
Background technique
With the iteration of block chain version, local data base and slip condition database also should constantly have a update, however block Chain Node distribution is numerous, and version tends not to timely update, however local data base without common recognition, if version updating is too late When will not influence data deposit, however after upgraded version, local data base is had and the recorded structure of current version Inconsistent situation, the existing scheme for updating local data base is to delete local data base and slip condition database, again from block Height starts synchrodata for 0.Currently existing scheme defect is: due to block height millions of height easily, can also increase at any time Long, the method time-consuming of synchrodata is very long in systems again after deletion database, inefficiency.
Summary of the invention
In view of drawbacks described above in the prior art or deficiency, it is intended to provide a kind of high-efficient, it is only necessary to reconstruct local number According to the reconstructing method in library, equipment and storage medium.
In a first aspect, the present invention provides a kind of reconstructing method of local data base, comprising:
Whether the version of detection local data base updates:
It is to re-execute the transaction of all blocks on the first block chain using block height as sequence then to rebuild local Database.
Further, the transaction for recalculating all blocks on the first block chain includes: to rebuild local data base
Local data base is deleted, and is obtained according to the sequence of block height from low to high and executes the transaction of each block;
Several data information memories for executing and generating after each transaction will be calculated in the local database to rebuild local Database.
Further, the above method further include:
It interrupts, is continued to execute after the block height of interruption after system reboot subsequent each in each process of exchange if executing Block.
Second aspect, the present invention also provides a kind of equipment, including one or more processors and memory, wherein memory Comprising can by instruction that the one or more processors execute so that the one or more processors execute it is each according to the present invention The local data base reconstructing method that embodiment provides.
The third aspect, the present invention also provides a kind of storage medium for being stored with computer program, which makes to count Calculation machine executes the local data base reconstructing method that each embodiment provides according to the present invention.
A kind of local data base reconstructing method, equipment and the storage medium that many embodiments of the present invention provide are by being local Whether database configuration version number, Test database version number have update, if there is updating, then from low to high according to block height Sequence re-execute the transaction in block to reconstruct local data base, substantially increase the efficiency of reconstructed database.Further, The present invention can also be rebuild just for data when wherein a certain contract updates for contract storage, to other The contract data not updated then is not processed, and targetedly progress database is more capable, further reduces reconstructed database Time.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is a kind of flow chart for local data base reconstructing method that one embodiment of the invention provides.
Fig. 2 is the flow chart of a preferred embodiment of Fig. 1 the method.
Fig. 3 is the flow chart of a preferred embodiment of method shown in Fig. 1 or Fig. 2.
Fig. 4 is a kind of structural schematic diagram for equipment that one embodiment of the invention provides.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, part relevant to invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
The present invention provides a kind of technical solution of local data base reconstruct.In the present invention, block chain database includes this Ground database and slip condition database, the key message of store transaction in slip condition database are known together by block chain and realize and update, In the case that block height normally increases, what slip condition database stored is the actual result of current version, is not needed generally again Building;Local data base, for the information for assisting user query to need, is such as supplied for storing the auxiliary information for recording some transaction The assets of list query user, the user's checks the time, the relevant informations such as sheet time, these information are not needed by altogether Know, local data base can be directly recorded in;Local data base deposits data information in the form of key-value Storage carries out data base querying by providing key value when inquiry.
It is local data base configuration file configuration version number, when block chain edition upgrading (such as in technical solution of the present invention Optimize a certain function or increase a certain function etc.), have corresponding key value and update or increase, when there is key to update or When increase, just more new configuration file version number.
Fig. 1 is a kind of flow chart for local data base reconstructing method that one embodiment of the invention provides.
As shown in Figure 1, in the present embodiment, the present invention provides a kind of local data base reconstructing method, comprising:
Whether S11, the version for detecting local data base update:
It is to re-execute the transaction of all blocks on the first block chain using block height as sequence then to rebuild local Database.
Specifically, after system restarting, it can detect and judge the current version number b of configuration file and be stored in local data Whether the version number a (having special key value record version number information in database, restart and do not disappear) in library has update, if so, Then updating the version number a in local data base is current version number b, and is deleted on the first block chain that local data base stores Transaction key value information, and re-execute according to the sequence of block height from low to high the transaction of each block on the first block chain, And it is stored again by several auxiliary informations generated after transaction are executed to local data base.
Further, the version updating of local data base recited above, the version number that can be configuration file increase, can also To be to be changed version number according to other definition modes, as long as meeting the judgement that node confirmative rules are able to achieve new and old edition ?.
In more embodiments, whether local data base is rebuild, i.e., whether re-execute the transaction on block chain with Local data base is regenerated, has update not related with database code, if local data base version is constant, even if code Change, system restarting will not re-execute all blocks;Even if code does not change, if local data base version changes, Also all blocks can be re-executed after system reboot.
Whether above-described embodiment has update to rebuild to local data base by the version of detection local data base, real Independent update local data base is showed, has not needed also not needing more new state data again from Network Synchronization data since 0 The time that database is rebuild after edition upgrading is greatly saved in library.
Fig. 2 is the flow chart of a preferred embodiment of Fig. 1 the method.As shown in Fig. 2, in a preferred embodiment, The above method further include:
If S12, executing and being interrupted in each process of exchange, after being continued to execute after the block height of interruption after system reboot Continue each block.
Specifically, system can be handed in the transaction on re-executing the first block chain in block having executed some block Easy block elevation information is stored into local data base, if in implementation procedure because of certain reasons (such as network interruption, power failure etc. Situation) it interrupts, then it, then will be since storing the last one block height in the local database after system restarting The block transaction for continuing to execute block height below, until reaching the block height recorded in slip condition database.
Fig. 3 is the flow chart of a preferred embodiment of method shown in Fig. 1 or Fig. 2.As shown in figure 3, being preferably implemented one In example, before the transaction for recalculating the block on the first block chain further include:
S111, the contract title for having update in local data base is obtained;
The transaction of the block on the first block chain is recalculated to rebuild local data base, comprising:
S112, several data informations that contract is corresponded to about contract title stored in local data base are deleted, according to conjunction About name acquiring and executes block relevant with corresponding contract and trade to rebuild local data base.
Specifically, after system reboot, contract is judged whether there is more when detecting local data base configuration file version updating Newly, if so, then obtaining the contract title of update, it is corresponding that the contract title stored in local data base is deleted according to contract title Contract related data, related with contract transaction is then executed since block height is 0 block, after execution Several transaction data storages are into local data base.
By only building a certain kind or several local data bases for updating contract in above-described embodiment, other are not updated Contract data be then not processed, which further increases the speed for rebuilding database.
Fig. 4 is a kind of structural schematic diagram for equipment that one embodiment of the invention provides.
As shown in figure 4, present invention also provides a kind of equipment 300, including one or more centres as on the other hand Unit (CPU) 301 is managed, can be added according to the program being stored in read-only memory (ROM) 302 or from storage section 308 The program that is downloaded in random access storage device (RAM) 303 and execute various movements appropriate and processing.In RAM303, also deposit It contains equipment 300 and operates required various programs and data.CPU301, ROM302 and RAM303 pass through the phase each other of bus 304 Even.Input/output (I/O) interface 305 is also connected to bus 304.
I/O interface 305 is connected to lower component: the importation 306 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 307 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 308 including hard disk etc.; And the communications portion 309 of the network interface card including LAN card, modem etc..Communications portion 309 via such as because The network of spy's net executes communication process.Driver 310 is also connected to I/O interface 305 as needed.Detachable media 311, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 310, in order to read from thereon Computer program be mounted into storage section 308 as needed.
Particularly, in accordance with an embodiment of the present disclosure, the local data base reconstructing method of any of the above-described embodiment description can be with It is implemented as computer software programs.For example, embodiment of the disclosure includes a kind of computer program product comprising visibly Comprising computer program on a machine-readable medium, computer program includes the journey for executing local data base reconstructing method Sequence code.In such embodiments, which can be downloaded and installed from network by communications portion 309, And/or it is mounted from detachable media 311.
As another aspect, present invention also provides a kind of computer readable storage medium, the computer-readable storage mediums Matter can be computer readable storage medium included in the device of above-described embodiment;It is also possible to individualism, it is unassembled Enter the computer readable storage medium in equipment.Computer-readable recording medium storage has one or more than one program, should Program is used to execute the local data base reconstructing method for being described in the application by one or more than one processor.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually It can be basically executed in parallel, they can also be executed in the opposite order sometimes, this is depending on related function.Also it wants It is noted that the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart, Ke Yitong The dedicated hardware based system of functions or operations as defined in executing is crossed to realize, or by specialized hardware and can be calculated The combination of machine instruction is realized.
Being described in the embodiment of the present application involved unit or module can be realized by way of software, can also be with It is realized by way of hardware.Described unit or module also can be set in the processor, for example, each unit can be Software program in computer or intelligent movable equipment is set, the hardware device being separately configured is also possible to.Wherein, these lists The title of member or module does not constitute the restriction to the unit or module itself under certain conditions.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from the application design, appointed by above-mentioned technical characteristic or its equivalent feature Other technical solutions of meaning combination and formation.Such as features described above and (but being not limited to) disclosed herein have similar functions Technical characteristic replaced mutually and the technical solution that is formed.

Claims (6)

1. a kind of local data base reconstructing method characterized by comprising
Whether the version of detection local data base updates:
It is to re-execute the transaction of the block on the first block chain using block height as sequence then to rebuild local data base.
2. the method according to claim 1, wherein the transaction for recalculating the block on the first block chain Include: to rebuild local data base
Local data base is deleted, the transaction of each block is obtained and executed according to the sequence of block height from low to high;
It is described to rebuild in the local database that calculating is executed to several data information memories generated after each transaction Local data base.
3. according to the method described in claim 2, it is characterized by further comprising:
It interrupts, is continued to execute after the block height of interruption after system reboot subsequent each in each process of exchange if executing The block.
4. according to the method in claim 2 or 3, which is characterized in that in the block recalculated on the first block chain Transaction before further include:
Obtain the contract title for having update in local data base;
The transaction for recalculating the block on the first block chain is to rebuild local data base, comprising:
Several data informations that contract is corresponded to about the contract title stored in local data base are deleted, according to the contract Name acquiring simultaneously executes block transaction relevant to corresponding contract to rebuild local data base.
5. a kind of equipment, which is characterized in that the equipment includes:
One or more processors;
Memory, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors Execute such as method of any of claims 1-4.
6. a kind of storage medium for being stored with computer program, which is characterized in that realize when the program is executed by processor as weighed Benefit requires method described in any one of 1-4.
CN201910157804.5A 2019-03-02 2019-03-02 Local database reconstruction method, device and storage medium Active CN109857727B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910157804.5A CN109857727B (en) 2019-03-02 2019-03-02 Local database reconstruction method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910157804.5A CN109857727B (en) 2019-03-02 2019-03-02 Local database reconstruction method, device and storage medium

Publications (2)

Publication Number Publication Date
CN109857727A true CN109857727A (en) 2019-06-07
CN109857727B CN109857727B (en) 2021-05-11

Family

ID=66899614

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910157804.5A Active CN109857727B (en) 2019-03-02 2019-03-02 Local database reconstruction method, device and storage medium

Country Status (1)

Country Link
CN (1) CN109857727B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110599321A (en) * 2019-09-20 2019-12-20 腾讯科技(深圳)有限公司 Tax data processing method, device, server and storage medium
CN113852698A (en) * 2021-12-01 2021-12-28 湖南宸瀚信息科技有限责任公司 Group-collaborative block chain data synchronization system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6535869B1 (en) * 1999-03-23 2003-03-18 International Business Machines Corporation Increasing efficiency of indexing random-access files composed of fixed-length data blocks by embedding a file index therein
US20030093431A1 (en) * 2001-11-13 2003-05-15 Tadpole Technology Plc System and method for managing the synchronization of replicated version-managed databases
CN106776894A (en) * 2016-11-29 2017-05-31 北京众享比特科技有限公司 Log database system and synchronous method
US20180089041A1 (en) * 2016-09-28 2018-03-29 Mcafee, Inc Query optimized distributed ledger system
CN108985757A (en) * 2017-11-27 2018-12-11 北京京东金融科技控股有限公司 Information processing method, apparatus and system, storage medium, electronic equipment
CN109086325A (en) * 2018-06-29 2018-12-25 阿里巴巴集团控股有限公司 Data processing method and device based on block chain
WO2019014337A1 (en) * 2017-07-11 2019-01-17 Swirlds, Inc. Methods and apparatus for efficiently implementing a distributed database within a network
CN109408551A (en) * 2018-08-06 2019-03-01 杭州复杂美科技有限公司 Data query method and system, common recognition method and system, equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6535869B1 (en) * 1999-03-23 2003-03-18 International Business Machines Corporation Increasing efficiency of indexing random-access files composed of fixed-length data blocks by embedding a file index therein
US20030093431A1 (en) * 2001-11-13 2003-05-15 Tadpole Technology Plc System and method for managing the synchronization of replicated version-managed databases
US20180089041A1 (en) * 2016-09-28 2018-03-29 Mcafee, Inc Query optimized distributed ledger system
CN106776894A (en) * 2016-11-29 2017-05-31 北京众享比特科技有限公司 Log database system and synchronous method
WO2019014337A1 (en) * 2017-07-11 2019-01-17 Swirlds, Inc. Methods and apparatus for efficiently implementing a distributed database within a network
CN108985757A (en) * 2017-11-27 2018-12-11 北京京东金融科技控股有限公司 Information processing method, apparatus and system, storage medium, electronic equipment
CN109086325A (en) * 2018-06-29 2018-12-25 阿里巴巴集团控股有限公司 Data processing method and device based on block chain
CN109408551A (en) * 2018-08-06 2019-03-01 杭州复杂美科技有限公司 Data query method and system, common recognition method and system, equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110599321A (en) * 2019-09-20 2019-12-20 腾讯科技(深圳)有限公司 Tax data processing method, device, server and storage medium
CN110599321B (en) * 2019-09-20 2023-09-29 腾讯科技(深圳)有限公司 Tax data processing method and device, server and storage medium
CN113852698A (en) * 2021-12-01 2021-12-28 湖南宸瀚信息科技有限责任公司 Group-collaborative block chain data synchronization system

Also Published As

Publication number Publication date
CN109857727B (en) 2021-05-11

Similar Documents

Publication Publication Date Title
US7801855B2 (en) Method and apparatus for merging log entries in a database management system
US11100502B1 (en) Modular, configurable smart contracts for blockchain transaction processing validations
US8832159B2 (en) Systems and methods for asynchronous schema changes
US8688628B2 (en) Nested queued transaction manager
CN109359222A (en) Date storage method and system, equipment and storage medium
US20180329930A1 (en) Upgrading systems with changing constraints
CN109408551A (en) Data query method and system, common recognition method and system, equipment and storage medium
CN108369601B (en) Promoting attributes in relational structured data
US8805777B2 (en) Data record collapse and split functionality
CN109977274A (en) A kind of data query and verification method, system, equipment and storage medium
US20070239342A1 (en) Method and system for deferred maintenance of database indexes
EP3396560B1 (en) Database operating method and device
US11704335B2 (en) Data synchronization in a data analysis system
CN108369599A (en) Duplication control between redundant data center
CN108431807A (en) The duplication of structured data in partition data memory space
CN110795447A (en) Data processing method, data processing system, electronic device, and medium
CN109857727A (en) A kind of local data base reconstructing method, equipment and storage medium
CN110244951B (en) Application publishing method and device
US7533074B2 (en) Modifiable knowledge base in a mobile device
CN110445843A (en) Parallel chain block method for pushing, equipment and storage medium
US11556519B2 (en) Ensuring integrity of records in a not only structured query language database
CN107038617B (en) Pre-creation method and device of payment order
CN109993656A (en) Tree-like block chain processing method, equipment and storage medium
US20180150498A1 (en) Database management device, information processing system, and database management method
CN111796845B (en) Database upgrading method, state data query method, device and storage medium

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