A system upgrade method, apparatus and device
By configuring a distributed lock on the target node, only one upgrade data producer is allowed to generate upgrade data, which solves the problem of data peak impact in the wireless upgrade system, enables flexible expansion and smooth upgrade traffic when the number of devices increases, and reduces the performance impact on other systems on the platform.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-02
- Publication Date
- 2026-03-20
AI Technical Summary
When the number of devices increases, the existing wireless upgrade system causes data spikes that impact the performance of other systems on the platform, making it impossible to achieve flexible expansion and smooth traffic flow.
A distributed lock mechanism is adopted, which configures a distributed lock on the target node to allow only one upgrade data producer to generate upgrade data. Upgrade data is sent by multiple threads through distributed lock application and multi-threaded transmission to avoid multiple producers generating upgrade data at the same time and reduce data peak impact.
It effectively reduced the data surge impact on other systems during system upgrades, enabling flexible capacity expansion and smooth upgrade traffic when the number of devices increases, and minimizing the performance impact on other systems on the platform.
Smart Images

Figure CN116069351B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wireless communication technology, and more specifically to a system upgrade method, apparatus, and device for distributed deployment of devices with smooth performance. Background Technology
[0002] In IoT platforms, wireless device upgrades are essential to meet the needs of software updates, firmware updates, and device management function updates. Therefore, a backend system specifically designed for wireless device upgrades has emerged. Besides stability and robustness, a wireless device upgrade system should be able to meet the performance demands of increasing upgrade devices as the company's business grows, allowing for flexible expansion. Furthermore, it should ensure smooth upgrade traffic to avoid performance spikes for other systems on the IoT platform (such as gateway systems).
[0003] The original upgrade backend system was a single-node design based on multi-threading. This design does not support distributed scaling. The original design used periodic tasks and multi-threading to complete the upgrade service. For example, see... Figure 1 As shown, in the existing upgrade scheme, the upgrade task queries the data of the device to be upgraded and issues upgrade commands according to a predetermined upgrade cycle (e.g., 15 minutes). Therefore, the upgrade data production will bring a data peak to other systems on the platform (e.g., gateway) every 15 minutes, affecting the normal operation of the system.
[0004] Therefore, there is an urgent need for a system upgrade solution that minimizes the impact on the system. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a system upgrade method, apparatus, and device to provide a system upgrade solution with minimal data peak impact.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0007] A system upgrade method, comprising:
[0008] When the system upgrade task begins, a distributed lock request is sent to the target node;
[0009] When a distributed lock is acquired, upgrade data is generated;
[0010] The upgrade data is sent to the target node so that the device to be upgraded can perform a system upgrade based on the upgrade data in the target node.
[0011] Optionally, the above system upgrade methods also include:
[0012] The devices to be upgraded are determined based on the upgrade task;
[0013] writing device data of the device to be upgraded into the target node;
[0014] deleting the device data of the device to be upgraded from the target node after the device to be upgraded is upgraded.
[0015] Optionally, in the system upgrading method, the step of initiating a distributed lock application to the target node comprises:
[0016] judging whether there is device data of a device to be upgraded that has not been upgraded in the target node;
[0017] when there is device data of a device to be upgraded that has not been upgraded in the target node, it indicates that the distributed lock has been occupied, and the upgrading task ends;
[0018] when there is no device data of a device to be upgraded that has not been upgraded in the target node, it indicates that the distributed lock has not been occupied, and a distributed lock application is initiated to the target node.
[0019] Optionally, in the system upgrading method, after the step of sending the upgrading data to the target node, the method further comprises:
[0020] judging whether there is device data of a device to be upgraded that has not been upgraded in the target node, and if there is, sending the upgrading data to the device data corresponding to the device to be upgraded in a multi-thread mode.
[0021] Optionally, in the system upgrading method, when there is no device data of a device to be upgraded that has not been upgraded in the target node, after sleeping for a first preset time length, it is continuously judged whether there is device data of a device to be upgraded that has not been upgraded in the target node;
[0022] after sending the upgrading data to the device data corresponding to the device to be upgraded in a multi-thread mode, after sleeping for a second preset time length, it is continuously judged whether there is device data of a device to be upgraded that has not been upgraded in the target node.
[0023] Optionally, in the system upgrading method, the step of initiating a distributed lock application to the target node when the system upgrading task starts comprises:
[0024] judging whether a system upgrading task is generated based on a third preset period, and when a system upgrading task is generated, it indicates that the system upgrading task starts, and a distributed lock application is initiated to the target node.
[0025] A system upgrading device comprises:
[0026] a distributed lock application unit, configured to initiate a distributed lock application to a target node when a system upgrading task starts;
[0027] An upgrade data generation unit is configured to generate upgrade data when a distributed lock is applied for;
[0028] An upgrade data publishing unit is configured to send the upgrade data to the target node, so that the device to be upgraded performs system upgrade based on the upgrade data in the target node.
[0029] Optionally, the system upgrade device further comprises:
[0030] A device to be upgraded determination unit is configured to:
[0031] determine the device to be upgraded based on the upgrade task;
[0032] write device data of the device to be upgraded into the target node;
[0033] delete the device data of the device to be upgraded from the target node when the device to be upgraded is upgraded.
[0034] Optionally, the system upgrade device, when initiating the distributed lock application to the target node, is specifically configured to:
[0035] determine whether there is device data of the device to be upgraded that has not been upgraded in the target node;
[0036] when there is device data of the device to be upgraded that has not been upgraded in the target node, it indicates that the distributed lock has been occupied, and the upgrade task is ended;
[0037] when there is no device data of the device to be upgraded that has not been upgraded in the target node, it indicates that the distributed lock has not been occupied, and the distributed lock application is initiated to the target node.
[0038] A system upgrade device comprises a memory configured to store a program;
[0039] a processor configured to execute the program to implement each step of the system upgrade method.
[0040] Based on the above technical solution, the above scheme provided by the embodiment of the application pre-configures a distributed lock in a target node, when an upgrade task is performed, a distributed lock application is first initiated to the target node, when the distributed lock application succeeds, upgrade data is generated, and the upgrade data is loaded to the target node, so as to realize system upgrade of the device to be upgraded, and when the distributed lock application fails, it indicates that other upgrade data producers have successfully applied for the distributed lock, at this time, the process is ended, and there is no need to generate upgrade data, so as to reduce the data peak impact strength on other systems in the system upgrade process. BRIEF DESCRIPTION OF DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute a part of the embodiments of the present application, and for those skilled in the art, other drawings can also be obtained based on the provided drawings without creative labor.
[0042] Figure 1 A flowchart of a system upgrade solution in the prior art;
[0043] Figure 2 A flowchart of a system upgrade method disclosed by an embodiment of the present application;
[0044] Figure 3 A flowchart of a system upgrade method disclosed by another embodiment of the present application;
[0045] Figure 4 A flowchart of a system upgrade method disclosed by another embodiment of the present application;
[0046] Figure 5 A structural diagram of a system upgrade device disclosed by an embodiment of the present application;
[0047] Figure 6 A structural diagram of a system upgrade device disclosed by an embodiment of the present application. DETAILED DESCRIPTION
[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only constitute a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0049] In order to solve the above problems of the system upgrade solution in the prior art, the present application discloses a system upgrade solution based on a distributed lock. The distributed lock is a lock implementation for controlling common access to shared resources between distributed systems or different systems. If different systems or different hosts of the same system share a certain resource, mutual exclusion principle is often used to prevent mutual interference to ensure consistency. Since the present design uses a distributed lock to limit upgrade data, it is used to ensure that in the case of multiple node distributed deployment, only one node of the upgrade data producer thread can produce upgrade data when the system is upgraded, and other upgrade data producer threads do not need to produce upgrade data, preventing data impact on other systems during system upgrade
[0050] Specifically, referring to Figure 2 ,Figure 2 For the flowchart of the system upgrade method disclosed in the embodiments of the present application, the system upgrade method disclosed in the present application can include steps S101-S103.
[0051] Step S101: When the system upgrade task starts, a distributed lock application is initiated to the target node;
[0052] In the present scheme, a target node is created in advance, which is used to provide a distributed lock. When the system is upgraded, only the upgrade data producer thread that applies for the distributed lock needs to generate upgrade data, and other upgrade data producer threads that do not apply for the distributed lock do not need to generate upgrade data.
[0053] In the present scheme, the specific configuration form of the distributed lock can be selected by the user as needed. For example, in the technical scheme disclosed in the embodiments of the present application, the distributed lock can be implemented based on REDIS, that is, the distributed lock is a distributed lock implemented based on REDIS. The distributed lock is denoted as a REDIS distributed lock, and the target node is denoted as a REDIS node. In the present scheme, the thread safety feature of the distributed lock implemented based on REDIS is mainly used, that is, when multiple upgrade data producers simultaneously apply for the distributed lock at the same time point, only one client can be successful.
[0054] In a specific embodiment of the present application, the REDIS distributed lock is taken as an example for explanation. The implementation of the REDIS distributed lock is as follows:
[0055] Locking:
[0056] In order to ensure the atomicity of the transaction, the upgrade data producer sends all operations to the REDIS node (which is the target node at this time) at one time by using a LUA script. The business logic of the general locking operation is as follows: when the distributed lock application is obtained, if the lock KEY does not exist in the REDIS node, the VALUE of the lock KEY is set, the timeout time of the VALUE is set (to prevent deadlock), and the result 1 is returned to the upgrade data producer, indicating that the upgrade data producer applies for the distributed lock successfully. If the lock KEY exists in the REDIS node, the result 0 is returned, indicating that the upgrade data producer fails to apply for the distributed lock.
[0057] For example:
[0058] if redis.call('setnx',KEYS[1],ARGV[1])==1then redis.call('expire',KEYS[1],ARGV[2])return 1else return 0end.
[0059] Unlock:
[0060] REDIS distributed lock unlocking, just delete the corresponding lock KEY.
[0061] LUA script example as follows:
[0062] if redis.call('get',KEYS[1])==ARGV[1]then return redis.call('del',KEYS[1])else return 0end.
[0063] Therefore, in the present solution, when a certain upgrade data producer obtains a system upgrade task of a device to be upgraded, a distributed lock application is initiated to the target node, and when one of the upgrade data producers applies for the distributed lock, the distributed lock will enter a locked state, at this time, other upgrade data producers cannot apply for the distributed lock.
[0064] Step S102: When the distributed lock is applied, the upgrade data is generated.
[0065] In this step, when a certain upgrade data producer applies for the distributed lock, upgrade data matched with the system upgrade task is generated, and the upgrade data is data for system upgrade of the device to be upgraded. Other upgrade data producers who do not apply for the distributed lock do not need to generate upgrade data.
[0066] Step S103: The upgrade data is sent to the target node, so that the device to be upgraded is upgraded based on the upgrade data in the target node.
[0067] In this step, the upgrade data producer who successfully applies for the distributed lock generates upgrade data, loads the upgrade data to the target node, and at this time, the device to be upgraded can be upgraded based on the upgrade data in the target node.
[0068] As can be seen from the technical solution disclosed in the above embodiment, in the technical solution disclosed in the present application, the distributed lock is configured in the target node in advance, when the upgrade task is executed, the distributed lock application is first made to the target node, when the distributed lock application is successful, the upgrade data is generated, and the upgrade data is loaded to the target node, so as to realize the system upgrade of the device to be upgraded, and when the distributed lock application fails, it indicates that other upgrade data producers have successfully applied for the distributed lock, at this time, the process is ended, and the upgrade data does not need to be generated, thereby reducing the data peak impact strength on other systems in the system upgrade process.
[0069] In the technical solution disclosed in the present application, in order to facilitate the search of the upgrade object, refer toFigure 3 In the technical solution, when the upgrade data producer successfully applies for the distributed lock, the following actions are further performed:
[0070] Step S201: Determine the to-be-upgraded device based on the upgrade task.
[0071] In this step, when the upgrade data producer successfully applies for the distributed lock, the upgrade task is parsed, the upgrade rule is obtained based on the parsing result, the current state of the target device is queried, the current state can refer to the system version state of the target device, and whether the target device needs to be upgraded is determined based on the system version state of the target device. When the state of the target device is determined, the to-be-upgraded device in the target device is determined based on the upgrade rule and the system version state of the target device, and the determined to-be-upgraded device is taken as the object of this upgrade.
[0072] Step S202: Write the device data of the to-be-upgraded device into the target node.
[0073] When the to-be-upgraded device is determined, the device data of the to-be-upgraded device is obtained, and the device data of the to-be-upgraded device is written into the target node. The device data at least includes the device identifier and the communication address of the to-be-upgraded device, and can further include other information, such as the system version number of the to-be-upgraded device.
[0074] Step S202: When the to-be-upgraded device is upgraded, the device data of the to-be-upgraded device is deleted from the target node.
[0075] In this step, after the device data of the to-be-upgraded device is written into the target node, the consumer starts to upgrade the system of the to-be-upgraded device according to the device data. In the upgrading process, the consumer first determines whether the device data of the to-be-upgraded device exists in the target node, and if the device data exists, the device data is called, the system of the to-be-upgraded device matched with the device data based on the upgrade data is upgraded, and when the to-be-upgraded device is upgraded, it indicates that the device data has been consumed by the consumer. The corresponding device data in the target node is deleted, and when all the device data in the target node is deleted, it indicates that all the to-be-upgraded devices have been upgraded, and the distributed lock is unlocked. At this time, other upgrade data producers can apply for the distributed lock.
[0076] Referring to Figure 4 In the technical solution disclosed in the embodiments of the present application, a specific process of applying for a distributed lock to a target node is disclosed. Specifically, the process can include:
[0077] Step S301: Determine whether the device data of the to-be-upgraded device that has not been upgraded exists in the target node.
[0078] In this step, when the distributed lock is applied, if the application is successful, the device data of the to-be-upgraded device of this upgrade is written to the target node, and when a to-be-upgraded device is upgraded, the device data corresponding to the to-be-upgraded device in the target node is deleted. Therefore, whether the upgrade task is completed can be detected by detecting whether there is unremoved device data in the target node. When there is no device data in the target node, it indicates that the upgrade task is completed, at this time, the distributed lock is unlocked. When there is device data in the target node, it indicates that the upgrade task is not completed, at this time, the distributed lock remains in the locked state.
[0079] Step S302: When there is device data of a to-be-upgraded device that has not been upgraded in the target node, it indicates that the distributed lock has been occupied, and the upgrade task is completed.
[0080] Step S303: When there is no device data of a to-be-upgraded device that has not been upgraded in the target node, it indicates that the distributed lock has not been occupied, and a distributed lock application is initiated to the target node.
[0081] In the technical solution disclosed in this embodiment, in order to improve the processing speed of the upgrade task, the to-be-upgraded devices can be upgraded in a multi-thread mode. At this time, after the upgrade data is sent to the target node, the method further includes: judging whether there is device data of a to-be-upgraded device that has not been upgraded in the target node, and if there is, sending upgrade data to the to-be-upgraded device corresponding to the device data in a multi-thread mode. The number of threads for upgrading the to-be-upgraded devices can be designed according to design requirements, and of course, the number can also be dynamically adjusted according to the number of device data remaining in the target node. For example, the more the number of device data remaining in the target node, the more the number of threads for upgrading the to-be-upgraded devices.
[0082] In this solution, to ensure timely delivery of upgrade data to the target node without putting pressure on system performance, the system can pause for a first preset duration after determining whether device data for the device to be upgraded exists in the target node. After the first preset duration, the system checks again whether device data for the device to be upgraded exists in the target node. To ensure a high-speed delivery rate of upgrade data, after sending upgrade data to the device to be upgraded corresponding to the device data using a multi-threaded approach, the system pauses for a second preset duration before continuing to check whether device data for an un-upgraded device to be upgraded exists in the target node. In the technical solution disclosed in this application, the above-mentioned pause time can be set according to user needs; that is, the first preset duration and the second preset duration can be set according to user needs. The reason for pausing in the above solution is twofold: first, to ensure that the performance of the server itself is not put too much pressure on it; and second, to ensure that other related systems, such as gateways, are not put too much pressure on them. This is because during the upgrade process, the device will have a lot of message and data interactions with the gateway.
[0083] In this solution, because the system version of the device to be upgraded is constantly changing, the producer's data upgrade business logic needs to be executed periodically. Considering the changing device versions and the performance of the application on the device to be upgraded, the step of initiating a distributed lock request to the target node when the system upgrade task begins includes: determining whether a system upgrade task has been generated based on a third preset period; if a system upgrade task has been generated, it indicates the start of the system upgrade task, and a distributed lock request is initiated to the target node. In this solution, the third preset period can be set to 1 minute or other durations.
[0084] In this embodiment, a system upgrade device is also disclosed in accordance with the above method. For the specific working content of each unit in the device, please refer to the content of the above method embodiment.
[0085] The system upgrade apparatus provided in the embodiments of the present invention is described below. The system upgrade apparatus described below and the system upgrade method described above can be referred to in correspondence.
[0086] See Figure 5 The system upgrade apparatus disclosed in this application embodiment may include:
[0087] Distributed lock application unit A, which corresponds to step S101 in the above method, is used to initiate a distributed lock application to the target node when the system upgrade task starts.
[0088] Upgrade data generation unit B, which corresponds to step S102 in the above method, is used to generate upgrade data when a distributed lock is acquired;
[0089] The upgrade data publishing unit C is configured to send the upgrade data to the target node, so that the device to be upgraded performs system upgrade based on the upgrade data in the target node.
[0090] Corresponding to the above method, the system upgrade device can further include:
[0091] A device to be upgraded determining unit is configured to:
[0092] determine the device to be upgraded based on the upgrade task;
[0093] write the device data of the device to be upgraded into the target node;
[0094] delete the device data of the device to be upgraded from the target node when the upgrade of the device to be upgraded is completed.
[0095] Corresponding to the above method, the system upgrade device, when initiating the distributed lock application to the target node, is specifically configured to:
[0096] determine whether there is device data of the device to be upgraded that has not been upgraded in the target node;
[0097] when there is device data of the device to be upgraded that has not been upgraded in the target node, it indicates that the distributed lock has been occupied, and the upgrade task is completed;
[0098] when there is no device data of the device to be upgraded that has not been upgraded in the target node, it indicates that the distributed lock has not been occupied, and the distributed lock application is initiated to the target node.
[0099] Corresponding to the above method, the application further discloses a system upgrade device, Figure 6 The hardware structure diagram of the server provided by the embodiment of the application is shown in Figure 6 and can include at least one processor 100, at least one communication interface 200, at least one memory 300 and at least one communication bus 400;
[0100] In the embodiment of the application, the number of the processor 100, the communication interface 200, the memory 300 and the communication bus 400 is at least one, and the processor 100, the communication interface 200 and the memory 300 complete the communication among each other through the communication bus 400; obviously, Figure 6 the communication connection shown in the processor 100, the communication interface 200, the memory 300 and the communication bus 400 is optional;
[0101] Optionally, the communication interface 200 can be the interface of the communication module, such as the interface of the GSM module.
[0102] The processor 100 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present application.
[0103] The memory 300 can include a high-speed RAM memory, and can also include a non-volatile memory, such as at least one disk memory.
[0104] The processor 100 is specifically configured to:
[0105] When the system upgrade task starts, a distributed lock application is initiated to the target node;
[0106] When the distributed lock is applied, upgrade data is generated;
[0107] The upgrade data is sent to the target node, so that the device to be upgraded performs system upgrade based on the upgrade data in the target node.
[0108] Corresponding to the above method, the processor 100 is specifically further configured to:
[0109] Determine the device to be upgraded based on the upgrade task;
[0110] Write device data of the device to be upgraded to the target node;
[0111] When the device to be upgraded is upgraded, delete the device data of the device to be upgraded from the target node.
[0112] Corresponding to the above method, the processor 100 is specifically further configured to:
[0113] After the upgrade data is sent to the target node:
[0114] Determine whether there is device data of the device to be upgraded that has not been upgraded in the target node, and if so, send upgrade data to the device to be upgraded corresponding to the device data in a multi-threaded manner.
[0115] Corresponding to the above method, the processor 100 is specifically further configured to:
[0116] When there is no device data of the device to be upgraded that has not been upgraded in the target node, after the first predetermined time period is suspended, continue to determine whether there is device data of the device to be upgraded that has not been upgraded in the target node;
[0117] After the multi-thread mode is used to send the upgrade data to the device corresponding to the device data of the device to be upgraded, the second preset time length is hibernated, and it is determined whether the device data of the device to be upgraded exists in the target node.
[0118] For the convenience of description, the above system is described in various modules in terms of functions. Of course, the functions of each module can be implemented in one or more software and / or hardware when implementing the present application.
[0119] Each embodiment in the specification is described in a progressive manner, and the same and similar parts of each embodiment can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, it is described more simply, and the related parts can be referred to the part of the method embodiment. The above-described system and system embodiment are only illustrative, and the units described as separate components can be or can not be physically separated, and the components displayed as units can be or can not be physical units, that is, they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment according to the actual needs. Those skilled in the art can understand and implement without creative labor.
[0120] The professional person can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the present text can be realized by electronic hardware, computer software or combination of both. In order to clearly show the interchangeability of hardware and software, the composition and steps of each example have been described in the above description. Whether the functions are realized by hardware or software depends on the specific application and design constraints of the technical solution. The professional person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0121] The steps of the method or algorithm described in combination with the embodiments disclosed in the present text can be directly implemented by hardware, software module executed by a processor, or a combination of both. The software module can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0122] It is also to be noted that, as used in this specification and the appended claims, the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. Thus, for example, reference to "a component" can include a combination of two or more components, and the term "an element" can include comparable reference to a plurality of elements. Additionally, the term "or" as used herein means any one member of a logical disjunction (i.e., it is equivalent to "or" and "or else") and not a logical exclusion. Also, the terms "comprise," "comprising," "include," "including," and the like mean "including but not limited to." Furthermore, the terms "first," "second," "third," etc. are used merely as labels, and are not intended to impose numerical requirements on their objects.
[0123] The above description of disclosed embodiments provides examples, and is not intended to be limiting. Numerous modifications of the embodiments, as defined herein, will be apparent to those skilled in the art, and will be encompassed within the spirit or scope of the disclosure. Therefore, the scope of the present disclosure is not to be determined by such exemplary embodiments but, rather, is to be understood by reference to the appended claims.
Claims
1. A system upgrade method, characterized in that, include: When the system upgrade task begins, the upgrade data producer initiates a distributed lock request to the target node, which is used to provide the distributed lock. When a distributed lock is acquired, upgrade data is generated. This upgrade data is the data used to upgrade the system of the device to be upgraded. The upgrade data is sent to the target node so that the device to be upgraded can perform a system upgrade based on the upgrade data in the target node.
2. The system upgrade method according to claim 1, characterized in that, Also includes: The devices to be upgraded are determined based on the upgrade task; Write the device data of the device to be upgraded into the target node; Once the upgrade of the device to be upgraded is completed, the device data of the device to be upgraded will be deleted from the target node.
3. The system upgrade method according to claim 2, characterized in that, The upgrade data producer's request for a distributed lock from the target node includes: Determine whether there is any un-upgraded device data for devices to be upgraded in the target node; When the target node contains device data for an un-upgraded device to be upgraded, it indicates that the distributed lock has been occupied, and the upgrade task ends. When the target node does not have device data for the un-upgraded devices to be upgraded, it indicates that the distributed lock is not occupied, and the upgrade data producer initiates a distributed lock request to the target node.
4. The system upgrade method according to claim 2, characterized in that, After sending the upgrade data to the target node, the process further includes: Determine whether there is any un-upgraded device data for the device to be upgraded in the target node. If so, use a multi-threaded approach to send upgrade data to the device to be upgraded corresponding to the device data.
5. The system upgrade method according to claim 4, characterized in that, If there is no device data for an un-upgraded device to be upgraded in the target node, the system will remain dormant for a first preset period of time, and then continue to determine whether there is device data for an un-upgraded device to be upgraded in the target node. After sending upgrade data to the device to be upgraded corresponding to the device data using a multi-threaded approach, the system sleeps for a second preset duration and then continues to determine whether there is device data for an un-upgraded device to be upgraded in the target node.
6. The system upgrade method according to claim 1, characterized in that, When the system upgrade task begins, the upgrade data producer initiates a distributed lock request to the target node, including: Based on the third preset period, it is determined whether a system upgrade task is generated. When a system upgrade task is generated, it indicates that the system upgrade task has started, and the upgrade data producer initiates a distributed lock request to the target node.
7. A system upgrade device, characterized in that, include: The distributed lock request unit is used to initiate a distributed lock request from the target node when the system upgrade task begins, and the target node is used to provide the distributed lock. An upgrade data generation unit is used to generate upgrade data when a distributed lock is acquired. The upgrade data is data for system upgrade of the device to be upgraded. The upgrade data publishing unit is used to send the upgrade data to the target node, so that the device to be upgraded can perform a system upgrade based on the upgrade data in the target node.
8. The system upgrade device according to claim 7, further comprising: The device to be upgraded determination unit is used for: The devices to be upgraded are determined based on the upgrade task; Write the device data of the device to be upgraded into the target node; Once the upgrade of the device to be upgraded is completed, the device data of the device to be upgraded will be deleted from the target node.
9. The system upgrade device according to claim 8, characterized in that, The distributed lock request unit is specifically used when the upgraded data producer initiates a distributed lock request to the target node for: Determine whether there is any un-upgraded device data for devices to be upgraded in the target node; When the target node contains device data for an un-upgraded device to be upgraded, it indicates that the distributed lock has been occupied, and the upgrade task ends. When the target node does not have device data for the un-upgraded devices to be upgraded, it indicates that the distributed lock is not occupied, and the upgrade data producer initiates a distributed lock request to the target node.
10. A system upgrade device, characterized in that, include: Memory, used to store programs; A processor for executing the program to implement the steps of the system upgrade method as described in any one of claims 1-6.
Citation Information
Patent Citations
Updating method of file layout in distributed file system
CN104158897A
Data version management method and device and storage medium
CN112363997A