Resource storage method and device, storage medium and electronic device

By writing the target object containing the target object identity and target resources in the object storage system and updating the index position, the problem of excessive I/O overhead during object update is solved, and the effect of reducing I/O overhead is achieved.

CN114675776BActive Publication Date: 2025-05-06BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011553770.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2025-05-06
Estimated Expiration
2040-12-24

AI Technical Summary

Technical Problem

When object updates are performed in an object storage system, there is a problem of excessive I/O overhead in the prior art.

Method used

By obtaining the target resource and writing the target object in the object storage system, the target object contains the target object identifier and the target resource of the existing object, the index corresponding to the target object identifier is updated to the physical spatial location of the target resource.

Benefits of technology

This method does not require deleting or recycling old objects, but directly updates the index position of the object identification, reducing the I/O overhead of object updates and solving the problem of excessive I/O overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114675776B_ABST
    Figure CN114675776B_ABST
Patent Text Reader

Abstract

The present application provides a resource storage method and device, a storage medium and an electronic device, wherein the method comprises: obtaining a target resource, wherein the target resource is a resource to be stored in an object storage system; if there is an existing object corresponding to the target resource in the object storage system, writing a target object in the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource; and updating an index corresponding to the target object identifier to the physical space location of the target resource. Through the present application, the problem of excessive I / O overhead in the method of updating objects in an object storage system in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a resource storage method and device, a storage medium, and an electronic device. Background Art

[0002] When an object is updated in an object storage system, the object can be updated by creating a new object: first, a new object is created, and then a mapping from a file name to an object ID is updated with a new object ID (Identity).

[0003] Using the above object update method, the old object whose mapping is replaced is generally garbage collected by mark deletion: the old object will be marked for deletion, and after the object is marked for deletion from the block file, it needs to be compacted asynchronously before it can be physically deleted. The compaction process is to read the original block file, filter out invalid objects, and generate a new block file.

[0004] The marking deletion method will bring a large I / O (Input / Output) overhead to the object storage system, that is, this process leads to a large amount of I / O amplification. It can be seen that the method of updating objects in the object storage system in the related art has the problem of excessive I / O overhead. Summary of the invention

[0005] The present application provides a resource storage method and device, a storage medium and an electronic device, so as to at least solve the problem of excessive I / O overhead in the way of updating objects in an object storage system in the related art.

[0006] According to one aspect of an embodiment of the present application, a resource storage method is provided, comprising: obtaining a target resource, wherein the target resource is a resource to be stored in an object storage system; writing a target object in the object storage system when there is an existing object corresponding to the target resource in the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource; and updating an index corresponding to the target object identifier to a physical spatial location of the target resource.

[0007] Optionally, after acquiring the target resource, the method further includes: using the target resource identifier of the target resource to query the metadata corresponding to the object storage system, wherein the metadata is used to indicate the mapping between the object identifier and the resource identifier; and when the target object identifier corresponding to the target resource identifier is found, determining that there is an existing object corresponding to the target resource in the object storage system.

[0008] Optionally, the use of the target resource identifier of the target resource to query the meta-information corresponding to the object storage system includes: using the target resource identifier of the target resource to query the meta-information corresponding to the target storage bucket to obtain a target query result, wherein the target storage bucket is used to store resources uploaded by a target account, the target account is the account used to upload the target resource, and the target query result is used to indicate whether there is an object identifier corresponding to the target resource identifier in the object storage system.

[0009] Optionally, writing the target object in the object storage system includes: additionally writing the target object identifier and the target resource in a first data block of a first data server, wherein the first data block is a data block to which the existing object belongs.

[0010] Optionally, updating the index corresponding to the target object identifier to the physical space position of the target resource includes: updating the physical space position corresponding to the target object identifier in the index of the first data block to the physical space position of the target resource.

[0011] Optionally, after appending the target object identifier and the target resource to the first data block of the first data server, the method further includes: writing the target object identifier and the target resource in a second data block of a second data server, wherein the second data server and the first data server are different servers, and the second data block is a copy of the first data block.

[0012] Optionally, after updating the index corresponding to the target object identifier to the physical space location of the target resource, the method further includes: marking the physical space location of the object resource storing the existing object as an available state, wherein the available state is a state that allows it to be used by objects other than the existing object.

