CN113448978B - 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
CN113448978B
CN113448978B CN202110797143.XA CN202110797143A CN113448978B CN 113448978 B CN113448978 B CN 113448978B CN 202110797143 A CN202110797143 A CN 202110797143A CN 113448978 B CN113448978 B CN 113448978B
Authority
CN
China
Prior art keywords
image file
state
current processing
metadata
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.)
Active
Application number
CN202110797143.XA
Other languages
Chinese (zh)
Other versions
CN113448978A (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

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 a homonymous image file, and relates to the technical field of big data, wherein the method comprises the following steps: for each replacement operation, receiving an image file to be replaced, which has the same name as the first image file, renaming to obtain a second image file, storing the second image file, and recording the current processing state as a first state; modifying 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 for each replacement operation occurring in a specified time period, and deleting the second image file for the replacement operation of 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 same-name image file.

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 operation of replacing a homonymous image file.
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 often requires the retention of images, such as facial site shots, certificate photographs, contract photocopies, etc., wherein the image platform system provides services such as uploading, reviewing, deleting, editing, and managing the images to the various business systems. The image stored in the image platform system comprises image metadata and image files, wherein the image metadata is business information of the image, 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 is required to be modified, the image file and the image metadata are required to be modified simultaneously so as to ensure the data consistency of the image metadata and the image file.
When the image file uploaded to the image platform is replaced by the same-name file, one of the files is replaced, and then the other is replaced after the replacement of the metadata is successful, namely the replacement of the image file is performed after the replacement of the metadata is successful, or the replacement of the metadata is performed after the replacement of the image file is successful. Due to the problems of the system itself or other problems, the replacement of the metadata may not succeed, or the replacement of the metadata may not succeed. To ensure data consistency, it is often necessary to rollback data that has been successfully replaced to data prior to replacement.
At present, in order to ensure that the data can be rolled back successfully, the old data needs to be backed up first, the backup is stored in a specific storage space, after the complete process of replacing the same-name file fails, the old file of the backup is taken out from the storage space, and the successfully replaced file is replaced by the old file. The backup and replacement processes are complicated, and the backup files are required to be stored independently, so that extra storage space is occupied.
Disclosure of Invention
The embodiment of the invention provides a method for ensuring data consistency in a same-name image file replacement operation, which is used for realizing the same-name image file replacement operation 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:
for each replacing operation, receiving an image file to be replaced, which has the same name as the first image file, and renaming the image file to be replaced to obtain a second image file with a different name from 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 metadata stored in a 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 for the replacement operation of which the current processing state is the first state or the third state; and for the replacement operation of the current processing state being the second state, the second image file is reused to cover the first image file.
The embodiment of the invention also provides a device for ensuring the data consistency in the replacement operation of the same-name image files, which is used for realizing the replacement operation of the same-name image files in a simple and easy way, ensuring the data consistency in the replacement operation and not occupying extra storage space, and comprises the following components:
for each replacement operation, the communication module is used for receiving an image file to be replaced, which has the same name as the first image file, and renaming the image file to be replaced to obtain a second image file with a different name from 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 triggering the storage module to change the current processing state from the first state to the second state after the metadata is successfully modified;
the replacing module is also used for covering the first image file by using the second image file, and triggering the storage module to change the current processing state from the second state to the third state after the second image file is successfully covered;
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 the first state or the third state, the deleting module is triggered to delete the second image file; and triggering the replacement module to reuse the second image file to cover the first image file for the replacement operation of which the current processing state is the second state.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the method for ensuring the data consistency in the same-name image file replacement operation when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium which stores a computer program for executing the method for guaranteeing data consistency in the same-name image file replacement operation.
In the embodiment of the invention, after the image file to be replaced with the same name as the first image file is obtained, renaming is carried out on the image file to be replaced 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 is not required to be backed up as in the prior art, the operation is convenient and easy, and the additional storage space is not required to be occupied; after each step of replacing metadata or image files is completed, the current processing state is synchronously changed, so that the processing progress of the replacing operation can be determined according to the current processing state; for 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 replaced successfully, deleting the second image file can enable the object storage and the database to be original data and have no redundant data, and can ensure the data consistency; if the state is the third state, the metadata and the image file are successfully replaced, the second image file is deleted, so that the object storage and the database are replaced data and no redundant data exist, and the data consistency can be ensured; if the metadata is in the second state, the metadata is successfully replaced, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the consistency of the data can be ensured after the replacement is successful. Therefore, after the execution failure of a certain step, 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 invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. In the drawings:
FIG. 1 is a flowchart of a method for guaranteeing data consistency in a homologous image file replacement operation according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for guaranteeing data consistency in a similar image file replacement operation according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for guaranteeing data consistency in a similar image file replacement operation according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a device for guaranteeing data consistency in a homologous 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
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings. The exemplary embodiments of the present invention and their descriptions herein are for the purpose of explaining the present invention, but are not to be construed as limiting the invention.
The embodiment of the invention provides a method for ensuring data consistency in a homonymous image file replacement operation, as shown in fig. 1, the method comprises steps 101 to 105:
step 101, for each replacing operation, receiving a to-be-replaced image file with the same name as the first image file, renaming the to-be-replaced image file, and obtaining a second image file with a different name from 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 for replacing the first image file, the file to be replaced is the same as the first image file in name, and more than two files with the same name cannot be contained in the same storage space, so that the new image file is renamed in order to simultaneously retain the original image file and the new image file before the image file is replaced successfully.
The renaming rule may be adding a time of receiving the image file to be replaced after the current name, as the name of the second image file, for example, the names of the current image file to be replaced and the first image file are both a, and the time of receiving the image file to be replaced is 16:00:05, and then the image file to be replaced may be renamed as a160005.
In order not to confuse the image file to be replaced received at each time, the time when the image file to be replaced is received may be accurate to the millisecond level, considering that the image file is frequently updated in some transactions.
It should be noted that, before renaming the image file to be replaced, a preparation work such as checking in a parameter, checking business logic, assembling business data, and recording the transaction running water of the replacing operation in a database is required, and the preparation work is a work frequently performed in the prior art, and a specific implementation process thereof is not described herein.
Step 102, storing the second image file in the object storage, and recording the current processing state as the first state.
The status is denoted by status and the first status is denoted by 0, then the current processing status may be recorded as status=0, i.e. an initialized status. In addition to recording the current processing state, some other information in the current replacement operation may be recorded, for example, using the operator_type=e to record that the operation Type to which the current replacement operation belongs is editing, and using the filename=a160005 to record that the image file to be stored is renamed to a160005.
The first state, operation type, renamed image file name, etc. may be recorded in the flexible transaction table to facilitate reading.
Step 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 status=2 after the metadata replacement is successful.
Specifically, as shown in fig. 2, step 103 of modifying metadata stored in the database to metadata to be replaced, and when the metadata modification is successful, changing the current processing state from the first state to the second state may be performed as follows steps 201 to 204:
step 201, starting a database transaction.
Step 202, modifying the metadata into metadata to be replaced.
Step 203, changing the current processing state from the first state to the second state.
Step 204, commit database transaction.
A transaction is a function provided by the database itself, and is only validated after the transaction is started, that is, the metadata and the current processing state are modified in step 202 and step 203, and are only validated in the database after the transaction is successfully executed in step 204, and if the transaction is not successfully executed in step 204, the modification of the metadata and the current processing state is not saved in the database.
By adopting the database transaction, the condition that the metadata is modified successfully or the current processing state is modified successfully at the same time, the condition that the metadata is not modified successfully, the current processing state is not modified successfully or the condition that the metadata is modified successfully but the current processing state is changed successfully due to the failure of the metadata modification can be ensured, so that the condition that the metadata is modified successfully when the metadata is in the second state is ensured.
Step 104, the first image file is covered by the second image file, and when the second image file is successfully covered, the current processing state is changed from the second state to the third state.
It should be noted that, in the coverage operation in the embodiment of the present invention, after the coverage, the name of the image file before the coverage is still reserved, for example, the second image file a160005 is used to cover the first image file a, and after the coverage is completed, the name is still a.
If the third state is denoted by 1, status=2 recorded in the flexible transaction table is modified to status=1 after the override is successful.
After the overlay is completed, the overlaid 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 the step 104 is performed, as shown in fig. 3, the following steps 301 and 302 may be further performed:
step 301, deleting the second image file in the object storage.
And step 302, deleting the current processing state of the record after the second image file is successfully deleted.
After the second image file is deleted, the entire replacing operation is completed, and the current processing state for recording the processing progress of the replacing operation may be deleted, so that in step 105, the current processing state of the completed replacing operation is not found, and the interference to the operation in step 105 is avoided.
Step 105, for each replacement operation occurring in the specified time period, scanning the current processing state recorded in each replacement operation, 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 the current processing state being the second state, the second image file is reused to cover the first image file.
Wherein, the specified time period is a period of time from a time before the current time, for example, the current time is 10:00:01, and the specified time period is a period of time before 10:00:00, and the state of the replacement operation occurring between 10:00:00 and 10:00:01 is not scanned in order to set the processing time for the replacement operation occurring recently, and not affect the normal execution of the replacement operation without any problem. The time interval between the present time and the previous time may be determined by a worker according to the completion time of one replacement operation in general, for example, may be set to 1 minute or the like.
The step is to complete the compensation processing of the replacement operation process unsuccessfully, and specifically, if the replacement operation in the first state is scanned, the metadata and the image file are not replaced successfully, and the second image file is deleted to enable the object storage and the database to be original data, so that the consistency of the data can be ensured, and meanwhile, the fact that the object storage has no redundant data is ensured.
After deleting the second image file, the replacing operation is not completed, the image file to be replaced, which has the same name as the first image file, can be re-acquired, and the methods in the following steps 101 to 104 are executed until the current processing state is changed to a third state (the state that both the metadata and the image file are successfully replaced), or the second image file and the current processing state (the state that the replacing operation is completely completed) are deleted, or the total number of re-execution reaches a frequency threshold (the state that the replacing operation is not completed due to errors). The re-executing includes re-acquiring the image file to be replaced with the same name as the first image file and re-using the second image file to cover the first image file.
If the third state indicates that the metadata and the image file are replaced successfully, deleting the second image file can enable the object storage and the database to be replaced data, redundant data is avoided, and data consistency is guaranteed.
If the metadata is in the second state, the metadata is successfully replaced, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the consistency of the data can be ensured after the replacement is successful. If the multiple attempts are not successful in replacement, the fact that the replacement operation cannot be completed automatically is indicated, and in the embodiment of the invention, the number of times of reusing the second image file to cover the first image file can be recorded; when the recorded times reach the time threshold, alarm information is sent out to inform a worker to manually process the replacement operation, and a fault which causes the replacement operation to be unable to be completed automatically is eliminated, so that the occurrence of subsequent abnormal transactions is reduced. Wherein the threshold number of times is set by the staff, such as 3 times or 5 times, etc.
In the embodiment of the invention, after the image file to be replaced with the same name as the first image file is obtained, renaming is carried out on the image file to be replaced 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 is not required to be backed up as in the prior art, the operation is convenient and easy, and the additional storage space is not required to be occupied; after each step of replacing metadata or image files is completed, the current processing state is synchronously changed, so that the processing progress of the replacing operation can be determined according to the current processing state; for 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 replaced successfully, deleting the second image file can enable the object storage and the database to be original data and have no redundant data, and can ensure the data consistency; if the state is the third state, the metadata and the image file are successfully replaced, the second image file is deleted, so that the object storage and the database are replaced data and no redundant data exist, and the data consistency can be ensured; if the metadata is in the second state, the metadata is successfully replaced, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the consistency of the data can be ensured after the replacement is successful. Therefore, after the execution failure of a certain step, the subsequent operation can be continuously executed according to the current processing state, and the processing efficiency can be improved.
The embodiment of the invention also provides a device for ensuring the consistency of data in the same-name image file replacement operation, which is described in the following embodiment. Because the principle of the device for solving the problem is similar to that of 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 the repetition is omitted.
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.
Wherein, for each replacement operation, the communication module 401 is configured to receive an image file to be replaced, which has the same name as the first image file, and rename the image file to be replaced to obtain a second image file with a different name from the first image file;
a storage module 402, configured to store a second image file in an object, and record a current processing state as a first state;
a replacing module 403, configured to modify metadata stored in the database into metadata to be replaced, and trigger the storage module 402 to change the current processing state from the first state to the second state after the metadata is successfully modified;
the replacing module 403 is further configured to overlay the first image file with the second image file, and trigger the storing module 402 to change the current processing state from the second state to the third state after the overlay is successful;
for each replacement operation occurring in the specified time period, the scanning module 404 scans the current processing state recorded in each replacement operation, and for the replacement operation in which the current processing state is the first state or the third state, triggers the deleting module 405 to delete the second image file; for the replacement operation that the current processing state is the second state, the replacement module 403 is triggered to reuse the second image file to cover the first image file.
In one implementation of an embodiment of the present invention,
the replacement module is used for starting database transactions;
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 the first state to the second state;
and the replacement module is used for submitting database transactions.
In one 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 current processing state of the record after the second image file is successfully deleted.
In one implementation manner of the embodiment of the present invention, after the replacement operation in which the current processing state is the first state, deleting the second image file, 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 deleting the second image file and the current processing state, or re-executing the image file to be replaced having the same name as the first image file, and re-executing the image file to cover the first image file by using the second image file.
In one 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 alarm information when the recorded times reach the time threshold.
In the embodiment of the invention, after the image file to be replaced with the same name as the first image file is obtained, renaming is carried out on the image file to be replaced 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 is not required to be backed up as in the prior art, the operation is convenient and easy, and the additional storage space is not required to be occupied; after each step of replacing metadata or image files is completed, the current processing state is synchronously changed, so that the processing progress of the replacing operation can be determined according to the current processing state; for 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 replaced successfully, deleting the second image file can enable the object storage and the database to be original data and have no redundant data, and can ensure the data consistency; if the state is the third state, the metadata and the image file are successfully replaced, the second image file is deleted, so that the object storage and the database are replaced data and no redundant data exist, and the data consistency can be ensured; if the metadata is in the second state, the metadata is successfully replaced, and the image file is not successfully replaced, the second image file is reused to cover the first image file, and the consistency of the data can be ensured after the replacement is successful. Therefore, after the execution failure of a certain step, the subsequent operation can be continuously executed according to the current processing state, and the processing efficiency can be improved.
The embodiment of the invention also provides a computer device, and fig. 5 is a schematic diagram of the computer device in the embodiment of the invention, where the computer device can implement all the steps in the method for guaranteeing data consistency in the same-name image file replacement operation 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;
wherein the processor 501, the memory 502, and the communication interface 503 perform communication with each other through the communication bus 504; the communication interface 503 is used for implementing information transmission between related devices;
the processor 501 is configured to invoke a computer program in the memory 502, where the processor executes the computer program to implement a method for ensuring data consistency in the replacement operation of the image file with the same name in the above embodiment.
The embodiment of the invention also provides a computer readable storage medium which stores a computer program for executing the method for guaranteeing data consistency in the same-name image file replacement operation.
It will be appreciated by those skilled in the art that 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (12)

1. A method for ensuring data consistency in a homonymous image file replacement operation, the method comprising:
for each replacing operation, receiving an image file to be replaced, which has the same name as the first image file, and renaming the image file to be replaced to obtain a second image file with a different name from 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 metadata stored in a 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; the metadata is the business information of the first image file;
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 for the replacement operation of which the current processing state is the first state or the third state; and for the replacement operation of the current processing state being 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 to metadata to be replaced, and wherein changing the current processing state from the first state to the second state when the metadata modification is successful comprises:
starting a database transaction;
modifying the metadata into metadata to be replaced;
changing the current processing state from the first state to the second state;
database transactions are 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 deleting the current processing state of the record after the second image file is successfully deleted.
4. A method according to claim 3, wherein after deleting the second image file for the replacement operation in which the 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, wherein the re-executing comprises re-acquiring the image file to be replaced with the same name as the first image file, and re-utilizing the second image file to cover the first image file.
5. The method according to claim 1, wherein the method further comprises:
recording the number of times of reusing the second image file to cover the first image file;
and when the recorded times reach the time threshold, sending out alarm information.
6. An apparatus for ensuring data consistency in a homonymous image file replacement operation, the apparatus comprising:
for each replacement operation, the communication module is used for receiving an image file to be replaced, which has the same name as the first image file, and renaming the image file to be replaced to obtain a second image file with a different name from 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 triggering the storage module to change the current processing state from the first state to the second state after the metadata is successfully modified; the metadata is the business information of the first image file;
the replacing module is also used for covering the first image file by using the second image file, and triggering the storage module to change the current processing state from the second state to the third state after the second image file is successfully covered;
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 the first state or the third state, the deleting module is triggered to delete the second image file; and triggering the replacement module to reuse the second image file to cover the first image file for the replacement operation of which the current processing state is the second state.
7. The apparatus of claim 6, wherein the device comprises a plurality of sensors,
the replacement module is used for starting database transactions;
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 the first state to the second state;
and the replacement module is used for submitting database transactions.
8. The apparatus of claim 6, wherein the apparatus further comprises:
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 current processing state of the record after the second image file is successfully deleted.
9. The apparatus according to claim 8, wherein after deleting the second image file for the replacement operation in which the 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 the second image file and the current processing state are deleted, or the total number of re-executions reaches the number of times threshold, the re-executions including re-acquiring the image file to be replaced having the same name as the first image file, and re-overwriting the first image file with the second image file.
10. The apparatus of claim 6, wherein the apparatus further comprises:
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 alarm information when the recorded times reach the time threshold.
11. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 5 when executing the computer program.
12. A computer readable storage medium storing a computer program executable by a processor to implement 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 CN113448978A (en) 2021-09-28
CN113448978B true 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
CN113448978A (en) 2021-09-28

Similar Documents

Publication Publication Date Title
US5884328A (en) System and method for sychronizing a large database and its replica
US6993537B2 (en) Data recovery system
CN111753013B (en) Distributed transaction processing method and device
US6594676B1 (en) System and method for recovery of multiple shared database data sets using multiple change accumulation data sets as inputs
CN109032838B (en) Automatic verification method for consistency of backup and recovery data of virtual machine
CN105573859A (en) Data recovery method and device of database
CN111258850B (en) Method and device for updating software information based on Linux system
US20030126163A1 (en) Method for file deletion and recovery against system failures in database management system
CN115145697A (en) Database transaction processing method and device and electronic equipment
WO1996041263A1 (en) Management of units of work on a computer system log
US20090248760A1 (en) Backup method of computer system
CN113448978B (en) Method and device for guaranteeing data consistency in same-name image file replacement operation
WO2018177193A1 (en) Software upgrade method and device
CN106815098A (en) Setting backup and the method and system for recovering based on linux system
CN111984472B (en) Data snapshot method, device and related equipment
EP1349067A2 (en) Document management system and method with fault recovery
CN114490543A (en) Transaction log implementation method, device, equipment and medium for memory multidimensional database
CN109634930B (en) Method and device for cleaning logs, storage medium and electronic device
CN112256481A (en) Data recovery method and system in agile development
CN110597609A (en) Cluster migration and automatic recovery method and system
CN110597669A (en) Bank historical data parameterized backup recovery method and device
CN114253474A (en) Method, system, equipment and readable storage medium for dumping magnetic tape based on transfer machine
CN117785546A (en) Database backup method, system and computing device cluster
CN111737056A (en) File breakpoint reentrant method and device
CN116302696A (en) Archive log generation method of database system, storage medium and computer device

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