CN101187936B - A log data storage method and device - Google Patents

A log data storage method and device Download PDF

Info

Publication number
CN101187936B
CN101187936B CN200710172018XA CN200710172018A CN101187936B CN 101187936 B CN101187936 B CN 101187936B CN 200710172018X A CN200710172018X A CN 200710172018XA CN 200710172018 A CN200710172018 A CN 200710172018A CN 101187936 B CN101187936 B CN 101187936B
Authority
CN
China
Prior art keywords
journal file
daily record
record data
fundamental block
length
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.)
Expired - Fee Related
Application number
CN200710172018XA
Other languages
Chinese (zh)
Other versions
CN101187936A (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.)
SHENGNUO NETWORK TECHNOLOGY(SHANGHAI) CO Ltd
Original Assignee
SHENGNUO NETWORK TECHNOLOGY(SHANGHAI) 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 SHENGNUO NETWORK TECHNOLOGY(SHANGHAI) CO Ltd filed Critical SHENGNUO NETWORK TECHNOLOGY(SHANGHAI) CO Ltd
Priority to CN200710172018XA priority Critical patent/CN101187936B/en
Publication of CN101187936A publication Critical patent/CN101187936A/en
Application granted granted Critical
Publication of CN101187936B publication Critical patent/CN101187936B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a storage method of journal data, and includes the steps that the journal data needed to be stored is obtained; whether the length of the journal data exceeds the length of a basic block of a presetting journal file is judged; the journal file includes the basic block and an expanding block which both have vested bytes; if exceeding, the journal data is recorded in the expanding block of the presetting journal file; if not exceeding, the journal data is recorded in the empty basic block of the journal file; each basic block is corresponding to a journal record. The invention creates the journal file in advance, and marks off the basic block and the expanding block in the journal file, general journal data can be directly stored in one basic block, and special long journal data can be stored in the expanding block, thereby avoiding from changing the length of the journal file when recording the journal data every time, improving the writing speed and reducing theIO pressure to the system.

Description