[0013] According to another aspect of an embodiment of the present application, a resource storage device is provided, comprising: an acquisition unit, used to acquire a target resource, wherein the target resource is a resource to be stored in an object storage system; a first writing unit, used to write a target object in the object storage system when there is an existing object corresponding to the target resource in the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource; and an updating unit, used to update an index corresponding to the target object identifier to a physical spatial location of the target resource.

[0014] Optionally, the device also includes: a query unit, used to query the metadata corresponding to the object storage system using the target resource identifier of the target resource after acquiring the target resource, wherein the metadata includes a mapping between the object identifier and the resource identifier; and a determination unit, used to determine whether the existing object corresponding to the target resource exists in the object storage system when the target object identifier corresponding to the target resource identifier is found.

[0015] Optionally, the query unit includes: a query module, used to use the target resource identifier of the target resource to query the meta-information corresponding to the target storage bucket to obtain a target query result, wherein the target storage bucket is used to store resources uploaded by a target account, the target account is the account used to upload the target resource, and the target query result is used to indicate whether there is an object identifier corresponding to the target resource identifier in the object storage system.

[0016] Optionally, the first writing unit includes: a writing module, configured to append the target object identifier and the target resource to a first data block of a first data server, wherein the first data block is a data block to which the existing object belongs.

[0017] Optionally, the updating unit includes: an updating module, configured to update the physical space position corresponding to the target object identifier in the index of the first data block to the physical space position of the target resource.

[0018] Optionally, the device also includes: a second writing unit, used to write the target object identifier and the target resource in a second data block of a second data server after appending the target object identifier and the target resource in the first data block of the first data server, wherein the second data server and the first data server are different servers, and the second data block is a copy of the first data block.

[0019] Optionally, the device also includes: a marking unit, used to mark the physical space location of the object resource storing the existing object as an available state after updating the index corresponding to the target object identifier to the physical space location of the target resource, wherein the available state is a state that allows it to be used by other objects other than the existing object.

[0020] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.

[0021] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.

[0022] In an embodiment of the present application, a method of updating the index position of an object identifier is adopted to obtain a target resource, wherein the target resource is a resource to be stored in an object storage system; in a case where there is an existing object corresponding to the target resource in the object storage system, the target object is written into the object storage system, wherein the target object includes the target object identifier and the target resource of the existing object; the index corresponding to the target object identifier is updated to the physical space position of the target resource. For existing objects in the object storage system, the space occupation of the old object can be released by updating the index of its object identifier to the physical space position of the new resource, thereby achieving the purpose of eliminating the need to delete and recycle old objects, achieving the technical effect of reducing the I / O overhead of object updates, and further solving the problem of excessive I / O overhead in the method of performing object updates in object storage systems in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0025] Figure 1 is a schematic diagram of a hardware environment of an optional resource storage method according to an embodiment of the present application;

[0026] Figure 2 is a flowchart of an optional resource storage method according to an embodiment of the present application;

[0027] Figure 3 is a flowchart of another optional resource storage method according to an embodiment of the present application;

[0028] Figure 4 is a structural block diagram of an optional resource storage device according to an embodiment of the present application;

[0029] Figure 5 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] According to one aspect of an embodiment of the present application, a resource storage method is provided. Optionally, in this embodiment, the resource storage method can be applied to Figure 1 In the hardware environment composed of the terminal 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal 102 via a network, and can be used to provide services (such as object storage services, etc.) for the terminal or a client (for example, a game client) installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 104, and can also be used to process cloud services.

[0033] The above-mentioned network includes but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity). The terminal 102 is not limited to a PC (Personal Computer), a mobile phone, a tablet computer, etc. The server 104 may be, but is not limited to, a combination of multiple servers, for example, a front-end server, a metadata server, a back-end server, and a data server. Each server may be a server or a server cluster, or a cloud server or a cloud server cluster, which is not limited in this embodiment.

[0034] The resource storage method of the embodiment of the present application may be executed by the server 104, or by the terminal 102, or by both the server 104 and the terminal 102. The resource storage method of the embodiment of the present application may be executed by the terminal 102 or by a client (e.g., a client of a target game) installed thereon.

