CN114647663A - Resource processing method, device and system, electronic equipment and storage medium - Google Patents

Resource processing method, device and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN114647663A
CN114647663A CN202011504092.9A CN202011504092A CN114647663A CN 114647663 A CN114647663 A CN 114647663A CN 202011504092 A CN202011504092 A CN 202011504092A CN 114647663 A CN114647663 A CN 114647663A
Authority
CN
China
Prior art keywords
resource
target
lock
database
request
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.)
Pending
Application number
CN202011504092.9A
Other languages
Chinese (zh)
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.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN202011504092.9A priority Critical patent/CN114647663A/en
Publication of CN114647663A publication Critical patent/CN114647663A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • 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/2308Concurrency control

Abstract

The invention relates to a resource processing method, a device, a system, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving a resource updating request from a sender, wherein the resource updating request is generated after the sender confirms that the collected log files carry resource updating information; inquiring a target database object matched with the resource updating request and state information of a target lock resource corresponding to the target database object; when the target lock resource is determined not to be occupied according to the state information, the target lock resource is allocated to the resource updating request; and executing the updating operation on the target database object according to the resource updating request carrying the target lock resource. The concurrent operation of the database objects is managed through different lock resources, and the competition of the lock resources is reduced. The condition of read-write conflict caused by simultaneous access of a plurality of requests to the database object is avoided. The efficiency of the database is improved over the original need for each request to access the database object individually.

Description