A kind of storage means of daily record data and device
Technical field
The present invention relates to computing machine Message Processing technical field, particularly relate to a kind of daily record data and be stored in method and apparatus on the disk message handling system.
Background technology
Message handling system is meant that generally concrete the application has e-mail system, SMS (short message service) gateway, cell phone multimedia message gateway or the like in order to help the computer software of user's pass-along message between network.
Log pattern mainly is to be used for writing down the ruuning situation of total system and user's operation behavior etc. in message handling system, the log record point that in the system each sets in advance all will produce a log information, along with the operation of system, system will continual generation log information.Log information can be shown on the terminal display of this system of login, and this mode is mainly used in user's debugging and checks system state; Log information also can store in the file, and this mode generally is used for the behavior of the operation conditions of long-term follow system and user's using system.
Log information directly is shown on the terminal, and advantage is to obtain log information in real time, and it is less directly to output on the terminal duty factor for system, and shortcoming is that log information can not be preserved, and the output line number also will be subjected to the restriction of user's terminal program.
Therefore, in a lot of application scenarios, generally all adopt and store log information in the corresponding journal file mode.Journal file is promptly preserved the data of log information, and the advantage of this mode is the restriction that does not have the bar number substantially, can use software to browse corresponding log information.
The traditional approach that in the prior art log information is write file is that content is appended to tail of file.Concrete, content being appended to tail of file comprising two steps, the first step is that file content is write disk, second step was length and the shared disc information that file system is upgraded this document.But in actual applications, there is bigger defective in the above-mentioned mode that log information is write file.
At first, to cause the operation of this kind updating file system information frequently to take place if frequently append content to daily record file, and because the operation of append file content and updating file system information is an indivisible process, then cause the journal file writing speed to reduce, increased the IO of system (input and output) pressure, influence is especially serious concerning needs carry out the message system of heap file operation.
Secondly, the journal file way to manage that present system generally adopts writes in the journal file for daily record on the same day, and this mode at first can bring above-mentioned journal file writing speed to reduce, and increases the defective of the IO of system pressure; Secondly, when the daily record data of needs record very for a long time, journal file is crossed seriously the slow down opening speed of file of senior general, further may reduce journal file writing speed or surfing.
In a word, need the urgent technical matters that solves of those skilled in the art to be exactly at present: how can propose a kind of innovation, with the method for journal file mode storing daily record data, to overcome the defective of prior art.
Summary of the invention
Technical matters to be solved by this invention provides a kind of storage means and device of daily record data, can improve the speed that daily record data writes journal file, and is less to system's IO pressure, and can improve the reading speed of log information.
In order to address the above problem, the invention discloses a kind of storage means of daily record data, can comprise: obtaining needs the stored log data; Judge whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets; Described journal file comprises fundamental block and extension blocks of at least one set byte; If surpass, then with this logdata record to the extension blocks of the journal file that presets; If do not surpass, then with this logdata record to the empty fundamental block of described journal file; The corresponding log record of each fundamental block.
Preferably, described method can also comprise: obtain need the stored log data after, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then create a new journal file automatically; If not, then continue to carry out judge this daily record data length whether above the step of the length of the fundamental block of the journal file that presets.
Preferably, described method can also comprise: after the length of judging daily record data not have length above the fundamental block of the journal file that presets, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then create a new journal file automatically; If not, then continue to carry out the step of this logdata record to the empty fundamental block of described journal file.
Preferably, finish record to daily record data after, described method can also comprise: with this daily record data in journal file the position and length records to the index block of described journal file.
Preferably, described method can also comprise: if judgement writes described daily record data in extension blocks, whether can exceed the setting capacity of extension blocks; If then increase the capacity of extension blocks, to hold described daily record data; And write described daily record data; If not, then directly write described daily record data to extension blocks.
According to another preferred embodiment of the present invention, a kind of memory storage of daily record data is also disclosed, comprising:
Interface module, being used to obtain needs the stored log data;
Writing module is used for writing daily record data to journal file;
First judge module is used to judge whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets; Described journal file comprises fundamental block and extension blocks of at least one set byte; If surpass, then notify the said write module with this logdata record to the extension blocks of the journal file that presets; If do not surpass, then notify the said write module with this logdata record to the empty fundamental block of described journal file; The corresponding log record of each fundamental block.
Preferably, described device can also comprise:
Second judge module, be used for obtain need the stored log data after, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then notify daily record document creation module; If not, then first judge module judges whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets;
Perhaps be used for after first judge module judges that the length of daily record data not have length above the fundamental block of the journal file that presets, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then notify daily record document creation module; If not, then continue to carry out;
The journal file creation module is used for creating a new journal file automatically according to notice.
Preferably, described device can also comprise:
The index upgrade module is used for behind the record of finishing daily record data, with this daily record data in journal file the position and length records to the index block of described journal file.
Preferably, described device can also comprise:
Whether the 3rd judge module if being used for judging writes described daily record data to extension blocks, can exceed the setting capacity of extension blocks; If then the notice capacity increases module; If not, then notify the said write module directly to write described daily record data to extension blocks;
Capacity increases module, is used for increasing according to notice the capacity of extension blocks, to hold described daily record data; And the extension blocks of notice said write module behind the increase capacity writes described daily record data.
According to another preferred embodiment of the present invention, a kind of read method of journal file is also disclosed, comprising: open journal file; Described journal file comprises index block, fundamental block and the extension blocks of set byte; Described fundamental block is used to store common daily record data, and described extension blocks is used for the daily record data that memory length surpasses the fundamental block capacity; The corresponding log record of each fundamental block; Read index information in this journal file index block, described index information comprises the storage reference position and the length of every log record; According to storage reference position and the length of log record in journal file, read corresponding daily record data.
According to another preferred embodiment of the present invention, a kind of reading device of journal file is also disclosed, comprising:
Interface unit is used to open required journal file; Described journal file comprises index block, fundamental block and the extension blocks of set byte; Described fundamental block is used to store common daily record data, and described extension blocks is used for the daily record data that memory length surpasses the fundamental block capacity; The corresponding log record of each fundamental block;
The index reading unit is used for reading this journal file index block index information, and described index information comprises the storage reference position and the length of every log record;
The daily record reading unit is used for reading corresponding daily record data according to the storage reference position and the length of log record at journal file.
Compared with prior art, the present invention has the following advantages:
The present invention has overcome log information has been write the slow-paced deficiency of file, and a kind of method that daily record data is write fast journal file is provided.The present invention creates journal file in advance, and in journal file, mark off fundamental block and extension blocks, general daily record data directly is stored in the fundamental block and gets final product, special long daily record data can be stored in the extension blocks, thereby in the time of can avoiding each log data to the change of journal file length, it is fast to improve writing speed, reduces the IO pressure to system.
Secondly, this method adopts index block every log information of record starting position and the length hereof in journal file, thereby has avoided the traditional logs information fetch program to read the drawback of character in proper order.When the daily record fetch program obtain every log information in journal file the starting position and the length of log information after can read this log information in batches, improved the reading speed and the reading efficiency of log information greatly, little to system's IO pressure.
Moreover, this method can be according to the already used capacity of the current journal file that writes decision newly-built journal file whether, follow-up log record operation will occur on the newly-built file, this method will guarantee that disk space that individual log file takies in controllable scope, avoids occurring the very slow problem of journal file opening speed.
Description of drawings
Fig. 1 is the flow chart of steps of the storage means embodiment of a kind of daily record data of the present invention;
Fig. 2 is the synoptic diagram of a kind of journal file structure of the present invention;
Fig. 3 is the flow chart of steps of preferred embodiment of the storage means of a kind of daily record data of the present invention;
Fig. 4 is the structured flowchart of the memory storage embodiment of a kind of daily record data of the present invention;
Fig. 5 is the structured flowchart of preferred embodiment of the memory storage of a kind of daily record data of the present invention;
Fig. 6 is the flow chart of steps of the read method embodiment of a kind of daily record data of the present invention;
Embodiment
Fig. 7 is the structured flowchart of the reading device embodiment of a kind of daily record data of the present invention.
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
The present invention can be used in numerous general or special purpose computingasystem environment or the configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, network PC, comprise distributed computing environment of above any system or equipment or the like.
The present invention can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in distributed computing environment, put into practice the present invention, in these distributed computing environment, by by communication network connected teleprocessing equipment execute the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
With reference to Fig. 1, show the storage means embodiment of a kind of daily record data of the present invention, specifically can comprise:
Step 101, obtain and need the stored log data;
Step 102, judge that whether the length of this daily record data surpass the length of the fundamental block of the journal file that presets; Described journal file comprises fundamental block and extension blocks;
If step 103 surpasses, then with this logdata record to the extension blocks of the journal file that presets;
If step 104 does not surpass, then with this logdata record to the empty fundamental block of described journal file; The corresponding log record of each fundamental block.
The fundamental block of described sky is meant the fundamental block that does not wherein have log data, but empty fundamental block not meaning person wherein without any data, because the journal file that the present invention was pre-created is to need the process internal formatization, to realize comprising fundamental block and extension blocks.The process that writes daily record data to fundamental block can correspond to the former data that adopt in the daily record data replacement fundamental block.
The present invention can be applied in the various message handling systems, when message handling system needs log data, carries out above-mentioned steps, promptly can be with this logdata record to the journal file that is pre-created.At every daily record data, repeat above-mentioned steps, can finish the recording storage of each daily record data that message handling system is produced.
Preferably, for reading conveniently in the future, in another preferred embodiment of the present invention, after the record of finishing daily record data, can also comprise: with this daily record data in journal file the position and length records to the index block of described journal file.
Like this, the journal file among the present invention just may comprise three pieces: index block, fundamental block and extension blocks.Referring to Fig. 2, show a kind of structural representation of journal file.The disk space that the index space size that occurs in this synoptic diagram, fundamental block quantity, fundamental block take, the disk space that extension blocks takies etc. all only are used for example, and those skilled in the art can adjust the above-mentioned parameter value according to practical situations.For example, the whole size of suitable journal file is set according to the file processing ability of the browsing software of journal file.
The file structure of journal file shown in Figure 2 is made up of three parts, and first is an index, and size is 4096 bytes, the content of depositing be every log information be stored in file where, reference position and length etc.; Second portion is 1024 fundamental blocks, and the size of each fundamental block is 4096 bytes, is used for depositing the daily record that size is no more than 4096 bytes; Third part is an extension blocks, and initial size is 65536 bytes, is used for depositing the daily record that size surpasses 4096 bytes, if the content in the extension blocks surpasses 65536 bytes, can increase the capacity of extension blocks so according to the size of daily record data automatically.
Need to prove that in the above-mentioned renewal process, the information field in the related index block is not changeless, can increase, and can reduce yet.For example, because the size of each fundamental block all is fixing and predefined, therefore,, just can know the reference position of its storage as long as which fundamental block log information of record is stored in; So can not write down its reference position for the log information in the fundamental block, in other words need be in the index upgrade step record, when creating journal file, write down and get final product.
The foregoing description all can be finished the recording storage of each daily record data that message handling system is produced.But because journal file is pre-created in the present invention, and specified file size, therefore, along with the increasing recording storage of daily record data quilt, at the more message handling system of daily record data, the problem that this journal file has reached maximum storage capacity may appear.
In order further to address the above problem, in another preferred embodiment of the present invention, can increase following preferred steps: judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then create a new journal file automatically; If not, then continue to carry out.
Need explanation be, above-mentioned preferred steps can be increased in before the step 102, promptly earlier judges whether journal file is full, if also have storage space, then the whether length of fundamental block of daily record data is judged in continuation.
In another preferred embodiment of the present invention, above-mentioned preferred steps can also be increased in after the step 102, judge earlier promptly whether daily record data surpasses the length of fundamental block, if do not surpass, judge further then whether the journal file of desiring to write is full, if full, then create a new journal file automatically, and this daily record data is write in the new journal file fundamental block; And if surpassed the length of fundamental block, then can directly this daily record data be stored in the extension blocks of current journal file.
That is to say that the present invention does not need to limit the increase position of above-mentioned preferred steps.
Concrete, the process of creating journal file also comprises the process of its internal formatization: at first the disk space that takies according to the index area of appointment is created the index area part; Secondly create the fundamental block part according to the fundamental block quantity of appointment and the disk space of specifying each fundamental block to take; The last disk space that takies according to the extension blocks of appointment is created the extension blocks part.
In actual applications, though the capacity of the extension blocks in the journal file of the present invention is bigger,, still may there be the situation of the setting capacity that exceeds extension blocks along with the storage of daily record data.For fear of the appearance of this problem, in another preferred embodiment of the present invention, can also comprise following preferred steps:, whether can exceed the setting capacity of extension blocks if judgement writes described daily record data in extension blocks; If then increase the capacity of extension blocks, to hold described daily record data; And write described daily record data; If not, then directly write described daily record data to extension blocks.
Said process also can cause the variation of file size, and increases the IO of system pressure, but because its occurrence probability in practice is very low, writes efficient so in fact can't obviously reduce, and also can obviously not increase the IO of system pressure.
On basis embodiment illustrated in fig. 1, above-mentioned several preferred steps, can distinguish separately increases; Also can adopt the combination in any mode to increase.With reference to Fig. 3, show the optimum embodiment that has whole above-mentioned preferred steps.
Whether the log store file that judgement is earlier desired to write before writing the log store file embodiment illustrated in fig. 3 has reached maximum storage capacity, be whether fundamental block all uses up, if file reaches maximum storage capacity, program will be created a new file so, and log information will write in the newly-built file;
Judge then whether this daily record length surpasses the length of fundamental block, if do not surpass, so daily record is write in the fundamental block, if surpass, so daily record is write in the extension blocks, Already in the journal file, the not usage space that is operating as extension blocks that log information is write extension blocks replaces with log information to extension blocks after log file formatsization is finished.
If the log information size of desiring to write adds the extension blocks capacity of appointment when extension blocks has used the capacity sum to surpass the system creation journal file, system will add that extension blocks used the capacity sum to hold this log information to the capacity increase of extension blocks to the log information size of desiring to write so.
Writing end back renewal index, to write down position and the length of this log information in storage file.
For the present invention, at first the file of log information is just created before daily record writes file, and file size and data are created the expense of journal file all according to the distinctive file layout initialization of native system when having avoided writing daily record.Secondly file is to create according to certain form, the corresponding log record of each fundamental block, if the length of log record does not surpass the size of fundamental block, the information of system after with the format in the fundamental block replaces with log information so, not using in the piece partly still keeps the information after the initialization, if surpass the size of fundamental block, this record can be stored in the extension blocks so.Because the size of each fundamental block is defaulted as 4096 bytes when journal file is created, can satisfy the requirement of most log records, only can occur in the rare long log record for the operation of extension blocks.
Adopt behind the present invention because format just created and finished by file before daily record writes, daily record writes the just direct end that new log information is appended to journal file unlike classic method so, but replace information in the physical block with new log information, this kind operation can not change file size.Because the change of file size can cause file system and carry out the renewal of information at this document, increase substantially so adopt behind the present invention journal file to write efficient; Journal file use to surpass the way that will create new journal file after the predefined size will guarantee that the size of each journal file fixes; And can be according to the suitable log file size of the file processing capabilities setting of daily record browsing software.
With reference to Fig. 4, show the memory storage embodiment of a kind of daily record data of the present invention, specifically can comprise:
Interface module 401, being used to obtain needs the stored log data;
Writing module 402 is used for writing daily record data to journal file;
First judge module 403 is used to judge whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets; Described journal file comprises fundamental block and extension blocks; If surpass, then notify the said write module with this logdata record to the extension blocks of the journal file that presets; If do not surpass, then notify the said write module with this logdata record to the empty fundamental block of described journal file; The corresponding log record of each fundamental block.
Further, with reference to Fig. 5, in another preferred embodiment of the present invention, except aforesaid three modules, can also comprise: second judge module 404 is used for judging whether the current fundamental block of desiring to write the journal file of daily record data exhausts; If then notify daily record document creation module 405; If not, then continue to carry out.Wherein, described journal file creation module 405 is used for creating a new journal file automatically according to notice.
In preferred embodiment shown in Figure 5, can also comprise: index upgrade module 406, be used for behind the record of finishing daily record data, with this daily record data in journal file the position and length records to the index block of described journal file.
Preferably, in preferred embodiment shown in Figure 5, can also comprise:
Whether the 3rd judge module 407 if being used for judging writes described daily record data to extension blocks, can exceed the setting capacity of extension blocks; If then the notice capacity increases module 408; If not, then notify said write module 402 directly to write described daily record data to extension blocks;
And capacity increases module 408, is used for increasing according to notice the capacity of extension blocks, to hold described daily record data; And the extension blocks of notice said write module 402 behind the increase capacity writes described daily record data.
Certainly, in the practical application, may also there be other other embodiment between simple embodiment shown in Figure 4 and optimum embodiment shown in Figure 5, for example, on the basis of Fig. 4, increased in the above-mentioned preferred module one or more, as only increasing by second judge module and journal file creation module or the like.The present invention has not just described in detail one by one at this.
With reference to Fig. 6, show a kind of read method embodiment of journal file, specifically can comprise:
Step 601, open journal file; Described journal file comprises index block, fundamental block and extension blocks; Described fundamental block is used to store common daily record data, and described extension blocks is used for the daily record data that memory length surpasses the fundamental block capacity; The corresponding log record of each fundamental block;
Step 602, read index information in this journal file index block, described index information comprises the storage reference position and the length of every log record;
Step 603, according to storage reference position and the length of log record in journal file, read corresponding daily record data.
Accordingly, the invention also discloses a kind of reading device embodiment of journal file,, specifically can comprise with lower member with reference to Fig. 7:
Interface unit 701 is used to open required journal file; Described journal file comprises index block, fundamental block and extension blocks; Described fundamental block is used to store common daily record data, and described extension blocks is used for the daily record data that memory length surpasses the fundamental block capacity; The corresponding log record of each fundamental block;
Index reading unit 702 is used for reading this journal file index block index information, and described index information comprises the storage reference position and the length of every log record;
Daily record reading unit 703 is used for reading corresponding daily record data according to the storage reference position and the length of log record at journal file.
After need being read by system, the log information of journal file record analyzed.Traditional method that reads log information is that program is opened journal file, and order reads character one by one, by whether reading newline or other specific characters judge whether a log information finishes.Owing to take order to read the mode of character one by one, so that traditional method reads log information speed is slow, when containing a large amount of log informations in the journal file of handling, need expends the plenty of time and read journal file, increased the IO of system pressure simultaneously.
Fig. 6 of the present invention and solution shown in Figure 7, employing is write down every log information starting position and length hereof and has been avoided the traditional logs information fetch program to read the drawback of character in proper order in journal file, when program obtain every log information in journal file the starting position and the length of log information after can read this log information in batches, improved the reading speed and the reading efficiency of log information greatly, little to system's IO pressure.
For example, it is as follows to read in the journal file step of whole log informations:
At first be the system journal fetch program to open journal file; Then program reads reference position and the length of all log informations in journal file in the index block; Then program pass reads the information in index block, reads log information one by one according to the reference position and the length of every log information in journal file; Final system daily record fetch program closing journal file, read operation finishes.Be the present invention at first the content by reading index area in the journal file with the position of determining every log information place file and the length of every log information, just can read the log information in the journal file then by the mode (Random Access) that file content reads at random, it is faster that the order of this method in compared to prior art reads (SequentialAccess) scheme speed, and efficient is higher.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed all is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.For device embodiment, because it is similar substantially to method embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of method embodiment.
More than to the storage means and the device of a kind of daily record data provided by the present invention, and a kind of read method of daily record data and device, be described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (11)