[0035] Taking the resource storage method in this embodiment executed by the server 104 as an example, Figure 2 is a flow chart of an optional resource storage method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0036] Step S202: Acquire a target resource, wherein the target resource is a resource to be stored in the object storage system.

[0037] The resource storage method in this embodiment can be applied to the scenario of storing objects in an object storage system. An object is the basic unit of data storage in an object storage system. Each object is a combination of data and a set of data attributes. The data attributes can be set according to the needs of the application. An object can contain an entire data structure, such as a file, a data table item, etc. Each object has an object identifier, and the object stored in a storage device (e.g., a data server) can be accessed through the object identifier.

[0038] An object storage system may include multiple devices, including but not limited to all or part of the following devices: a client of the object storage system, a metadata server, a front-end server (referred to as the front end), a back-end server (referred to as the back end), and a data server (object storage device), wherein the front-end server and the back-end server may be the same server, or the metadata server, the front-end server, and the back-end server may be the same server.

[0039] For example, an object storage system may include: a client of the object storage system, a metadata server, and a data server. Objects are stored in the data server, and the objects may be stored in the form of data blocks (Block files / directories).

[0040] The client of the object storage system can be run on the terminal device of the user (corresponding to an object), and the client can communicate with the server (e.g., front end) of the object storage system. The user can log in to the client running on his terminal device by using an account and password, a dynamic password, or an associated application (third-party application) to log in, and perform object operations by operating the client, such as object storage operations, object call operations, etc.

[0041] The target user can use the target account and the corresponding password to log in to the target client running on his terminal device, which is the client of the object storage system. On the resource upload interface of the target client, the target user can upload the target resource through local call or other methods. The target resource can be a file, a data table item, etc. It can be the new content in the file uploaded by the user. In this embodiment, there is no limitation on the type of the target resource.

[0042] The front end of the object storage system can obtain the target resource uploaded by the target client, determine whether there is an existing object corresponding to the target resource in the object storage system, and perform subsequent operations based on the determination result. The front end can be the API (Application Programming Interface) layer of the object storage system.

[0043] It should be noted that this embodiment is described by taking the method of the client uploading the target resource as an example, and the resource storage method in this embodiment is also applicable to other methods of obtaining resources.

[0044] Step S204: if there is an existing object corresponding to the target resource in the object storage system, write the target object into the object storage system, wherein the target object includes the target object identifier of the existing object and the target resource.

[0045] If there is no object corresponding to the target resource in the object storage system, the front end can initiate a new object creation request to the back end storage layer, thereby storing the target resource by creating a new object.

[0046] If there is an object corresponding to the target resource in the object storage system, that is, an existing object, the object identifier (ID) of the existing object is the target object identifier, the front end can set the target object ID as one of the update parameters and initiate an object update to the backend storage layer.

[0047] The backend can write the target object in the object storage system based on the target object identifier and the target resource. The target object contains the target object identifier and the target resource. That is, the target resource is stored using the target object identifier of the existing object corresponding to the target resource. This can be understood as directly updating the existing object in the object storage system using the target object.

[0048] Step S206: update the index corresponding to the target object identifier to the physical space location of the target resource.

[0049] In order to ensure the accuracy of object updates, after writing the target object, it is necessary to update the index corresponding to the target object identifier, that is, update the physical address pointed to by the index corresponding to the target object index, and the pointed address is the physical space location of the target resource.

[0050] If the object is updated successfully, the backend can return an indication of the object being updated successfully to the frontend, and the frontend can send an indication of the object being updated successfully to the target user through the target client. Otherwise, if the object is updated unsuccessfully, the backend can return an indication of the object being updated unsuccessfully to the frontend. The frontend can create a new object using the target resource and target resource identifier uploaded by the target user.

[0051] As an optional implementation, if the object update fails, the front end may also return indication information of the object update failure to the target client, and the target user may decide whether to retry and when to retry through the client.

[0052] As another optional implementation, if the object update fails, the backend storage layer may directly create a new object, return a new object ID to the frontend, and initiate asynchronous garbage collection based on the old object ID.

