Search

CN-115599302-B - Data writing method, device, equipment and storage medium

CN115599302BCN 115599302 BCN115599302 BCN 115599302BCN-115599302-B

Abstract

The application discloses a data writing method, a device, equipment and a storage medium, and relates to the field of data management, wherein the method comprises the steps of obtaining a data updating request which is sent by upper software and aims at current target data in a new data catalog; the data updating request comprises new data to be written and a target logic address, current target data are migrated to an old data directory to obtain first target old data, a mapping relation between the first target old data and the target logic address is newly built in a local first mapping relation library, a local writing operation is executed on the new data to be written, when writing fails, the first target old data corresponding to the target logic address is searched from the old data directory by using the first mapping relation library, the first target old data are migrated back to the new data directory, and data recovery operation is completed. The application manages the old data by using the target logical address, avoids the step of carrying out the disc-dropping operation on the copied metadata so as to manage the old data, and reduces the double-writing operation of the data.

Inventors

  • ZHANG ZHAOYANG

Assignees

  • 济南浪潮数据技术有限公司

Dates

Publication Date
20260508
Application Date
20221021

Claims (10)

  1. 1. The data writing method is characterized by being applied to a solid state disk and comprising the following steps of: acquiring a data updating request which is sent by upper software and aims at current target data in a new data catalog, wherein the data updating request comprises new data to be written and a target logic address; Migrating the current target data to an old data directory to obtain first target old data, and newly establishing a mapping relation between the first target old data and the target logical address in a local first mapping relation library; executing a local writing operation on the new data to be written, searching the first target old data corresponding to the target logical address from the old data directory by utilizing the first mapping relation library when the writing fails, and migrating the first target old data back to the new data directory so as to complete corresponding data recovery operation; the data writing method further comprises the following steps: The method comprises the steps of obtaining a first data writing request sent by upper software, wherein the first data writing request comprises first data to be written and a preset logic address configured by the upper software for the first data to be written, executing local writing operation on the first data to be written to obtain first written target data, and newly establishing a mapping relation between the first written target data and the preset logic address in a local second mapping relation library; the step of migrating the current target data to an old data directory to obtain first target old data includes: And searching the current target data corresponding to the target logical address by using the second mapping relation library, and migrating the current target data to an old data directory to obtain first target old data.
  2. 2. The data writing method according to claim 1, wherein after the performing of the local write operation on the new data to be written, further comprising: sending a corresponding writing result feedback message to the upper layer software, so that the upper layer software marks the local target logic address as an available state when the writing result feedback message indicates that writing operation is finished; correspondingly, the obtaining the data update request sent by the upper software for the current target data in the new data directory includes: and acquiring the data updating request, initiated by the upper layer software, for the current target data when the local target logical address is in an available state.
  3. 3. The data writing method according to claim 1, wherein after the performing of the local write operation on the new data to be written, further comprising: And if the writing is successful, searching second target old data corresponding to the target logical address from the old data directory by using the first mapping relation library, and marking the second target old data in the old data directory as a recoverable state, wherein the second target old data is last target data migrated from the new data directory to the old data directory in last data updating operation.
  4. 4. A data writing method according to claim 3, further comprising: Acquiring a data deleting request which is sent by the upper layer software and contains the target logical address; Searching target old data in a recoverable state corresponding to the target logical address in the data deleting request from the old data directory by utilizing the first mapping relation library; and executing deleting operation on the target old data, and deleting the mapping relation between the target old data and the target logical address from the first mapping relation library.
  5. 5. The method for writing data according to claim 4, wherein the obtaining the data deletion request including the target logical address sent by the upper layer software includes: And acquiring a data deleting request which is sent by the upper layer software when the number of the current data writing requests is smaller than a preset number threshold and contains the target logical address, wherein the data writing request comprises a data first writing request and a data updating request.
  6. 6. The data writing method is characterized by being applied to upper-layer software and comprising the following steps of: creating a data update request for current target data in a new data catalog on the solid state disk, wherein the data update request comprises new data to be written and a target logic address; The data updating request is sent to the solid state disk, so that the solid state disk migrates the current target data to an old data directory to obtain first target old data, and a mapping relation between the first target old data and the target logical address is newly built in a local first mapping relation library; executing a local writing operation on the new data to be written, searching the first target old data corresponding to the target logical address from the old data directory by utilizing the first mapping relation library when the writing fails, and migrating the first target old data back to the new data directory to complete corresponding data recovery operation; the data writing method further comprises the following steps: Sending a data first-time writing request to the solid state disk so that the solid state disk executes local writing operation on the first-time data to be written to obtain first-time written target data, and newly establishing a mapping relation between the first-time written target data and a preset logic address in a local second mapping relation library, wherein the data first-time writing request comprises the first-time data to be written and the preset logic address configured by upper software for the first-time data to be written; the step of migrating the current target data to an old data directory to obtain first target old data includes: And searching the current target data corresponding to the target logical address by using the second mapping relation library, and migrating the current target data to an old data directory to obtain first target old data.
  7. 7. The utility model provides a data write device which characterized in that is applied to solid state disk, includes: the system comprises a request acquisition module, a request updating module and a request updating module, wherein the request acquisition module is used for acquiring a data updating request which is sent by upper software and aims at current target data in a new data catalog, and the data updating request comprises new data to be written and a target logic address; the relation creation module is used for migrating the current target data to an old data catalog to obtain first target old data, and newly creating a mapping relation between the first target old data and the target logical address in a local first mapping relation library; the data writing module is used for executing local writing operation on the new data to be written; the data recovery module is used for searching the first target old data corresponding to the target logical address from the old data directory by utilizing the first mapping relation library when writing fails, and migrating the first target old data back to the new data directory so as to complete corresponding data recovery operation; the data writing device is specifically configured to: The method comprises the steps of obtaining a first data writing request sent by upper software, wherein the first data writing request comprises first data to be written and a preset logic address configured by the upper software for the first data to be written, executing local writing operation on the first data to be written to obtain first written target data, and newly establishing a mapping relation between the first written target data and the preset logic address in a local second mapping relation library; the relation creation module is specifically configured to: And searching the current target data corresponding to the target logical address by using the second mapping relation library, and migrating the current target data to an old data directory to obtain first target old data.
  8. 8. A data writing device, characterized by being applied to upper layer software, comprising: the system comprises a request creation module, a request updating module and a request updating module, wherein the request creation module is used for creating a data updating request aiming at current target data in a new data catalog on a solid state disk, and the data updating request comprises new data to be written and a target logic address; The request sending module is used for sending the data updating request to the solid state disk so that the solid state disk can migrate the current target data to an old data directory to obtain first target old data, and a mapping relation between the first target old data and the target logical address is newly built in a local first mapping relation library; executing a local writing operation on the new data to be written, searching the first target old data corresponding to the target logical address from the old data directory by utilizing the first mapping relation library when the writing fails, and migrating the first target old data back to the new data directory to complete corresponding data recovery operation; the data writing device is specifically configured to: Sending a data first-time writing request to the solid state disk so that the solid state disk executes local writing operation on the first-time data to be written to obtain first-time written target data, and newly establishing a mapping relation between the first-time written target data and a preset logic address in a local second mapping relation library, wherein the data first-time writing request comprises the first-time data to be written and the preset logic address configured by upper software for the first-time data to be written; the request sending module is specifically configured to: And searching the current target data corresponding to the target logical address by using the second mapping relation library, and migrating the current target data to an old data directory to obtain first target old data.
  9. 9. An electronic device, comprising: A memory for storing a computer program; a processor for executing the computer program to implement the data writing method as claimed in any one of claims 1 to 6.
  10. 10. A computer readable storage medium for storing a computer program which, when executed by a processor, implements the data writing method according to any one of claims 1 to 6.