1. the storage means of a daily record data is characterized in that, comprising:
Obtaining needs the stored log data;
Judge whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets; Described journal file comprises fundamental block and extension blocks of at least one set byte;
If surpass, then with this logdata record to the extension blocks of the journal file that presets;
If do not surpass, then with this logdata record to the empty fundamental block of described journal file; The corresponding log record of each fundamental block.
2. the method for claim 1 is characterized in that, also comprises:
Obtain need the stored log data after,
Judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts;
If then create a new journal file automatically; If not, then continue to carry out judge this daily record data length whether above the step of the length of the fundamental block of the journal file that presets.
3. the method for claim 1 is characterized in that, also comprises:
After the length of judging daily record data not have length above the fundamental block of the journal file that presets, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts;
If then create a new journal file automatically; If not, then continue to carry out the step of this logdata record to the empty fundamental block of described journal file.
4. the method for claim 1 is characterized in that, finish record to daily record data after, also comprise: with this daily record data in journal file the position and length records to the index block of described journal file.
5. the method for claim 1 is characterized in that, also comprises:
If judge in extension blocks, to write described daily record data, whether can exceed the setting capacity of extension blocks;
If then increase the capacity of extension blocks, to hold described daily record data; And write described daily record data;
If not, then directly write described daily record data to extension blocks.
6. the memory storage of a daily record data is characterized in that, comprising:
Interface module, being used to obtain needs the stored log data;
Writing module is used for writing daily record data to journal file;
First judge module is used to judge whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets; Described journal file comprises fundamental block and extension blocks of at least one set byte; If surpass, then notify the said write module with this logdata record to the extension blocks of the journal file that presets; If do not surpass, then notify the said write module with this logdata record to the empty fundamental block of described journal file; The corresponding log record of each fundamental block.
7. device as claimed in claim 6 is characterized in that, also comprises:
Second judge module, be used for obtain need the stored log data after, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then notify daily record document creation module; If not, then first judge module judges whether the length of this daily record data surpasses the length of the fundamental block of the journal file that presets;
Perhaps be used for after first judge module judges that the length of daily record data not have length above the fundamental block of the journal file that presets, judge whether the fundamental block in the current journal file of desiring to write daily record data exhausts; If then notify daily record document creation module; If not, then continue to carry out;
The journal file creation module is used for creating a new journal file automatically according to notice.
8. device as claimed in claim 6 is characterized in that, also comprises:
The index upgrade module is used for behind the record of finishing daily record data, with this daily record data in journal file the position and length records to the index block of described journal file.
9. device as claimed in claim 6 is characterized in that, also comprises:
Whether the 3rd judge module if being used for judging writes described daily record data to extension blocks, can exceed the setting capacity of extension blocks; If then the notice capacity increases module; If not, then notify the said write module directly to write described daily record data to extension blocks;
Capacity increases module, is used for increasing according to notice the capacity of extension blocks, to hold described daily record data; And the extension blocks of notice said write module behind the increase capacity writes described daily record data.
10. the read method of a journal file is characterized in that, comprising:
Open journal file; Described journal file comprises index block, fundamental block and the extension blocks of set byte; Described fundamental block is used to store common daily record data, and described extension blocks is used for the daily record data that memory length surpasses the fundamental block capacity; The corresponding log record of each fundamental block;
Read index information in this journal file index block, described index information comprises the storage reference position and the length of every log record;
According to storage reference position and the length of log record in journal file, read corresponding daily record data.
11. the reading device of a journal file is characterized in that, comprising:
Interface unit is used to open required journal file; Described journal file comprises index block, fundamental block and the extension blocks of set byte; Described fundamental block is used to store common daily record data, and described extension blocks is used for the daily record data that memory length surpasses the fundamental block capacity; The corresponding log record of each fundamental block;
The index reading unit is used for reading this journal file index block index information, and described index information comprises the storage reference position and the length of every log record;
The daily record reading unit is used for reading corresponding daily record data according to the storage reference position and the length of log record at journal file.
CN200710172018XA 2007-12-07 2007-12-07 A log data storage method and device Expired - Fee Related CN101187936B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200710172018XA CN101187936B (en) 2007-12-07 2007-12-07 A log data storage method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200710172018XA CN101187936B (en) 2007-12-07 2007-12-07 A log data storage method and device