[0053] Through the above steps S202 to S206, the target resource is obtained, wherein the target resource is a resource to be stored in the object storage system; when there is an existing object corresponding to the target resource in the object storage system, the target object is written into the object storage system, wherein the target object includes the target object identifier and the target resource of the existing object; the index corresponding to the target object identifier is updated to the physical space location of the target resource, thereby solving the problem of excessive I / O overhead in the method of updating objects in the object storage system in the related art and reducing the I / O overhead of object updating.

[0054] As an optional embodiment, after acquiring the target resource, the method further includes:

[0055] S11, using the target resource identifier of the target resource to query meta information corresponding to the object storage system, wherein the meta information is used to indicate a mapping between the object identifier and the resource identifier;

[0056] S12: When a target object identifier corresponding to the target resource identifier is found, it is determined that there is an existing object corresponding to the target resource in the object storage system.

[0057] After acquiring the target resource, the front end can query the metadata through the metadata server to determine whether there is an existing object corresponding to the target resource in the object storage system. The metadata corresponding to the object storage system is used to indicate the mapping between the object identifier and the resource identifier in the object storage system.

[0058] The front end can first obtain the resource identifier of the target resource, that is, the target resource identifier. The target resource can be a target file. Correspondingly, the target resource identifier is the target file name of the target file. Then, the target resource identifier is used to query the metadata corresponding to the object storage system to determine whether there is an object identifier corresponding to the target resource identifier.

[0059] If the target object identifier corresponding to the target resource identifier is found, it can be determined that there is an existing object corresponding to the target resource in the object storage system; otherwise, it is determined that there is no existing object corresponding to the target resource in the object storage system.

[0060] Through this embodiment, by saving the mapping between the object identifier and the resource identifier of the object storage system through metadata, and using the resource identifier to perform metadata query, it is possible to quickly determine whether there is an existing object corresponding to the target resource in the object storage system, thereby improving the efficiency of object query.

[0061] As an optional embodiment, using the target resource identifier of the target resource to query the meta information corresponding to the object storage system includes:

[0062] S21, use the target resource identifier of the target resource to query the meta-information corresponding to the target storage bucket to obtain a target query result, wherein the target storage bucket is used to store the resources uploaded by the target account, the target account is the account used to upload the target resource, and the target query result is used to indicate whether there is an object identifier corresponding to the target resource identifier in the object storage system.

[0063] A user can create one or more buckets to store the resources they upload. For example, a user can create three buckets: bucket A, bucket B, and bucket C. The files under the three buckets are independent of each other and can have the same file name. For the target user (the user using the target account), the bucket created by the target user is the target storage bucket, that is, the target storage bucket can be used to store the resources uploaded by the target account.

[0064] The front end can use the target resource identifier to query the metadata corresponding to the target storage bucket to determine whether there is an object identifier corresponding to the target resource identifier in the object storage system, that is, to determine whether the target resource identifier already exists under the target storage bucket, thereby obtaining the target query result.

[0065] For example, after a user initiates a file upload, the front-end API layer can query the meta information to determine whether the uploaded file name exists in the storage system under the user's bucket.

[0066] Through this embodiment, different storage buckets are used to store resources uploaded by different accounts, which can improve the efficiency of meta information query.

[0067] As an optional embodiment, writing the target object in the object storage system includes:

[0068] S31, additionally writing a target object identifier and a target resource into a first data block of a first data server, wherein the first data block is a data block to which an existing object belongs.

[0069] The backend can initiate an update to the data server (first data server) to which the existing object belongs according to the target object ID and target resource. The first data server appends the object ID and its new content to the block file to which the object belongs, that is, appends the target object ID and target resource to the target data block.

[0070] As an optional embodiment, updating the index corresponding to the target object identifier to the physical space location of the target resource includes:

[0071] S41, updating the physical space position corresponding to the target object identifier in the index of the first data block to the physical space position of the target resource.

[0072] When updating the index corresponding to the target object identifier, the first data server or the backend may update the block index so that subsequent search requests are indexed to the physical space location of the new content of the object (target resource).

[0073] The block index can be used to indicate the object identifier stored in the block and the physical space location where the object content corresponding to the object identifier is stored. For the first data block, the backend or the first data server can update the physical space location corresponding to the target object identifier in the index of the first data block to the physical space location of the target resource.

