CN107168685B - Method and device for updating script and computer terminal - Google Patents

Method and device for updating script and computer terminal Download PDF

Info

Publication number
CN107168685B
CN107168685B CN201610131451.8A CN201610131451A CN107168685B CN 107168685 B CN107168685 B CN 107168685B CN 201610131451 A CN201610131451 A CN 201610131451A CN 107168685 B CN107168685 B CN 107168685B
Authority
CN
China
Prior art keywords
script
updated
scripts
processing
updating
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
CN201610131451.8A
Other languages
Chinese (zh)
Other versions
CN107168685A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610131451.8A priority Critical patent/CN107168685B/en
Publication of CN107168685A publication Critical patent/CN107168685A/en
Application granted granted Critical
Publication of CN107168685B publication Critical patent/CN107168685B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method and a device for updating a script and a computer terminal. Wherein, the method comprises the following steps: determining a processing progress mark of the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in the script set to be updated when being processed, and the processing progress mark is used for recording the latest updated script of the server at the current moment according to the processing sequence; and executing the updating operation on the script which is not updated in the script set to be updated according to the processing progress mark. The invention solves the technical problems that the script updating scheme adopted in the related technology easily causes omission or the script updating process of a plurality of servers is asynchronous in the process that a single server updates a plurality of scripts.

Description