Publications (2)

Publication Number Publication Date
CN101187936A CN101187936A (en) 2008-05-28
CN101187936B true CN101187936B (en) 2011-06-29

Family

ID=39480330

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200710172018XA Expired - Fee Related CN101187936B (en) 2007-12-07 2007-12-07 A log data storage method and device

Country Status (1)

Country Link
CN (1) CN101187936B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101763433B (en) * 2010-01-12 2012-12-12 浪潮(北京)电子信息产业有限公司 Data storage system and method
CN101853278A (en) * 2010-05-19 2010-10-06 苏州迈科网络安全技术有限公司 Application method of data storage system
CN103294570B (en) * 2012-02-23 2015-11-04 深圳市腾讯计算机系统有限公司 A kind of backup method of internal storage data and device
CN107688624B (en) * 2017-08-18 2020-12-29 杭州迪普科技股份有限公司 Log index construction method and device
CN113127265B (en) * 2021-03-29 2023-03-10 珠海全志科技股份有限公司 Method and system for repairing driving record file

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6611852B1 (en) * 2000-09-29 2003-08-26 Emc Corporation System and method for cleaning a log structure
CN1549135A (en) * 2003-05-12 2004-11-24 四川大学 Digital watermark journal structural method
CN1599935A (en) * 2001-12-05 2005-03-23 皇家飞利浦电子股份有限公司 Data storage methods and apparatuses with basic and extended file system capacity

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6611852B1 (en) * 2000-09-29 2003-08-26 Emc Corporation System and method for cleaning a log structure
CN1599935A (en) * 2001-12-05 2005-03-23 皇家飞利浦电子股份有限公司 Data storage methods and apparatuses with basic and extended file system capacity
CN1549135A (en) * 2003-05-12 2004-11-24 四川大学 Digital watermark journal structural method

