CN110858204B - Query request processing method, device and medium - Google Patents

Query request processing method, device and medium Download PDF

Info

Publication number
CN110858204B
CN110858204B CN201810936221.8A CN201810936221A CN110858204B CN 110858204 B CN110858204 B CN 110858204B CN 201810936221 A CN201810936221 A CN 201810936221A CN 110858204 B CN110858204 B CN 110858204B
Authority
CN
China
Prior art keywords
data object
changed
state
query request
variable
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810936221.8A
Other languages
Chinese (zh)
Other versions
CN110858204A (en
Inventor
王凡
龙凤
陈乐君
唐堂
谭正
颜理
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Chongqing Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Chongqing 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 China Mobile Communications Group Co Ltd, China Mobile Group Chongqing Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201810936221.8A priority Critical patent/CN110858204B/en
Publication of CN110858204A publication Critical patent/CN110858204A/en
Application granted granted Critical
Publication of CN110858204B publication Critical patent/CN110858204B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The application discloses a query request processing method, query request processing equipment and a query request processing medium. The method comprises the following steps: setting a first variable to a first state, wherein the first state is used for indicating that a data object change requirement exists in a database system; according to the first state, placing a query request related to the data object to be changed into a cache queue; changing the data object to be changed; and if the data object to be changed successfully completes the change, sending the query request in the cache queue to the database system. The query request processing method disclosed by the application can buffer the query request related to the data object to be changed during the data object changing period, so that the data object changed in the database system can be accessed after the data object is changed, the data object changing in a mode of interrupting service access is avoided, and the use experience of a user is improved.

Description

Query request processing method, device and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method for processing a query request, an apparatus for processing a query request, and a computer readable storage medium.
Background
If the data object is changed, such as large-scale change is carried out on the data object when the application program version is released, the service access can be interrupted, the data object is changed during the service access interruption period, and the service access is restored after the data object is changed, so that the offline change method belongs to the offline change method.
However, since the structured query language (StructuredQueryLanguage, SQL) request cannot be received during the change of the data object, service access to the database system cannot be performed, and if the update frequency of the data object is high, the service access needs to be frequently interrupted, especially when the access of the enterprise key service is frequently interrupted, a bad use experience is brought to the enterprise.
Disclosure of Invention
The embodiment of the application provides a query request processing method, query request processing equipment and query request processing medium, which can change a data object under the condition of not interrupting service access.
In a first aspect, an embodiment of the present application provides a method for processing a query request, including:
setting a first variable to a first state, wherein the first state is used for indicating that a data object change requirement exists in a database system;
according to the first state, placing a query request related to the data object to be changed into a cache queue;
changing the data object to be changed;
and if the data object to be changed successfully completes the change, sending the query request in the cache queue to the database system.
In a second aspect, an embodiment of the present application provides an apparatus for processing a query request, including:
the first setting module is used for setting a first variable into a first state, wherein the first state is used for indicating that a data object change requirement exists in the database system;
the first storage module is used for placing a query request related to the data object to be changed into a cache queue according to the first state;
a changing module, configured to change the data object to be changed;
and the first sending module is used for sending the query request in the cache queue to the database system if the data object to be changed successfully completes the change.
In a third aspect, an embodiment of the present application provides an apparatus for processing a query request, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the method as described above.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described method.
Compared with the prior art, the query request processing method, the device and the medium provided by the embodiment of the application have the advantages that if the data object is required to be changed, the query request related to the data object to be changed is put into the cache queue for caching, and after the data object is changed, the query request in the cache queue is sent to the database system. It can be seen that query requests related to data objects to be changed can be cached during a change of the data objects, and that the changed data objects in the database system can be accessed after the data objects have been changed. In the related technical scheme, the query request cannot be received during the change of the data object, and therefore, service access to the database system cannot be performed, so that compared with the scheme in the related technology, the embodiment of the application does not interrupt the service access to the database system, and the use experience of a user is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
FIG. 1 shows a schematic flow chart of a method of processing a query request according to an embodiment of the application;
FIG. 2 is a schematic logic block diagram of a method of processing a query request according to another embodiment of the present application;
FIG. 3 shows a schematic flow chart of an object change method of an embodiment of the application;
FIG. 4 shows a schematic flow chart diagram of a method of depositing a query request in accordance with one embodiment of the application;
FIG. 5 shows a schematic flow chart diagram of a method of processing a query request in a cache queue in accordance with one embodiment of the present application;
FIG. 6 shows a schematic flow chart diagram of a method of processing a query request in a pass-through queue in accordance with one embodiment of the present application;
FIG. 7 shows a schematic block diagram of an apparatus for processing a query request in accordance with an embodiment of the present application;
fig. 8 shows a schematic structural diagram of an apparatus for processing a query request according to another embodiment of the present application.
Detailed Description
Features and exemplary embodiments of various aspects of the application are described in detail below. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the application. It will be apparent, however, to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the application by showing examples of the application.
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The embodiments will be described in detail below with reference to the accompanying drawings.
FIG. 1 shows a schematic flow diagram of a method 100 of processing a query request in accordance with an embodiment of the application. The method comprises the following steps: s101 to S104.
S101, setting a first variable to be in a first state, wherein the first state is used for indicating that a data object change requirement exists in a database system.
As one example, a first variable is set to a first state by assigning a value to the first variable.
For example, the value of the first variable is set to be 1, and when the value of the first variable is set to be 1, the data object change requirement exists in the database system.
It should be noted that, it is not limited herein when the first variable is set to the first state.
For example, when a user input of a name of a data object to be changed is received, a data object change requirement is indicated, and the first variable is set to a first state.
For another example, the first variable may be set to the first state when a change instruction from a user is received.
S102, according to the first state, placing a query request related to the data object to be changed into a cache queue.
As an example, the query request may be an SQL request, and the query request may also be other query requests, and the query request is not specifically limited herein.
As one example, after setting the first variable to the first state, the predefined data object name variable is set to the name of the data object to be changed, and the received query requests from the application are divided into two classes according to the data object name variable, the two classes being a query request related to the data object to be changed and a query request unrelated to the data object to be changed, respectively.
For example, the data object to be changed is table a, and the data object name variable is set as the name of table a; receiving a query request from an application; if the query request contains the information of the data object name variable, the query request is related to the data object to be changed; if the query request does not contain the information of the data object name variable, the query request is a query request which is not related to the data object to be changed.
S103, changing the data object to be changed.
The order of starting S102 and S103 is not limited, and S102 may be started first and S103 may be started again; or S102 and S103 start to be executed at the same time; or starts to execute S103 and then starts to execute S102.
And S104, if the data object to be changed successfully completes the change, sending the query request in the cache queue to the database system.
As an example, the sending of the query request in the cache queue to the database system is accomplished by first depositing the query request in the cache queue into the pass-through queue and then sending the query request in the pass-through queue to the database system.
As another example, the query requests in the cache queue are sent directly to the database system without going through the pass-through queue.
According to the method 100 for processing a query request in an embodiment of the present application, if a data object needs to be changed, the query request related to the data object to be changed is put into a cache queue for caching, and after the data object is changed, the query request in the cache queue is sent to a database system. It can be seen that query requests related to data objects to be changed can be cached during a change of the data objects, and that the changed data objects in the database system can be accessed after the data objects have been changed. In the related technical scheme, the query request cannot be received during the change of the data object, and therefore, service access to the database system cannot be performed, so that compared with the scheme in the related technology, the embodiment of the application does not interrupt service access to the database system, and the use experience of a user is improved.
In one embodiment of the present application, S103 includes:
when the data object to be changed and the copy of the data object to be changed meet the preset data object synchronization condition, the copy of the data object to be changed is used for changing the data object to be changed.
It should be noted that, a copy of the data object to be changed may be established in advance, for example, a copy of the data object to be changed may be established in advance by a user. The name of the copy of the data object to be changed may be the name of the data object to be changed + tmp, tmp being used to represent the copy. A mapping transformation may be established between the data object to be altered and the copy of the data object to be altered. The object structure between the data object to be changed and the copy of the data object to be changed is consistent or inconsistent. And adding data to the copy of the data object to be changed according to the data object to be changed so as to keep the data object to be changed and the copy of the data object to be changed synchronous.
For example, the copy of the data object includes data generated before the time point a, and when the data object is updated, the data generated after the time point a in the data object is written into the copy of the data object, so as to maintain synchronization between the data object and the copy of the data object.
As one example, the data object synchronization conditions include: the generation time point of the latest data in the data object to be changed is the same as the generation time point of the latest data in the copy of the data object to be changed.
For example, the data object to be changed is the data object a, the copy of the data object to be changed is the data object A1, the generation time point of the latest data in the data object a is 3 pm whole day, the generation time point of the latest data in the copy of the data object A1 is 0 min 1 s3 pm the day, and then the data object a and the copy of the data object A1 are not synchronized.
As one example, the data object synchronization conditions include: the interval between the generation time point of the latest data in the data object to be changed and the generation time point of the latest data in the copy of the data object to be changed is smaller than the first preset time. For example, the data object to be changed is the data object B, the copy of the data object to be changed is the data object B1, the first preset time is 5 seconds, the generation time point of the latest data in the data object B is 3 pm whole day, the generation time point of the latest data in the copy of the data object B1 is 0 min 7 seconds in 3 pm on the day, and the difference between the data object B and the copy of the data object B1 is greater than the first preset time by 7 seconds, so that the data object B and the copy of the data object B1 are not synchronized.
As one example, a change instruction based on a data definition language (DataDefinitionLanguage, DDL) is sent to a database system for making a change to a data object to be changed.
After receiving the DDL-based change instruction, the database system changes the name of the data object to be changed to another name, and changes the name of the copy of the data object to be changed to the original name of the data object to be changed.
For example, the name of the data object to be changed is M, the name of the copy of the data object to be changed is M1, the name of the data object to be changed is changed from M to m+old, and the name of the copy of the data object to be changed is changed to M.
According to the query request processing method provided by the embodiment of the application, when the data object to be changed and the copy of the data object to be changed meet the preset data object synchronization condition, the data in the data object to be changed and the copy of the data object to be changed are identical or basically identical, and the data object to be changed is changed, so that the data in the data object after the change and the data object before the change are identical or basically identical, and a large difference between the data object before the change and the data object before the change is avoided.
In one embodiment of the present application, the method for processing a query request further includes:
if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, and the length of the query request in the cache queue is greater than the preset length, ending the change of the data object.
It should be noted that, after the first variable is set in the first state, when the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, waiting is needed until the data object to be changed and the copy of the data object to be changed meet the data object synchronization condition, and then the data object to be changed is changed. In the waiting process, more and more inquiry requests are sent to the cache queue, if the length of the inquiry requests in the cache queue is larger than the preset length, the cache queue is about to overflow, the data object to be changed is failed to be changed, and the change of the data object is ended.
Or if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, and the duration of the first variable in the first state reaches the preset time, ending the change of the data object.
It should be noted that, after the first variable is set in the first state, if the data object to be changed and the copy of the data object to be changed satisfy the data object synchronization condition, the data object to be changed may be changed; if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, waiting is needed until the data object to be changed and the copy of the data object to be changed meet the data object synchronization condition. If the first variable is set in the first state, starting to count the duration time of the first variable in the first state, wherein the count result is waiting time, if the waiting time reaches preset time, indicating that the waiting time is long, and the data object to be changed and the copy of the data object to be changed still do not meet the data object synchronization condition, ending the change of the data object.
According to the method for processing the query requests, when the cache queue is about to overflow, it is indicated that all the query requests related to the data object to be changed cannot be stored in the cache queue, and therefore all the query requests related to the data object to be changed cannot be sent to the database system, the change of the data object is finished, and the influence on service access due to the fact that part of the query requests related to the data object to be changed are not cached is avoided. When the duration of the first variable in the first state reaches the preset time, the time for waiting for synchronization of the data object to be changed and the copy of the data object to be changed is relatively long, the change of the data object is ended, and the situation that a long time is needed for accessing the data object to be changed is avoided, so that the use experience of a user is ensured.
In one embodiment of the present application, after finishing the change of the data object, the method for processing the query request further includes:
the first variable is set to a second state, the second state being indicative of no data object change requirements in the database system.
As one example, the first variable is set to the second state by assigning a value to the first variable.
For example, the value of the first variable is set to 0, and when the value of the first variable is set to 0, the condition that there is no data object change requirement in the database system is indicated.
According to the query request processing method, after the data object is failed to be changed and the data object is changed, the first variable is set to be in the second state, so that the fact that the data object changing requirement does not exist in the database system according to the first variable is obtained in the second state, and the next processing is facilitated.
In one embodiment of the present application, the method for processing a query request further includes:
if the length of the query request in the cache queue is greater than the preset length, setting the first variable in a sixth state, wherein the sixth state is used for indicating that the cache queue overflows or the cache queue is about to overflow.
As one example, the first variable is set to the sixth state by assigning a value to the first variable.
For example, the value of the first variable is set to 2, and when the value of the first variable is set to 2, it indicates that the cache queue overflows or indicates that the cache queue is about to overflow.
In one embodiment of the present application, after S104, the method for processing a query request further includes:
the first variable is set to a second state, the second state being indicative of no data object change requirements in the database system.
According to the method for processing the query request, after the data object successfully completes the change, and the query request in the cache queue is sent to the database system, the first variable is in the second state, namely, the first variable is set to be in the initial state, so that the next change of the data object is facilitated.
In one embodiment of the present application, S101 includes:
and after the data object to be changed and the copy of the data object to be changed meet the preset data change condition, setting the first variable into a first state.
As one example, the data change condition includes: the interval between the generation time point of the latest data in the data object to be changed and the generation time point of the latest data in the copy of the data object to be changed is smaller than the second preset time.
For example, the data object to be changed is the data object a, the copy of the data object to be changed is the data object A1, the second preset time is 10 seconds, the generation time point of the latest data in the data object a is 3 pm whole day, the generation time point of the latest data in the copy of the data object A1 is 3 pm 0 min 9 seconds, and then the data change condition is satisfied between the data object a and the copy of the data object A1.
According to the query request processing method, when the difference between the data object to be changed and the copy of the data object to be changed is smaller, the time waiting for synchronization between the data object to be changed and the copy of the data object to be changed is shorter, so that the first variable is set to be in the first state, and the flow of entering the data object change is started, and the success rate of data object update is higher.
In one embodiment of the present application, after S101, the method for processing a query request further includes:
and if the second variable is in the third state, setting the second variable into a fourth state, wherein the third state is used for indicating that the cache queue is empty, and the fourth state is used for indicating that the cache queue comprises the query request.
After S101, it is described that the query request related to the data object to be changed enters the cache queue, and before the data object to be changed successfully completes the change, the second variable is set to the fourth state, so as to indicate that the cache queue includes the query request, and the cache queue is not empty.
In one embodiment of the present application, the method for processing a query request further includes:
and if the data object to be changed successfully completes the change, setting the second variable to a fifth state, wherein the fifth state is used for indicating that the data object completes the change.
After S104, further including:
the second variable is set to a third state.
It should be noted that, if the data object to be changed successfully completes the change, the second variable is immediately set from the fourth state to the fifth state. The order of setting the second variable to the fifth state and starting execution of S104 is not limited herein, and it should be noted that the time taken to set the second variable to the fifth state is short, and a plurality of query requests are generally required to be sent to the database system in S104, and thus, S104 has not been executed yet, and setting the second variable to the fifth state has been completed.
In one embodiment of the application, setting the second variable to the third state comprises:
stopping putting the query requests into the cache queue, and putting all the received query requests into the transparent transmission queue; setting the second variable to a third state; if the transparent queue includes the query request related to the data object to be changed, after the second variable is set to the third state, the query request related to the data object to be changed in the transparent queue is sent to the database system.
According to the method for processing the query requests, after all the query requests in the cache queue are respectively sent to the database system, normal access to the database system is restored, the query requests are stopped from being put into the cache queue, and all the received query requests are put into the transparent queue. In the fifth state, the second variable may include a query request associated with the changed data object in the pass-through queue. It will be appreciated that since the data object to be changed completes the change, the description is made herein using the data object to be changed, and not using the data object to be changed, that is, the data object to be changed appearing here is the data object to be changed as described above. If the transparent queue includes the query request related to the changed data object, the query request related to the changed data object in the transparent queue is not sent to the database system first, but after the second variable is set to the third state, that is, after normal access to the database system is restored, the query request related to the changed data object in the transparent queue is sent to the database system.
In one embodiment of the present application, after S101, the method for processing a query request further includes:
according to the first state, placing a query request irrelevant to the data object to be changed into a transparent transmission queue; and sending the query request irrelevant to the data object to be changed in the transparent queue to the database system.
It should be noted that, when the first variable is in the first state, the received query request includes a query request related to the data object to be changed and a query request unrelated to the data object to be changed, the query request related to the data object to be changed is put in the cache queue, and the query request unrelated to the data object to be changed is put in the transparent queue. The query request irrelevant to the data object to be changed in the transparent queue is sent to the database system, so that the data object which is not changed in the database system can be accessed during the data object changing period, the data object changing does not influence the access to the data object which is not changed in the database system, and the user experience is further improved. FIG. 2 shows a schematic logic structure diagram of a method for processing SQL requests according to another embodiment of the application. The method is realized by a data synchronization program, an SQL interception and analysis program, an object change program, a cache forwarding program and a pass-through program. This embodiment is described by taking a query request as an example of an SQL request.
Synchronization between the data object to be changed and the copy of the data object to be changed is achieved through a data synchronization program.
And intercepting the SQL request from the external application through the SQL interception analysis program, and putting the SQL request into a cache queue and a transparent transmission queue according to the first variable and the second variable.
And changing the data object to be changed through the object changing program.
And forwarding the SQL request in the cache queue to a database system through a cache forwarding program.
And forwarding the SQL request in the transparent queue to a database system through a transparent program.
A first variable of 0 indicates that there is no data object change requirement in the database system; a first variable 1 indicates that a data object change requirement exists in the database system; a first variable of 2 indicates a cache queue overflow.
A second variable of 0 indicates that the cache queue is empty; a second variable of 1 indicates that the cache queue comprises SQL requests; a second variable of 2 indicates that the data object completes the change.
Based on fig. 2, fig. 3 shows a schematic flow chart of an object changing method according to an embodiment of the application. The method may be implemented by an object change program. The method includes S301 to S308.
S301, acquiring the name of the data object to be changed, which is input by a user.
S302, judging whether the first variable is 2, if yes, indicating that the buffer queue overflows when the data object is changed last time, executing step S303, and if no, executing step 304.
S303, setting the first variable to 0, namely initializing the first variable.
S304, judging whether the synchronization delay gap between the data object and the copy of the data object meets the data changing condition, executing step 305 when the judging result is yes, and returning to step S302 when the judging result is no. The synchronization delay gap refers to an interval between a generation time point of the latest data in the data object to be changed and a generation time point of the latest data in the copy of the data object to be changed.
S305, setting the first variable as 1, setting the data object variable as the name of the data object to be changed, and distinguishing the SQL request related to the data object to be changed from the SQL request unrelated to the data object to be changed according to the data object variable.
S306, judging whether the synchronization delay gap between the data object and the copy of the data object is 0, executing step S307 when the judging result is yes, and executing step S308 when the judging result is no, indicating that the data object and the copy of the data object need to be synchronized.
S307, changing the data object to be changed.
S308, judging whether the first variable is 2, if yes, indicating that in the process of waiting for synchronization of the data object and the copy of the data object, the buffer queue overflows due to overlong waiting for synchronization, the data object to be changed is failed to be changed, ending the change of the data object to be changed, returning to the step S303, and if no, returning to the step S306.
Based on FIG. 2, FIG. 4 shows a schematic flow chart of a method of depositing SQL requests according to an embodiment of the application. The method can be realized by SQL interception analysis program. The method includes S401 to S411.
S401, judging whether the first variable is 1, if yes, executing step S402, and if no, executing step S409, wherein no data object change requirement is indicated.
S402, it is determined whether the second variable is 2, and if yes, step S403 is executed, and if no, step S404 is executed.
S403, when the data object successfully completes the change, all SQL requests in the cache queue are put into the transparent queue, and then the SQL requests in the transparent queue are sent to the database system, so that all SQL requests in the cache queue are respectively sent to the database system. It will be appreciated that all SQL requests in the cache queue can be sent directly to the database system without going through the pass-through queue.
S404, judging whether the second variable is 1, if yes, executing step S405, and if no, executing step S406 to make the second variable be 1.
S405, judging whether the length of the SQL request in the cache queue is very long, namely judging whether the length of the SQL request in the cache queue is larger than a preset length, executing step S407 when the judgment result is yes, and executing step S408 when the judgment result is no.
S406, setting the second variable to 1.
S407, when the length of the SQL request in the cache queue is very long, setting the first variable to 2 and the second variable to 2, and indicating that the change of the data object fails.
S408, putting SQL requests which are not related to the data object to be changed in the SQL requests received from the application into a buffer queue, and putting SQL requests which are not related to the data object to be changed in the SQL requests received from the application into a transparent queue.
S409, when no data object change requirement exists in the database system, all the received SQL requests are put into a transparent transmission queue.
S410, it is determined whether the second variable is 0, and if yes, the process returns to step S401, and if no, step S411 is executed.
S411, the second variable is set to 0, and if the second variable is 1, the second variable is set to 2 first, and then the second variable is set to 0; if the second variable is 2, the second variable is set to 0 directly.
Based on FIG. 2, FIG. 5 shows a schematic flow chart of a method of processing SQL requests in a cache queue according to one embodiment of the application. The method may be implemented by a cache forwarding program. The method includes S501 and S502.
S501, it is determined whether the second variable is 2, and if yes, step S502 is executed, and if no, step S501 is returned.
S502, all SQL requests in the cache queue are sent to the database system until the cache queue is empty, and the second variable is set to 0.
Based on fig. 2, fig. 6 shows a schematic flow chart of a method of processing SQL requests in a pass-through queue according to an embodiment of the application. The method may be implemented by a pass-through program. The method includes S601 to S603.
S601, it is determined whether the second variable is 2, and if yes, step S602 is executed, and if no, step S603 is executed.
S602, sending the SQL request irrelevant to the changed data object in the transparent queue to a database system, and temporarily not processing the SQL request relevant to the changed data object in the transparent queue.
S603, the SQL request related to the changed data object in the transparent queue is sent to the database system.
It should be noted that, when the second variable is 2, the SQL request is stopped from being put into the cache queue, and all the received SQL requests are put into the pass-through queue, so the pass-through queue may include the SQL request related to the changed data object. When the transparent queue comprises SQL requests related to the changed data objects, the SQL requests related to the changed data objects in the transparent queue are not processed temporarily, and when the second variable is 0, namely the second variable is restored to the initial value, the SQL requests related to the changed data objects in the transparent queue are sent to the database system.
FIG. 7 shows a schematic block diagram of an apparatus for processing a query request in accordance with an embodiment of the present application. The apparatus 700 includes: a first setting module 701, a first storing module 702, a changing module 703 and a first transmitting module 704.
The first setting module 701 is configured to set a first variable to a first state, where the first state is used to indicate that there is a data object change requirement in the database system.
The first storing module 702 is configured to put, according to the first state, a query request related to a data object to be changed into a cache queue.
A changing module 703, configured to change the data object to be changed.
The first sending module 704 is configured to send the query request in the cache queue to the database system if the data object to be changed completes the change successfully.
In one embodiment of the application, the change module 703 is used to,
when the data object to be changed and the copy of the data object to be changed meet the preset data object synchronization condition, the copy of the data object to be changed is used for changing the data object to be changed.
In one embodiment of the application, the alteration module 703 is also used to,
if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, and the length of the query request in the cache queue is greater than the preset length, ending the change of the data object.
Or alternatively, the process may be performed,
and if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, and the duration of the first variable in the first state reaches the preset time, ending the change of the data object.
In one embodiment of the application, the apparatus 700 further comprises:
the second setting module is used for setting the first variable to a second state, and the second state is used for indicating that no data object change needs exist in the database system.
In one embodiment of the application, the first setting module 701 is configured to,
and after the data object to be changed and the copy of the data object to be changed meet the preset data change condition, setting the first variable into a first state.
In one embodiment of the application, the apparatus 700 further comprises:
and the third setting module is used for setting the second variable into a fourth state when the second variable is in a third state, wherein the third state is used for indicating that the cache queue is empty, and the fourth state is used for indicating that the query request is entering the cache queue.
In one embodiment of the application, the apparatus 700 further comprises:
and the fourth setting module is used for setting the second variable to a fifth state if the data object to be changed successfully completes the change, and the fifth state is used for indicating that the data object completes the change.
And a fifth setting module for setting the second variable to a third state.
In one embodiment of the present application, the fifth setting module includes:
and the sending unit is used for stopping the query request from being put into the cache queue and putting all the received query requests into the transparent transmission queue.
A setting unit configured to set the second variable to a third state;
the sending unit is further configured to send, to the database system, the query request related to the data object to be changed in the transparent queue after the setting unit sets the second variable to the third state if the transparent queue includes the query request related to the data object to be changed.
In one embodiment of the application, the apparatus 700 further comprises:
the second storage module is used for placing the query request irrelevant to the data object to be changed into the transparent transmission queue according to the first state;
and the second sending module is used for sending the query request irrelevant to the data object to be changed in the transparent queue to the database system.
Fig. 8 shows a schematic structural diagram of an apparatus for processing a query request according to another embodiment of the present application. The apparatus 800 comprises: input device 801, input interface 802, processor 803, memory 804, output interface 805, and output device 806.
The input interface 802, the processor 803, the memory 804, and the output interface 805 are connected to each other through a bus 810, and the input device 801 and the output device 806 are connected to the bus 810 through the input interface 802 and the output interface 805, respectively, and further connected to other components of the computing device 800.
Specifically, the input device 801 receives input information from the outside and transmits the input information to the processor 803 through the input interface 802; the processor 803 processes the input information based on computer executable instructions stored in the memory 804 to generate output information, temporarily or permanently stores the output information in the memory 804, and then transmits the output information to an output device 806 through an output interface 805; output device 806 outputs the output information to the outside of computing device 800 for use by a user.
Computing device 800 may perform the steps of the methods of the application described above.
The processor 803 may be one or more central processing units (English: central Processing Unit, CPU). In the case where the processor 803 is one CPU, the CPU may be a single core CPU or a multi-core CPU.
The Memory 804 may be, but is not limited to, one or more of random access Memory (Random Access Memory, RAM), read-Only Memory (ROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), compact disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM), hard disk, and the like. The memory 804 is used for storing program codes.
It will be appreciated that in an embodiment of the present application, the functions of any or all of the modules provided in fig. 7 may be implemented by the central processor 803 shown in fig. 8.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When used in whole or in part, is implemented in the form of a computer program product comprising one or more computer instructions. When loaded or executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (Digital Subscriber Line, DSL), or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
An apparatus for processing a query request according to an embodiment of the present application includes: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the above-described methods.
A computer readable storage medium according to an embodiment of the present application is provided, on which computer program instructions are stored, which when executed by a processor implement the above-mentioned method.
While the application has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (12)

