CN103885872A - Pipe-based log rollback implementation method - Google Patents

Pipe-based log rollback implementation method Download PDF

Info

Publication number
CN103885872A
CN103885872A CN201210563561.3A CN201210563561A CN103885872A CN 103885872 A CN103885872 A CN 103885872A CN 201210563561 A CN201210563561 A CN 201210563561A CN 103885872 A CN103885872 A CN 103885872A
Authority
CN
China
Prior art keywords
log
program
rollback
daily record
write
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
CN201210563561.3A
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.)
GEER SOFTWARE CO Ltd SHANGHAI
Original Assignee
GEER SOFTWARE CO Ltd SHANGHAI
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 GEER SOFTWARE CO Ltd SHANGHAI filed Critical GEER SOFTWARE CO Ltd SHANGHAI
Priority to CN201210563561.3A priority Critical patent/CN103885872A/en
Publication of CN103885872A publication Critical patent/CN103885872A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a pipe-based log rollback implementation method. The method includes: 1, starting an independent log writer which opens a named pipe at the time of startup; 2, allowing the log writer to open a log file to be written finally; 3, allowing a service program to open the named pipe which is opened when the log writer is started, and writing log; 4, allowing the log writer to continue to read the named pipes and write all read contents into the log files, and determining to roll back or not by checking up the size of files according to a log rollback strategy. The pipe-based log rollback implementation method has the advantages that the defects of the existing two log rollback methods can be solved, the rollback strategy can be controlled accurately and integration is easy in different programs.

Description

A kind of log rollback implementation method based on pipeline
Technical field
The present invention relates to a kind of implementation method of journal file rollback, particularly a kind of log rollback implementation method based on pipeline.
Background technology
Log is one of basic function of numerous computer programs, particularly important for server program.In the limited system of disk size, the rollback of journal file is necessary, otherwise the in the situation that of long-time running, journal file just likely fully supports whole disk partition, affect the normal operation of program, therefore need regularly or specified requirements carries out rollback to journal file---also fix the quantity of journal file and the size of Single document.
Common log rollback method has two classes: in program, realization and program realize outward.
In program, realize: refer to and write fashionable in the daily record of program inter-process, check whether current journal file has exceeded the max cap. of setting, if exceeded, close existing file, and open new file and write, finally to check whether all journal file quantity has reached the upper limit, if reached, delete the oldest file.A lot of famous log processing storehouses are as log4j, and log4cpp etc. are based on this method.
Program realizes outward: refer in program outside, by making regular check on the means such as disk or catalogue, in the time finding that journal file exceeds capacity, existing journal file is copied to backup file, current file being blocked is 0 again, finally reexamine all journal file quantity and whether reached the upper limit, if reached, delete the oldest file.The representative of this method is the logrotate series of tools under UNIX.
Above two kinds of methods have certain deficiency in actual applications:
The defect realizing in program is: be relatively difficult to process multiple processes, thread uses the situation of same journal file, because need to notify each thread/process to use new file to be relatively difficult to accomplish simultaneously, especially, for the program of multi-process, the transmission of file handle between multiple processes is difficult to.
The outer defect realizing of program is: because need external program to make regular check on file size, the frequency checking and the speed of the actual writing in files of program may be not corresponding, probably, between twice inspection, program occurs that paroxysmal daily record writes, and has just broken through storage restriction quickly.Store in limited scene and (operate in such as program in CF card or Flash) at some, this situation can cause more serious problem.
Summary of the invention
The present invention is directed to the interior realization of existing program and program and realize the existing problem of log rollback technology outward, and a kind of log rollback implementation method based on pipeline is provided.The method can solve existing two kinds of existing deficiencies of log rollback method, can accurately control the strategy of rollback, is also easy in distinct program integrated simultaneously.
In order to achieve the above object, the present invention adopts following technical scheme:
A log rollback implementation method based on pipeline, described implementation method comprises the steps:
(1) start an independently daily record write-in program, when this daily record write-in program starts, open a named pipes;
(2) daily record write-in program is opened the journal file that finally will write;
(3) business procedure is opened the named pipes of opening when daily record write-in program starts, and writes daily record;
(4) daily record write-in program continues to read named pipes, and all contents that read are write to journal file; And according to the size of log rollback strategy inspection file, determine whether to carry out rollback.
In preferred embodiment of the present invention, described daily record write-in program is the program of an one process/thread.
The present invention who forms according to such scheme, by having designed the such middle layer of named pipes and daily record write-in program, had both simplified the realization of business procedure, had guaranteed again the accuracy of log rollback.
Accompanying drawing explanation
Further illustrate the present invention below in conjunction with the drawings and specific embodiments.
Fig. 1 is the schematic diagram that the present invention realizes.
Embodiment
For technological means, creation characteristic that the present invention is realized, reach object and effect is easy to understand, below in conjunction with concrete diagram, further set forth the present invention.
Log rollback implementation method provided by the invention, by design named pipes and the such middle layer of daily record write-in program, has been simplified thus the realization of business procedure, and has been guaranteed again the accuracy of log rollback.
Wherein, daily record write-in program control named pipes and journal file, for reading named pipes data and the daily record of being correlated with writes in journal file, and check according to log rollback strategy and the size of file determine whether to carry out rollback.
Named pipes writes for the daily record that realizes multiple business procedure.
Accordingly, scheme provided by the invention is specifically implemented as follows (referring to Fig. 1):
(1) start an independently daily record write-in program, suppose logwriter by name.This logwriter program is the program of an one process/thread, therefore need in multi-process/thread, not coordinate when its control documents rollback, does not also need striding course to transmit file handle.
(2) when logwriter program starts, open a named pipes (FIFO), suppose logpipe by name.
(3) logwriter program is opened the journal file that finally will write, as server.log
(4) business procedure App(it comprise three sub-process/thread 1-3) no longer directly open server.log, but open the programme controlled named pipes logpipe of logwriter, and write daily record to it.
(5) logwriter continues to read named pipes logpipe, and all contents that read (being the daily record that business procedure App writes to named pipes logpipe) are write to server.log; And according to the size of log rollback strategy inspection file, determine whether to carry out rollback.
Known by above-mentioned example, scheme provided by the invention, in the time implementing, for business procedure App, without processing all logics relevant with log rollback, has been simplified code realization; Moreover logwriter program can accurately realize rollback strategy, can not cause not in time journal file to exceed capacity limit owing to not detecting.
More than show and described ultimate principle of the present invention, principal character and advantage of the present invention.The technician of the industry should understand; the present invention is not restricted to the described embodiments; that in above-described embodiment and instructions, describes just illustrates principle of the present invention; without departing from the spirit and scope of the present invention; the present invention also has various changes and modifications, and these changes and improvements all fall in the claimed scope of the invention.The claimed scope of the present invention is defined by appending claims and equivalent thereof.