[0074] Through this embodiment, when an object is updated, the index of the data block where the object is located is updated, so that the accuracy of index updating can be improved.

[0075] As an optional embodiment, after the target object identifier and the target resource are appended to the first data block of the first data server, the method further includes:

[0076] S51, writing a target object identifier and a target resource into a second data block of a second data server, wherein the second data server and the first data server are different servers, and the second data block is a copy of the first data block.

[0077] In order to avoid being unable to access objects stored in a data server due to problems with the data server, objects and copies of objects may be stored in multiple data servers.

[0078] For the first data block, in addition to the first data block in the first data server, there may be a copy of the first data block in one or more other data servers. After updating the existing object in the first data server, the backend may also copy the target object ID and target resource to other copies.

[0079] For example, for the second data server, the second data block in the first data server is a copy of the first data block. After appending the target object identifier and target resource to the first data block of the first data server, the backend can write the target object identifier and target resource to the second data block of the second data server.

[0080] Through this embodiment, the reliability of data storage can be guaranteed by copying the object ID and the new content to the corresponding replica data block.

[0081] As an optional embodiment, after updating the index corresponding to the target object identifier to the physical space location of the target resource, the method further includes:

[0082] S61: Mark the physical space location of the object resource storing the existing object as an available state, wherein the available state is a state that allows it to be used by other objects except the existing object.

[0083] After the index corresponding to the target object identifier is updated to the physical space location of the target resource, the existing object does not need to be deleted and recycled, but is marked as an invalid object, and the space storing the invalid object can be used by other objects.

[0084] Optionally, in this embodiment, the backend or the corresponding data server may mark the physical space location of the object resource storing the existing object as available. The storage in the available state may be used by other objects except the existing object.

[0085] In the related art, an old object is updated by creating a new object. The new object ID is different from the old object ID, and the complete old object is retained in the data block. If garbage collection is not performed, the space utilization rate in the block will be reduced. If garbage collection is performed, block files will be frequently read, filtered, and new block files will be generated, which will cause I / O amplification and additional scheduling overhead.

[0086] Through this embodiment, I / O amplification and additional scheduling overhead caused by deleting and recycling old objects can be reduced, I / O consumption can be reduced, and scheduling overhead can be reduced.

[0087] The resource storage method in the embodiment of the present application is explained below with reference to optional examples. In this example, the target resource is a file uploaded by a user, the resource identifier is a file name, the front end is a front end API layer, and the back end is a back end storage layer. The front end API layer and the back end object storage layer of the object storage system all support updates, and the update request is finally executed in the back end object storage layer through the front end API.

[0088] In the resource storage method in this example, the front end searches for and passes the ID of the updated object to the back end, and the back end reliably completes the object update and returns the object ID to the front end. Figure 3 As shown, the process of the resource storage method in this optional example may include the following steps:

[0089] Step S302: After the user initiates file upload, if the object corresponding to the uploaded file exists in the object storage system, an object update is initiated to the backend storage layer.

[0090] After the user initiates a file upload, the front-end API layer can first query the metadata to determine whether the uploaded file name exists in the storage system under the user's bucket. If not, a new object request is initiated to the back-end storage layer to store the file in the object storage system by creating a new object.

[0091] On the contrary, if it exists, the front end can set the object ID in the meta information as one of the update parameters and initiate an object update to the backend storage layer.

[0092] Step S304: the backend initiates an update to the data server to which it belongs based on the object ID and the new content.

[0093] The backend can initiate an update to the data server to which the old content belongs based on the object ID and the new content (the content in the uploaded file, which has the same function as the target resource).

[0094] Step S306: The data server appends the object ID and new content to the block file to which the object belongs, and updates the block index.

[0095] According to the update initiated by the backend, the data server can append the object ID and new content to the block file to which the old object belongs, and update the block index so that subsequent search requests are indexed to the physical space location of the new content of the object.

[0096] Step S308: copy the object ID and new content to the copy of the block.

[0097] The backend can then replicate the object ID and new content to other replicas, which can be in other data servers.

[0098] If all replicas have successfully updated the object ID and new content, the backend may return an update success to the frontend; otherwise, if the update fails, the backend may return an update failure to the frontend.