1. A method for processing a query request, comprising:
setting a first variable to a first state, wherein the first state is used for indicating that a data object change requirement exists in a database system;
according to the first state, placing a query request related to the data object to be changed into a cache queue;
changing the data object to be changed;
if the data object to be changed successfully completes the change, sending a query request in the cache queue to the database system;
after the setting the first variable to the first state, the method further comprises:
according to the first state, placing a query request irrelevant to the data object to be changed into a transparent transmission queue;
and sending the query request irrelevant to the data object to be changed in the transparent queue to the database system.
2. The method of claim 1, wherein said altering the data object to be altered comprises:
and when the data object to be changed and the copy of the data object to be changed meet the preset data object synchronization condition, using the copy of the data object to be changed to change the data object to be changed.
3. The method as recited in claim 2, further comprising:
if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, and the length of the query request in the cache queue is greater than the preset length, ending the change of the data object;
or alternatively, the process may be performed,
and if the data object to be changed and the copy of the data object to be changed do not meet the data object synchronization condition, and the duration of the first variable in the first state reaches the preset time, ending the change of the data object.
4. The method of claim 3, wherein after said ending the change to the data object, further comprising:
and setting the first variable to a second state, wherein the second state is used for indicating that no data object change needs exist in the database system.
5. The method of claim 1, wherein after sending the query request in the cache queue to the database system, further comprising:
and setting the first variable to a second state, wherein the second state is used for indicating that no data object change needs exist in the database system.
6. The method of claim 2, wherein setting the first variable to the first state comprises:
and setting the first variable to the first state after the data object to be changed and the copy of the data object to be changed meet a preset data change condition.
7. The method as recited in claim 1, further comprising:
and if the second variable is in a third state, setting the second variable into a fourth state, wherein the third state is used for indicating that the cache queue is empty, and the fourth state is used for indicating that the cache queue comprises a query request.
8. The method as recited in claim 7, further comprising:
if the data object to be changed successfully completes the change, setting the second variable to a fifth state, wherein the fifth state is used for indicating that the data object completes the change;
after the query request in the cache queue is sent to the database system, the method further comprises:
setting the second variable to the third state.
9. The method of claim 8, wherein the setting the second variable to the third state comprises: stopping putting the query requests into the cache queue, and putting all the received query requests into a transparent transmission queue;
setting the second variable to the third state;
and if the transparent queue comprises the query request related to the data object to be changed, after the second variable is set to the third state, sending the query request related to the data object to be changed in the transparent queue to the database system.
10. An apparatus for processing a query request, comprising:
the first setting module is used for setting a first variable into a first state, wherein the first state is used for indicating that a data object change requirement exists in the database system;
the first storage module is used for placing a query request related to the data object to be changed into a cache queue according to the first state;
a changing module, configured to change the data object to be changed;
the first sending module is used for sending the query request in the cache queue to the database system if the data object to be changed successfully completes the change;
the apparatus further comprises:
the input module is used for inputting the query request irrelevant to the data object to be changed into a transparent transmission queue according to the first state;
and the second sending module is used for sending the query request irrelevant to the data object to be changed in the transparent queue to the database system.
11. An apparatus for processing a query request, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the method of any one of claims 1-9.
12. A computer readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the method of any of claims 1-9.
CN201810936221.8A 2018-08-16 2018-08-16 Query request processing method, device and medium Active CN110858204B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810936221.8A CN110858204B (en) 2018-08-16 2018-08-16 Query request processing method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810936221.8A CN110858204B (en) 2018-08-16 2018-08-16 Query request processing method, device and medium