Method and device for updating script and computer terminal
Technical Field
The invention relates to the field of internet, in particular to a method and a device for updating a script and a computer terminal.
Background
The rule engine is developed by an inference engine, which is a component embedded in an application program, and realizes the separation of business decisions from application program codes and the writing of business decisions by using predefined semantic modules. The rules engine may receive data input, interpret business rules, and make business decisions based on the business rules.
The rule engine is used as the technical core of the wind control system, and the main principle is as follows: the wind control rules are expressed in a script form, the script is executed in a rule engine in an event-driven mode, and the output result of the script is risk identification and handling conditions.
From the system structure, the rule engine usually adopts distributed deployment, a plurality of events can be distributed to different servers in a hash mode, and each server selects a script to execute according to the events and outputs a result after the execution process is finished.
In view of the strong confrontation in the field of wind control, the wind control rules are changed frequently. The rule needs to be issued to the rule engine after each rule change, i.e. each server of the rule engine needs to be updated to the latest version of the script. If server false death, restart and other phenomena occur in the updating process, normal issuing of the script can be influenced.
Script release refers to updating the script in the rule engine to the latest version after the script is modified.
For script distribution, the following two methods are generally adopted in the related art:
(1) circularly calling a cluster interface mode: and circularly calling the reloading script interfaces on each server according to the server address list, and if each interface returns success information, indicating that the script is successfully issued.
However, this approach has the following drawbacks: if any server in the mode of circularly calling the cluster interface has fault phenomena of false death, restart and the like, the script issuing is failed; and, during the redeployment of the server, the user can not perform any script issuing operation.
(2) Distributed cluster configuration manager approach: through the distributed cluster configuration manager, for example: ZooKeeper, Diamond, etc. push the latest script to all servers to ensure that each server can receive the latest script configuration.
However, this approach has the following drawbacks: the script configuration in the distributed cluster configuration manager mode can be covered, and when the server is recovered after being falsely dead, script changes occurring in the period can not be synchronized, so that the script version of the whole cluster is easily asynchronous.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for updating scripts and a computer terminal, which are used for at least solving the technical problems that a script updating scheme adopted in the related technology is easy to cause omission or the script updating process of a plurality of servers is asynchronous in the process of updating a plurality of scripts by a single server.
According to an aspect of an embodiment of the present invention, there is provided a method for updating a script, including: determining a processing progress mark of the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in the script set to be updated when being processed, and the processing progress mark is used for recording the latest updated script of the server at the current moment according to the processing sequence; and executing the updating operation on the script which is not updated in the script set to be updated according to the processing progress mark.
Optionally, the determining the processing progress identifier according to the processing order includes: distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence; acquiring a processing sequence identifier of a latest updating-completed script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated; and setting the acquired processing sequence identifier as a processing progress identifier.
Optionally, the performing an update operation on the non-updated script according to the processing progress identifier includes: obtaining an un-updated script according to the processing sequence and the processing progress mark; judging whether a plurality of scripts with the same script identification exist in the non-updated scripts or not; if the script exists, one of the scripts is reserved from the scripts with the same script identification according to the processing sequence, and the updating operation is executed on the screened script which is not updated; and if not, performing updating operation on the non-updated scripts according to the processing sequence.
Optionally, the obtaining the non-updated script according to the processing sequence and the processing progress identifier includes: under the condition that the processing sequence is that each script to be updated in the script set to be updated is updated according to the processing sequence identification from small to large, judging whether a plurality of scripts of which the processing sequence identifications are larger than the processing progress identifications exist in the script set to be updated or not; if so, determining a plurality of scripts larger than the processing progress identification as the non-updated scripts.
Optionally, the saving one of the scripts identified by the script according to the processing order includes: selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence; and comparing the processing sequence identifiers corresponding to each script in a plurality of scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier.
Optionally, the executing the update operation on the non-updated script according to the processing progress identifier further includes: the processing progress mark is updated by adopting one of the following modes: after one script is updated each time according to the processing sequence, updating the processing progress mark in real time; and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
Optionally, the script set to be updated includes one of: a plurality of scripts to be updated that have been received when the script update operation is started to be executed in the processing order; the script updating method includes the steps of starting to execute a script updating operation according to a processing sequence, wherein the script updating operation comprises a plurality of scripts to be updated which are received when the script updating operation is started to execute, and a plurality of scripts to be updated which are newly received from the beginning of executing the script updating operation to the current moment.
According to another aspect of the embodiments of the present invention, there is provided another method for updating a script, including: respectively determining a processing progress identifier of each server in the plurality of servers at the current moment according to a processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress identifier is used for recording the latest updated script of the corresponding server at the current moment according to the processing sequence; and sending indication information to the corresponding server according to the processing progress mark, wherein the indication information is used for indicating the corresponding server to execute updating operation on the script which is not updated in the script set to be updated.
Optionally, after sending the indication information to the corresponding server according to the processing progress identifier, the method further includes: receiving a response message returned by the corresponding server, wherein the response message is used for indicating the completion progress of the corresponding server to the un-updated script according to the indication information; and updating the processing progress identification according to the response message.
According to another aspect of the embodiments of the present invention, there is also provided an apparatus for updating a script, including: the determining module is used for determining a processing progress mark of the current moment according to a processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress mark is used for recording the latest updated script of the server at the current moment according to the processing sequence; and the updating module is used for executing updating operation on the script which is not updated in the script set to be updated according to the processing progress mark.
Optionally, the determining module includes: the distribution unit is used for distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence; the first acquisition unit is used for acquiring the processing sequence identifier of the latest updated script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated; and the setting unit is used for setting the acquired processing sequence identifier as a processing progress identifier.
Optionally, the update module includes: a second obtaining unit, configured to obtain an un-updated script according to the processing order and the processing progress identifier; the judging unit is used for judging whether a plurality of scripts with the same script identification exist in the non-updated scripts or not; the updating unit is used for keeping one script from a plurality of scripts with the same script identification according to the processing sequence and executing updating operation on the screened non-updated scripts when the output of the judging unit is yes; or when the output of the judging unit is negative, the updating operation is executed on the script which is not updated according to the processing sequence.
Optionally, the second obtaining unit includes: the judgment subunit is configured to, when the processing order is that each script to be updated in the script set to be updated is updated in sequence from small to large according to the processing order identifier, judge whether there are multiple scripts in the script set to be updated, where the processing order identifier is larger than the processing progress identifier; and the determining unit is used for determining a plurality of scripts larger than the processing progress mark as the non-updated scripts when the output of the judging subunit is yes.
Optionally, the update unit includes: the selecting subunit is used for selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence; and the comparison subunit is used for comparing the processing sequence identifier corresponding to each script in the multiple scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier.
Optionally, the updating module is further configured to update the processing progress identifier by one of the following manners: after one script is updated each time according to the processing sequence, updating the processing progress mark in real time; and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
Optionally, the script set to be updated includes one of: a plurality of scripts to be updated that have been received when the script update operation is started to be executed in the processing order; the script updating method includes the steps of starting to execute a script updating operation according to a processing sequence, wherein the script updating operation comprises a plurality of scripts to be updated which are received when the script updating operation is started to execute, and a plurality of scripts to be updated which are newly received from the beginning of executing the script updating operation to the current moment.
According to still another aspect of the embodiments of the present invention, there is also provided an apparatus for updating a script, including: respectively determining a processing progress identifier of each server in the plurality of servers at the current moment according to a processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress identifier is used for recording the latest updated script of the corresponding server at the current moment according to the processing sequence; and sending indication information to the corresponding server according to the processing progress mark, wherein the indication information is used for indicating the corresponding server to execute updating operation on the script which is not updated in the script set to be updated.
Optionally, after sending the indication information to the corresponding server according to the processing progress identifier, the method further includes: receiving a response message returned by the corresponding server, wherein the response message is used for indicating the completion progress of the corresponding server to the un-updated script according to the indication information; and updating the processing progress identification according to the response message.
According to yet another aspect of embodiments of the present invention, there is provided a computer readable medium having program code executable by a processor, the program code, when executed, causing the processor to perform the steps of: determining a processing progress mark of the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in the script set to be updated when being processed, and the processing progress mark is used for recording the latest updated script of the server at the current moment according to the processing sequence; and executing the updating operation on the script which is not updated in the script set to be updated according to the processing progress mark.
According to still another aspect of the embodiments of the present invention, there is provided a computer terminal including: the processor is used for determining the processing progress mark of the current moment according to the processing sequence; and executing an updating operation on the scripts which are not updated in the script set to be updated according to the processing progress marks, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress marks are used for recording the scripts which are updated latest by the server at the current moment according to the processing sequence.
In the embodiment of the invention, a mode of setting a processing progress mark in each server is adopted, the script information which is updated by each server currently is recorded all the time through the processing progress mark, and the updating operation is completed on all the scripts which are not updated by each server according to the processing progress mark, so that the omission of the scripts which are not updated in the script updating process of each server can be effectively avoided, in addition, the script updating progress among a plurality of servers can be effectively kept synchronous, and the technical problem that the script updating process of a plurality of servers is easily omitted or is asynchronous in the script updating process of the plurality of scripts in the script updating scheme adopted in the related technology is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a block diagram of a hardware configuration of a computer terminal of a method of updating a script according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method of updating scripts according to a first embodiment of the present invention;
FIG. 3 is an overall schematic diagram of a script updating process according to the first preferred embodiment of the present invention;
FIG. 4 is a diagram of a rules engine server processing issue queues, according to a first preferred embodiment of the present invention;
FIG. 5 is a diagram illustrating the processing flow of the rules engine server in the event that the server needs to be restarted due to a failure according to a first preferred embodiment of the present invention;
FIG. 6 is a flowchart of another method for updating scripts according to one embodiment of the present invention;
FIG. 7 is a block diagram showing the structure of an apparatus for updating a script according to a second embodiment of the present invention;
FIG. 8 is a block diagram of an apparatus for updating a script according to a second preferred embodiment of the present invention;
fig. 9 is a block diagram of a computer terminal according to a third embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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 only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
There is also provided, in accordance with an embodiment of the present invention, a method embodiment of a method of updating scripts, it being noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than here.
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, a server, or a similar computing device. Taking the example of running on a computer terminal, fig. 1 is a hardware structure block diagram of a computer terminal of a method for updating a script according to an embodiment of the present invention. As shown in fig. 1, the computer terminal 10 may include one or more (only one shown) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the method for updating a script in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 104, that is, implementing the above-mentioned method for updating a script. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
Under the above operating environment, the present application provides a method of updating a script as shown in fig. 2. FIG. 2 is a flowchart of a method for updating a script according to a first embodiment of the invention. As shown in fig. 2, the method may include the steps of:
step S202: and determining a processing progress identifier of the current moment according to the written processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress identifier is used for recording the latest updated script of the server at the current moment according to the processing sequence.
The assumption is that the script set to be updated exists according to the sequence of the writing time: if the total number of the 6 scripts is 6, namely script 1, script 2, script 3, script 4, script 5 and script 6, the update operation on the 6 scripts according to the sequence of the writing time needs to be executed sequentially from script 1 to script 6. If the update operations of 3 scripts of script 1, script 2, and script 3 have been completed at the current time, what the processing progress flag has recorded last should be the flag of script 3, which indicates that all scripts preceding script 3 (including script 3) in the above processing order have been updated.
Step S204: and executing the updating operation on the script which is not updated in the script set to be updated according to the processing progress mark.
In a preferred implementation process, the script set to be updated may include one of the following:
(1) a plurality of scripts to be updated that have been received when the script update operation is started to be executed in the processing order;
(2) the script updating method includes the steps of starting to execute a script updating operation according to a processing sequence, wherein the script updating operation comprises a plurality of scripts to be updated which are received when the script updating operation is started to execute, and a plurality of scripts to be updated which are newly received from the beginning of executing the script updating operation to the current moment.
Still by way of example, if the processing progress flag is the latest recorded flag of the script 3, that is, all scripts before the script 3 (including the script 3) have been updated, the scripts that have not been updated in the script set to be updated are the script 4, the script 5 and the script 6. Of course, if during the process of executing the update in the set of scripts to be updated, the server may be forced to interrupt the update due to a restart or a false death, and during this period, a plurality of scripts to be updated may be added, for example: script 7, script 8 … …, so that in addition to script 4, script 5 and script 6, additional scripts to be updated (e.g. script 7, script 8 … …) need to be included in the scripts that are not updated completely.
By adopting the method shown in fig. 2, a processing progress flag is set in each server, the script information that each server has currently completed updating is always recorded by the processing progress flag, and the updating operation is completed on all the scripts that are not updated by each server according to the processing progress flag. The updated script of each server latest completion is tracked and recorded in real time by setting the processing progress mark, so that the phenomenon that the script which is not updated is omitted in the script updating process of each server can be effectively avoided, in addition, because each server needs to completely update the currently written script, the script updating progress among a plurality of servers can be effectively kept synchronous, and the technical problem that the script updating process of omitting or a plurality of servers is asynchronous easily caused in the updating process of a plurality of scripts by a single server in the script updating scheme adopted in the related technology is solved.
Alternatively, in step S202, determining the processing progress flag according to the processing order may include the following operations:
step S1: distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence;
step S2: acquiring a processing sequence identifier of a latest updating-completed script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated;
step S3: and setting the acquired processing sequence identifier as a processing progress identifier.
In the preferred embodiment, the script issuing process (i.e. the script updating process) provided by the preferred embodiment of the present invention can be divided into three parts, namely a script editor, an issuing queue and a rule engine; the specific functions to be realized by each part are as follows:
(1) the script editor edits the script by the user, then saves the script content to the database, and submits the issuing action to the issuing queue, and each server needs to complete the updating operation of all issued scripts except that the script identification of the issued scripts is the same and only one of the issued scripts is updated;
(2) the issuing queue allocates Identification (ID) information set according to a preset sequence (such as an increasing sequence) for each issuing action and maintains the issuing information;
(3) each server in the rule engine records the processing progress of the server in the issue queue, processes the issue actions according to the ascending order, and can ensure that the issue actions are not normally executed due to omission under the conditions of restart and false death.
Fig. 3 is an overall schematic diagram of a script updating process according to a first preferred embodiment of the present invention. As shown in fig. 3, when the user submits the release action, the script editor writes the script type of the release operation and the identification (SID) of the script itself into a release queue (which may be stored in a database), and writes the script content into the database. And then, the distribution queue distributes processing sequence Identification (ID) to the written scripts according to the processing sequence (for example, the sequence of increasing ID). In addition, each rule engine server is provided with a variable i for recording the processing sequence identifier ID of the currently and newly processed script of the rule engine server.
For example: at time T1, the user writes a script with SID 100 and submits an issue action through the script editor, writing the script type and SID (100) of the script into the issue queue, and writing the script content into the database. Then, the issue queue assigns a processing order identification ID of 1 to the script in the order of increasing IDs.
At time T2(T2 > T1), the user writes a script with SID 105 and submits a release action through the script editor, writing the script type and SID (105) of the script into the release queue, and writing the script content into the database. Then, the issue queue assigns a processing order identification ID of 2 to the script in the order of increasing IDs.
At time T3(T3 > T2), the user writes a script with SID 103 and submits a release action through the script editor, writing the script type and SID (103) of the script into the release queue, and writing the script content into the database. Then, the issue queue assigns a processing order identification ID of 3 to the script in the order of increasing IDs.
At time T4(T4 > T3), the user writes a script with SID 105 and submits a release action through the script editor, writing the script type and SID (105) of the script into the release queue, and writing the script content into the database. Then, the issue queue assigns a processing order identification ID of 4 to the script in the order of increasing IDs.
At time T5(T5 > T4), the user writes a script with SID 107 and submits a release action through the script editor, writing the script type and SID (107) of the script into the release queue, and writing the script content into the database. Then, the issue queue assigns a processing order identification ID of 5 to the script in the order of increasing IDs.
At time T6(T6 > T5), the user writes a script with SID 105 and submits a release action through the script editor, writing the script type and SID (105) of the script into the release queue, and writing the script content into the database. Then, the issue queue assigns a processing order identification ID of 6 to the script in the order of increasing IDs.
At the time of T7(T7 > T6, the latest moment), the user writes a script with SID 104, submits a publishing action through a script editor, writes the script type and SID (104) of the script into a publishing queue, and writes the script content into a database. Then, the issue queue assigns a processing order identification ID of 7 to the script in the order of increasing IDs.
Assuming that the rule engine server 1 starts at time T5, the rule engine server 1 first needs to set the variable i to the current maximum ID value (i.e., ID 5); next, the rule engine server 1 loads all currently existing scripts (i.e., scripts with ID 1, SID 100, scripts with ID 4, SID 105, scripts with ID 3, SID 103, and scripts with ID 5 and SID 107) into the memory and sequentially executes the update operations in the order of increasing IDs; then, the rule engine server 1 starts to execute the subsequent script updating process again, that is, the following script updating processes are sequentially executed: and updating the script with the ID of 4 and the SID of 105 by using the script with the ID of 6 and the SID of 105, loading a new script with the ID of 7 and the SID of 104, and executing an updating operation.
Assuming that the rule engine server 2 starts up at time T3, the rule engine server 2 first needs to set the variable i to the current maximum ID value (i.e., ID 3); secondly, the rule engine server 2 loads all scripts currently existing (i.e. scripts with ID 1 and SID 100, scripts with ID 2 and SID 105, and scripts with ID 3 and SID 103) into the memory and sequentially executes the updating operation according to the increasing order of the IDs; then, the rule engine server 2 starts to execute the subsequent script updating process again, that is, the following script updating processes are sequentially executed: loading scripts with the ID of 5 and the SID of 107 and executing the updating operation, updating the scripts with the ID of 2 and the SID of 105 by using the scripts with the ID of 6 and the SID of 105, loading a new script with the ID of 7 and the SID of 104 and executing the updating operation.
Assuming that the rule engine server 3 starts at time T6, the rule engine server 3 first needs to set the variable i to the current maximum ID value (i.e., ID 6); next, the rule engine server 3 loads all the currently existing scripts (i.e., scripts with ID 1, SID 100, ID 6, SID 105, ID 3, SID 103, and ID 5, SID 107) into the memory and sequentially executes the update operations in the order of increasing IDs. Then, the rule engine server 3 starts to execute the subsequent script updating process, i.e. loads a new script with ID 7 and SID 104 and executes the updating operation.
Optionally, in step S204, performing an update operation on an un-updated script according to the processing progress flag may include the following steps:
step S4: obtaining an un-updated script according to the processing sequence and the processing progress mark;
taking the rule engine server 2 in fig. 3 as an example, since the rule engine server 2 is started at time T3, the rule engine server 2 first needs to set the variable i to the current maximum ID value (i.e., ID ═ 3); next, the rule engine server 2 loads all the currently existing scripts (i.e., scripts with ID 1 and SID 100, scripts with ID 2 and SID 105, and scripts with ID 3 and SID 103) into the memory and sequentially executes the update operation in the order of increasing IDs. The scripts that have completed updating at this time include scripts with ID 1 and SID 100, scripts with ID 2 and SID 105, and scripts with ID 3 and SID 103, and the processing progress identifier is the processing order identifier of the scripts with ID 3 and SID 103 (i.e., i is 3). Then, the rule engine server 2 starts to execute the subsequent script updating process again, and the non-updated scripts are scripts with ID 4 and SID 105, scripts with ID 5 and SID 107, scripts with ID 6 and SID 105, and scripts with ID 7 and SID 104.
Step S5: judging whether a plurality of scripts with the same script identification exist in the non-updated scripts or not;
taking the rule engine server 2 in fig. 3 as an example, in the non-updated script, two scripts having an ID of 4 and an SID of 105 are the same script identifier as the script having an ID of 6 and an SID of 105, that is, a plurality of scripts having the same script identifier exist in the non-updated script.
Step S6: if the script exists, one of the scripts is reserved from the scripts with the same script identification according to the processing sequence, and the updating operation is executed on the screened script which is not updated; and if not, performing updating operation on the non-updated scripts according to the processing sequence.
Taking the rule engine server 2 in fig. 3 as an example, assuming that the processing sequence adopted is ID increasing sequence, the rule engine server 2 selects the script with ID 6 and SID 105 with larger ID value from the script with ID 4 and SID 105 and the script with ID 6 and SID 105 for reservation, and then sequentially executes the following script updating processes: loading scripts with the ID of 5 and the SID of 107 and executing the updating operation, updating the scripts with the ID of 6 and the SID of 105 by using the scripts with the ID of 6 and the SID of 105, loading a new script with the ID of 7 and the SID of 104 and executing the updating operation.
Alternatively, in step S4, obtaining the non-updated script according to the processing order and the processing progress flag may include the following operations:
step S41: under the condition that the processing sequence is that each script to be updated in the script set to be updated is updated according to the processing sequence identification from small to large, judging whether a plurality of scripts of which the processing sequence identifications are larger than the processing progress identifications exist in the script set to be updated or not;
step S42: if so, determining a plurality of scripts larger than the processing progress identification as the non-updated scripts.
Still taking the rule engine server 2 in fig. 3 as an example, since the rule engine server 2 starts up at time T3, the rule engine server 2 first needs to set the variable i to the current maximum ID value (i.e., ID ═ 3); next, the rule engine server 2 loads all the currently existing scripts (i.e., scripts with ID 1 and SID 100, scripts with ID 2 and SID 105, and scripts with ID 3 and SID 103) into the memory and sequentially executes the update operation in the order of increasing IDs. The scripts that have completed updating at this time include scripts with ID 1 and SID 100, scripts with ID 2 and SID 105, and scripts with ID 3 and SID 103, and the processing progress identifier is the processing order identifier of the scripts with ID 3 and SID 103 (i.e., i is 3). Then, when the rule engine server 2 starts to execute the subsequent script updating process again, all scripts with ID values greater than 3 need to be acquired, and then the scripts that are not updated at this time are the scripts with ID 4 and SID 105, the scripts with ID 5 and SID 107, the scripts with ID 6 and SID 105, and the scripts with ID 7 and SID 104.
Alternatively, in step S6, the step of reserving one of the scripts from the plurality of scripts identified by the same script identification according to the processing order may include the steps of:
step S61: selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence;
step S62: and comparing the processing sequence identifiers corresponding to each script in a plurality of scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier. That is, as described above, when it is assumed that the processing order is the ID increment order, the rule engine server 2 selects and retains the script with the ID 6 and the SID 105 having the larger ID value from the script with the ID 4 and the SID 105 and the script with the ID 6 and the SID 105.
Fig. 4 is a schematic diagram of a rule engine server processing issue queue according to a first preferred embodiment of the present invention. As shown in FIG. 4, the process of the rules engine server processing the issue queue may include the following steps:
step S402: scanning a new (i.e. ID > i) issuing operation at regular time (for example: 1 second), and reading a new issuing operation list from a database into a memory;
suppose that the rule engine server scans and processes for the first time a script with an ID of 1 and a SID of 100. When scanning again, all scripts with an ID greater than 1 need to be retrieved. Scanning to obtain scripts with ID 2 and SID 105, scripts with ID 3 and SID 103, scripts with ID 4 and SID 105, scripts with ID 5 and SID 107, and scripts with ID 6 and SID 105, so that the obtained ID list is: { ID ═ 2, ID ═ 3, ID ═ 4, ID ═ 5, and ID ═ 6 }.
Step S404: and inquiring whether the scripts with the same version exist in the issuing operation list, and if so, deleting the scripts with smaller IDs, namely, only keeping the scripts with the largest IDs under the condition that the scripts with the same version exist in the issuing operation list, so that the scripts are prevented from being issued repeatedly.
Based on the above example, it can be found that the scripts SID with ID 2, ID 4 and ID 6 are 105, and therefore, the script with the largest ID (i.e., the script with ID 6) needs to be retained, so as to avoid repeated distribution of scripts. The ID list obtained after the deletion operation is performed is: { ID ═ 3, ID ═ 5, and ID ═ 6 }.
Step S406: and circularly processing the issuing operation list, and updating i to the latest executed script ID.
Still based on the above example, the rule engine server processes the script with ID 3 and SID 103, the script with ID 5 and SID 107, and the script with ID 6 and SID 105 in sequence, updates the value i of the rule engine server to 6, and waits for the script with ID 7 and SID 104 to be issued.
Optionally, in step S204, performing an update operation on the non-updated script according to the processing progress flag may further include the following operations:
step S7: the processing progress mark is updated by adopting one of the following modes:
after one script is updated each time according to a processing sequence, updating a processing progress mark in real time;
in a preferred embodiment, the rule engine server may update the values of i in real-time with each script update, for example: the rule engine server sets the value of i to 5 after loading the script with the ID of 5 and the SID of 107 and executing the updating operation, sets the value of i to 6 after updating the script with the ID of 6 and the SID of 105 by adopting the script with the ID of 6 and the SID of 105, and sets the value of i to 7 after loading the script with the new ID of 7 and the SID of 104 and executing the updating operation.
And secondly, after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
Of course, the rule engine server may also update the value of i when a group of scripts to be updated is completely updated, for example: the rule engine server keeps the value of i unchanged after loading the script with the ID of 5 and the SID of 107 and executing the updating operation, keeps the value of i unchanged after updating the script with the ID of 6 and the SID of 105 by adopting the script with the ID of 6 and the SID of 105, and directly sets the value of i to 7 after loading the script with the new ID of 7 and the SID of 104 and executing the updating operation.
The case of a restart or a false death of the rules engine server for a specific reason will be described in further detail below with reference to two preferred embodiments, respectively.
Fig. 5 is a schematic diagram of a processing flow of a rule engine server in a case where a server needs to be restarted due to a failure according to a first preferred embodiment of the present invention. As shown in fig. 5, when the server needs to be restarted due to a failure, the process flow of the rule engine server may include the following steps:
step S502: setting i as the maximum ID value of the current issue queue;
after the rule engine server processes the scripts with ID 1 and SID 100, ID 2 and SID 105, and ID 3 and SID 103 in sequence, a server restart phenomenon occurs due to a specific reason (e.g., a failure). At this time, in order to avoid affecting the normal issue of the script, it is necessary to set the rule engine server to the maximum ID value of the current issue queue (i.e., i is 3), and then to start performing the restart operation.
It should be noted that the above-mentioned script information (i.e. script with ID 1, SID 100, script with ID 2, SID 105 and script with ID 3, SID 103) which is updated before the rule engine server is restarted and the current i value may be present in the script database or other storage area separately configured to store such information, so that the rule engine server can continue to complete the script updating operation after the normal operation is resumed by performing the restarting operation.
Step S504: loading the script in full, wherein the script state after loading is not less than i;
after the restart operation of the rule engine server is completed, all scripts stored in the script database (i.e. the full-loading scripts) need to be read from the script database, and are all recorded in another storage area different from the release queue, for example: script with ID 1 and SID 100, script with ID 2 and SID 105, script with ID 3 and SID 103, script with ID 4 and SID 109, script with ID 5 and SID 107, script with ID 6 and SID 105, and script with ID 7 and SID 104.
Step S506: and continuing to repeatedly execute the rule engine processing flow from the step S402 to the step S406, and loading the newly added issuing operation and the subsequent issuing operation in the restarting process.
Specifically, if scripts with ID 4 and SID 109, scripts with ID 5 and SID 107, scripts with ID 6 and SID 105, and scripts with ID 7 and SID 104 are received from the script editor in sequence in the release queue at the restart stage of the rule engine server, the rule engine server can acquire all scripts with ID greater than 3 starting from i ═ 3(ID ═ 3) by the full load scripts. Thus, the rule engine server obtains the script with the ID of 4 and the SID of 109, the script with the ID of 5 and the SID of 107, the script with the ID of 6 and the SID of 105, and the script with the ID of 7 and the SID of 104 from all scripts with the ID of 1 and the SID of 100, the script with the ID of 2 and the SID of 105, the script with the ID of 3 and the SID of 103, the script with the ID of 4 and the SID of 109, the script with the ID of 5 and the SID of 107, the script with the ID of 6 and the SID of 105, and the script with the ID of 7 and the SID of 104. Thus, the resulting list of IDs is: { ID ═ 4, ID ═ 5, ID ═ 6, and ID ═ 7 }. The rule engine server finds, through comparison, that there is no script with duplicate SID in the ID list, so after screening by the script with duplicate SID, the ID list remains as follows: { ID is 4, ID is 5, ID is 6, and ID is 7}, so the rule engine server can sequentially use the script with ID 4 and SID 109, the script with ID 5 and SID 107, the script with ID 6 and SID 105, and the script with ID 7 and SID 104 to perform the update operation.
As another preferred embodiment of the present invention, when the server is temporarily crashed, the issue operation cannot be executed immediately, and once the server is restored from the crashed state to the normal operating state, the server will resume scanning the issue queue, and load the outstanding issue operation.
Still taking the above-mentioned fig. 3 as an example, assuming that the rule engine server 2 is started at time T2, the rule engine server 2 first needs to set the variable i to the current maximum ID value (i.e., ID ═ 2), and then loads all the scripts currently existing (i.e., the script with ID 1 and SID 100 and the script with ID 2 and SID 105) into the memory. Then, the subsequent script update process is started again, and when the rule engine server 2 runs from the time T2 to the time T3, if the rule engine server 2 is dead at the time T3, the script with ID 3 and SID 103 will be interrupted.
When the rule engine server 2 returns from the false death state to normal operation after a period of time, the rule engine server 2 first obtains the script with ID 2 and SID 105 that have been updated most recently at the current time and sets the value of i to 2, and then obtains all the scripts that have not been updated (ID greater than 2), i.e. the script with ID 3 and SID 103, and during the period of false death of the rule engine server 2, the user writes all the scripts (ID greater than 2) in the issue queue through the script editor, i.e. the script with ID 4, SID 105, the script with ID 5 and SID 107, and the script with ID 6 and SID 105, and obtains the ID lists as: { ID ═ 3, ID ═ 4, ID ═ 5, and ID ═ 6 }. The rule engine server 2 compares the ID 4 and ID 6 to find that the script SID is 105, and therefore, the script with the largest ID (i.e., the script with the ID 6) needs to be retained, so as to avoid repeated distribution of the scripts. The ID list obtained after the deletion operation is performed is: { ID ═ 3, ID ═ 5, and ID ═ 6 }. Based on the finally obtained ID list { ID is 3, ID is 5, ID is 6}, the rule engine server 2 sequentially uses a scenario with ID 3 and SID 103, a scenario with ID 5 and SID 107, and a scenario with ID 6 and SID 105, and the value i of the rule engine server 2 is updated to i 6, and the process waits for a scenario with ID 7 and SID 104 to be issued.
Under the above operating environment, the present application provides another method for updating scripts as shown in fig. 6. FIG. 6 is a flowchart of another method for updating scripts according to an embodiment of the present invention. As shown in fig. 6, the method may include the steps of:
step S602: respectively determining a processing progress identifier of each server in the plurality of servers at the current moment according to a processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress identifier is used for recording the latest updated script of the corresponding server at the current moment according to the processing sequence;
step S604: and sending indication information to the corresponding server according to the processing progress mark, wherein the indication information is used for indicating the corresponding server to execute updating operation on the script which is not updated in the script set to be updated.
In a preferred embodiment, an independent client or server may be adopted to perform unified control on a plurality of servers that need to perform script updating operations, where the client or server receives a plurality of scripts to be updated that are written by a user through a script editor, and stores the plurality of scripts to be updated to an issuing queue according to a writing sequence. In addition, the client or the server also manages the latest processing progress mark of each server at the current time in a unified manner, and instructs the corresponding server to execute the updating operation on a plurality of scripts to be updated which are not updated completely according to the processing progress marks.
Optionally, after the step S604 sends the indication information to the corresponding server according to the processing progress identifier, the following steps may be further included:
step S606: receiving a response message returned by the corresponding server, wherein the response message is used for indicating the completion progress of the corresponding server to the un-updated script according to the indication information; and updating the processing progress identification according to the response message.
In a preferred embodiment, if a specific server performs an update operation on an un-updated script according to the indication information, the server may timely feed back the update progress of the un-updated script to a server or a terminal in charge of unified management, so as to update a processing progress identifier stored therein and corresponding to the server, so as to ensure consistency of a script update process and avoid causing omission or repeated update of the un-updated script.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method for updating a script according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example two
According to an embodiment of the present invention, there is also provided a block diagram of an apparatus for implementing the update script, as shown in fig. 7, the apparatus includes: the determining module 10 is configured to determine a processing progress identifier of the current time according to a processing sequence, where the processing sequence is an order in which the scripts in the script set to be updated are processed, and the processing progress identifier is used to record the latest updated script of the server at the current time according to the processing sequence; and the updating module 20 is configured to execute an updating operation on an un-updated script in the script set to be updated according to the processing progress identifier.
In a preferred implementation process, the script set to be updated may include one of the following:
(1) a plurality of scripts to be updated that have been received when the script update operation is started to be executed in the processing order;
(2) the script updating method includes the steps of starting to execute a script updating operation according to a processing sequence, wherein the script updating operation comprises a plurality of scripts to be updated which are received when the script updating operation is started to execute, and a plurality of scripts to be updated which are newly received from the beginning of executing the script updating operation to the current moment.
Alternatively, fig. 8 is a block diagram of an apparatus for updating a script according to a second preferred embodiment of the present invention. As shown in fig. 8, the determining module 10 may include: the distribution unit 100 is configured to distribute a processing sequence identifier to each script to be updated in the script set to be updated according to the processing sequence; a first obtaining unit 102, configured to obtain, according to the processing sequence identifier allocated to each script to be updated, a processing sequence identifier of a latest script that is updated at the current time; and the setting unit is used for setting the acquired processing sequence identifier as a processing progress identifier.
Alternatively, as shown in fig. 8, the update module 20 may include: a second obtaining unit 200, configured to obtain an un-updated script according to the processing order and the processing progress identifier; a judging unit 202, configured to judge whether multiple scripts with the same script identifier exist in the un-updated script; an updating unit 204, configured to, when the output of the determining unit is yes, reserve one of the scripts from the multiple scripts with the same script identifier according to the processing order, and perform an updating operation on the screened non-updated script; or when the output of the judging unit is negative, the updating operation is executed on the script which is not updated according to the processing sequence.
Alternatively, the second acquiring unit 200 may include: a judging subunit (not shown in the figure), configured to, when a processing order is that each script to be updated in the script set to be updated is updated in sequence from small to large according to the processing order identifier, judge whether there are multiple scripts in the script set to be updated, where the processing order identifier is larger than the processing progress identifier; a determination unit (not shown in the figure) for determining a plurality of scripts larger than the processing progress flag as the non-updated scripts when the judgment subunit outputs yes.
Optionally, the updating unit 204 may include: a selecting subunit (not shown in the figure) for selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence; and a comparing subunit (not shown in the figure), configured to compare processing sequence identifiers corresponding to each of the multiple scripts with the same script identifier, and select and reserve the script with the largest processing sequence identifier.
Optionally, the updating module 20 is further configured to update the processing progress identifier by one of the following manners: after one script is updated each time according to the processing sequence, updating the processing progress mark in real time; and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
EXAMPLE III
The embodiment of the invention can provide a computer terminal which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computer terminal may be located in at least one network device of a plurality of network devices of a computer network.
In this embodiment, the computer terminal may execute program codes of the following steps in the method for updating a script:
alternatively, fig. 9 is a block diagram of a computer terminal according to an embodiment of the present invention. As shown in fig. 9, the computer terminal may include: one or more processors (only one shown) and memory.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for updating a script in the embodiments of the present invention, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the method for updating a script. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps:
s1, determining a processing progress mark of the current time according to a processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress mark is used for recording the latest updated script of the server at the current time according to the processing sequence;
and S2, executing the updating operation on the script which is not updated in the script set to be updated according to the processing progress identification.
Optionally, the processor may further execute the program code of the following steps: distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence; acquiring a processing sequence identifier of a latest updating-completed script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated; and setting the acquired processing sequence identifier as a processing progress identifier.
Optionally, the processor may further execute the program code of the following steps: obtaining an un-updated script according to the processing sequence and the processing progress mark; judging whether a plurality of scripts with the same script identification exist in the non-updated scripts or not; if the script exists, one of the scripts is reserved from the scripts with the same script identification according to the processing sequence, and the updating operation is executed on the screened script which is not updated; and if not, performing updating operation on the non-updated scripts according to the processing sequence.
Optionally, the processor may further execute the program code of the following steps: under the condition that the processing sequence is that each script to be updated in the script set to be updated is updated according to the processing sequence identification from small to large, judging whether a plurality of scripts of which the processing sequence identifications are larger than the processing progress identifications exist in the script set to be updated or not; if so, determining a plurality of scripts larger than the processing progress identification as the non-updated scripts.
Optionally, the processor may further execute the program code of the following steps: selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence; and comparing the processing sequence identifiers corresponding to each script in a plurality of scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier.
Optionally, the processor may further execute the program code of the following steps: executing the update operation on the un-updated script according to the processing progress identifier further comprises: the processing progress mark is updated by adopting one of the following modes: after one script is updated each time according to the processing sequence, updating the processing progress mark in real time; and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
According to the embodiment of the invention, a mode of setting the processing progress mark in each server is adopted, the script information which is updated by each server currently is recorded all the time through the processing progress mark, and the updating operation is completed on all the scripts which are not updated by each server according to the processing progress mark, so that the omission of the scripts which are not updated in the script updating process of each server can be effectively avoided, in addition, the script updating progress among a plurality of servers can be effectively kept synchronous, and the technical problem that the script updating process of a plurality of servers is easily omitted or asynchronous in the process of updating the scripts by a single server in the script updating scheme adopted in the related technology is solved.
It can be understood by those skilled in the art that the structure shown in fig. 9 is only an illustration, and the computer terminal may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 9 is a diagram illustrating a structure of the electronic device. For example, the computer terminal may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 9, or have a different configuration than shown in FIG. 9.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Example four
The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store program codes executed by the method for updating a script provided in the first embodiment.
Optionally, in this embodiment, the storage medium may be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
s1, determining a processing progress mark of the current time according to a processing sequence, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed, and the processing progress mark is used for recording the latest updated script of the server at the current time according to the processing sequence;
and S2, executing the updating operation on the script which is not updated in the script set to be updated according to the processing progress identification.
The storage medium is further configured to store program code for performing the steps of: distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence; acquiring a processing sequence identifier of a latest updating-completed script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated; and setting the acquired processing sequence identifier as a processing progress identifier.
The storage medium is further configured to store program code for performing the steps of: obtaining an un-updated script according to the processing sequence and the processing progress mark; judging whether a plurality of scripts with the same script identification exist in the non-updated scripts or not; if the script exists, one of the scripts is reserved from the scripts with the same script identification according to the processing sequence, and the updating operation is executed on the screened script which is not updated; and if not, performing updating operation on the non-updated scripts according to the processing sequence.
The storage medium is further configured to store program code for performing the steps of: under the condition that the processing sequence is that each script to be updated in the script set to be updated is updated according to the processing sequence identification from small to large, judging whether a plurality of scripts of which the processing sequence identifications are larger than the processing progress identifications exist in the script set to be updated or not; if so, determining a plurality of scripts larger than the processing progress identification as the non-updated scripts.
The storage medium is further configured to store program code for performing the steps of: selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence; and comparing the processing sequence identifiers corresponding to each script in a plurality of scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier.
The storage medium is further configured to store program code for performing the steps of: executing the update operation on the un-updated script according to the processing progress identifier further comprises: the processing progress mark is updated by adopting one of the following modes: after one script is updated each time according to the processing sequence, updating the processing progress mark in real time; and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (19)