Resource processing method, device and system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a resource processing method, apparatus, system, electronic device, and storage medium.
Background
In real-time streaming data processing, we consume the data in Kafka through Flink and then write the data into Kudu database. When data is processed through the Flink, a program can automatically identify whether newly added resource information exists in the currently processed data, and if the newly added resource information exists, a target database object corresponding to the resource information is updated. Since Flink handles log data in a distributed manner, there is a possibility that a conflict will occur by updating database objects with each Task.
For example: if a new field exists in one of the tasks, then other tasks may initiate to add the same field, and at this time, if multiple tasks access the database at the same time and the field already exists in the database object, then an access conflict will occur.
In other words, since Flink handles data in a distributed manner, when all tasks need to read from or write to the same database object, access conflicts may occur, which reduces the efficiency of the database.
Disclosure of Invention
In order to solve the technical problems described above or at least partially solve the technical problems, the invention provides a resource processing method, a resource processing apparatus, an electronic device, and a storage medium.
In a first aspect, the present invention provides a resource processing method, including:
receiving a resource updating request from a sender, wherein the resource updating request is generated by the sender after confirming that a collected log file carries resource updating information;
inquiring a target database object to be accessed by the resource updating request and state information of a target lock resource corresponding to the target database object;
when the target lock resource is determined to be unoccupied according to the state information, the resource updating request and the target lock resource are sent to a database;
and updating the state information of the target lock resource, wherein the updated state information marks that the target lock resource is occupied.
In an optional embodiment of the present invention, the querying a target database object to be accessed by the resource update request, and the status information of the target database object corresponding to the target lock resource, includes:
determining a target object identification of the target database object;
acquiring a mapping relation between an object identifier and a lock resource;
determining a target lock resource corresponding to the target object identifier according to the mapping relation;
and determining the state information according to the lock resource identifier currently corresponding to the target lock resource.
In an optional embodiment of the present invention, when it is determined that the target lock resource is not occupied according to the state information, the sending the resource update request and the target lock resource to a database includes:
and when the target lock resource is determined not to be occupied according to the state information, sending the resource updating request and the target lock resource to a database, locking the target database object by the database according to the target lock resource, and updating the locked target database object according to resource updating information carried by the resource updating request.
In an alternative embodiment of the invention, the method further comprises:
when the target lock resource is determined to be occupied according to the state information, the resource updating request is added to a request pool;
when the target lock resource is detected to be unoccupied, selecting a resource updating request matched with the unoccupied target lock resource from the request pool;
and sending the unoccupied target lock resources and the resource updating request matched with the target lock resources to the database.
In an alternative embodiment of the invention, the method further comprises:
when the target lock resource is determined to be occupied according to the state information, determining an occupation duration;
when the occupation duration is greater than or equal to a preset occupation duration, acquiring a target resource updating request which is matched with the target lock resource and meets a preset access requirement from the request pool;
generating a temporary lock resource according to the target resource updating request;
and sending the temporary lock resource and the target resource updating request to the database.
In a second aspect, the present invention provides a resource processing apparatus, including:
the receiving module is used for receiving a resource updating request from a sender, wherein the resource updating request is generated after the sender confirms that the collected log file carries resource updating information;
the query module is used for querying a target database object matched with the resource updating request and state information of a target lock resource corresponding to the target database object;
the sending module is used for sending the resource updating request and the target lock resource to a database when the target lock resource is determined to be unoccupied according to the state information;
and the updating module is used for updating the state information of the target lock resource, and the updated state information marks that the target lock resource is occupied.
In a third aspect, the present invention provides a resource processing system, including: a task manager, a resource processor and a database;
the task manager is used for sending the resource updating request to the resource processor, wherein the resource updating request carries resource updating information;
the resource processor is used for receiving a resource updating request from a sender, inquiring a target database object matched with the resource updating request and state information of a target lock resource corresponding to the target database object after the sender confirms that a collected log file carries resource updating information, and sending the resource updating request and the target lock resource to a database to be sent to the database when the target lock resource is determined to be unoccupied according to the state information;
the resource processor is further configured to update state information of the target lock resource, where the updated state information identifies that the target lock resource is occupied;
the database is configured to receive a resource update request from a resource processor and a target lock resource, where the resource update request carries resource update information, lock the target database object according to the target lock resource, and acquire an object information list of the locked target database object, where the object information list includes: and selecting object information corresponding to the update time closest to the current time as target object information, and updating the target object information by adopting the resource update information when the target object information is determined not to have the resource update information.
In an optional embodiment of the present invention, the database is further configured to determine a lock type of the target lock resource according to the resource update request, and lock the target database object according to the lock type, where the lock type includes: an exclusive access lock, an exclusive modification lock, a shared modification lock, and a shared access lock.
In a fourth aspect, the present invention provides an electronic device, comprising: at least one processor, and at least one memory, bus connected with the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to call program instructions in the memory to perform the resource processing method of any one of the first aspects.
In a fifth aspect, an embodiment of the present invention provides a storage medium, where the storage medium stores one or more programs, and the one or more programs are executable by one or more processors to implement the resource processing method according to any one of the above first aspects.
According to the technical scheme provided by the embodiment of the invention, the resource processor is arranged between the Flink and the database, the corresponding relation between the database object and the lock resource is arranged in the resource processor, and the concurrent operation of the database object is managed through different lock resources, so that the competition of the lock resource is reduced. The condition of read-write conflict caused by simultaneous access of a plurality of requests to the database object is avoided. The efficiency of the database is improved over the original need for each request to access the database object individually.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a resource processing method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a resource processing method according to another embodiment of the present invention;
fig. 3 is a flowchart illustrating a resource processing method according to another embodiment of the present invention;
FIG. 4 is a schematic diagram of a resource processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a resource processing apparatus according to another embodiment of the present invention;
FIG. 6 is a diagram illustrating a resource processing system according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, an implementation flow diagram of a resource processing method provided in an embodiment of the present invention is shown, where the method specifically includes the following steps:
step S11, receiving a resource updating request from a sender, wherein the resource updating request is generated by the sender after confirming that the collected log file carries resource updating information;
the method provided in the embodiment of the application is applied to a resource processor (schema-manager). The sender is a Task manager in the Flink (open source stream processing framework developed by Apache software foundation), and the Task manager collects tasks in the Flink and sends the tasks to the resource processor.
Because the TASK carries the log file in the flag, the TASK manager analyzes the log file, and when it is determined that resource update information exists in the log file or a database needs to be accessed to obtain resources, a resource update request is generated and sent to the resource processor. The resource update information may be: new fields, new indexes, new views, etc. of the data table.
Step S12, inquiring the target database object to be accessed by the resource updating request and the state information of the target lock resource corresponding to the target database object;
in the embodiment of the present application, the resource processor locally stores a corresponding relationship between an object identifier of a database object and a lock resource, where each database object corresponds to one lock resource, and the lock resource is used to determine whether the database object is occupied currently. The database objects in this embodiment are main components of the database, and the database objects in this embodiment may include tables, tablespaces, patterns, indexes, views, rules, and the like.
It should be noted that the lock resource is an important technical means for the database management system to perform concurrency control, and is used to manage concurrent access of shared resources of the database, and ensure that multiple transactions can access correct and consistent database objects (e.g., tables, indexes, etc.) during concurrent execution.
As an example, when there are multiple requests to access a database object at the same time, the lock resource is randomly allocated to a request, and when the lock resource allocation is completed and other requests want to access the database object, it will be shown that the database object is occupied.
In an optional embodiment of the present invention, the resource update request carries a target object identifier and resource update information, where the target object identifier may be a data object identifier, a view identifier, an index identifier, and the like.
In an alternative embodiment of the present invention, the step S12, querying the target database object to be accessed by the resource update request and the status information of the target lock resource corresponding to the target database object, includes the following steps a 1-A3:
step A1, determining the target object identification of the target database object;
step A2, acquiring the mapping relation between the object identification and the lock resource;
in the embodiment of the present application, a first corresponding relationship between an object identifier and a lock resource and a second corresponding relationship between a lock resource and a lock resource identifier are stored in a resource processor, where the lock resource identifier is used to indicate state information of the lock resource.
As one example, there are two layers of key-value pairs (key-values) in the resource processor, where the object is identified as a key name (key) in the first layer of key-value pairs and the lock resource is a key value (value); the lock resource in the second layer of key value pairs is a key name (key), and the lock resource identification is a key value (value).
Step A3, determining the target lock resource corresponding to the target object identifier according to the mapping relation;
step A4, determining the status information according to the current corresponding lock resource identification of the target lock resource.
In this embodiment of the application, determining the target lock resource corresponding to the target database object from the second correspondence may be determining a key name matched with the target lock resource from the second-layer key value correspondence, where a lock resource identifier corresponding to the key name is a lock resource identifier corresponding to the target lock resource, and determining the state information according to the lock resource identifier.
Step S13, when the target lock resource is determined not to be occupied according to the state information, the resource updating request and the target lock resource are sent to a database;
in the embodiment of the application, when the target lock resource is determined not to be occupied, the resource updating request and the target lock resource are sent to the database, the database locks the target database object to be accessed by the resource updating request according to the target lock resource, and the object information of the target database object is updated according to the resource updating information carried by the resource updating request.
Step S14, the state information of the target lock resource is updated, and the updated state information identifies that the target lock resource is occupied.
In the embodiment of the present application, after sending the target lock resource and the resource update request to the database, the resource processor locally updates the lock resource identifier of the target lock resource, that is, updates the state information of the target lock resource.
According to the method provided by the embodiment of the application, the resource processor is arranged between the Flink and the database, the corresponding relation between the database object and the lock resource is arranged in the resource processor, the database object is managed through the concurrent operation of different lock resources, the fierce competition of the lock resource is reduced, the read-write conflict is reduced, and the condition that the access conflict is caused because a plurality of requests access the database object at the same time is avoided. The efficiency of the database is improved over the original need for each request to access the database object individually.
Fig. 2 is a flowchart of a resource processing method according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:
step S21, when the target lock resource is determined to be occupied according to the state information, a resource updating request is added to the request pool;
step S22, when detecting the unoccupied target lock resource, selecting a resource updating request matched with the unoccupied target lock resource from the request pool;
step S23, sending the unoccupied target lock resource and the resource update request matched with the target lock resource to the database.
It should be noted that, because there is a case where one database object is accessed by multiple requests at the same time, when the target lock resource corresponding to the database object is occupied, the resource request is added to the request pool in a more detailed manner, and the next access is waited.
In the embodiment of the present application, since the time for each request access is limited, when one request access is completed, the lock resource occupied by the request is unoccupied (i.e., the state information of the lock resource becomes unoccupied). Therefore, the resource processor monitors the released target lock resources in real time, when a certain lock resource is detected to be released, a target resource updating request matched with the unoccupied target lock resource is selected from the request pool, and the unoccupied target lock resource and the target resource updating request are sent to the database.
The resource processing method provided by the embodiment of the application further comprises the following steps: when the target lock resource is determined to be occupied according to the state information, determining an occupied duration, and when the occupied duration is greater than or equal to the preset occupied duration, acquiring a target resource updating request which is matched with the target lock resource and meets the preset access requirement from the request pool; the target resource update request meeting the preset access requirement may be a request for accessing a database to obtain a resource.
After the target resource updating request is determined, a temporary locking resource is generated according to the target resource updating request, and the temporary locking resource and the target resource updating request are sent to the database.
In the embodiment of the application, when the time that a certain resource updating request occupies a lock resource is longer than the preset occupied time, a target resource updating request meeting an access requirement is determined, and a temporary lock resource is generated for the request, so that the request can be ensured to acquire the resource from a database in time, and conflict with the updating request of the resource being accessed can not be generated.
In the process of implementing the present application, the inventor further finds that, whenever there is resource update information, it is first determined in each Task whether the current resource update information already exists in the database object, and if not, the resource update is performed. But this still has a chance of generating a conflict because the Kudu database is transaction-unsupported. For example: when the first Task is adding the A field, the second Task initiates access, the second Task cannot inquire that the A field exists, and the second Task adds the A field and still causes access conflict.
To this end, the present application further provides a resource processing method, and fig. 3 is a flowchart of the resource processing method provided in the embodiment of the present application, and as shown in fig. 3, the method may include the following steps:
step S31, receiving a resource updating request from a resource processor and a target lock resource, wherein the resource updating request carries resource updating information;
the method provided by the embodiment of the application is applied to a database, the database in the embodiment is a kubu database, when the kubu database receives a resource update request from resource processing and a target lock resource, a target database object to be accessed by the resource update request is processed according to the target lock resource, and the processing process is as follows:
step S32, locking the target database object according to the target lock resource;
in the embodiment of the present application, step S32, locking the target database object according to the target lock resource, includes the following steps B1-B3:
step B1, determining the locking type of the target lock resource according to the resource updating request;
step B2, locking the target database object according to the locking type;
step B3, the lock type includes: an exclusive access lock, an exclusive modification lock, a shared modification lock, and a shared access lock.
Wherein the exclusive access lock represents that other requests are not allowed to modify the target database object and other requests are not allowed to access the object. The exclusive modification lock represents that other requests are not allowed to modify the target database object, and other requests are allowed to share access to the target database object. The sharing modification lock represents that other requests are allowed to share and modify the target database object, and other requests are allowed to share and access the target database object; the shared access lock represents that other requests are allowed to share and modify the target database object, and other requests are allowed to share and access the target database object.
Step S33, acquiring an object information list of the locked target database object, where the object information list includes: object information and update time of the object information;
in the embodiment of the present application, since a database object has a plurality of different requests for different accesses, the resource handler stores the time (update time) for each access to the database object and the object information of the database object after each access. It is convenient to provide up-to-date object information for subsequent requests for access. Where the object information may be a table structure, view information, index fields, etc.
Step S34, selecting object information corresponding to the update time closest to the current time as target object information;
in the embodiment of the application, the latest update time from the current time is used as the target object information, that is, the latest object information of the target database object.
In step S35, when it is determined that the resource update information does not exist in the target object information, the target object information is updated with the resource update information.
In the embodiment of the application, when the target object information is accessed, the target object information is traversed, and when the target object information is confirmed to have no resource updating information, the target object information is updated by adopting the resource updating information.
As an example, a resource update request is received, where the resource update request includes a target table identifier and resource update information (when the resource update information is that M fields are newly added in table N of the database, and the field information of the M fields); and determining a target data table and a target lock resource corresponding to the target data table according to the target table identifier, when the target lock resource exists, determining that the locking type of the target lock resource is exclusive modification locking according to the resource update information, performing exclusive modification locking on the data table N at the moment, and inserting the M fields and the field contents into the data table N after locking.
Fig. 4 is a block diagram of a resource processing apparatus provided in an embodiment of the present application, where the apparatus may be implemented as part of or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 4, the apparatus includes:
a receiving module 41, configured to receive a resource update request from a sender, where the resource update request is generated by the sender after confirming that a collected log file carries resource update information;
the query module 42 is configured to query a target database object matched with the resource update request, and status information of a target lock resource corresponding to the target database object;
a sending module 43, configured to send the resource update request and the target lock resource to the database when it is determined that the target lock resource is not occupied according to the state information;
and the updating module 44 is configured to update the state information of the target lock resource, where the updated state information identifies that the target lock resource is occupied.
In an embodiment of the present application, the query module 42 is configured to determine a target object identifier of a target database object; acquiring a mapping relation between an object identifier and a lock resource; determining a target lock resource corresponding to the target object identifier according to the mapping relation; and determining the state information according to the lock resource identifier currently corresponding to the target lock resource.
In this embodiment of the present application, the sending module 43 is configured to send the resource update request and the target lock resource to the database when it is determined that the target lock resource is not occupied according to the state information, the database locks the target database object according to the target lock resource, and update the locked target database object according to the resource update information carried in the resource update request.
In an embodiment of the present application, the apparatus further includes: the detection module is used for adding the resource updating request to the request pool when the target lock resource is determined to be occupied according to the state information; when the target lock resource is detected to be unoccupied, selecting a resource updating request matched with the unoccupied target lock resource from the request pool; and sending the unoccupied target lock resources and the resource updating request matched with the target lock resources to the database.
In an embodiment of the present application, the apparatus further includes: the processing module is used for determining the occupation duration when the target lock resource is determined to be occupied according to the state information; when the occupation time is longer than or equal to the preset occupation time, acquiring a target resource updating request which is matched with the target lock resource and meets the preset access requirement from the request pool; generating a temporary lock resource according to the target resource updating request; and sending the temporary lock resource and the target resource updating request to the database.
Fig. 5 is a block diagram of a resource processing apparatus provided in an embodiment of the present application, where the apparatus may be implemented as part of or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 5, the apparatus includes:
a receiving module 51, configured to receive a resource update request from a resource processor and a target lock resource, where the resource update request carries resource update information;
a locking module 52, configured to lock the target database object according to the target lock resource;
the query module 53 is configured to obtain an object information list of the locked target database object, where the object information list includes: object information and update time of the object information;
a selecting module 54, configured to use object information corresponding to an update time closest to the current time as target object information;
and an updating module 55, configured to update the target object information with the resource update information when it is determined that the resource update information does not exist in the target object information.
In this embodiment of the present application, the locking module 52 is configured to determine a locking type of a target lock resource according to a resource update request; locking the target database object according to the locking type; the locking types include: an exclusive access lock, an exclusive modification lock, a shared modification lock, and a shared access lock.
Fig. 6 is a block diagram of a resource processing system according to an embodiment of the present application, where as shown in fig. 6, the apparatus includes: a task manager 61, a resource handler 62 and a database 63;
the task manager 61 is configured to send a resource update request to the resource processor, where the resource update request carries resource update information;
in the embodiment of the present application, the Task manager 61 is a device in the Flink for sending Task.
The resource processor 62 is configured to receive a resource update request from a sender, where the resource update request is generated by the sender after confirming that the collected log file carries resource update information, query a target database object matched with the resource update request, and status information of a target lock resource corresponding to the target database object, and send the resource update request and the target lock resource to the database to send to the database when it is determined that the target lock resource is not occupied according to the status information;
the resource processor 62 is further configured to update state information of the target lock resource, where the updated state information identifies that the target lock resource is occupied;
the database 63 is configured to receive a resource update request from a resource processor and a target lock resource, where the resource update request carries resource update information, lock a target database object according to the target lock resource, and acquire an object information list of the locked target database object, where the object information list includes: and selecting the object information corresponding to the update time closest to the current time as the target object information, and updating the target object information by adopting the resource update information when the target object information is determined not to have the resource update information.
In this embodiment of the present application, the database is further configured to determine a locking type of the target lock resource according to the resource update request, and lock the target database object according to the locking type, where the locking type includes: an exclusive access lock, an exclusive modification lock, a shared modification lock, and a shared access lock.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium are executable by one or more processors, the resource processing method executed on the resource processing device side as described above is realized.
The processor is used for executing the resource processing program stored in the memory to realize the following steps of the resource processing method executed on the resource processing device side:
receiving a resource updating request from a sender, wherein the resource updating request is generated after the sender confirms that the collected log files carry resource updating information;
inquiring a target database object to be accessed by the resource updating request and state information of a target lock resource corresponding to the target database object;
when the target lock resource is determined to be unoccupied according to the state information, sending a resource updating request and the target lock resource to a database;
and updating the state information of the target lock resource, wherein the updated state information identifies that the target lock resource is occupied.
Further, querying a target database object to be accessed by the resource update request and state information of the target lock resource corresponding to the target database object includes:
determining a target object identifier of a target database object;
acquiring a mapping relation between an object identifier and a lock resource;
determining a target lock resource corresponding to the target object identifier according to the mapping relation;
and determining the state information according to the lock resource identifier currently corresponding to the target lock resource.
Further, when it is determined that the target lock resource is not occupied according to the state information, the resource update request and the target lock resource are sent to the database, including:
and when the target lock resource is determined to be unoccupied according to the state information, sending the resource updating request and the target lock resource to the database, locking the target database object by the database according to the target lock resource, and updating the locked target database object according to the resource updating information carried by the resource updating request.
Further, the method further comprises:
when the target lock resource is determined to be occupied according to the state information, a resource updating request is added to a request pool;
when the target lock resource is detected to be unoccupied, selecting a resource updating request matched with the unoccupied target lock resource from the request pool;
and sending the unoccupied target lock resources and the resource updating request matched with the target lock resources to the database.
Further, the method further comprises:
when the target lock resource is determined to be occupied according to the state information, determining the occupation duration;
when the occupation time is longer than or equal to the preset occupation time, acquiring a target resource updating request which is matched with the target lock resource and meets the preset access requirement from the request pool;
generating a temporary lock resource according to the target resource updating request;
and sending the temporary lock resource and the target resource updating request to the database.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program executes the following steps during running:
receiving a resource updating request from a sender, wherein the resource updating request is generated after the sender confirms that the collected log files carry resource updating information;
inquiring a target database object to be accessed by the resource updating request and state information of a target lock resource corresponding to the target database object;
when the target lock resource is determined to be unoccupied according to the state information, sending a resource updating request and the target lock resource to a database;
and updating the state information of the target lock resource, wherein the updated state information identifies that the target lock resource is occupied.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 60 shown in fig. 7 includes: at least one processor 601, and at least one memory 602, bus 603 connected to processor 601; the processor 601 and the memory 602 complete communication with each other through the bus 603; the processor is used for calling the program instructions in the memory to execute the resource processing method. The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
The invention also provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
receiving a resource updating request from a sender, wherein the resource updating request is generated after the sender confirms that the collected log files carry resource updating information;
inquiring a target database object to be accessed by the resource updating request and state information of a target lock resource corresponding to the target database object;
when the target lock resource is determined to be unoccupied according to the state information, sending a resource updating request and the target lock resource to a database;
and updating the state information of the target lock resource, wherein the updated state information identifies that the target lock resource is occupied.
Further, querying the target database object to be accessed by the resource update request and the state information of the target lock resource corresponding to the target database object includes:
determining a target object identifier of a target database object;
acquiring a mapping relation between an object identifier and a lock resource;
determining a target lock resource corresponding to the target object identifier according to the mapping relation;
and determining the state information according to the lock resource identifier currently corresponding to the target lock resource.
Further, when the target lock resource is determined not to be occupied according to the state information, the resource updating request and the target lock resource are sent to the database, and the method comprises the following steps:
and when the target lock resource is determined to be unoccupied according to the state information, sending the resource updating request and the target lock resource to the database, locking the target database object by the database according to the target lock resource, and updating the locked target database object according to the resource updating information carried by the resource updating request.
Further, the method further comprises:
when the target lock resource is determined to be occupied according to the state information, a resource updating request is added to the request pool;
when the target lock resource is detected to be unoccupied, selecting a resource updating request matched with the unoccupied target lock resource from the request pool;
and sending the unoccupied target lock resources and the resource updating request matched with the target lock resources to the database.
Further, the method further comprises:
when the target lock resource is determined to be occupied according to the state information, determining the occupation duration;
when the occupation time is longer than or equal to the preset occupation time, acquiring a target resource updating request which is matched with the target lock resource and meets the preset access requirement from the request pool;
generating a temporary lock resource according to the target resource updating request;
and sending the temporary lock resource and the target resource updating request to the database.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), including at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present invention, and are not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (10)