[0099] If the update fails, the front end can create a new object using the file name and file content uploaded by the user, and update the mapping from file name to object ID in the meta information with the new object ID.

[0100] Through this example, in the scenario where the user updates the file, the object storage system directly supports the update. The backend storage layer can support object updates, so there is no need to delete and recycle old objects, avoiding the I / O amplification and additional scheduling overhead caused by deleting and recycling old objects.

[0101] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0103] According to another aspect of an embodiment of the present application, a resource storage device for implementing the above resource storage method is provided. Figure 4 is a structural block diagram of an optional resource storage device according to an embodiment of the present application, such as Figure 4 As shown, the device may include:

[0104] (1) an acquisition unit 402, configured to acquire a target resource, wherein the target resource is a resource to be stored in the object storage system;

[0105] (2) a first writing unit 404, connected to the acquiring unit 402, configured to write a target object into the object storage system if there is an existing object corresponding to the target resource in the object storage system, wherein the target object includes a target object identifier of the existing object and a target resource;

[0106] (3) An updating unit 406, connected to the first writing unit 404, is used to update the index corresponding to the target object identifier to the physical space location of the target resource.

[0107] It should be noted that the acquisition unit 402 in this embodiment can be used to execute the above step S202, the first writing unit 404 in this embodiment can be used to execute the above step S204, and the updating unit 406 in this embodiment can be used to execute the above step S206.

[0108] Through the above module, the target resource is obtained, wherein the target resource is a resource to be stored in the object storage system; when there is an existing object corresponding to the target resource in the object storage system, the target object is written into the object storage system, wherein the target object includes the target object identifier and the target resource of the existing object; the index corresponding to the target object identifier is updated to the physical space location of the target resource, thereby solving the problem of excessive I / O overhead in the method of updating objects in the object storage system in the related art and reducing the I / O overhead of object updating.

[0109] As an optional embodiment, the above device also includes:

[0110] A query unit, configured to query meta-information corresponding to the object storage system using a target resource identifier of the target resource after acquiring the target resource, wherein the meta-information includes a mapping between the object identifier and the resource identifier;

[0111] The determination unit is used to determine whether there is an existing object corresponding to the target resource in the object storage system when a target object identifier corresponding to the target resource identifier is found.

[0112] As an optional embodiment, the query unit includes:

[0113] The query module is used to use the target resource identifier of the target resource to query the meta-information corresponding to the target storage bucket to obtain a target query result, wherein the target storage bucket is used to store resources uploaded by the target account, and the target account is the account used to upload the target resource. The target query result is used to indicate whether there is an object identifier corresponding to the target resource identifier in the object storage system.

[0114] As an optional embodiment, the first writing unit 404 includes:

[0115] The writing module is used to additionally write a target object identifier and a target resource into a first data block of a first data server, wherein the first data block is a data block to which an existing object belongs.

[0116] As an optional embodiment, the updating unit 406 includes:

[0117] An updating module is used to update the physical space position corresponding to the target object identifier in the index of the first data block to the physical space position of the target resource.

[0118] As an optional embodiment, the above device also includes:

[0119] The second writing unit is used to write the target object identifier and the target resource in the second data block of the second data server after appending the target object identifier and the target resource in the first data block of the first data server, wherein the second data server and the first data server are different servers, and the second data block is a copy of the first data block.

[0120] As an optional embodiment, the above device also includes:

[0121] A marking unit is used to mark the physical space location of the object resource storing the existing object as an available state after updating the index corresponding to the target object identifier to the physical space location of the target resource, wherein the available state is a state that allows it to be used by other objects except the existing object.

[0122] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.

[0123] According to another aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned resource storage method is also provided. The electronic device may be a server, a terminal, or a combination thereof.

[0124] Figure 5 is a structural block diagram of an optional electronic device according to an embodiment of the present application, such as Figure 5 As shown, it includes a processor 502, a communication interface 504, a memory 506 and a communication bus 508, wherein the processor 502, the communication interface 504 and the memory 506 communicate with each other through the communication bus 508, wherein,

[0125] Memory 506, used for storing computer programs;

[0126] The processor 502 is used to execute the computer program stored in the memory 506 to implement the following steps:

[0127] S1, obtaining a target resource, wherein the target resource is a resource to be stored in an object storage system;