1. A method of updating a script, comprising:
determining a processing progress mark of the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in a script set to be updated when being processed, and the processing progress mark is used for recording a script which is updated by each server in a plurality of servers at the current moment according to the processing sequence;
and executing an updating operation on the script which is not updated in the script set to be updated according to the processing progress mark so as to keep the script updating progress of the plurality of servers synchronous.
2. The method of claim 1, wherein determining the processing progress indicator according to the processing order comprises:
distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence;
acquiring a processing sequence identifier of the latest updating-completed script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated;
and setting the acquired processing sequence identifier as the processing progress identifier.
3. The method of claim 2, wherein performing an update operation on the un-updated script according to the processing progress identifier comprises:
acquiring the non-updated script according to the processing sequence and the processing progress mark;
judging whether a plurality of scripts with the same script identification exist in the un-updated scripts or not;
if yes, one of the scripts is reserved from the scripts with the same script identification according to the processing sequence, and updating operation is carried out on the screened scripts which are not updated;
and if not, executing the updating operation on the non-updated script according to the processing sequence.
4. The method of claim 3, wherein obtaining the un-updated script according to the processing order and the processing progress identifier comprises:
under the condition that the processing sequence is to update each script to be updated in the script set to be updated in sequence from small to large according to the processing sequence identification, judging whether a plurality of scripts of which the processing sequence identifications are larger than the processing progress identifications exist in the script set to be updated or not;
and if so, determining a plurality of scripts which are larger than the processing progress identification as the non-updated scripts.
5. The method of claim 4, wherein reserving one of the scripts from among the plurality of scripts identified as the same by the script according to the processing order comprises:
selecting a plurality of scripts with the same script identification from the non-updated scripts according to the processing sequence;
and comparing the processing sequence identifiers corresponding to each script in the plurality of scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier.
6. The method of any of claims 1-5, wherein performing an update operation on the un-updated script according to the processing progress identifier further comprises:
updating the processing progress mark by adopting one of the following modes:
after one script is updated each time according to the processing sequence, updating the processing progress mark in real time;
and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
7. The method according to any one of claims 1 to 5, wherein the set of scripts to be updated comprises one of: a plurality of scripts to be updated which have been received when the script updating operation is started to be executed according to the processing sequence; the script updating method comprises the steps of starting to execute script updating operation according to the processing sequence, wherein the script updating operation comprises a plurality of scripts to be updated which are already received when the script updating operation is started to execute, and a plurality of scripts to be updated which are newly received from the beginning of executing the script updating operation to the current moment.
8. A method of updating a script, comprising:
respectively determining a processing progress identifier of each server in a plurality of servers at the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in a script set to be updated when being processed, and the processing progress identifier is used for recording the latest updated script of the corresponding server at the current moment according to the processing sequence;
and sending indication information to the corresponding server according to the processing progress mark, wherein the indication information is used for indicating the corresponding server to execute updating operation on the script which is not updated in the script set to be updated, so that the script updating progress of the plurality of servers is kept synchronous.
9. The method according to claim 8, further comprising, after sending the indication information to the corresponding server according to the processing progress flag:
receiving a response message returned by the corresponding server, wherein the response message is used for indicating the completion progress of the corresponding server to the non-updated script according to the indication information;
and updating the processing progress identification according to the response message.
10. An apparatus for updating a script, comprising:
the determining module is used for determining a processing progress identifier of the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in a script set to be updated when being processed, and the processing progress identifier is used for recording a script which is updated by each server in a plurality of servers at the current moment according to the processing sequence;
and the updating module is used for executing updating operation on the scripts which are not updated in the script set to be updated according to the processing progress marks so as to keep the script updating progress of the servers synchronous.
11. The apparatus of claim 10, wherein the determining module comprises:
the distribution unit is used for distributing a processing sequence identifier for each script to be updated in the script set to be updated according to the processing sequence;
the first acquisition unit is used for acquiring the processing sequence identifier of the latest updated script corresponding to the current moment according to the processing sequence identifier distributed to each script to be updated;
and the setting unit is used for setting the acquired processing sequence identifier as the processing progress identifier.
12. The apparatus of claim 11, wherein the update module comprises:
a second obtaining unit, configured to obtain the non-updated script according to the processing order and the processing progress identifier;
the judging unit is used for judging whether a plurality of scripts with the same script identification exist in the un-updated scripts or not;
the updating unit is used for reserving one script from a plurality of scripts with the same script identification according to the processing sequence and executing updating operation on the screened non-updated scripts when the output of the judging unit is yes; or, when the output of the judging unit is negative, the updating operation is executed to the un-updated script according to the processing sequence.
13. The apparatus of claim 12, wherein the second obtaining unit comprises:
the judgment subunit is configured to, when the processing order is that each script to be updated in the script set to be updated is updated sequentially from small to large according to the processing order identifier, judge whether multiple scripts of which the processing order identifiers are larger than the processing progress identifiers exist in the script set to be updated;
and the determining unit is used for determining a plurality of scripts which are larger than the processing progress mark as the non-updated scripts when the output of the judging subunit is yes.
14. The apparatus of claim 13, wherein the updating unit comprises:
a selecting subunit, configured to select, according to the processing sequence, multiple scripts with the same script identifier from the non-updated scripts;
and the comparison subunit is used for comparing the processing sequence identifier corresponding to each script in the multiple scripts with the same script identifier, and selecting and reserving the script with the largest processing sequence identifier.
15. The apparatus according to any one of claims 10 to 14, wherein the updating module is further configured to update the processing progress indicator by one of:
after one script is updated each time according to the processing sequence, updating the processing progress mark in real time;
and after the non-updated scripts are completely updated according to the processing sequence, updating the processing progress mark.
16. The apparatus according to any one of claims 10 to 14, wherein the set of scripts to be updated comprises one of: a plurality of scripts to be updated which have been received when the script updating operation is started to be executed according to the processing sequence; the script updating method comprises the steps of starting to execute script updating operation according to the processing sequence, wherein the script updating operation comprises a plurality of scripts to be updated which are already received when the script updating operation is started to execute, and a plurality of scripts to be updated which are newly received from the beginning of executing the script updating operation to the current moment.
17. An apparatus for updating a script, comprising:
respectively determining a processing progress identifier of each server in a plurality of servers at the current moment according to a processing sequence, wherein the processing sequence is the sequence of scripts in a script set to be updated when being processed, and the processing progress identifier is used for recording the latest updated script of the corresponding server at the current moment according to the processing sequence;
and sending indication information to the corresponding server according to the processing progress mark, wherein the indication information is used for indicating the corresponding server to execute updating operation on the script which is not updated in the script set to be updated, so that the script updating progress of the plurality of servers is kept synchronous.
18. The apparatus of claim 17, further comprising, after sending the indication information to the corresponding server according to the processing progress flag:
receiving a response message returned by the corresponding server, wherein the response message is used for indicating the completion progress of the corresponding server to the non-updated script according to the indication information;
and updating the processing progress identification according to the response message.
19. A computer terminal, comprising: the processor is used for determining a processing progress mark of the current moment according to a processing sequence, wherein the processing progress mark is used for recording a script which is updated by each server in the plurality of servers at the current moment latest according to the processing sequence; and executing an updating operation on the scripts which are not updated in the script set to be updated according to the processing progress identification so as to keep the script updating progress of the plurality of servers synchronous, wherein the processing sequence is the sequence of the scripts in the script set to be updated when being processed.
CN201610131451.8A 2016-03-08 2016-03-08 Method and device for updating script and computer terminal Active CN107168685B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610131451.8A CN107168685B (en) 2016-03-08 2016-03-08 Method and device for updating script and computer terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610131451.8A CN107168685B (en) 2016-03-08 2016-03-08 Method and device for updating script and computer terminal