Claims (2)

1. the log rollback implementation method based on pipeline, is characterized in that, described implementation method comprises the steps:
(1) start an independently daily record write-in program, when this daily record write-in program starts, open a named pipes;
(2) daily record write-in program is opened the journal file that finally will write;
(3) business procedure is opened the named pipes of opening when daily record write-in program starts, and writes daily record;
(4) daily record write-in program continues to read named pipes, and all contents that read are write to journal file; And according to the size of log rollback strategy inspection file, determine whether to carry out rollback.
2. a kind of log rollback implementation method based on pipeline according to claim 1, is characterized in that, described daily record write-in program is the program of an one process/thread.
CN201210563561.3A 2012-12-21 2012-12-21 Pipe-based log rollback implementation method Pending CN103885872A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210563561.3A CN103885872A (en) 2012-12-21 2012-12-21 Pipe-based log rollback implementation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210563561.3A CN103885872A (en) 2012-12-21 2012-12-21 Pipe-based log rollback implementation method

Publications (1)

Publication Number Publication Date
CN103885872A true CN103885872A (en) 2014-06-25

Family

ID=50954780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210563561.3A Pending CN103885872A (en) 2012-12-21 2012-12-21 Pipe-based log rollback implementation method

Country Status (1)

Country Link
CN (1) CN103885872A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086380A (en) * 2018-07-25 2018-12-25 光大环境科技(中国)有限公司 The method and system of compression storage are carried out to historical data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101133397A (en) * 2004-10-14 2008-02-27 甲骨文国际公司 Oplogging for online recovery in direct connection client server systems
US20090177850A1 (en) * 2008-01-03 2009-07-09 Boyd Kenneth W Apparatus, system, and method for a read-before-write storage controller instruction
CN101753344A (en) * 2008-12-12 2010-06-23 华为技术有限公司 Method, device and system for logging

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101133397A (en) * 2004-10-14 2008-02-27 甲骨文国际公司 Oplogging for online recovery in direct connection client server systems
US20090177850A1 (en) * 2008-01-03 2009-07-09 Boyd Kenneth W Apparatus, system, and method for a read-before-write storage controller instruction
CN101753344A (en) * 2008-12-12 2010-06-23 华为技术有限公司 Method, device and system for logging

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
三斗室,内存•溢出(聚客): "《http://ju.outofmemory.cn/entry/61687》", 28 January 2010 *
陈军等,IBM DEVELOPERWORKS中国: "《http://www.ibm.com/developerworks/cn/linux/l-cn-apachelog/》", 26 March 2009 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086380A (en) * 2018-07-25 2018-12-25 光大环境科技(中国)有限公司 The method and system of compression storage are carried out to historical data
CN109086380B (en) * 2018-07-25 2022-09-16 光大环境科技(中国)有限公司 Method and system for compressing and storing historical data

Similar Documents

Publication Publication Date Title
US9128615B2 (en) Storage systems that create snapshot queues
US20060282471A1 (en) Error checking file system metadata while the file system remains available
US8195619B2 (en) Extent reference count update system and method
US9612948B2 (en) Reads and writes between a contiguous data block and noncontiguous sets of logical address blocks in a persistent storage device
CN109656779A (en) Internal memory monitoring method, device, terminal and storage medium
EP3161641B1 (en) Methods and apparatuses for automated testing of streaming applications using mapreduce-like middleware
CN112148221B (en) Method, device, equipment and storage medium for inspecting redundant array of inexpensive disks
JP2017079053A (en) Methods and systems for improving storage journaling
CN103577310A (en) Method and device for recording software debugging logs
WO2015112094A2 (en) Method of file system design and failure recovery with non-volatile memory
CN103593257A (en) Data backup method and device
CN106469119B (en) Data writing caching method and device based on NVDIMM
US9507657B2 (en) Investigation program, information processing apparatus, and information processing method
US9619336B2 (en) Managing production data
CN103544097B (en) The log storing method of embedded system, system and log read method and system
CN103729166A (en) Method, device and system for determining thread relation of program
CN105095418B (en) A kind of method and apparatus of processing write requests
CN108052644B (en) The method for writing data and system of data pattern log file system
CN103885872A (en) Pipe-based log rollback implementation method
CN103399783A (en) Storage method and device of mirror image documents of virtual machines
CN112579483A (en) Data recovery method and device for shingled magnetic recording disk
US20150249708A1 (en) System and method for asynchronous replication of a storage in a computing environment
CN106484564B (en) Collected data storage method
CN107766385B (en) Method and equipment for converting file format of virtual disk
CN103473116A (en) Remote call method and device for data with large data volume

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: 20140625

RJ01 Rejection of invention patent application after publication