Description

Data writing method, device, equipment and storage medium Technical Field The present invention relates to the field of data management, and in particular, to a data writing method, apparatus, device, and storage medium. Background The distributed storage software only uses SSD (Solid STATE DISK, i.e. Solid state disk) as a storage unit, and needs to rely on double writing to ensure data security for a data writing request, and does not reasonably utilize data management logic in the SSD Solid state disk. As shown in fig. 1, when a data write request is sent, not only a new data is dropped, but also an old data is copied for metadata management, and metadata dropping operation exists, metadata management also increases DB (DataBase) operation, and excessive interaction between upper software and SSD solid state disk not only reduces performance but also reduces disk service life. Disclosure of Invention Accordingly, the present invention is directed to a data writing method, apparatus, device and storage medium, which can manage old data using a target logical address, avoiding the step of performing a disc-dropping operation on copied metadata to manage the old data, and reducing the double writing operation of data. The specific scheme is as follows: in a first aspect, the present application provides a data writing method, applied to a solid state disk, including: acquiring a data updating request which is sent by upper software and aims at current target data in a new data catalog, wherein the data updating request comprises new data to be written and a target logic address; Migrating the current target data to an old data directory to obtain first target old data, and newly establishing a mapping relation between the first target old data and the target logical address in a local first mapping relation library; And executing a local writing operation on the new data to be written, searching the first target old data corresponding to the target logical address from the old data directory by utilizing the first mapping relation library when the writing fails, and migrating the first target old data back to the new data directory so as to complete corresponding data recovery operation. Optionally, after the performing the local write operation on the new data to be written, the method further includes: sending a corresponding writing result feedback message to the upper layer software, so that the upper layer software marks the local target logic address as an available state when the writing result feedback message indicates that writing operation is finished; correspondingly, the obtaining the data update request sent by the upper software for the current target data in the new data directory includes: and acquiring the data updating request, initiated by the upper layer software, for the current target data when the local target logical address is in an available state. Optionally, after the performing the local write operation on the new data to be written, the method further includes: And if the writing is successful, searching second target old data corresponding to the target logical address from the old data directory by using the first mapping relation library, and marking the second target old data in the old data directory as a recoverable state, wherein the second target old data is last target data migrated from the new data directory to the old data directory in last data updating operation. Optionally, the method further comprises: Acquiring a data deleting request which is sent by the upper layer software and contains the target logical address; Searching target old data in a recoverable state corresponding to the target logical address in the data deleting request from the old data directory by utilizing the first mapping relation library; and executing deleting operation on the target old data, and deleting the mapping relation between the target old data and the target logical address from the first mapping relation library. Optionally, the obtaining the data deletion request including the target logical address sent by the upper layer software includes: And acquiring a data deleting request which is sent by the upper layer software when the number of the current data writing requests is smaller than a preset number threshold and contains the target logical address, wherein the data writing request comprises a data first writing request and a data updating request. Optionally, the method further comprises: The method comprises the steps of obtaining a first data writing request sent by upper software, wherein the first data writing request comprises first data to be written and a preset logic address configured by the upper software for the first data to be written; performing a local write operation on the first data to be written to obtain target data after the first write; a mapping relation between the target data after the first writing and the preset logic address is newly built i