Publications (2)

Publication Number Publication Date
CN107168685A CN107168685A (en) 2017-09-15
CN107168685B true CN107168685B (en) 2021-01-29

Family

ID=59848643

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610131451.8A Active CN107168685B (en) 2016-03-08 2016-03-08 Method and device for updating script and computer terminal

Country Status (1)

Country Link
CN (1) CN107168685B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108416449B (en) * 2018-02-05 2022-06-03 北京奇艺世纪科技有限公司 Operation and maintenance method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6167567A (en) * 1998-05-05 2000-12-26 3Com Corporation Technique for automatically updating software stored on a client computer in a networked client-server environment
CN103139245A (en) * 2011-11-25 2013-06-05 中兴通讯股份有限公司 Method and device for updating network elements

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6167567A (en) * 1998-05-05 2000-12-26 3Com Corporation Technique for automatically updating software stored on a client computer in a networked client-server environment
CN103139245A (en) * 2011-11-25 2013-06-05 中兴通讯股份有限公司 Method and device for updating network elements

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
无线传感器网络在线升级系统设计和实现;霍文文;《中国优秀硕士学位论文全文数据库 信息科技辑》;20130115(第1期);正文第48-50页第4.3节 *

Also Published As

Publication number Publication date
CN107168685A (en) 2017-09-15