Publications (2)

Publication Number Publication Date
CN110858204A CN110858204A (en) 2020-03-03
CN110858204B true CN110858204B (en) 2023-09-19

Family

ID=69634820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810936221.8A Active CN110858204B (en) 2018-08-16 2018-08-16 Query request processing method, device and medium

Country Status (1)

Country Link
CN (1) CN110858204B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1462958A2 (en) * 2003-03-28 2004-09-29 Microsoft Corporation Systems and methods for requesting and receiving database change notifications
CN101329686A (en) * 2008-07-31 2008-12-24 中国科学院计算技术研究所 System for implementing network search caching and search method
CN103390041A (en) * 2013-07-18 2013-11-13 杭州东信北邮信息技术有限公司 Method and system for providing data service based on middleware
CN104407926A (en) * 2014-12-15 2015-03-11 成都英力拓信息技术有限公司 Scheduling method of cloud computing resources
CN104471573A (en) * 2012-08-14 2015-03-25 艾玛迪斯简易股份公司 Updating cached database query results
CN107391764A (en) * 2017-08-31 2017-11-24 江西博瑞彤芸科技有限公司 Business datum querying method
CN107807816A (en) * 2016-09-08 2018-03-16 阿里巴巴集团控股有限公司 The upgrade method of serve end program and database, device and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6901437B1 (en) * 2000-10-06 2005-05-31 Verizon Laboratories Inc. Mobile cache for dynamically composing user-specific information

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1462958A2 (en) * 2003-03-28 2004-09-29 Microsoft Corporation Systems and methods for requesting and receiving database change notifications
CN101329686A (en) * 2008-07-31 2008-12-24 中国科学院计算技术研究所 System for implementing network search caching and search method
CN104471573A (en) * 2012-08-14 2015-03-25 艾玛迪斯简易股份公司 Updating cached database query results
CN103390041A (en) * 2013-07-18 2013-11-13 杭州东信北邮信息技术有限公司 Method and system for providing data service based on middleware
CN104407926A (en) * 2014-12-15 2015-03-11 成都英力拓信息技术有限公司 Scheduling method of cloud computing resources
CN107807816A (en) * 2016-09-08 2018-03-16 阿里巴巴集团控股有限公司 The upgrade method of serve end program and database, device and equipment
CN107391764A (en) * 2017-08-31 2017-11-24 江西博瑞彤芸科技有限公司 Business datum querying method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王彦士 ; 王伟 ; 刘朝辉 ; 魏峻 ; 黄涛 ; .支持透明集成的数据缓存机制.计算机研究与发展.2015,(04),907-917. *

