CN105630900A - Data storage method and system - Google Patents

Data storage method and system Download PDF

Info

Publication number
CN105630900A
CN105630900A CN201510961681.2A CN201510961681A CN105630900A CN 105630900 A CN105630900 A CN 105630900A CN 201510961681 A CN201510961681 A CN 201510961681A CN 105630900 A CN105630900 A CN 105630900A
Authority
CN
China
Prior art keywords
data
file
temporary file
target data
official document
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.)
Pending
Application number
CN201510961681.2A
Other languages
Chinese (zh)
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.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry 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 Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201510961681.2A priority Critical patent/CN105630900A/en
Publication of CN105630900A publication Critical patent/CN105630900A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1405Saving, restoring, recovering or retrying at machine instruction level
    • G06F11/1407Checkpointing the instruction stream
    • 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/18File system types
    • G06F16/182Distributed file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention discloses a data storage method and system. Target data is write into a temporary file, the temporary file is renamed as an official file by using a rename system calling manner, writing the temporary file cannot affect data in the official file, and if a renaming operation result is successful, the official file can be replaced by the temporary file, and original data can be entirely replaced by the stored data; and if the result is failed, an operating system can ensure that the official file is not affected. In both cases, the data in the official file is always consistent and complete. Atomicity of file replacement is ensured by the atomicity of rename system call, and if a target file has already existed, the target file will be atomically replaced, so that data storage consistency can be realized efficiently and in low cost.

Description