[0128] S2, if there is an existing object corresponding to the target resource in the object storage system, write the target object into the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource;

[0129] S3, updating the index corresponding to the target object identifier to the physical space location of the target resource.

[0130] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0131] The communication interface is used for communication between the above electronic device and other devices.

[0132] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0133] As an example, the memory 506 may include but is not limited to the acquisition unit 402, the first writing unit 404 and the updating unit 406 in the resource storage device. In addition, it may also include but is not limited to other modules in the resource storage device, which will not be described in detail in this example.

[0134] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0135] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0136] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only. The device for implementing the above resource storage method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 5 It does not limit the structure of the above electronic device. For example, the terminal device may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations shown.

[0137] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0138] According to another aspect of the embodiments of the present application, a storage medium is further provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the resource storage methods in the embodiments of the present application.

[0139] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.

[0140] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0141] S1, obtaining a target resource, wherein the target resource is a resource to be stored in an object storage system;

[0142] S2, if there is an existing object corresponding to the target resource in the object storage system, write the target object into the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource;

[0143] S3, updating the index corresponding to the target object identifier to the physical space location of the target resource.

[0144] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.

[0145] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0146] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0147] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0148] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0149] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.

[0151] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0152] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A resource storage method, characterized in that: include: Acquire a target resource, wherein the target resource is a resource to be stored in an object storage system; In the case where there is an existing object corresponding to the target resource in the object storage system, writing the target object in the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource; Updating the index corresponding to the target object identifier to the physical spatial location of the target resource; Among them, after obtaining the target resource, the method also includes: using the target resource identifier of the target resource to query the meta information corresponding to the target storage bucket to obtain a target query result, the meta information is used to indicate the mapping between the object identifier and the resource identifier, the target storage bucket is used to store the resources uploaded by the target account, the target account is the account used to upload the target resource, and the target query result is used to indicate whether there is an object identifier corresponding to the target resource identifier in the object storage system; when the target object identifier corresponding to the target resource identifier is found, it is determined that the existing object corresponding to the target resource exists in the object storage system.

2. The method according to claim 1, characterized in that Writing the target object in the object storage system comprises: The target object identifier and the target resource are additionally written into a first data block of a first data server, wherein the first data block is a data block to which the existing object belongs.

3. The method according to claim 2, characterized in that The updating of the index corresponding to the target object identifier to the physical space location of the target resource includes: The physical space position corresponding to the target object identifier in the index of the first data block is updated to the physical space position of the target resource.

4. The method according to claim 2, characterized in that: After appending the target object identifier and the target resource to the first data block of the first data server, the method further includes: The target object identifier and the target resource are written into a second data block of a second data server, wherein the second data server and the first data server are different servers, and the second data block is a copy of the first data block.

5. The method according to any one of claims 1 to 4, characterized in that After updating the index corresponding to the target object identifier to the physical space location of the target resource, the method further includes: The physical space location of the object resource storing the existing object is marked as an available state, wherein the available state is a state that allows the object to be used by other objects except the existing object.

6. A resource storage device, characterized in that: include: An acquisition unit, configured to acquire a target resource, wherein the target resource is a resource to be stored in an object storage system; A first writing unit, configured to write a target object into the object storage system if there is an existing object corresponding to the target resource in the object storage system, wherein the target object includes a target object identifier of the existing object and the target resource; An updating unit, configured to update the index corresponding to the target object identifier to the physical spatial location of the target resource; The device further includes: a query unit, which is used to query the metadata corresponding to the target storage bucket using the target resource identifier of the target resource after acquiring the target resource, and obtain a target query result, wherein the metadata is used to indicate the mapping between the object identifier and the resource identifier, the target storage bucket is used to store the resources uploaded by the target account, the target account is the account used to upload the target resource, and the target query result is used to indicate whether there is an object identifier corresponding to the target resource identifier in the object storage system; a determination unit, which is used to determine whether there is an existing object corresponding to the target resource in the object storage system when the target object identifier corresponding to the target resource identifier is found.

7. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the method steps of any one of claims 1 to 5 by running the computer program stored in the memory.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method steps described in any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Apparatus, system, and method for storage space recovery in solid-state storage

    CN101646993A