Also Published As

Publication number Publication date
CN110858204A (en) 2020-03-03

Similar Documents

Publication Publication Date Title
US11593337B2 (en) Data processing method, device, and a storage medium
CN109032796B (en) Data processing method and device
US10489378B2 (en) Detection and resolution of conflicts in data synchronization
AU2014209697A1 (en) Method and system for using a recursive event listener on a node in hierarchical data structure
CN110019123B (en) Data migration method and device
CN112835885B (en) Processing method, device and system for distributed form storage
CN112015816A (en) Data synchronization method, device, medium and electronic equipment
CN110858204B (en) Query request processing method, device and medium
US11288263B2 (en) Change service for shared database object
CN109284177B (en) Data updating method and device
CN110955460A (en) Service process starting method and device, electronic equipment and storage medium
US9860313B2 (en) Maintaining state synchronization of an application between computing devices as well as maintaining state synchronization of common information between different applications without requiring perioidic synchronization
CN115189931A (en) Distributed key management method, device, equipment and storage medium
US9749426B2 (en) Method, system, and apparatus for agent-based architecture for integrated mobile applications
US20190303193A1 (en) Computing system including enhanced application performance based on last completed operation sequence value
CN112817701A (en) Timer processing method and device, electronic equipment and computer readable medium
CN113094431A (en) Read-write separation method and device and server
CN113742376A (en) Data synchronization method, first server and data synchronization system
US10310921B2 (en) Computing system including PLSO command to maintain equivalency between independent coupling facilities
CN110879818A (en) Method, device, medium and electronic equipment for acquiring data
US20240104069A1 (en) Systems and methods of managing state machine systems with compacting distributed log storage
CN116401317B (en) Cache data synchronization method and device, electronic equipment and medium
CN114780593A (en) Processing method and device for timing task
CN113760532A (en) Data processing method, device, electronic equipment, system and storage medium
CN117827385A (en) Transaction management method for database cluster, readable storage medium and computer device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant