CN108959405A - The strong consistency read method and terminal device of data - Google Patents
The strong consistency read method and terminal device of data Download PDFInfo
- Publication number
- CN108959405A CN108959405A CN201810574708.6A CN201810574708A CN108959405A CN 108959405 A CN108959405 A CN 108959405A CN 201810574708 A CN201810574708 A CN 201810574708A CN 108959405 A CN108959405 A CN 108959405A
- Authority
- CN
- China
- Prior art keywords
- data
- read
- reading
- value
- storage unit
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention is suitable for field of computer technology, provides the strong consistency read method and terminal device of a kind of data, wherein the described method includes: determining the data block of data to be read according to I/O Request, redirects read operation to local cache;If there is the data block in local cache, read lock locking is added;If data mode is the first preset state in data block, MD5 value is read from local cache;Read operation is redirected to object-storage unit; compare MD5 value in the MD5 value and object-storage unit; if different; data are read from object-storage unit; data in more new data block; setting data mode is the second preset state; and update MD5 value in local cache; read lock locking is released, it can be by adding read lock, it is ensured that data strong consistency in caching; it is verified by MD5 value; guarantee that data are when first used in caching, it is consistent with data in object storage, it is applied to object storage service in the higher application of data coherence request.
Description
Technical field
The invention belongs to the strong consistency read methods and terminal of field of computer technology more particularly to a kind of data to set
It is standby.
Background technique
With the fast development of cloud computing technology and the arrival of big data era, there is safe and reliable, cubic elasticity to stretch,
The distributed objects storage service of the features such as easy to use, high-performance, low cost obtains being widely used for enterprise application system.When
Preceding object storage service provider realizes the High Availabitity of system by more copy asynchronous replication of data to enhance user experience
With the final consistency of data, the consistency that user perceives has been ensured.But for partially needing to provide the enterprise of strong consistency
For industry (such as medical field, financial field etc.), the data management mechanism of cloud object storage service itself is relied solely on not
It is able to satisfy the needs of strong consistency.
Summary of the invention
In view of this, the embodiment of the invention provides the strong consistency read method and terminal device of a kind of data, with solution
For the certainly existing enterprise for partially needing to provide strong consistency, the data management of cloud object storage service itself is relied solely on
Mechanism is not able to satisfy the problem of strong consistency needs.
The first aspect of the embodiment of the present invention provides a kind of strong consistency read method of data, comprising:
According to object-storage unit read data input/output (Input/Output, IO) request reset determine to
The data block for reading data, to read operation to local cache, and detects whether have the data block in the local cache;
If there is the data block in the local cache, to data block addition read lock locking, and the number is obtained
According to the state of data in block;
If the state of data is the first preset state in the data block, eap-message digest is read from the local cache
Algorithm (Message Digest Algorithm, MD) 5 values;
Read operation is redirected to the object-storage unit according to the I/O Request, if the MD5 value read and the object
MD5 value in storage unit is different, then data is read from the object-storage unit according to the read operation of redirection, according to reading
The data taken update the data in the data block, set the second preset state for the state of updated data, and according to
MD5 value in the object-storage unit updates the MD5 value in the local cache, releases the read lock locking.
Optionally, the strong consistency read method of above-mentioned data further include:
If the state of data is second preset state in the data block, according to the read operation of redirection from described
Data are read in data block, and after the completion of reading, release the read lock locking.
Optionally, the strong consistency read method of above-mentioned data further include:
If the MD5 value read is identical as the MD5 value in the object-storage unit, according to the read operation of redirection from institute
It states and reads data in data block, and after the completion of reading, release the read lock locking.
Optionally, it is also wrapped after reading data in the object-storage unit in the read operation according to redirection
It includes:
Hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP) is added in the MD5 value of reading to ask
It asks, If-Match label is added to the HTTP request that MD5 value is added, and the HTTP request for adding If-Match label is sent to
The object-storage unit.
Optionally, the strong consistency read method of above-mentioned data further include:
If not having the data block in the local cache, read operation is redirected to the object according to the I/O Request
Storage unit reads data from the object-storage unit according to the read operation of redirection, the data of reading is saved in institute
It states in local cache, and sets second preset state for the state of the data of preservation.
The second aspect of the embodiment of the present invention provides a kind of strong consistency reading device of data, comprising:
First read operation redirects unit, to be read for being determined according to the I/O Request for reading data to object-storage unit
The data block of data redirects read operation to local cache, and detects whether have the data block in the local cache;
Data mode acquiring unit, if being added for having the data block in the local cache to the data block
Read lock locking, and obtain the state of data in the data block;
MD5 value reading unit, if the state for data in the data block is the first preset state, from the local
MD5 value is read in caching;
First data-reading unit, for redirecting read operation to the object-storage unit according to the I/O Request, if
The MD5 value of reading is different from the MD5 value in the object-storage unit, then is stored according to the read operation of redirection from the object
Data are read in unit, update the data in the data block according to the data of reading, and the state of updated data is arranged
For the second preset state, and the MD5 value in the local cache is updated according to the MD5 value in the object-storage unit, released
The read lock locking.
Optionally, the strong consistency reading device of above-mentioned data further include:
Second data-reading unit, if the state for data in the data block is second preset state, root
Data are read from the data block according to the read operation of redirection, and after the completion of reading, release the read lock locking.
Optionally, the strong consistency reading device of above-mentioned data further include:
Third data-reading unit, if the MD5 value for reading is identical as the MD5 value in the object-storage unit,
Data are read from the data block according to the read operation of redirection, and after the completion of reading, release the read lock locking.
The third aspect of the embodiment of the present invention provides a kind of strong consistency reading terminal equipment of data, including storage
Device, processor and storage in the memory and the computer program that can run on the processor, the processor
It realizes when executing the computer program such as the step of the above method.
The fourth aspect of the embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage
Media storage has computer program, realizes when the computer program is executed by processor such as the step of the above method.
Existing beneficial effect is the embodiment of the present invention compared with prior art: the embodiment of the present invention when reading data,
Data in local cache are first read, if being not present in caching, illustrates the read-write operation for not carrying out the block in caching range, has
The sufficient time guarantees the final consistency of data block in object storage, and by adding read lock in local cache, same
Data block does not allow concurrent reading and writing to operate, and allows concurrent read operation, it is ensured that the strong consistency of data in caching passes through data block
The verification of MD5 value guarantees that the data in when first used, storing with object of the data in caching are consistent, client can be made simultaneously
When hair reads data, what is obtained is all newest data, the loss that the final consistency for avoiding object from storing may cause data,
The application range for expanding object storage increases the selling resources income of object storage operator, makes object storage service can
To be applied to in the higher application of data coherence request, such as financial industry, medical industry, it is ensured that need strong consistency
Enterprise is able to use object storage service and does not have to undertake the inconsistent bring risk of data.
Detailed description of the invention
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art
Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is only of the invention some
Embodiment for those of ordinary skill in the art without any creative labor, can also be according to these
Attached drawing obtains other attached drawings.
Fig. 1 is a kind of schematic flow diagram of the strong consistency read method of data provided in an embodiment of the present invention;
Fig. 2 be another embodiment of the present invention provides a kind of data strong consistency read method schematic flow diagram;
Fig. 3 is a kind of schematic flow diagram of the strong consistency read method for data that yet another embodiment of the invention provides;
Fig. 4 is a kind of schematic flow diagram of the strong consistency read method for data that further embodiment of this invention provides;
Fig. 5 is a kind of schematic flow diagram of the strong consistency read method for data that further embodiment of this invention provides;
Fig. 6 is a kind of schematic block diagram of the strong consistency reading device of data provided in an embodiment of the present invention;
Fig. 7 be another embodiment of the present invention provides a kind of data strong consistency reading device schematic block diagram;
Fig. 8 is a kind of schematic block diagram of the strong consistency reading terminal equipment of data provided in an embodiment of the present invention.
Specific embodiment
In being described below, for illustration and not for limitation, the tool of such as particular system structure, technology etc is proposed
Body details, to understand thoroughly the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specific
The present invention also may be implemented in the other embodiments of details.In other situations, it omits to well-known system, device, electricity
The detailed description of road and method, in case unnecessary details interferes description of the invention.
In order to illustrate technical solutions according to the invention, the following is a description of specific embodiments.
It is a kind of exemplary flow of the strong consistency read method of data provided in an embodiment of the present invention referring to Fig. 1, Fig. 1
Figure is illustrated, here, terminal can be smart phone, tablet computer by taking the triggering of the angle of terminal as an example in this embodiment
Equal mobile terminals.As shown in Figure 1, in this embodiment, the treatment process of terminal may comprise steps of:
S101: determining the data block of data to be read according to the I/O Request for reading data to object-storage unit, redirects
Read operation detects whether have the data block in the local cache to local cache.
Here, when client reads data from object-storage unit, the I/O Request of data is read in interception, is determined to be read
The data block of data redirects read operation to local cache.Specifically, terminal can prestore reading manner, according to the reading prestored
Mode is taken to redirect read operation to local cache, the reading manner prestored here can be local first to read local cache data
It is not present, is then read from object-storage unit in caching.Wherein, redirecting is exactly by various methods by various network requests
Again a fixed direction goes to other positions.
After reading manner that above-mentioned basis prestores redirects read operation to local cache, detect in local cache whether
Have the data block, if there is subsequent step can be executed, if not provided, can according to above-mentioned I/O Request redirect read operation to pair
As storage unit, data are read from object-storage unit according to the read operation of redirection.
Local cache refers to that the physical memory by client computer local marks off a part of space and is used to buffer client computer write-back
To the data of server, effect: the technology is by the no longer first write service device hard disk of the data of client computer write-back, but by write-back number
According to local cache is first written, when spatial cache reaches certain threshold value, then by write back data to server, clothes can be substantially reduced
Business device read-write pressure and network load.Here, local cache can be memory or persistence equipment.Object storage i.e. key assignments
Storage is generally provided using http protocol through interfaces such as simple PUT, GET, is suitble to carry out in cloud environment large-scale non-
Structural data storage uses.
S102: if there is the data block in the local cache, to data block addition read lock locking, and institute is obtained
State the state of data in data block.
Specifically, if there is above-mentioned data block in local cache, read lock is added to above-mentioned data block, same data block does not permit
Perhaps concurrent reading and writing operates, and allows concurrent read operation, it is ensured that the strong consistency of data in caching.
S103: if the state of data is the first preset state in the data block, MD5 is read from the local cache
Value.
Here, if the state of data is the first preset state (such as clean2) in above-mentioned data block, illustrate in caching
Data need to carry out MD5 verification with data in object storage, if the state of data is the second preset state in above-mentioned data block
(such as clean) illustrates that the data in caching are latest data, and reading of content to target simultaneously returns, and releases read lock, wherein MD5
For a kind of widely used hash function of computer safety field, to provide the integrity protection of message.Above-mentioned generation first
Preset state (clean2) only generation when program restarts and loads existing cache file, in normal program operation
In, the first preset state will not be generated.
S104: according to the I/O Request redirect read operation arrive the object-storage unit, if reading MD5 value with it is described
MD5 value in object-storage unit is different, then data, root is read from the object-storage unit according to the read operation of redirection
The data in the data block are updated according to the data of reading, set the second preset state for the state of updated data, and
The MD5 value in the local cache is updated according to the MD5 value in the object-storage unit, releases the read lock locking.
Specifically, if having data and state for the first preset state in caching, such as clean2, then illustrate number in caching
According to needing data in storing with object to carry out MD5 verification, if verifying successfully, reading of content to target and is returned from caching, solution
Except read lock;If verification is unsuccessful, data are read from object storage, and update the data block in caching, corresponding states updates
For the second preset state, such as clean, while the MD5 value in local cache is updated, releases read lock.
It is evidenced from the above discussion that the strong consistency read method of data of the embodiment of the present invention is first read when reading data
Data in local cache illustrate the read-write operation for not carrying out the block in caching range, there is abundance if being not present in caching
Time guarantees the final consistency of data block in object storage, and by adding read lock, same data block in local cache
Do not allow concurrent reading and writing to operate, allow concurrent read operation, it is ensured that the strong consistency of data in caching passes through the MD5 value of data block
Verification guarantees that the data in when first used, storing with object of the data in caching are consistent, client can be made concurrently to read
According to when, what is obtained is all newest data, and the loss that may cause to data of final consistency for avoiding object from storing expands
The application range of object storage increases the selling resources income of object storage operator, applies object storage service
In to the higher application of data coherence request, such as financial industry, medical industry, it is ensured that need enterprise's energy of strong consistency
Enough do not have to undertake the inconsistent bring risk of data using object storage service.
Referring to Fig. 2, Fig. 2 be another embodiment of the present invention provides a kind of data strong consistency read method signal
Flow chart.The difference of the present embodiment and above-described embodiment is S205, wherein the S101 in S201~S204 and a upper embodiment
~S104 is identical, referring specifically to the associated description of S101~S104 in above-described embodiment, does not repeat herein.In the present embodiment
The strong consistency read method of data can also include:
S205: if the state of data is second preset state in the data block, according to the read operation of redirection
Data are read from the data block, and after the completion of reading, release the read lock locking.
Here, if having data and state for the second preset state in caching, such as clean, then illustrate the data in caching
For latest data, reading of content to target is simultaneously returned, and releases read lock.
Referring to Fig. 3, Fig. 3 is a kind of signal of the strong consistency read method for data that yet another embodiment of the invention provides
Flow chart.The difference of the present embodiment and above-described embodiment is S305, wherein the S101 in S301~S304 and a upper embodiment
~S104 is identical, referring specifically to the associated description of S101~S104 in above-described embodiment, does not repeat herein.In the present embodiment
The strong consistency read method of data can also include:
S305: it if the MD5 value read is identical as the MD5 value in the object-storage unit, is grasped according to the reading of redirection
Work reads data from the data block, and after the completion of reading, releases the read lock locking.
Specifically, as above-mentioned, if having data and state in caching is the first preset state, such as clean2, then illustrate
In caching data need with object storage in data carry out MD5 verification, if verifying successfully, from caching reading of content to target simultaneously
It returns, releases read lock;If verification is unsuccessful, data are read from object storage, and update the data block in caching, corresponding shape
State is updated to the second preset state, such as clean, releases read lock.
Referring to Fig. 4, Fig. 4 is a kind of signal of the strong consistency read method for data that further embodiment of this invention provides
Flow chart.The difference of the present embodiment and above-described embodiment is S404~S405, wherein in S401~S403 and a upper embodiment
S101~S103 it is identical, S406 is identical as the S104 in a upper embodiment, referring specifically to S101 in above-described embodiment~
The associated description of S104, does not repeat herein.The strong consistency read method of data in the present embodiment can also include:
S404: being added HTTP request for the MD5 value of reading, adds If-Match label to the HTTP request that MD5 value is added,
And the HTTP request for adding If-Match label is sent to the object-storage unit.
S405: the response results that the object-storage unit returns are received, the MD5 read is determined according to the response results
It is worth whether identical as the MD5 value in the object-storage unit.
Here, if the state of data is the first preset state (clean2) in above-mentioned data block, from local cache
MD5 value is read, which is added HTTP request header parameter, and add " If-Match " label, by addition If-Match mark
The HTTP request of label is sent to object-storage unit, and object-storage unit will be in the MD5 value on HTTP request head and object storage
MD5 value be compared, if they are the same, return response result, such as return to 304 status codes, terminal is according to the read operation of redirection
Data are read from the data block, and after the completion of reading, release the read lock locking;If it is different, returning an object value storage is single
Data in member update the data in above-mentioned data block according to the data of reading, set for the state of updated data
Two preset states, and the MD5 value in local cache is updated according to the MD5 value in object-storage unit, release the read lock locking.
Referring to Fig. 5, Fig. 5 is a kind of signal of the strong consistency read method for data that further embodiment of this invention provides
Flow chart.The difference of the present embodiment and above-described embodiment is S505, wherein the S101 in S401~S404 and a upper embodiment
~S104 is identical, referring specifically to the associated description of S101~S104 in above-described embodiment, does not repeat herein.In the present embodiment
The strong consistency read method of data can also include:
S505: if not having the data block in the local cache, read operation is redirected to institute according to the I/O Request
Object-storage unit is stated, data are read from the object-storage unit according to the read operation of redirection, the data of reading are protected
It is stored in the local cache, and sets second preset state for the state of the data of preservation.
Specifically, if not having above-mentioned data block in caching, read operation can be redirected according to above-mentioned I/O Request to object
Storage unit reads data according to the read operation of redirection from object-storage unit, the data of reading is saved in local slow
In depositing, and above-mentioned second preset state is set by the state of the data of preservation, is suitble to application.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
Corresponding to the strong consistency read method of data described in foregoing embodiments, Fig. 6 shows the embodiment of the present invention and mentions
A kind of schematic block diagram of the strong consistency reading device of the data supplied.The strong consistency reading device of the data of the present embodiment
600 each units for including are used to execute each step in the corresponding embodiment of Fig. 1, referring specifically to the corresponding implementation of Fig. 1 and Fig. 1
Associated description in example, does not repeat herein.The strong consistency reading device 600 of the data of the present embodiment includes the first read operation weight
Directed element 601, data mode acquiring unit 602, MD5 value reading unit 603 and the first data-reading unit 604.
Wherein, the first read operation redirects unit 601, for true according to the I/O Request for reading data to object-storage unit
The data block of fixed data to be read redirects read operation to local cache, and detects whether have the number in the local cache
According to block.Data mode acquiring unit 602, if being added for having the data block in the local cache to the data block
Read lock locking, and obtain the state of data in the data block.MD5 value reading unit 603, if for data in the data block
State be the first preset state, then from the local cache read MD5 value.First data-reading unit 604 is used for basis
The I/O Request redirects read operation to the object-storage unit, if in the MD5 value and the object-storage unit that read
MD5 value is different, then reads data from the object-storage unit according to the read operation of redirection, is updated according to the data of reading
Data in the data block set the second preset state for the state of updated data, and are stored according to the object
MD5 value in unit updates the MD5 value in the local cache, releases the read lock locking.
It is evidenced from the above discussion that the strong consistency reading device of data of the embodiment of the present invention, make object storage service can be with
Applied to in the higher application of data coherence request, such as financial industry, medical industry, it is ensured that need the enterprise of strong consistency
Industry is able to use object storage service and does not have to undertake the inconsistent bring risk of data.
Referring to Fig. 7, Fig. 7 be another embodiment of the present invention provides another data strong consistency reading device signal
Property block diagram.The strong consistency reading device 700 of the data of the present embodiment includes that the first read operation redirects unit 701, data shape
State acquiring unit 702, MD5 value reading unit 703, the first data-reading unit 704, the second data-reading unit 705, third number
Unit 709 is redirected according to reading unit 706, HTTP request processing unit 707, response processing unit 708 and the second read operation.
Wherein, the first read operation redirects unit 701, data mode acquiring unit 702, MD5 value reading unit 703 and the
One data-reading unit 704 redirects unit 601, data referring specifically to the first read operation in the corresponding embodiment of Fig. 6 and Fig. 6
The associated description of state acquiring unit 602, MD5 value reading unit 603 and the first data-reading unit 604, does not repeat herein.
Further, the second data-reading unit 705, if the state for data in the data block is described second pre-
If state, then data are read from the data block according to the read operation of redirection, and after the completion of reading, releases the read lock
Locking.
Further, third data-reading unit 706, if in the MD5 value and the object-storage unit of reading
MD5 value is identical, then data is read from the data block according to the read operation of redirection, and after the completion of reading, described in releasing
Read lock locking.
Further, HTTP request is added in HTTP request processing unit 707, the MD5 value for that will read, to addition MD5
The HTTP request of value adds If-Match label, and the HTTP request for adding If-Match label is sent to the object and is stored
Unit.
Response processing unit 708 is also used to receive the response results that the object-storage unit returns, according to the response
As a result determine whether the MD5 value read and the MD5 value in the object-storage unit are identical.
Further, the second read operation redirects unit 708, if for there is no the data block in the local cache,
Read operation is then redirected to the object-storage unit according to the I/O Request, is deposited according to the read operation of redirection from the object
Data are read in storage unit, the data of reading are saved in the local cache, and set the state of the data of preservation to
Second preset state.
It is evidenced from the above discussion that the embodiment of the present invention when reading data, first reads data in local cache, if in caching
It is not present, then illustrates the read-write operation for not carrying out the block in caching range, there is the sufficient time to guarantee data in object storage
The final consistency of block, and by adding read lock in local cache, same data block does not allow concurrent reading and writing to operate, and allows
Concurrent read operation, it is ensured that the strong consistency of data in caching is verified by the MD5 value of data block, guarantees that the data in caching exist
When first used, consistent with data in object storage, client can be made when concurrently reading data, what is obtained is all newest number
According to the loss that the final consistency for avoiding object from storing may cause data expands the application range of object storage, increases
The selling resources income of object storage operator, can be applied to object storage service higher to data coherence request
In, such as financial industry, medical industry, it is ensured that the enterprise of strong consistency is needed to be able to use object storage service and do not have to
Undertake the inconsistent bring risk of data.
It is a kind of showing for the strong consistency reading terminal equipment of data provided by one embodiment of the present invention referring to Fig. 8, Fig. 8
Meaning block diagram.As shown in figure 8, the strong consistency reading terminal equipment 80 of the data of the embodiment includes: processor 800, memory
801 and it is stored in the computer program 802 that can be run in the memory 801 and on the processor 800, such as data
Strong consistency reading program.The processor 800 realizes the strong by one of above-mentioned each data when executing the computer program 802
Step in cause property read method embodiment, such as step 101 shown in FIG. 1 is to 104.Alternatively, the processor 800 executes institute
The function of each unit in above-mentioned each Installation practice, such as unit 701 to 708 shown in Fig. 7 are realized when stating computer program 802
Function.
The computer program 802 can be divided into one or more module/units, one or more of moulds
Block/unit is stored in the memory 801, and is executed by the processor 800, to complete the present invention.It is one or
Multiple module/units can be the series of computation machine program instruction section that can complete specific function, and the instruction segment is for describing
Implementation procedure of the computer program 802 in the strong consistency reading terminal equipment 80 of the data.For example, the calculating
Machine program 802 can be divided into the first read operation and redirect unit, data mode acquiring unit, MD5 value reading unit, first
Data-reading unit, the second data-reading unit, third data-reading unit, HTTP request processing unit and the second read operation weight
Directed element, each unit concrete function are as follows:
The data block of data to be read is determined according to the I/O Request for reading data to object-storage unit, redirects read operation
To local cache, and detect whether have the data block in the local cache;
If there is the data block in the local cache, to data block addition read lock locking, and the number is obtained
According to the state of data in block;
If the state of data is the first preset state in the data block, MD5 value is read from the local cache;
Read operation is redirected to the object-storage unit according to the I/O Request, if the MD5 value read and the object
MD5 value in storage unit is different, then data is read from the object-storage unit according to the read operation of redirection, according to reading
The data taken update the data in the data block, set the second preset state for the state of updated data, and according to
MD5 value in the object-storage unit updates the MD5 value in the local cache, releases the read lock locking.
Further, each unit concrete function further include:
If the state of data is second preset state in the data block, according to the read operation of redirection from described
Data are read in data block, and after the completion of reading, release the read lock locking.
Further, each unit concrete function further include:
If the MD5 value read is identical as the MD5 value in the object-storage unit, according to the read operation of redirection from institute
It states and reads data in data block, and after the completion of reading, release the read lock locking.
Further, each unit concrete function further include:
HTTP request is added in the MD5 value of reading, If-Match label is added to the HTTP request that MD5 value is added, and will
The HTTP request of addition If-Match label is sent to the object-storage unit;
Receive the response results that the object-storage unit returns, determined according to the response results MD5 value that reads with
Whether the MD5 value in the object-storage unit is identical.
Further, each unit concrete function further include:
If not having the data block in the local cache, read operation is redirected to the object according to the I/O Request
Storage unit reads data from the object-storage unit according to the read operation of redirection, the data of reading is saved in institute
It states in local cache, and sets second preset state for the state of the data of preservation.
Above scheme first reads data in local cache when reading data, if being not present in caching, illustrates slow
The read-write operation for not carrying out the block in range is deposited, has the sufficient time to guarantee the final consistency of data block in object storage, and
And by adding read lock in local cache, same data block does not allow concurrent reading and writing to operate, and allows concurrent read operation, it is ensured that slow
The strong consistency for depositing middle data is verified by the MD5 value of data block, guarantees data in caching when first used, with object
Data are consistent in storage, and client can be made when concurrently reading data, and what is obtained is all newest data, and object is avoided to store
The loss that final consistency may cause data expands the application range of object storage, increases object storage operator
Selling resources income, can be applied to object storage service in the higher application of data coherence request, such as financial row
Industry, medical industry, it is ensured that need the enterprise of strong consistency to be able to use object storage service and do not have to undertake data inconsistent
Bring risk.
The strong consistency reading terminal equipment 80 of the data can be desktop PC, notebook, palm PC and
Cloud server etc. calculates equipment.The strong consistency reading terminal equipment of the data may include, but be not limited only to, processor
800, memory 801.It will be understood by those skilled in the art that Fig. 8 is only the strong consistency reading terminal equipment 80 of data
Example, the not restriction of the strong consistency reading terminal equipment 80 of structure paired data may include more more or fewer than illustrating
Component, perhaps combines certain components or different components, such as the strong consistency reading terminal equipment of the data can be with
Including input-output equipment, network access equipment, bus etc..
Alleged processor 800 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
Deng.
The memory 801 can be the internal storage unit of the strong consistency reading terminal equipment 80 of the data, example
Such as the hard disk or memory of the strong consistency reading terminal equipment 80 of data.The memory 801 is also possible to the strong of the data
It is equipped on the External memory equipment of consistency reading terminal equipment 80, such as the strong consistency reading terminal equipment 80 of the data
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card,
Flash card (Flash Card) etc..Further, the memory 801 can also both have been read the strong consistency including the data
The internal storage unit of terminal device 80 also includes External memory equipment.The memory 801 is for storing the computer journey
Other programs and data needed for the strong consistency reading terminal equipment of sequence and the data.The memory 801 can be with
For temporarily storing the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing
The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also
To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated
Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list
Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system
The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device/terminal device and method, it can be with
It realizes by another way.For example, device described above/terminal device embodiment is only schematical, for example, institute
The division of module or unit is stated, only a kind of logical function partition, there may be another division manner in actual implementation, such as
Multiple units or components can be combined or can be integrated into another system, or some features can be ignored or not executed.Separately
A bit, shown or discussed mutual coupling or direct-coupling or communication connection can be through some interfaces, device
Or the INDIRECT COUPLING or communication connection of unit, it can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated module/unit be realized in the form of SFU software functional unit and as independent product sale or
In use, can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-mentioned implementation
All or part of the process in example method, can also instruct relevant hardware to complete, the meter by computer program
Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on
The step of stating each embodiment of the method.Wherein, the computer program includes computer program code, the computer program generation
Code can be source code form, object identification code form, executable file or certain intermediate forms etc..The computer-readable medium
It may include: any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic that can carry the computer program code
Dish, CD, computer storage, read-only memory (Read-Only Memory, ROM), random access memory (Random
Access Memory, RAM), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that the meter
The content that calculation machine readable medium includes can carry out increase and decrease appropriate according to the requirement made laws in jurisdiction with patent practice,
Such as in certain jurisdictions, according to legislation and patent practice, computer-readable medium do not include be electric carrier signal and electricity
Believe signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality
Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each
Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified
Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.
Claims (10)
1. a kind of strong consistency read method of data characterized by comprising
The data block of data to be read is determined according to the input/output I/O Request for reading data to object-storage unit, is redirected
Read operation detects whether have the data block in the local cache to local cache;
If there is the data block in the local cache, to data block addition read lock locking, and the data block is obtained
The state of middle data;
If the state of data is the first preset state in the data block, Message Digest 5 is read from the local cache
MD5 value;
Read operation is redirected to the object-storage unit according to the I/O Request, if the MD5 value read and the object store
MD5 value in unit is different, then data is read from the object-storage unit according to the read operation of redirection, according to reading
Data update the data in the data block, set the second preset state for the state of updated data, and according to described
MD5 value in object-storage unit updates the MD5 value in the local cache, releases the read lock locking.
2. the strong consistency read method of data as described in claim 1, which is characterized in that further include:
If the state of data is second preset state in the data block, according to the read operation of redirection from the data
Data are read in block, and after the completion of reading, release the read lock locking.
3. the strong consistency read method of data as described in claim 1, which is characterized in that further include:
If the MD5 value read is identical as the MD5 value in the object-storage unit, according to the read operation of redirection from the number
According to reading data in block, and after the completion of reading, the read lock locking is released.
4. the strong consistency read method of data as described in claim 1, which is characterized in that further include:
HTTP request is added in the MD5 value of reading, If-Match is added to the HTTP request that MD5 value is added
Label, and the HTTP request for adding If-Match label is sent to the object-storage unit;
Receive the response results that the object-storage unit returns, determined according to the response results MD5 value that reads with it is described
Whether the MD5 value in object-storage unit is identical.
5. the strong consistency read method of data as described in claim 1, which is characterized in that further include:
If there is no the data block in the local cache, read operation is redirected according to the I/O Request and is stored to the object
Unit reads data from the object-storage unit according to the read operation of redirection, the data of reading is saved in described
In ground caching, and second preset state is set by the state of the data of preservation.
6. a kind of strong consistency reading device of data characterized by comprising
First read operation redirects unit, for determining data to be read according to the I/O Request for reading data to object-storage unit
Data block, redirect read operation to local cache, and detect whether have the data block in the local cache;
Data mode acquiring unit, if adding read lock to the data block for having the data block in the local cache
Locking, and obtain the state of data in the data block;
MD5 value reading unit, if the state for data in the data block is the first preset state, from the local cache
Middle reading MD5 value;
First data-reading unit, for redirecting read operation to the object-storage unit according to the I/O Request, if reading
MD5 value it is different from the MD5 value in the object-storage unit, then according to the read operation of redirection from the object-storage unit
Middle reading data update the data in the data block according to the data of reading, set for the state of updated data
Two preset states, and the MD5 value in the local cache is updated according to the MD5 value in the object-storage unit, described in releasing
Read lock locking.
7. the strong consistency reading device of data as claimed in claim 6, which is characterized in that further include:
Second data-reading unit, if the state for data in the data block is second preset state, according to weight
Data are read in the read operation of orientation from the data block, and after the completion of reading, release the read lock locking.
8. the strong consistency reading device of data as claimed in claim 6, which is characterized in that further include:
Third data-reading unit, if the MD5 value for reading is identical as the MD5 value in the object-storage unit, basis
Data are read in the read operation of redirection from the data block, and after the completion of reading, release the read lock locking.
9. a kind of strong consistency reading terminal equipment of data, including memory, processor and storage are in the memory
And the computer program that can be run on the processor, which is characterized in that when the processor executes the computer program
It realizes such as the step of any one of claim 1 to 5 the method.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists
In when the computer program is executed by processor the step of any one of such as claim 1 to 5 of realization the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810574708.6A CN108959405B (en) | 2018-06-06 | 2018-06-06 | Strong consistency reading method of data and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810574708.6A CN108959405B (en) | 2018-06-06 | 2018-06-06 | Strong consistency reading method of data and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108959405A true CN108959405A (en) | 2018-12-07 |
CN108959405B CN108959405B (en) | 2021-08-17 |
Family
ID=64493504
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810574708.6A Active CN108959405B (en) | 2018-06-06 | 2018-06-06 | Strong consistency reading method of data and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108959405B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115826880A (en) * | 2023-02-14 | 2023-03-21 | 北京大道云行科技有限公司 | Local caching method, device, system, medium and equipment of object storage system |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6216212B1 (en) * | 1997-08-01 | 2001-04-10 | International Business Machines Corporation | Scaleable method for maintaining and making consistent updates to caches |
CN101090401A (en) * | 2007-05-25 | 2007-12-19 | 金蝶软件(中国)有限公司 | Data buffer store method and system at duster environment |
CN102012872A (en) * | 2010-11-24 | 2011-04-13 | 烽火通信科技股份有限公司 | Level two cache control method and device for embedded system |
US20130325827A1 (en) * | 2012-05-31 | 2013-12-05 | Red Hat Inc. | Incremental optimistic locking of data distributed on multiple nodes to avoid transaction deadlock |
US20150169497A1 (en) * | 2013-12-12 | 2015-06-18 | International Business Machines Corporation | Efficient Distributed Cache Consistency |
CN104796439A (en) * | 2014-01-16 | 2015-07-22 | 腾讯科技(深圳)有限公司 | Webpage pushing method, webpage pushing client, webpage pushing server and webpage pushing system |
US20160154736A1 (en) * | 2014-12-01 | 2016-06-02 | Macronix Internatioal Co., Ltd. | Cache controlling method for memory system and cache system thereof |
CN106021381A (en) * | 2016-05-11 | 2016-10-12 | 北京搜狐新媒体信息技术有限公司 | Data access/storage method and device for cloud storage service system |
CN106156049A (en) * | 2015-03-27 | 2016-11-23 | 天脉聚源(北京)科技有限公司 | A kind of method and system of digital independent |
CN107305477A (en) * | 2016-04-25 | 2017-10-31 | 中国科学院微电子研究所 | Cache read-write operation method and system of flash cache hybrid storage system |
CN107656701A (en) * | 2017-09-26 | 2018-02-02 | 郑州云海信息技术有限公司 | Small documents read accelerated method, system, device and computer-readable recording medium |
CN107656937A (en) * | 2016-07-26 | 2018-02-02 | 北京京东尚科信息技术有限公司 | Method and apparatus for realizing read-write data consistency |
-
2018
- 2018-06-06 CN CN201810574708.6A patent/CN108959405B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6216212B1 (en) * | 1997-08-01 | 2001-04-10 | International Business Machines Corporation | Scaleable method for maintaining and making consistent updates to caches |
CN101090401A (en) * | 2007-05-25 | 2007-12-19 | 金蝶软件(中国)有限公司 | Data buffer store method and system at duster environment |
CN102012872A (en) * | 2010-11-24 | 2011-04-13 | 烽火通信科技股份有限公司 | Level two cache control method and device for embedded system |
US20130325827A1 (en) * | 2012-05-31 | 2013-12-05 | Red Hat Inc. | Incremental optimistic locking of data distributed on multiple nodes to avoid transaction deadlock |
US20150169497A1 (en) * | 2013-12-12 | 2015-06-18 | International Business Machines Corporation | Efficient Distributed Cache Consistency |
CN104796439A (en) * | 2014-01-16 | 2015-07-22 | 腾讯科技(深圳)有限公司 | Webpage pushing method, webpage pushing client, webpage pushing server and webpage pushing system |
US20160154736A1 (en) * | 2014-12-01 | 2016-06-02 | Macronix Internatioal Co., Ltd. | Cache controlling method for memory system and cache system thereof |
CN106156049A (en) * | 2015-03-27 | 2016-11-23 | 天脉聚源(北京)科技有限公司 | A kind of method and system of digital independent |
CN107305477A (en) * | 2016-04-25 | 2017-10-31 | 中国科学院微电子研究所 | Cache read-write operation method and system of flash cache hybrid storage system |
CN106021381A (en) * | 2016-05-11 | 2016-10-12 | 北京搜狐新媒体信息技术有限公司 | Data access/storage method and device for cloud storage service system |
CN107656937A (en) * | 2016-07-26 | 2018-02-02 | 北京京东尚科信息技术有限公司 | Method and apparatus for realizing read-write data consistency |
CN107656701A (en) * | 2017-09-26 | 2018-02-02 | 郑州云海信息技术有限公司 | Small documents read accelerated method, system, device and computer-readable recording medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115826880A (en) * | 2023-02-14 | 2023-03-21 | 北京大道云行科技有限公司 | Local caching method, device, system, medium and equipment of object storage system |
Also Published As
Publication number | Publication date |
---|---|
CN108959405B (en) | 2021-08-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3559874B1 (en) | Event-driven blockchain workflow processing | |
CN108959407A (en) | The strong consistency wiring method and terminal device of data | |
US8849776B2 (en) | Method and system for resolving data inconsistency | |
CN109493223B (en) | Accounting method and device | |
Sun et al. | Using ethereum blockchain in Internet of Things: A solution for electric vehicle battery refueling | |
CN109889505A (en) | The data property held verification method and terminal device | |
CN107688487A (en) | For the method and system for the state for recovering database session | |
Zawirski et al. | SwiftCloud: Fault-tolerant geo-replication integrated all the way to the client machine | |
CN107633014A (en) | A kind of date storage method and server | |
US20140143367A1 (en) | Robustness in a scalable block storage system | |
CN108037946A (en) | A kind of method, system and the server of the renewal of application program heat | |
CN106716335B (en) | Asynchronous processing of mapping information | |
US20230052935A1 (en) | Asynchronous accounting method and apparatus for blockchain, medium and electronic device | |
CN106815528B (en) | A kind of file management method and device, storage equipment | |
GB2529246A (en) | Method for securing integrity and consistency of a cloud storage service with efficient client operations | |
CN110753105B (en) | Data transmission method, device, system, electronic equipment and storage medium | |
CN109241357A (en) | Chain structure model and its construction method, system and terminal device | |
WO2022048358A1 (en) | Data processing method and device, and storage medium | |
CN106033422A (en) | A database operation control method, device and system | |
US10127270B1 (en) | Transaction processing using a key-value store | |
WO2021174882A1 (en) | Data fragment verification method, apparatus, computer device, and readable storage medium | |
CN108959405A (en) | The strong consistency read method and terminal device of data | |
CN111722946A (en) | Distributed transaction processing method and device, computer equipment and readable storage medium | |
WO2023274409A1 (en) | Method for executing transaction in blockchain system and blockchain node | |
CN113420050B (en) | Data query management method, device, computer equipment and readable 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 | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Strong consistency reading methods and terminal devices for data Effective date of registration: 20230821 Granted publication date: 20210817 Pledgee: Shenzhen SME financing Company limited by guarantee Pledgor: SHENZHEN VISPRACTICE TECHNOLOGY CO.,LTD. Registration number: Y2023980053045 |