CN113448978A - Method and device for guaranteeing data consistency in same-name image file replacement operation - Google Patents

Method and device for guaranteeing data consistency in same-name image file replacement operation Download PDF

Info

Publication number
CN113448978A
CN113448978A CN202110797143.XA CN202110797143A CN113448978A CN 113448978 A CN113448978 A CN 113448978A CN 202110797143 A CN202110797143 A CN 202110797143A CN 113448978 A CN113448978 A CN 113448978A
Authority
CN
China
Prior art keywords
image file
state
current processing
replacement operation
replaced
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110797143.XA
Other languages
Chinese (zh)
Other versions
CN113448978B (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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202110797143.XA priority Critical patent/CN113448978B/en
Publication of CN113448978A publication Critical patent/CN113448978A/en
Application granted granted Critical
Publication of CN113448978B publication Critical patent/CN113448978B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity

Landscapes

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

Abstract

The invention discloses a method and a device for guaranteeing data consistency in the replacement operation of image files with the same name, which relate to the technical field of big data, wherein the method comprises the following steps: for each replacement operation, receiving a to-be-replaced image file with the same name as the first image file, renaming the to-be-replaced image file to obtain a second image file, storing the second image file, and recording the current processing state as a first state; modifying the metadata stored in the database into metadata to be replaced, and changing the metadata into a second state after the metadata is successfully modified; covering the first image file by using the second image file, and changing to a third state after the covering is successful; scanning the current processing state recorded in each replacement operation aiming at each replacement operation occurring in a specified time period, and deleting the second image file aiming at the replacement operation in the first state or the third state; and for the replacement operation of the second state, the second image file is reused to cover the first image file. The invention can ensure the data consistency in the replacement of the image files with the same name.

Description

Method and device for guaranteeing data consistency in same-name image file replacement operation
Technical Field
The invention relates to the technical field of big data, in particular to a method and a device for guaranteeing data consistency in the replacement operation of image files with the same name.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
Banking businesses often need to keep images, such as face spot photos, certificate photos, contract photos, and the like, wherein the image platform system provides a plurality of services such as uploading, retrieving, deleting, editing, managing, and the like of the images for all business systems. The images stored in the image platform system include image metadata and image files, the image metadata is service information of the images, belongs to structured data, and is generally stored in a relational database, and the image files belong to unstructured data and are stored in an object storage. If the image needs to be modified, the image file and the image metadata need to be modified at the same time, so as to ensure the data consistency of the image metadata and the image file.
When the same-name file replacement is performed on the image file uploaded to the image platform, one of the image files is often replaced first, and then the other image file is replaced after the metadata replacement is successful, that is, the image file is replaced after the metadata replacement is successful, or the metadata is replaced after the metadata replacement is successful. Due to the problems of the system itself or other problems, the metadata may not be successfully replaced after the metadata is successfully replaced, or the metadata may not be successfully replaced after the metadata is successfully replaced. In order to ensure data consistency, data which has been successfully replaced often needs to be rolled back to data before replacement.
At present, in order to ensure that data can be rolled back successfully, old data needs to be backed up first, the backup is stored in a specific storage space, after the complete replacement process of files with the same name fails, the old files of the backup are taken out from the storage space, and the files which are successfully replaced are replaced by the old files. The backup and replacement process is complicated, and the backup files need to be stored separately, which occupies additional storage space.
Disclosure of Invention
The embodiment of the invention provides a method for ensuring data consistency in the replacement operation of a same-name image file, which is used for realizing the replacement operation of the same-name image file in a simple and easy way, ensuring the data consistency in the replacement operation and not occupying extra storage space, and comprises the following steps:
aiming at each replacement operation, receiving an image file to be replaced with the same name as the first image file, and renaming the image file to be replaced to obtain a second image file with the name different from that of the first image file;
storing the second image file into an object for storage, and recording the current processing state as a first state;
modifying the metadata stored in the database into metadata to be replaced, and changing the current processing state from a first state to a second state after the metadata is successfully modified;
covering the first image file by using the second image file, and changing the current processing state from the second state to a third state after the covering is successful;
scanning the current processing state recorded in each replacement operation aiming at each replacement operation occurring in a specified time period, and deleting the second image file aiming at the replacement operation of which the current processing state is the first state or the third state; and for the replacement operation of which the current processing state is the second state, the second image file is reused to cover the first image file.
An embodiment of the present invention further provides a device for guaranteeing data consistency in a homonymous image file replacement operation, so as to implement the homonymous image file replacement operation in a simple and easy manner, guarantee data consistency in the replacement operation, and avoid occupying additional storage space, where the device includes:
aiming at each replacement operation, the communication module is used for receiving the image file to be replaced with the same name as the first image file, renaming the image file to be replaced and obtaining a second image file with the name different from that of the first image file;
the storage module is used for storing the second image file into an object for storage and recording the current processing state as a first state;
the replacing module is used for modifying the metadata stored in the database into metadata to be replaced, and after the metadata is successfully modified, the storage module is triggered to change the current processing state from the first state to the second state;
the replacing module is also used for covering the first image file by using the second image file, and after the covering is successful, the storage module is triggered to change the current processing state from the second state to the third state;
aiming at each replacement operation occurring in a specified time period, the scanning module scans the current processing state recorded in each replacement operation, and for the replacement operation of which the current processing state is a first state or a third state, the scanning module triggers the deleting module to delete the second image file; and for the replacement operation with the current processing state being the second state, triggering the replacement module to reuse the second image file to cover the first image file.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the method for ensuring the data consistency in the replacement operation of the image files with the same name.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program for executing the method for guaranteeing data consistency in the replacement operation of the image file with the same name is stored.
In the embodiment of the invention, after the image file to be replaced which has the same name as the first image file is obtained, the image file to be replaced is renamed to obtain the second image file, so that the first image file and the second image file can be well distinguished, the first image file does not need to be backed up as in the prior art, the operation is convenient and easy, and no extra storage space is occupied; then, after each step of replacing the metadata or the image file is completed, synchronously changing the current processing state, so that the processing progress of the replacement operation can be determined according to the current processing state; aiming at all replacement operations occurring in a specified time period, scanning the current processing state of each replacement operation, if the current processing state is the first state, indicating that the metadata and the image file are not successfully replaced, and deleting the second image file can enable the object storage and the database to be both original data and have no redundant data, thereby ensuring the data consistency; if the state is the third state, the metadata and the image file are both replaced successfully, the second image file is deleted, so that the object storage and the database are both replaced data without redundant data, and the data consistency can be ensured; if the state is the second state, the metadata replacement is successful, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the data consistency can still be ensured after the replacement is successful. Therefore, when a certain step fails to be executed, the subsequent operation can be continuously executed according to the current processing state, and the processing efficiency can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a flowchart illustrating a method for guaranteeing data consistency in a homonymous image file replacement operation according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another method for guaranteeing data consistency in a homonymous image file replacement operation according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another method for guaranteeing data consistency in a homonymous image file replacement operation according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram illustrating an apparatus for guaranteeing data consistency in a homonymous image file replacement operation according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
An embodiment of the present invention provides a method for guaranteeing data consistency in a replacement operation of a same-name image file, as shown in fig. 1, the method includes steps 101 to 105:
step 101, for each replacement operation, receiving an image file to be replaced having the same name as the first image file, and renaming the image file to be replaced to obtain a second image file having a name different from that of the first image file.
The first image file is an original image file stored in the object storage, the file to be replaced is a new file replacing the first image file, the name of the new file is the same as that of the first image file, and the same storage space cannot contain more than two files with the same name, so that the new image file is renamed before the original image file and the new image file are reserved simultaneously before the image file is replaced successfully.
The renaming rule may be that the time when the to-be-replaced video file is received is added after the current name, and the name of the second video file is used as the name, for example, if the names of the current to-be-replaced video file and the first video file are both a, and the time when the to-be-replaced file is received is 16:00:05, the to-be-replaced video file may be renamed to a 160005.
In order to avoid confusion between the image files to be replaced received at different times, the time of receiving the image files to be replaced can be accurate to millisecond level, considering that the image files are frequently updated in some transactions.
It should be noted that, before renaming the image file to be replaced, preparation works, such as entry check, service logic check, service data assembly, and recording the transaction flow of the replacement operation in the database, are also required to be performed, and these preparation works are often performed in the prior art, and detailed description of the specific implementation process is omitted here.
And 102, storing the second image file into an object for storage, and recording the current processing state as a first state.
If status represents status and 0 represents the first status, the current processing status may be recorded as status-0, i.e. an initialized status. Besides recording the current processing state, some other information in the current replacement operation may also be recorded, for example, using operator _ Type ═ E to record the operation Type to which the current replacement operation belongs as edit, and using filename ═ a160005 to record the rename of the to-be-stored video file as a 160005.
The first status, the operation type, the renamed image file name and the like can be recorded in the flexible transaction table so as to be convenient to read.
And 103, modifying the metadata stored in the database into metadata to be replaced, and changing the current processing state from the first state to the second state after the metadata is successfully modified.
If the second state is represented by 2, the status 0 recorded in the flexible transaction table is modified to be 2 after the metadata replacement is successful.
Specifically, as shown in fig. 2, step 103 modifies metadata stored in the database into metadata to be replaced, and when the metadata is successfully modified, changing the current processing state from the first state to the second state may be performed as following steps 201 to 204:
step 201, opening database transaction.
Step 202, the metadata is modified into metadata to be replaced.
And step 203, changing the current processing state from the first state to the second state.
Step 204, submitting database transaction.
The transaction is a function provided by the database itself, and the operation steps executed after the transaction is opened are effective only after the database transaction is successfully committed, that is, the metadata and the current processing state are modified in step 202 and step 203, and the operation steps are effective in the database only after step 204 is successfully executed, and if step 204 is not successfully executed, the modification of the metadata and the current processing state is not saved in the database.
By adopting database transaction, the metadata modification and the current processing state can be ensured to be successfully modified or unsuccessfully modified at the same time, and the situations that the metadata modification is successful, the current processing state is not successfully modified or the metadata modification is unsuccessful and the current processing state is successfully changed can not occur, so that the metadata can be successfully modified in the second state.
And 104, covering the first image file by using the second image file, and changing the current processing state from the second state to a third state after the covering is successful.
It should be noted that, after the overwriting operation in the embodiment of the present invention, the name of the image file before being overwritten is still maintained, for example, the second image file a160005 is used to overwrite the first image file a, and after the overwriting operation is completed, the name is still a.
If the third status is represented by 1, the status 2 recorded in the flexible transaction table is modified to 1 after the overwriting is successful.
After the overwriting is completed, the overwritten image file a and the second image file a160005 are still stored in the object storage, where a is identical to a160005, and in order to save the storage space in the object storage, after step 104 is performed, as shown in fig. 3, the following steps 301 and 302 may also be performed:
step 301, delete the second video file in the target storage.
Step 302, when the second image file is deleted successfully, the recorded current processing state is deleted.
After the second video file is deleted and the entire replacement operation is completed, the current processing state for recording the processing progress of the replacement operation may also be deleted, so that the current processing state of the completed replacement operation may not be found in step 105, and interference on the operation in step 105 is avoided.
Step 105, scanning the current processing state recorded in each replacement operation aiming at each replacement operation occurring in the appointed time period, and deleting the second image file for the replacement operation of which the current processing state is the first state or the third state; and for the replacement operation of which the current processing state is the second state, the second image file is reused to cover the first image file.
The specified time period is a time period from a time before the current time, for example, the current time is 10:00:01, the specified time period is a time period from 10:00:00, and the state of not scanning the replacement operation occurring between 10:00:00 and 10:00:01 is to set a processing time for the replacement operation occurring recently, and not to affect the normal execution of the replacement operation without any problem. The time interval from the current time to the previous time may be determined by the staff according to the completion time of the replacement operation in general, and may be set to 1 minute, for example.
The step is compensation processing for unsuccessfully completing the replacement operation process, specifically, if the replacement operation in the first state is scanned, the metadata and the image file are not successfully replaced, and the object storage and the database can be both original data by deleting the second image file, so that the consistency of the data can be ensured, and no redundant data exists in the object storage.
After deleting the second image file, the current replacement operation is not completed, the image file to be replaced having the same name as the first image file may be obtained again, and the method in the subsequent steps 101 to 104 is executed until the current processing state is changed to the third state (the state in which both the metadata and the image file are successfully replaced), or the second image file and the current processing state are deleted (the state in which the replacement operation is completed), or the total number of times of re-execution reaches the number threshold (the state in which the replacement operation is not completed due to an error). The re-execution comprises re-acquiring the image file to be replaced with the same name as the first image file, and re-covering the first image file by using the second image file.
If the third state indicates that the metadata and the image file are both replaced successfully, the second image file is deleted, so that the object storage and the database are both replaced data, no redundant data exists, and the data consistency is ensured.
If the state is the second state, the metadata replacement is successful, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the data consistency can still be ensured after the replacement is successful. If the replacement is not successful after multiple attempts, the replacement operation may not be automatically completed, and in the embodiment of the present invention, the number of times of reusing the second image file to cover the first image file may be recorded; when the recorded times reach the time threshold value, alarm information is sent out to inform workers to manually process the replacement operation, and faults which cause the replacement operation not to be automatically completed are eliminated, so that the occurrence of subsequent abnormal transactions is reduced. Wherein, the time threshold is set by the staff, such as 3 times or 5 times.
In the embodiment of the invention, after the image file to be replaced which has the same name as the first image file is obtained, the image file to be replaced is renamed to obtain the second image file, so that the first image file and the second image file can be well distinguished, the first image file does not need to be backed up as in the prior art, the operation is convenient and easy, and no extra storage space is occupied; then, after each step of replacing the metadata or the image file is completed, synchronously changing the current processing state, so that the processing progress of the replacement operation can be determined according to the current processing state; aiming at all replacement operations occurring in a specified time period, scanning the current processing state of each replacement operation, if the current processing state is the first state, indicating that the metadata and the image file are not successfully replaced, and deleting the second image file can enable the object storage and the database to be both original data and have no redundant data, thereby ensuring the data consistency; if the state is the third state, the metadata and the image file are both replaced successfully, the second image file is deleted, so that the object storage and the database are both replaced data without redundant data, and the data consistency can be ensured; if the state is the second state, the metadata replacement is successful, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the data consistency can still be ensured after the replacement is successful. Therefore, when a certain step fails to be executed, the subsequent operation can be continuously executed according to the current processing state, and the processing efficiency can be improved.
The embodiment of the present invention further provides a device for guaranteeing data consistency in the replacement operation of the image file with the same name, as described in the following embodiments. Because the principle of the device for solving the problems is similar to the method for guaranteeing the data consistency in the same-name image file replacement operation, the implementation of the device can refer to the implementation of the method for guaranteeing the data consistency in the same-name image file replacement operation, and repeated parts are not described again.
As shown in fig. 4, the apparatus 400 includes a communication module 401, a storage module 402, a replacement module 403, a scanning module 404, and a deletion module 405.
For each replacement operation, the communication module 401 is configured to receive an image file to be replaced having the same name as the first image file, rename the image file to be replaced, and obtain a second image file having a name different from that of the first image file;
a storage module 402, configured to store the second image file in an object storage, and record the current processing state as a first state;
a replacing module 403, configured to modify the metadata stored in the database into metadata to be replaced, and after the metadata is successfully modified, trigger the storing module 402 to change the current processing state from the first state to the second state;
the replacing module 403 is further configured to overwrite the first image file with the second image file, and when the overwriting is successful, trigger the storing module 402 to change the current processing state from the second state to the third state;
for each replacement operation occurring in a specified time period, the scanning module 404 scans the current processing state recorded in each replacement operation, and for the replacement operation of which the current processing state is the first state or the third state, the deletion module 405 is triggered to delete the second image file; for the replacement operation with the current processing state being the second state, the replacement module 403 is triggered to reuse the second image file to overwrite the first image file.
In one implementation of an embodiment of the present invention,
the replacing module is used for starting database affairs;
the replacing module is also used for modifying the metadata into metadata to be replaced;
the storage module is used for changing the current processing state from a first state to a second state;
a replacement module to commit the database transaction.
In an implementation manner of the embodiment of the present invention, the apparatus further includes:
the deleting module is used for deleting the second image file in the object storage;
and the deleting module is also used for deleting the recorded current processing state after the second image file is successfully deleted.
In an implementation manner of the embodiment of the present invention, after deleting the second image file for the replacement operation whose current processing state is the first state, the communication module re-acquires the image file to be replaced having the same name as the first image file, and triggers the storage module and the replacement module to execute the subsequent method until the current processing state is changed to the third state, or deletes the second image file and the current processing state, or the total number of times of re-execution reaches the number threshold, re-execution includes re-acquiring the image file to be replaced having the same name as the first image file, and re-covering the first image file with the second image file.
In an implementation manner of the embodiment of the present invention, the apparatus further includes:
the recording module is used for recording the times of reusing the second image file to cover the first image file;
and the alarm module is used for sending out alarm information when the recorded times reach a time threshold value.
In the embodiment of the invention, after the image file to be replaced which has the same name as the first image file is obtained, the image file to be replaced is renamed to obtain the second image file, so that the first image file and the second image file can be well distinguished, the first image file does not need to be backed up as in the prior art, the operation is convenient and easy, and no extra storage space is occupied; then, after each step of replacing the metadata or the image file is completed, synchronously changing the current processing state, so that the processing progress of the replacement operation can be determined according to the current processing state; aiming at all replacement operations occurring in a specified time period, scanning the current processing state of each replacement operation, if the current processing state is the first state, indicating that the metadata and the image file are not successfully replaced, and deleting the second image file can enable the object storage and the database to be both original data and have no redundant data, thereby ensuring the data consistency; if the state is the third state, the metadata and the image file are both replaced successfully, the second image file is deleted, so that the object storage and the database are both replaced data without redundant data, and the data consistency can be ensured; if the state is the second state, the metadata replacement is successful, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the data consistency can still be ensured after the replacement is successful. Therefore, when a certain step fails to be executed, the subsequent operation can be continuously executed according to the current processing state, and the processing efficiency can be improved.
An embodiment of the present invention further provides a computer device, and fig. 5 is a schematic diagram of a computer device in an embodiment of the present invention, where the computer device is capable of implementing all steps in the method for guaranteeing data consistency in the replacement operation of the image file with the same name in the embodiment, and the computer device specifically includes the following contents:
a processor (processor)501, a memory (memory)502, a communication Interface (Communications Interface)503, and a communication bus 504;
the processor 501, the memory 502 and the communication interface 503 complete mutual communication through the communication bus 504; the communication interface 503 is used for implementing information transmission between related devices;
the processor 501 is configured to call a computer program in the memory 502, and when the processor executes the computer program, the method for guaranteeing data consistency in the replacement operation of the image file with the same name in the above embodiments is implemented.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program for executing the method for guaranteeing data consistency in the replacement operation of the image file with the same name is stored.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. A method for guaranteeing data consistency in replacement operation of image files with the same name is characterized by comprising the following steps:
aiming at each replacement operation, receiving an image file to be replaced with the same name as the first image file, and renaming the image file to be replaced to obtain a second image file with the name different from that of the first image file;
storing the second image file into an object for storage, and recording the current processing state as a first state;
modifying the metadata stored in the database into metadata to be replaced, and changing the current processing state from a first state to a second state after the metadata is successfully modified;
covering the first image file by using the second image file, and changing the current processing state from the second state to a third state after the covering is successful;
scanning the current processing state recorded in each replacement operation aiming at each replacement operation occurring in a specified time period, and deleting the second image file aiming at the replacement operation of which the current processing state is the first state or the third state; and for the replacement operation of which the current processing state is the second state, the second image file is reused to cover the first image file.
2. The method of claim 1, wherein modifying the metadata stored in the database into the metadata to be replaced, and changing the current processing state from the first state to the second state after the metadata modification is successful comprises:
opening a database transaction;
modifying the metadata into metadata to be replaced;
changing the current processing state from a first state to a second state;
the database transaction is committed.
3. The method of claim 1, wherein after changing the current processing state from the second state to the third state, the method further comprises:
deleting the second image file in the object storage;
and when the second image file is deleted successfully, deleting the recorded current processing state.
4. The method of claim 3, wherein after deleting the second video file for the replacement operation whose current processing state is the first state, the method further comprises:
and re-acquiring the image file to be replaced with the same name as the first image file, and executing a subsequent method until the current processing state is changed into a third state, or deleting the second image file and the current processing state, or re-executing the image file to be replaced with the same name as the first image file, and re-covering the first image file by using the second image file.
5. The method of claim 1, further comprising:
recording the times of reusing the second image file to cover the first image file;
and when the recorded times reach a time threshold value, sending out alarm information.
6. An apparatus for ensuring data consistency in a homonymous image file replacement operation, the apparatus comprising:
aiming at each replacement operation, the communication module is used for receiving the image file to be replaced with the same name as the first image file, renaming the image file to be replaced and obtaining a second image file with the name different from that of the first image file;
the storage module is used for storing the second image file into an object for storage and recording the current processing state as a first state;
the replacing module is used for modifying the metadata stored in the database into metadata to be replaced, and after the metadata is successfully modified, the storage module is triggered to change the current processing state from the first state to the second state;
the replacing module is also used for covering the first image file by using the second image file, and after the covering is successful, the storage module is triggered to change the current processing state from the second state to the third state;
aiming at each replacement operation occurring in a specified time period, the scanning module scans the current processing state recorded in each replacement operation, and for the replacement operation of which the current processing state is a first state or a third state, the scanning module triggers the deleting module to delete the second image file; and for the replacement operation with the current processing state being the second state, triggering the replacement module to reuse the second image file to cover the first image file.
7. The apparatus of claim 6,
the replacing module is used for starting database affairs;
the replacing module is also used for modifying the metadata into metadata to be replaced;
the storage module is used for changing the current processing state from a first state to a second state;
a replacement module to commit the database transaction.
8. The apparatus of claim 6, further comprising:
the deleting module is used for deleting the second image file in the object storage;
and the deleting module is also used for deleting the recorded current processing state after the second image file is successfully deleted.
9. The apparatus according to claim 8, wherein after deleting the second video file for the replacement operation whose current processing state is the first state, the communication module retrieves the to-be-replaced video file having the same name as the first video file, and triggers the storage module and the replacement module to execute the subsequent method until the current processing state changes to the third state, or the second video file and the current processing state are deleted, or the total number of times of the re-execution reaches a threshold number of times, the re-execution including retrieving the to-be-replaced video file having the same name as the first video file, and reusing the second video file to overwrite the first video file.
10. The apparatus of claim 6, further comprising:
the recording module is used for recording the times of reusing the second image file to cover the first image file;
and the alarm module is used for sending out alarm information when the recorded times reach a time threshold value.
11. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 5 when executing the computer program.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 5.
CN202110797143.XA 2021-07-14 2021-07-14 Method and device for guaranteeing data consistency in same-name image file replacement operation Active CN113448978B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110797143.XA CN113448978B (en) 2021-07-14 2021-07-14 Method and device for guaranteeing data consistency in same-name image file replacement operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110797143.XA CN113448978B (en) 2021-07-14 2021-07-14 Method and device for guaranteeing data consistency in same-name image file replacement operation

Publications (2)

Publication Number Publication Date
CN113448978A true CN113448978A (en) 2021-09-28
CN113448978B CN113448978B (en) 2024-04-16

Family

ID=77816274

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110797143.XA Active CN113448978B (en) 2021-07-14 2021-07-14 Method and device for guaranteeing data consistency in same-name image file replacement operation

Country Status (1)

Country Link
CN (1) CN113448978B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198100A (en) * 2013-03-13 2013-07-10 中国科学院计算技术研究所 Renaming method and renaming system for file synchronization among multiple devices
US9043280B1 (en) * 2011-08-15 2015-05-26 Symantec Corporation System and method to repair file system metadata
CN109753511A (en) * 2018-12-28 2019-05-14 北京东方国信科技股份有限公司 A kind of the cross-region real-time synchronization method and system of big data platform
CN111309526A (en) * 2020-02-26 2020-06-19 中国工商银行股份有限公司 File backup and recovery method and device
CN111737331A (en) * 2020-06-22 2020-10-02 中国银行股份有限公司 Transaction consistency processing method and system for database and object storage
CN112035444A (en) * 2020-09-03 2020-12-04 中国银行股份有限公司 Method and device for transferring image data between heterogeneous systems without stopping
CN112530551A (en) * 2020-12-10 2021-03-19 武汉联影医疗科技有限公司 Image processing system and method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9043280B1 (en) * 2011-08-15 2015-05-26 Symantec Corporation System and method to repair file system metadata
CN103198100A (en) * 2013-03-13 2013-07-10 中国科学院计算技术研究所 Renaming method and renaming system for file synchronization among multiple devices
CN109753511A (en) * 2018-12-28 2019-05-14 北京东方国信科技股份有限公司 A kind of the cross-region real-time synchronization method and system of big data platform
CN111309526A (en) * 2020-02-26 2020-06-19 中国工商银行股份有限公司 File backup and recovery method and device
CN111737331A (en) * 2020-06-22 2020-10-02 中国银行股份有限公司 Transaction consistency processing method and system for database and object storage
CN112035444A (en) * 2020-09-03 2020-12-04 中国银行股份有限公司 Method and device for transferring image data between heterogeneous systems without stopping
CN112530551A (en) * 2020-12-10 2021-03-19 武汉联影医疗科技有限公司 Image processing system and method

Also Published As

Publication number Publication date
CN113448978B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
US11635908B2 (en) Managing digital assets stored as components and packaged files
US6993537B2 (en) Data recovery system
US6324548B1 (en) Database backup and recovery using separate history files for database backup and audit backup
CA2422176C (en) Method and apparatus for interrupting updates to a database to provide read-only access
US6944635B2 (en) Method for file deletion and recovery against system failures in database management system
US20060259461A1 (en) Method and system for preserving access to deleted and overwritten documents by means of a system recycle bin
US11537570B2 (en) Systems and/or methods for migrating live database schemas to support zero downtime deployments with zero data losses
CN112306965A (en) Data writing storage method, device, equipment and computer readable storage medium
CN115145697A (en) Database transaction processing method and device and electronic equipment
CN102597995B (en) Synchronizing database and non-database resources
US20050262033A1 (en) Data recording apparatus, data recording method, program for implementing the method, and program recording medium
WO2018177193A1 (en) Software upgrade method and device
US10915513B2 (en) Archival of data in a relational database management system using block level copy
US20030220950A1 (en) Database controlling system
CN113448978A (en) Method and device for guaranteeing data consistency in same-name image file replacement operation
US20210034709A1 (en) Optimizing incremental backups
EP1349067A2 (en) Document management system and method with fault recovery
CN110471796B (en) File directory-oriented full and incremental backup recovery method
CN114490543A (en) Transaction log implementation method, device, equipment and medium for memory multidimensional database
CN108874592B (en) Data cold standby method and system for Log-structured storage engine
EP1713008B1 (en) Method and system for preserving access to deleted and overwritten documents by means of a system recycle bin
JP4710380B2 (en) Distributed processing system and distributed processing method
CN114880277B (en) Block device snapshot method, system and storage medium
JP3759676B2 (en) Application device and method having work redo and undo function and automatic saving function
CN114253474A (en) Method, system, equipment and readable storage medium for dumping magnetic tape based on transfer machine

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