A kind of date storage method and system
Technical field
The present invention relates to distributed data processing field, particularly relate to a kind of date storage method and system.
Background technology
When running software system, sometimes produced for system operation or some required data are stored on disk. The benefit of this way be when system because of accident (process collapse or killed, operating system collapse, system cut-off or restart immediately) and when stopping; data, partly or entirely recovery system running status before termination can be again read in from disk after starting next time.
In above-mentioned design, continuous renewal along with data, it is also required to every now and then these renewals are saved in disk, and ensure these data concordance (can not have error in data) after being saved and integrity (can not have loss of data), otherwise, can encounter problems after system reboot. Prior art, in order to realize the concordance of data storage, generally has following several method:
1, using data database storing, the preservation of data submitted to being organized into an affairs globality, the internal mechanism of data base can ensure that the concordance of this submission;
2, use data redundancy and verification, while preserving data, also preserve its relevant information (i.e. metadata), as the length of data, beginning and end mark, verify and etc. When reading data, by checking these information, it has been found that and abandon inconsistent data.
For the less situation of some data volumes, above-mentioned solution is all excessively complicated, use data base can introduce extra module and cost, and use data redundancy and verification can increase design and the workload of exploitation, it is impossible to realize data storage coherence high efficiency, low cost.
Summary of the invention
In view of this, present invention is primarily targeted at a kind of date storage method of offer and system, it is possible to realize data storage coherence high efficiency, low cost.
For achieving the above object, the invention provides a kind of date storage method, including:
Target data is write temporary file;
By rename system method of calling by described temporary file RNTO official document.
Preferably, also included after described temporary file RNTO official document by rename system method of calling:
Respond the reading instruction of described target data, from described official document, read described target data.
Preferably, also include before target data being write temporary file:
Response data write instruction obtains the target data to write.
Present invention also offers a kind of data-storage system, including:
Temporary file writing module, for writing temporary file by target data;
Official document acquisition module, is used for described temporary file RNTO official document by rename system method of calling.
Preferably, described data-storage system also includes:
Data read module, for responding the reading instruction of described target data, reads described target data from described official document.
Preferably, described data-storage system also includes:
Target data acquisition module, obtains the target data to write for response data write instruction.
Apply a kind of date storage method provided by the invention and system, target data is write temporary file, by rename system method of calling by described temporary file RNTO official document, write temporary file is without influence on the data in official document, and renaming operating result be successfully time, temporary file will replace official document, and entirety is also replaced original data by the data wherein preserved; Result be unsuccessfully time, operating system will ensure that official document is unaffected. In both cases, the data in official document are consistent and complete all the time. The atomicity called by rename system ensures the atomicity that file is replaced, if file destination exists, it will be replaced by atomicity, thus high efficiency, low cost realize data storage concordance.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, the accompanying drawing used required in embodiment or description of the prior art will be briefly described below, apparently, accompanying drawing in the following describes is only embodiments of the invention, for those of ordinary skill in the art, under the premise not paying creative work, it is also possible to obtain other accompanying drawing according to the accompanying drawing provided.
Fig. 1 is the flow chart of a kind of date storage method embodiment one of the present invention;
Fig. 2 is the structural representation of a kind of data-storage system embodiment two of the present invention;
Fig. 3 is the another structural representation of the present invention a kind of data-storage system embodiment two.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only a part of embodiment of the present invention, rather than whole embodiments. Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under not making creative work premise, broadly fall into the scope of protection of the invention.
Embodiment one:
The invention provides a kind of date storage method, Fig. 1 illustrates the flow chart of date storage method embodiment one of the present invention, including:
Step S101: target data is write temporary file;
Response data write instruction obtains the target data to write, and described target data is write temporary file, and data will save as temporary file, it is ensured that data rule, to tackle hardware and restart, the situation of hardware power-off.
Step S102: by rename system method of calling by described temporary file RNTO official document.
In Linux/UNIX system, rename system has called a feature: if file destination exists, and it will be replaced by atomicity. Rename under Windows system will be failed when file destination exists, so this programme is not suitable for Windows system.
Rename function performance is to a file renaming, can realize file locomotive function with this function, the drive of the fullpath of a file be changed the movement being achieved that this file.
Renaming operation is likely to there are two kinds of results:
(1) success. At this moment temporary file will replace official document, and entirety is also replaced original data by the data wherein preserved;
(2) failure because of wrong or accident. At this moment, operating system will ensure that official document is unaffected.
In both cases, the data in official document are consistent and complete all the time.
When needing to read data afterwards, respond the reading instruction of described target data, from described official document, read described target data.
A kind of date storage method that application the present embodiment provides, target data is write temporary file, by rename system method of calling by described temporary file RNTO official document, write temporary file is without influence on the data in official document, and renaming operating result be successfully time, temporary file will replace official document, and entirety is also replaced original data by the data wherein preserved; Result be unsuccessfully time, operating system will ensure that official document is unaffected. In both cases, the data in official document are consistent and complete all the time. The atomicity called by rename system ensures the atomicity that file is replaced, if file destination exists, it will be replaced by atomicity, thus high efficiency, low cost realize data storage concordance.
Embodiment two:
Present invention also offers a kind of data-storage system, Fig. 2 illustrates the structural representation of data-storage system embodiment two of the present invention, including:
Temporary file writing module 101, for writing temporary file by target data;
Official document acquisition module 102, is used for described temporary file RNTO official document by rename system method of calling.
As it is shown on figure 3, corresponding to Fig. 2, the present embodiment may also include that
Target data acquisition module 100, obtains the target data to write for response data write instruction;
Data read module 103, for responding the reading instruction of described target data, reads described target data from described official document.
A kind of data-storage system that application the present embodiment provides, target data is write temporary file, by rename system method of calling by described temporary file RNTO official document, write temporary file is without influence on the data in official document, and renaming operating result be successfully time, temporary file will replace official document, and entirety is also replaced original data by the data wherein preserved; Result be unsuccessfully time, operating system will ensure that official document is unaffected. In both cases, the data in official document are consistent and complete all the time. The atomicity called by rename system ensures the atomicity that file is replaced, if file destination exists, it will be replaced by atomicity, thus high efficiency, low cost realize data storage concordance.
It should be noted that each embodiment in this specification all adopts the mode gone forward one by one to describe, what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually referring to. For system class embodiment, due to itself and embodiment of the method basic simlarity, so what describe is fairly simple, relevant part illustrates referring to the part of embodiment of the method.
Finally, it can further be stated that, in this article, term " includes ", " comprising " or its any other variant are intended to comprising of nonexcludability, so that include the process of a series of key element, method, article or equipment not only include those key elements, but also include other key elements being not expressly set out, or also include the key element intrinsic for this process, method, article or equipment. When there is no more restriction, statement " including ... " key element limited, it is not excluded that there is also other identical element in including the process of described key element, method, article or equipment.
Above method and system provided by the present invention being described in detail, principles of the invention and embodiment are set forth by specific case used herein, and the explanation of above example is only intended to help to understand method and the core concept thereof of the present invention; Simultaneously for one of ordinary skill in the art, according to the thought of the present invention, all will change in specific embodiments and applications, in sum, this specification content should not be construed as limitation of the present invention.

Claims (6)

1. a date storage method, it is characterised in that including:
Target data is write temporary file;
By rename system method of calling by described temporary file RNTO official document.
2. date storage method according to claim 1, it is characterised in that also included after described temporary file RNTO official document by rename system method of calling:
Respond the reading instruction of described target data, from described official document, read described target data.
3. date storage method according to claim 1, it is characterised in that also include before target data is write temporary file:
Response data write instruction obtains the target data to write.
4. a data-storage system, it is characterised in that including:
Temporary file writing module, for writing temporary file by target data;
Official document acquisition module, is used for described temporary file RNTO official document by rename system method of calling.
5. data-storage system according to claim 4, it is characterised in that also include:
Data read module, for responding the reading instruction of described target data, reads described target data from described official document.
6. data-storage system according to claim 4, it is characterised in that also include:
Target data acquisition module, obtains the target data to write for response data write instruction.
CN201510961681.2A 2015-12-18 2015-12-18 Data storage method and system Pending CN105630900A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510961681.2A CN105630900A (en) 2015-12-18 2015-12-18 Data storage method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510961681.2A CN105630900A (en) 2015-12-18 2015-12-18 Data storage method and system

Publications (1)

Publication Number Publication Date
CN105630900A true CN105630900A (en) 2016-06-01

Family

ID=56045833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510961681.2A Pending CN105630900A (en) 2015-12-18 2015-12-18 Data storage method and system

Country Status (1)

Country Link
CN (1) CN105630900A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220388A (en) * 2017-06-30 2017-09-29 郑州云海信息技术有限公司 A kind of method and apparatus of upper transmitting file
CN108733753A (en) * 2018-04-10 2018-11-02 网宿科技股份有限公司 A kind of file reading and application entity

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635644A (en) * 2009-08-21 2010-01-27 中兴通讯股份有限公司 Method and device for generating north orientation file
JP2013164798A (en) * 2012-02-13 2013-08-22 Hioki Ee Corp Measurement result recording device and measurement result recording method
CN103795803A (en) * 2014-02-14 2014-05-14 浪潮通信信息系统有限公司 Cross-network-environment remote deployment distributed data collecting node method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635644A (en) * 2009-08-21 2010-01-27 中兴通讯股份有限公司 Method and device for generating north orientation file
JP2013164798A (en) * 2012-02-13 2013-08-22 Hioki Ee Corp Measurement result recording device and measurement result recording method
CN103795803A (en) * 2014-02-14 2014-05-14 浪潮通信信息系统有限公司 Cross-network-environment remote deployment distributed data collecting node method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DOTEDY: "redis(7)、redis持久化", 《CSDN博客:HTTPS://BLOG.CSDN.NET/DOTEDY/ARTICLE/DETAILS/50252675》 *
SONGWEI128: "各类题目答疑总结", 《CSDN博客:HTTPS://BLOG.CSDN.NET/SONGWEI128/ARTICLE/DETAILS/43193549》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220388A (en) * 2017-06-30 2017-09-29 郑州云海信息技术有限公司 A kind of method and apparatus of upper transmitting file
CN108733753A (en) * 2018-04-10 2018-11-02 网宿科技股份有限公司 A kind of file reading and application entity

Similar Documents

Publication Publication Date Title
US11422907B2 (en) Disconnected operation for systems utilizing cloud storage
US8788770B2 (en) Multiple cascaded backup process
US9600500B1 (en) Single phase transaction commits for distributed database transactions
US10146630B1 (en) Block changes framework for delta file incremental backup
US20110154092A1 (en) Multistage system recovery framework
KR100515890B1 (en) Method of efficiently recovering database
US8060794B2 (en) NAND flash memory and method for managing data thereof
US20130227009A1 (en) Arbitration of disk ownership in a storage pool
US20140181395A1 (en) Virtual tape library system
JP6097880B2 (en) Byzantine fault tolerance data replication method and system
US7359927B1 (en) Method for performing periodic replication of data on a remote storage system
US9798761B2 (en) Apparatus and method for fsync system call processing using ordered mode journaling with file unit
US9823976B2 (en) Optimization to permit block based incremental backup across system reboot or crash
US20170235643A1 (en) Data recovery from multiple data backup technologies
CN104166605A (en) Data backup method and system based on incremental data files
US10095415B2 (en) Performance during playback of logged data storage operations
US20170083419A1 (en) Data management method, node, and system for database cluster
US8271968B2 (en) System and method for transparent hard disk drive update
US20170161150A1 (en) Method and system for efficient replication of files using shared null mappings when having trim operations on files
US20200250041A1 (en) System and method for log metadata automatic recovery on dual controller storage system
US20220129420A1 (en) Method for facilitating recovery from crash of solid-state storage device, method of data synchronization, computer system, and solid-state storage device
US10503718B2 (en) Parallel transfers of electronic data
CN104268097B (en) A kind of metadata processing method and system
CN105630900A (en) Data storage method and system
US8112465B2 (en) System, device, and method for validating data structures in a storage system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160601

RJ01 Rejection of invention patent application after publication