Also Published As

Publication number Publication date
CN101187936A (en) 2008-05-28

Similar Documents

Publication Publication Date Title
CN102662690B (en) Method and apparatus for starting application program
CN101110837B (en) System and method for implementing mobile phone blog
CN101706822B (en) Method and device for improving speed of mounting journal file system
CN101364217B (en) Data maintenance method, equipment and system thereof in data-base
CN101187936B (en) A log data storage method and device
CN102047231A (en) Data storage and access
CN101571850A (en) Display packing and device of text document in support of page turn function
CN101702139B (en) Method and device for accessing data of Nand flash memory
CN104461750A (en) Method and device for accessing NAND flash
CN102402698B (en) A kind of method and device reducing the erasable number of operations of Subscriber Identity Module file
CN116578234B (en) Flash memory access system and method
CN201707662U (en) Embedded type equipment supporting JAVA technology
CN105260264A (en) Snapshot implementation method and snapshot system
CN101345945A (en) Short message storage method and apparatus
CN101770426B (en) Storage method and storage equipment
CN109002399A (en) The method of embedded device logout
CN101515274A (en) Method for reading and playing mobile phone audio-frequency data
CN103124309B (en) Method and terminal for read-write control of mobile phone files
CN101996168B (en) Method and device for formatting flash memory
CN100498765C (en) Method and device for making electric newspaper printing plate
CN100444166C (en) Position-based interface access method and device for FAT file system
CN105279103A (en) Data management method and apparatus
CN116185891B (en) Descriptor management method
CN114327260B (en) Data reading method, system, server and storage medium
US20230409235A1 (en) File system improvements for zoned storage device operations

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110629

Termination date: 20141207

EXPY Termination of patent right or utility model