1. A method for processing resources, comprising:
receiving a resource updating request from a sender, wherein the resource updating request is generated by the sender after confirming that a collected log file carries resource updating information;
inquiring a target database object to be accessed by the resource updating request and state information of a target lock resource corresponding to the target database object;
when the target lock resource is determined to be unoccupied according to the state information, the resource updating request and the target lock resource are sent to a database;
and updating the state information of the target lock resource, wherein the updated state information marks that the target lock resource is occupied.
2. The method according to claim 1, wherein the querying the target database object to be accessed by the resource update request and the status information of the target database object corresponding to the target lock resource comprises:
determining a target object identification of the target database object;
acquiring a mapping relation between an object identifier and a lock resource;
determining a target lock resource corresponding to the target object identifier according to the mapping relation;
and determining the state information according to the lock resource identifier currently corresponding to the target lock resource.
3. The method of claim 1, wherein sending the resource update request and the target lock resource to a database when it is determined that the target lock resource is unoccupied according to the status information comprises:
and when the target lock resource is determined to be not occupied according to the state information, sending the resource updating request and the target lock resource to a database, locking the target database object by the database according to the target lock resource, and updating the locked target database object according to resource updating information carried by the resource updating request.
4. The method of claim 1, further comprising:
when the target lock resource is determined to be occupied according to the state information, the resource updating request is added to a request pool;
when the target lock resource is detected to be unoccupied, selecting a resource updating request matched with the unoccupied target lock resource from the request pool;
and sending the unoccupied target lock resource and a resource updating request matched with the target lock resource to the database.
5. The method of claim 1, further comprising:
when the target lock resource is determined to be occupied according to the state information, determining an occupation duration;
when the occupation duration is greater than or equal to a preset occupation duration, acquiring a target resource updating request which is matched with the target lock resource and meets a preset access requirement from the request pool;
generating a temporary lock resource according to the target resource updating request;
and sending the temporary lock resource and the target resource updating request to the database.
6. A resource handling apparatus, comprising:
the receiving module is used for receiving a resource updating request from a sender, wherein the resource updating request is generated after the sender confirms that the collected log file carries resource updating information;
the query module is used for querying a target database object matched with the resource updating request and state information of a target lock resource corresponding to the target database object;
the sending module is used for sending the resource updating request and the target lock resource to a database when the target lock resource is determined to be unoccupied according to the state information;
and the updating module is used for updating the state information of the target lock resource, and the updated state information marks that the target lock resource is occupied.
7. A resource processing system, comprising: a task manager, a resource processor and a database;
the task manager is used for sending the resource updating request to the resource processor, wherein the resource updating request carries resource updating information;
the resource processor is used for receiving a resource updating request from a sender, inquiring a target database object matched with the resource updating request and state information of a target lock resource corresponding to the target database object after the sender confirms that a collected log file carries resource updating information, and sending the resource updating request and the target lock resource to a database to be sent to the database when the target lock resource is determined to be unoccupied according to the state information;
the resource processor is further configured to update state information of the target lock resource, where the updated state information identifies that the target lock resource is occupied;
the database is configured to receive a resource update request from a resource processor and a target lock resource, where the resource update request carries resource update information, lock the target database object according to the target lock resource, and acquire an object information list of the locked target database object, where the object information list includes: and selecting object information corresponding to the update time closest to the current time as target object information, and updating the target object information by adopting the resource update information when the target object information is determined not to have the resource update information.
8. The system of claim 7, wherein the database is further configured to determine a lock type of the target lock resource based on the resource update request, and lock the target database object according to the lock type, and wherein the lock type comprises: an exclusive access lock, an exclusive modification lock, a shared modification lock, and a shared access lock.
9. An electronic device, comprising: at least one processor, and at least one memory, bus connected with the processor; the processor and the memory complete mutual communication through the bus; the processor is used for calling the program instructions in the memory to execute the method of any one of claims 1-5.
10. A storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the method of any one of claims 1-5.
CN202011504092.9A 2020-12-18 2020-12-18 Resource processing method, device and system, electronic equipment and storage medium Pending CN114647663A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011504092.9A CN114647663A (en) 2020-12-18 2020-12-18 Resource processing method, device and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011504092.9A CN114647663A (en) 2020-12-18 2020-12-18 Resource processing method, device and system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114647663A true CN114647663A (en) 2022-06-21