Similar Documents

Publication Publication Date Title
CN109493076B (en) Kafka message unique consumption method, system, server and storage medium
US20210011817A1 (en) Virtual Machine Recovery Method and Virtual Machine Management Device
CN110096336B (en) Data monitoring method, device, equipment and medium
US20150331612A1 (en) Memory Cleaning Method and Apparatus, and Terminal Device
CN110413282B (en) Redundant resource processing method, device, equipment and storage medium
US20160026699A1 (en) Method for Synchronization of UGC Master and Backup and System Thereof, and Computer Storage Medium
US10649765B2 (en) Systems and methods for preventing service disruption during software updates
CN112231108A (en) Task processing method and device, computer readable storage medium and server
CN111367922A (en) Data updating method and related equipment
CN110990415A (en) Data processing method and device, electronic equipment and storage medium
CN109542841B (en) Method for creating data snapshot in cluster and terminal equipment
CN107168685B (en) Method and device for updating script and computer terminal
CN112044061B (en) Game picture processing method and device, electronic equipment and storage medium
CN112000850A (en) Method, device, system and equipment for data processing
CN117435569A (en) Dynamic capacity expansion method, device, equipment, medium and program product for cache system
CN117130697A (en) Method and device for fixing application on taskbar
CN113747423B (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN113157476B (en) Method and device for processing display card faults in virtual cloud environment
CN111045997B (en) Centralized storage data deleting method and device
CN111491040B (en) IP distribution method and IP distribution device
CN114553859A (en) BMC configuration management method and device, electronic equipment and storage medium
CN114945026A (en) Data processing method, device and system
CN112488462A (en) Unified pushing method, device and medium for workflow data
CN112445574A (en) Application container multi-cluster migration method and device
CN108206933B (en) Video data acquisition method and device based on video cloud storage system

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