Disclosure of Invention
Therefore, the present invention aims to provide a method, apparatus, device and storage medium for separating data from logic computation, which can make the software systems on each controller of the storage device easier to cooperate with each other, and can reduce the time occupied by online upgrade of software. The specific scheme is as follows:
in a first aspect, the present application discloses a method for separating data from logic computation, comprising:
calling a first target file and a second target file, wherein the first target file is used for storing a pre-developed logic computing processing program related to logic computing, and the second target file is used for storing a pre-developed data and state field program related to data and state fields and an operation interface program;
Compiling the logic calculation processing program in the first target file to obtain a corresponding main program, and compiling the data and state field program and the operation interface program in the second target file to obtain a corresponding dynamic library;
When the main program and the dynamic library are operated, an operation interface is called to open by the main program to open the dynamic library so as to acquire the operation interfaces related to the data and the state field in the dynamic library, and corresponding operations are carried out on the data and the state field.
Optionally, compiling the logic calculation processing program in the first target file to obtain a corresponding main program includes:
And compiling the logic calculation processing program in the first target file according to a first preset compiling instruction to obtain a corresponding main program.
Optionally, compiling the data and status field program and the operation interface program in the second object file to obtain a corresponding dynamic library includes:
And compiling the data and state field programs and the operation interface program in the second target file according to a second preset compiling instruction to obtain a corresponding dynamic library.
Optionally, the acquiring the operation interface related to the data and the status field in the dynamic library performs corresponding operations on the data and the status field, including:
And acquiring operation interfaces related to the data and the state field in the dynamic library through a preset acquisition interface, and performing corresponding operation on the data and the state field.
Optionally, the method for separating data from logic computation further includes:
monitoring whether the logic calculation processing program has a problem or not;
and if the problem of the logic calculation processing program is detected, calling a closing operation interface through the main program to close the dynamic library.
Optionally, the method for separating data from logic computation further includes:
Monitoring whether the logic calculation processing program adds new logic;
If the logic calculation processing program is monitored to add the new logic, compiling a new logic calculation processing program to obtain a new main program, and replacing the main program with the new main program, wherein the new logic calculation processing program is the logic calculation processing program added with the new logic.
Optionally, the method for separating data from logic computation further includes:
monitoring whether the data and the status fields and associated operating logic need to be updated;
If the data and the state fields and the related operation logic need to be updated, recompiling new data and state field programs to obtain a new dynamic library, calling the closing operation interface to close the dynamic library through the main program, and calling the opening operation interface to open the new dynamic library to realize the updating of the dynamic library, wherein the new data and state field programs are the data and state field programs updated by the data and the state fields.
In a second aspect, the present application discloses a data and logic computation separation device, comprising:
The file calling module is used for calling a first target file and a second target file, wherein the first target file is used for storing a pre-developed logic calculation processing program related to logic calculation, and the second target file is used for storing a pre-developed data and state field program related to data and state fields and an operation interface program;
the first program compiling module is used for compiling the logic calculation processing program in the first target file to obtain a corresponding main program;
The second program compiling module is used for compiling the data and state field programs and the operation interface program in the second target file to obtain a corresponding dynamic library;
And the operation module is used for calling an operation interface to open the dynamic library through the main program to acquire the operation interface related to the data and the state field in the dynamic library to perform corresponding operation on the data and the state field when the main program and the dynamic library are operated.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
and a processor for executing the computer program to implement the steps of the disclosed data and logic calculation separation method.
In a fourth aspect, the present application discloses a computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the previously disclosed data and logic computation separation method.
The application provides a data and logic computing separation method, which comprises the steps of calling a first target file and a second target file, wherein the first target file is used for storing a logic computing processing program related to logic computing which is developed in advance, the second target file is used for storing a data and a state field program and an operation interface program related to data and state fields which are developed in advance, compiling the logic computing processing program in the first target file to obtain a corresponding main program, compiling the data and state field program and the operation interface program in the second target file to obtain a corresponding dynamic library, and calling an operation interface to open the dynamic library through the main program to obtain the operation interface related to the data and the state fields in the dynamic library when the main program and the dynamic library are operated, and carrying out corresponding operation on the data and the state fields. Therefore, the application compiles the logic calculation processing program, the data and the state field program separately and compiles the logic calculation processing program and the data and the state field program into the main program and the dynamic library respectively, so that the separation of the logic calculation processing program and the data and the state field program is realized, when the main program and the dynamic library run, the main program can use the related content in the dynamic library to execute corresponding operation, thereby enabling software systems on each controller of the storage device to be matched with each other more easily, and updating corresponding parts as required when the software is updated, avoiding all updating, and further reducing the time occupied by the online updating of the software.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Currently, in a SAN application environment, a storage device is generally a cluster system formed by a plurality of identical controllers, and from the perspective of a server host, the storage cluster is an integral unit, and in consideration of load balancing, read-write operation can be performed through any one of the controllers, but the storage reliability requirement is higher, and in the process of repairing software problems, the storage service is required to be always on line, which means that software systems on the controllers of the storage device can be mutually matched and support the online upgrade of software. Therefore, the application provides a data and logic calculation separation scheme, which can enable software systems on each controller of the storage device to be matched with each other more easily and can reduce the time occupied by online upgrading of software.
The embodiment of the invention discloses a data and logic calculation separation method, which is shown in fig. 1 and comprises the following steps:
Step S11, calling a first target file and a second target file, wherein the first target file is used for storing a pre-developed logic calculation processing program related to logic calculation, and the second target file is used for storing a pre-developed data and state field program related to data and state fields and an operation interface program.
It should be noted that the software system operated by each controller of the storage device may be programmed in the C language, the development of the storage device software program may be performed based on the Linux operating system, and when the storage device software program is designed and developed, the developer stores the logic calculation processing program related to the logic calculation, the data and the state field program related to the data and the state field and the operation interface program separately into different files, that is, the pre-developed logic calculation processing program related to the logic calculation is stored into the first target file, the pre-developed data and the state field program related to the data and the state field program and the operation interface program are stored into the second target file, and when the developer designs the program, the developer analyzes which data and the state field involve communication among the plurality of controllers, and the state field includes the read/write I/O (Input/Output) related to each state field, and each controller in the whole cluster system needs to keep consistent data and state field, that is also the controllers in the cluster system need to keep consistent data and state field program and consistent operation interface program. Logical computing processes are developed that are associated with logical computing, including software upgrades, and related open and close dynamic library processes when using dynamic libraries. That is, the developer has two parts, namely logic calculation and cluster related state data processing based on a storage device software program developed by the Linux operating system.
In this embodiment, first, a first object file storing a logical calculation processing program related to logical calculation and a second object file storing a data and status field program related to data and status fields and an operation interface program are called.
And step S12, compiling the logic calculation processing program in the first target file to obtain a corresponding main program, and compiling the data and state field program and the operation interface program in the second target file to obtain a corresponding dynamic library.
In this embodiment, the called logical computing processing program in the first object file is compiled to obtain a corresponding main program, and the data and status field program and the operation interface program in the second object file are compiled to obtain a corresponding dynamic library. It can be understood that the dynamic library is used to separate the logic computing processing program related to logic computing from the data and status field program synchronized with the cluster system, so that when the logic function upgrade or problem modification is involved in the later maintenance, the software replacement scope can be reduced, that is, a part of the software can be replaced as required during the software upgrade, the online upgrade process of the software is accelerated, the risk of interruption of the service is reduced, and the independent status data management is more convenient for the cluster system control management. For example, the main program is named mymain, the data and status field programs and the operation interface program related to the data and status fields are categorized together, and compiled into a dynamic library, such as gcc-fPIC-shared status.
And step S13, when the main program and the dynamic library are operated, an operation interface is called to open the dynamic library through the main program so as to acquire the operation interfaces related to the data and the state field in the dynamic library, and corresponding operations are carried out on the data and the state field.
In this embodiment, when the main program and the dynamic library are running, the main program calls an operation interface to open the dynamic library to obtain an operation interface related to the data and the status field in the dynamic library, and performs corresponding operations on the data and the status field. That is, when the main program and the dynamic library are run, the mymain program opens the dynamic library libstatus.so through the dlopen operation interface, and when the operation of the data and the status fields in the dynamic library is involved, the dlsym interface is used to obtain the operation interface corresponding to the data and the status fields in the dynamic library to operate on the data and the status fields. And when the main program and the dynamic library are operated, the two separated parts are loaded into one process, and then when software is upgraded, one part of the two parts can be replaced according to requirements, for example, a software program operated in one process can be used for independently updating a logic calculation processing program part and an operation interface program part for independently updating data and state field program parts and operation data and states.
In the technical scheme of the application, the logic calculation processing program related to logic calculation, the data related to the data and the state field program are separately compiled into the main program and the dynamic library, so that the post maintenance is more convenient, the scope of software replacement can be reduced according to the updated content or the condition of modifying the problem, the online updating process is accelerated, the risk of interrupted service is reduced, and the independent state data management is more convenient for the state management among controllers in the cluster system.
When the main program and the dynamic library are operated, whether the logic calculation processing program has problems or not can be monitored in real time; and if the problem of the logic calculation processing program is detected, calling a closing operation interface through the main program to close the dynamic library. If the logic calculation processing program is monitored to add the new logic, compiling the new logic calculation processing program to obtain a new main program, and replacing the main program with the new main program, wherein the new logic calculation processing program is the logic calculation processing program added with the new logic. That is, when there is a problem with the logic computation handler or new logic is added, mymain is only required to call dlclose to shut down the dynamic library or change to a new mymain program run.
And if the data and the state fields and the related operation logic are monitored to be updated, recompiling new data and state field programs to obtain a new dynamic library, calling the closing operation interface to close the dynamic library through the main program, calling the opening operation interface to open the new dynamic library to realize the updating of the dynamic library, and the new data and state field programs are the data and state field programs updated by the data and the state field. That is, when the relevant data and status fields of the cluster system management are monitored and the operating logic needs to be updated, mymain program call dlclose closes the old dynamic library and then calls dlopen opens the new dynamic library to complete the relevant software upgrade.
Therefore, in the embodiment of the application, the logic calculation processing program, the data and the state field program are compiled into the main program and the dynamic library respectively by separate compiling, so that the separation of the logic calculation processing program and the data and the state field program is realized, and when the main program and the dynamic library are operated, the main program can use the related content in the dynamic library to execute corresponding operation, so that software systems on all controllers of the storage device are easier to mutually cooperate, corresponding parts are updated as required when the software is upgraded, all the updating is avoided, and the time occupied by the online upgrading of the software can be reduced.
Referring to fig. 2, an embodiment of the present invention discloses a specific data and logic calculation separation method, and compared with the previous embodiment, the present embodiment further describes and optimizes the technical scheme.
Step S21, calling a first target file and a second target file, wherein the first target file is used for storing a pre-developed logic calculation processing program related to logic calculation, and the second target file is used for storing a pre-developed data and state field program related to data and state fields and an operation interface program.
And S22, compiling the logic calculation processing program in the first target file according to a first preset compiling instruction to obtain a corresponding main program.
In this embodiment, the logic calculation processing program in the first target file is compiled according to a first preset compiling instruction to obtain a corresponding main program. It is understood that the logical computing processing program is compiled into the main program according to a first preset compiling instruction.
And S23, compiling the data and the state field program and the operation interface program in the second target file according to a second preset compiling instruction to obtain a corresponding dynamic library.
In this embodiment, the data and status field program and the operation interface program in the second object file are compiled according to a second preset compiling instruction to obtain a corresponding dynamic library. It will be appreciated that the data and status field program and the operation interface program are compiled into a dynamic library according to a second preset compiling instruction.
And step S24, when the main program and the dynamic library are operated, the dynamic library is opened by calling an opening operation interface through the main program so as to acquire the operation interface related to the data and the state field in the dynamic library, and the data and the state field are correspondingly operated.
For the specific content of the above steps S21 to S24, reference may be made to the corresponding content disclosed in the foregoing embodiment, and no detailed description is given here.
Therefore, in the embodiment of the application, the logic calculation processing program, the data and the state field program are compiled separately and are compiled into the main program and the dynamic library respectively through the corresponding compiling instructions, so that the logic calculation processing program and the data and the state field program are separated, when the main program and the dynamic library run, the main program can use the related content in the dynamic library to execute corresponding operations, so that software systems on all controllers of the storage device are more easily matched with each other, corresponding parts are updated as required when the software is updated, all the updating is avoided, and the time occupied by the online updating of the software can be reduced.
Correspondingly, the embodiment of the application also discloses a data and logic calculation separation device, which is shown in fig. 3 and comprises the following components:
A file calling module 11, configured to call a first target file and a second target file, where the first target file is used to store a pre-developed logic calculation processing program related to logic calculation, and the second target file is used to store a pre-developed data and status field program related to data and status fields and an operation interface program;
A first program compiling module 12, configured to compile the logical computing processing program in the first object file to obtain a corresponding main program;
a second program compiling module 13, configured to compile the data and status field program and the operation interface program in the second object file to obtain a corresponding dynamic library;
and the operation module 14 is configured to, when the main program and the dynamic library are operated, call an open operation interface through the main program to open the dynamic library so as to obtain an operation interface related to the data and the status field in the dynamic library, and perform corresponding operations on the data and the status field.
Therefore, in the embodiment of the application, the logic calculation processing program, the data and the state field program are compiled into the main program and the dynamic library respectively by separately compiling the logic calculation processing program, the data and the state field program, so that the separation of the logic calculation processing program and the data and the state field program is realized, when the main program and the dynamic library run, the main program can use the related content in the dynamic library to execute corresponding operation, so that software systems on all controllers of the storage device are easier to mutually cooperate, corresponding parts are updated as required when the software is updated, all the updating is avoided, and the time occupied by the online updating of the software can be reduced.
In some specific embodiments, the first program compiling module 12 may specifically include:
And the first program compiling unit is used for compiling the logic calculation processing program in the first target file according to a first preset compiling instruction to obtain a corresponding main program.
In some specific embodiments, the second program compiling module 13 may specifically include:
and the second program compiling unit is used for compiling the data and the state field program and the operation interface program in the second target file according to a second preset compiling instruction to obtain a corresponding dynamic library.
In some specific embodiments, the operation module 14 may specifically include:
And the operation interface acquisition unit is used for acquiring the operation interfaces related to the data and the state field in the dynamic library through a preset acquisition interface to perform corresponding operation on the data and the state field.
In some specific embodiments, the data and logic calculation separation device may specifically include:
the first monitoring module is used for monitoring whether the logic calculation processing program has a problem or not;
and the first upgrade processing module is used for calling a closing operation interface through the main program to close the dynamic library if the problem of the logic calculation processing program is detected.
In some specific embodiments, the data and logic calculation separation device may specifically include:
the second monitoring module is used for monitoring whether the logic calculation processing program adds new logic or not;
And the second upgrading processing module is used for compiling a new logic calculation processing program to obtain a new main program and replacing the main program with the new main program if the logic calculation processing program is monitored to add the new logic, wherein the new logic calculation processing program is the logic calculation processing program added with the new logic.
In some specific embodiments, the data and logic calculation separation device may specifically include:
a third monitoring module for monitoring whether the data and the status fields and related operating logic need to be updated;
And the third upgrade processing module is used for recompiling new data and state field programs to obtain a new dynamic library if the data and the state fields and the related operation logic need to be updated, calling the closing operation interface through the main program to close the dynamic library, calling the opening operation interface to open the new dynamic library to realize the upgrade of the dynamic library, wherein the new data and state field programs are the data and state field programs after the data and the state field are updated.
Further, the embodiment of the application also provides electronic equipment. Fig. 4 is a block diagram of an electronic device 20, according to an exemplary embodiment, and the contents of the diagram should not be construed as limiting the scope of use of the present application in any way.
Fig. 4 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may include, in particular, at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input-output interface 25, and a communication bus 26. Wherein the memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement the relevant steps of the data and logic computation separation method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide working voltages for each hardware device on the electronic device 20, the communication interface 24 is capable of creating a data transmission channel with an external device for the electronic device 20, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein, and the input/output interface 25 is configured to obtain external input data or output data to the external device, and the specific interface type of the input/output interface may be selected according to the specific application needs and is not specifically limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program capable of performing other specific tasks in addition to the computer program capable of performing the data and logic calculation separation method performed by the electronic device 20 as disclosed in any of the foregoing embodiments.
Further, the embodiment of the application also discloses a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and when the computer program is loaded and executed by a processor, the data and logic calculation separation method steps disclosed in any embodiment are realized.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing describes the principles and embodiments of the present invention in detail using specific examples to facilitate understanding of the method and core ideas of the present invention, and meanwhile, the present invention should not be construed as being limited to the embodiments and application scope of the present invention, since the general technical personnel in the art can change the scope of the present invention according to the ideas.