Family

ID=81989983

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011504092.9A Pending CN114647663A (en) 2020-12-18 2020-12-18 Resource processing method, device and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114647663A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117519945A (en) * 2023-12-07 2024-02-06 北京优炫软件股份有限公司 Database resource scheduling method, device and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117519945A (en) * 2023-12-07 2024-02-06 北京优炫软件股份有限公司 Database resource scheduling method, device and system

Similar Documents

Publication Publication Date Title
US20200220924A1 (en) Service Deployment Method and Function Management Platform Under Serverless Architecture
CN108897628B (en) Method and device for realizing distributed lock and electronic equipment
JP3851272B2 (en) Stateful program entity workload management
US8996469B2 (en) Methods and apparatus for job state tracking in cluster computing
KR20170059451A (en) System and method for determination of partition identifiers in a multitenant application server environment
CN107402821B (en) Access control method, device and equipment for shared resources
US7895332B2 (en) Identity migration system apparatus and method
US8666958B2 (en) Approaches to reducing lock communications in a shared disk database
CN110032568B (en) Data structure reading and updating method and device, and electronic equipment
CN106156126A (en) Process the data collision detection method in data task and server
US7574439B2 (en) Managing a nested request
CN114647663A (en) Resource processing method, device and system, electronic equipment and storage medium
US11853229B2 (en) Method and apparatus for updating cached information, device, and medium
CN113590320A (en) Resource processing method, device, equipment and medium for distributed batch task scheduling
US20230344781A1 (en) Grouping resource metadata tags
CN116662426A (en) Database connection establishment method, device, equipment and medium
US20230336557A1 (en) Resource allocating and management in a computer network
CN110659303A (en) Read-write control method and device for database nodes
US11308048B2 (en) Database migration method, apparatus, device, and computer-readable medium
CN113961586A (en) Control method and device for SQL (structured query language) statements
CN110011832B (en) Configuration issuing method and device for planned tasks
CN115878336A (en) Information processing method and device in lock operation and computing equipment
US20050198005A1 (en) Systems and methods for controlling access to an object
KR20180000023A (en) Method, apparatus, and computer program stored in computer readable medium for reading block in database system
CN111259375A (en) Processing method and device for access request applied to operating system of Internet of things

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