A transaction log encryption parameter processing method, device, equipment and medium
Patent Information
- Application Number
- CN202211102780.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-09-09
AI Technical Summary
[0003]但是,在主机和备机发生切换,备机转换为新主机后,新主机不会自动将事务日志加密参数调整至与原主机一致,存在信息泄露的风险
[0037]The transaction log encryption parameter processing method provided in this application controls the primary/standby machine to read the transaction log encryption parameters from the primary host's transaction log, and updates the transaction log encryption parameters in the primary/standby machine's shared memory according to the transaction log encryption parameters in the primary host's transaction log, thereby ensuring that the transaction log encryption parameters in the primary/standby machine's shared memory are consistent with those in the primary host's transaction log. After the primary/standby machine switches to the new primary host, the method controls each process writing transaction logs on the new primary host to obtain the transaction log encryption parameters only from the new primary host's shared memory, ensuring that the transaction log encryption parameters obtained by each process writing transaction logs on the new primary host at the same time are consistent with those of the primary host's transaction log, reducing the risk of information leakage after the standby machine switches to the primary host.
Smart Images

Figure CN117708841B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to a method, apparatus, device, and medium for processing transaction log encryption parameters. Background Technology
[0002] In the Kingbase Elasticsearch (KES) database, the transaction log (XLOG) records in detail the operations performed by service processes on the KES database. If the transaction log contains sensitive user information, such as ID card numbers and detailed addresses, this information can be obtained through simple transaction log replay operations, leading to user information leakage. Therefore, it is necessary to encrypt the transaction log to prevent the leakage of user information from it.
[0003] However, when the primary and standby machines switch over and the standby machine becomes the new primary machine, the new primary machine will not automatically adjust the transaction log encryption parameters to be consistent with the original primary machine, which poses a risk of information leakage. Summary of the Invention
[0004] This application provides a method, apparatus, device, and medium for processing transaction log encryption parameters, which reduces the risk of information leakage on the new host after the standby machine is switched to the new host.
[0005] Firstly, this application provides a method for processing transaction log encryption parameters, including:
[0006] The system controls the primary and standby machines to read the transaction log encryption parameters from the transaction log of the primary host, and updates the transaction log encryption parameters in the shared memory of the primary and standby machines according to the transaction log encryption parameters from the transaction log of the primary host.
[0007] After the original standby machine is switched to the new host, the processes controlling the writing of transaction logs in the new host only obtain the transaction log encryption parameters from the shared memory of the new host.
[0008] Optionally, updating the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the original host's transaction log specifically includes:
[0009] Update the transaction log encryption parameters in the local file and configuration file of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host;
[0010] When the original standby machine is switched to the new host and the new host is restarted, the postmaster process in the new host is controlled to read the transaction log encryption parameters in the local files and configuration files of the new host;
[0011] Determine whether the transaction log encryption parameters in the local file of the new host are valid;
[0012] If so, update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the local file of the new host;
[0013] If not, update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the new host's configuration file.
[0014] Optionally, determining whether the transaction log encryption parameters in the local file of the new host are valid specifically includes:
[0015] Determine whether the transaction log encryption parameter in the local file of the new host is the value corresponding to enabling encryption.
[0016] Optionally, the method further includes:
[0017] Modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enabling transaction log encryption;
[0018] A reload signal is sent to the postmaster process on the original host to control the postmaster process to load the configuration file of the original host and update the transaction log encryption parameters in the shared memory of the original host according to the transaction log encryption parameters in the configuration file of the original host.
[0019] Optionally, the method further includes:
[0020] Modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enabling transaction log encryption;
[0021] A reload signal is sent to the postmaster process on the original host to control the postmaster process to load the configuration file of the original host and write the transaction log encryption parameters in the configuration file of the original host into the transaction log and local file of the original host.
[0022] When the original host restarts, the postmaster process of the original host reads the transaction log encryption parameters in the local files and configuration files of the original host.
[0023] Determine whether the transaction log encryption parameters in the local file of the original host are valid;
[0024] If so, update the transaction log encryption parameters in the shared memory of the original host using the transaction log encryption parameters in the local file of the original host;
[0025] If not, update the transaction log encryption parameters in the shared memory of the original host using the transaction log encryption parameters in the original host's configuration file.
[0026] Optionally, the method further includes:
[0027] The processes controlling each write transaction log on the original host obtain the transaction log encryption parameters only from the shared memory of the original host.
[0028] Optionally, determining whether the transaction log encryption parameters in the local file of the original host are valid specifically includes:
[0029] Determine whether the transaction log encryption parameter in the local file of the original host is the value corresponding to enabling encryption.
[0030] Secondly, this application provides a processing apparatus for transaction log encryption parameters, comprising:
[0031] The first control module is used to control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host.
[0032] The second control module is used to control each process writing transaction logs in the new host to obtain transaction log encryption parameters only from the shared memory of the new host after the original standby machine is switched to the new host.
[0033] Thirdly, this application provides an electronic device, including: a memory and a processor;
[0034] The memory is used to store instructions; the processor is used to call the instructions in the memory to execute the processing method of transaction log encryption parameters in the first aspect and any possible design of the first aspect.
[0035] Fourthly, this application provides a computer-readable storage medium storing computer instructions, which, when executed by at least one processor of an electronic device, enable the electronic device to perform the processing method for transaction encryption parameters in the first aspect and any possible design of the first aspect.
[0036] Fifthly, this application provides a computer program product comprising computer instructions, wherein when at least one processor of an electronic device executes the computer instructions, the electronic device executes the processing method for transaction log encryption parameters in the first aspect and any possible design of the first aspect.
[0037] The transaction log encryption parameter processing method provided in this application controls the primary / standby machine to read the transaction log encryption parameters from the primary host's transaction log, and updates the transaction log encryption parameters in the primary / standby machine's shared memory according to the transaction log encryption parameters in the primary host's transaction log, thereby ensuring that the transaction log encryption parameters in the primary / standby machine's shared memory are consistent with those in the primary host's transaction log. After the primary / standby machine switches to the new primary host, the method controls each process writing transaction logs on the new primary host to obtain the transaction log encryption parameters only from the new primary host's shared memory, ensuring that the transaction log encryption parameters obtained by each process writing transaction logs on the new primary host at the same time are consistent with those of the primary host's transaction log, reducing the risk of information leakage after the standby machine switches to the primary host. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figures 1-4 A flowchart illustrating a method for processing transaction log encryption parameters according to an embodiment of this application;
[0040] Figure 5 A schematic diagram of the structure of a processing device for transaction log encryption parameters provided in an embodiment of this application;
[0041] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0043] As described in the background section, in the Kingbase ES database, the transaction log records in detail the operations performed by service processes on the KES database. If the transaction log contains sensitive user information, this information can be obtained through simple transaction log replay operations, leading to user information leakage. Therefore, it is necessary to encrypt the transaction log to prevent the leakage of user information.
[0044] However, when the primary and standby servers switch over and the standby server becomes the new primary server, the new primary server will not automatically adjust the transaction log encryption parameters to be consistent with the original primary server. Instead, it will directly read the GUC parameters in its own configuration file. The CUC parameters include the transaction log encryption parameters. However, the transaction log encryption parameters in its own configuration file may be inconsistent with those in the original primary server, which poses a risk of information leakage.
[0045] To address the aforementioned technical problems, this application proposes a method for processing transaction log encryption parameters. The method involves controlling the primary / standby machine to read the transaction log encryption parameters from the primary host's transaction log and updating the transaction log encryption parameters in the primary / standby machine's shared memory based on these parameters. After the primary / standby machine is switched to the new host, each process writing transaction logs on the new host is controlled to retrieve the transaction log encryption parameters only from the new host's shared memory. Because the primary / standby machine updates its shared memory with the encryption parameters from the primary host's transaction log, the transaction log encryption parameters in the primary / standby machine's shared memory are consistent with those in the primary host's transaction log, reducing the risk of information leakage. Furthermore, after the primary / standby machine is switched to the new host, each process writing transaction logs on the new host retrieves the encryption parameters only from the new host's shared memory. This ensures that each process reading the same encryption parameters at the same time is consistent, allowing each process to synchronously enable or disable the transaction log encryption function, avoiding inconsistent encryption parameters and further reducing the risk of information leakage.
[0046] The technical solutions of this application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0047] In this application, an electronic device is used as the execution subject to perform a method for enabling the encryption function of the transaction log according to the following embodiments. Specifically, the execution subject can be a hardware device of the electronic device, a software application implementing the following embodiments in the electronic device, a computer-readable storage medium on which the software application implementing the following embodiments is installed, or code implementing the software application.
[0048] Figure 1 A flowchart illustrating a method for processing transaction log encryption parameters according to an embodiment of this application is shown. Figure 1 As shown, with an electronic device as the execution subject, the method in this embodiment may include the following steps:
[0049] S101. Control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host.
[0050] The system controls the standby machine to read the transaction (XLOG) log from the primary master and record the primary master's transaction log encryption parameters. It then retrieves the primary master's transaction log encryption parameters from the primary master's transaction log and modifies the transaction log encryption parameters in the standby machine's shared memory based on these parameters, ensuring consistency between the standby machine's shared memory and the primary master's. For example, it can modify the Grand Unified Configuration (GUC) parameters at the overload parameter (PGC_SIGHUP) level in shared memory. Modifying the GUC parameters includes modifying the transaction log encryption parameters, thus modifying the transaction log encryption parameters in shared memory by changing the overload parameter level database configuration parameters.
[0051] The transaction log encryption parameter (wal_encryption) includes a value corresponding to enabling encryption (true) and a value corresponding to disabling encryption (false). For example, if the transaction log encryption parameter of the primary host is set to the value corresponding to enabling encryption, and the transaction log encryption parameter in the shared memory of the primary standby host is set to the value corresponding to disabling encryption, then after obtaining the transaction log encryption parameter of the primary host set to the value corresponding to enabling encryption, the transaction log encryption parameter in the shared memory of the primary standby host will be modified to the value corresponding to enabling encryption.
[0052] S102. After the original standby machine is switched to the new master machine, the processes that control the writing of transaction logs in the new master machine obtain the transaction log encryption parameters only from the shared memory of the new master machine.
[0053] The process of switching from the standby machine to the new primary machine can be understood as the new primary machine and the standby machine being the same device. After the switch, each process writing transaction logs on the new primary machine retrieves the transaction log encryption parameters only from the shared memory of the new primary machine, ensuring that the encryption parameters are consistent across all processes. Since the processes writing transaction logs on the new primary machine do not modify the encryption parameters in the shared memory, and each process retrieves the encryption parameters from the shared memory, the encryption parameters read by each process at the same time are identical. This ensures that the transaction log encryption function is enabled synchronously across all processes writing transaction logs on the new primary machine, thus preventing user information leakage due to some processes not enabling transaction log encryption.
[0054] The transaction log encryption parameter processing method provided in this application controls the primary / standby machine to read the transaction log encryption parameters from the primary host's transaction log. Based on these parameters, the standby machine updates its shared memory with these encryption parameters, ensuring consistency between the primary and standby machine's transaction log encryption parameters and reducing the risk of information leakage after the standby machine is switched to the new host. Furthermore, after the standby machine is switched to the new host, each process writing transaction logs on the new host is controlled to retrieve the encryption parameters only from the new host's shared memory. This ensures that each process on the new host retrieves the same encryption parameters at the same time, and that these parameters are consistent with those of the primary host, further reducing the risk of information leakage after the standby machine is switched to the primary host.
[0055] Figure 2 A flowchart illustrating a method for processing transaction log encryption parameters according to an embodiment of this application is shown. Figure 2 As shown, with an electronic device as the execution subject, the method in this embodiment may include the following steps:
[0056] S201. Control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the local file and configuration file of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host.
[0057] After the primary / standby machine reads the transaction log encryption parameters from the primary host's transaction log, it updates the transaction log encryption parameters in its configuration file based on these parameters. Simultaneously, if the primary / standby machine's local file (local_file) includes the transaction log encryption parameters, it updates the local file with these parameters from the primary host's transaction log. If the primary / standby machine's local file does not contain the transaction log encryption parameters, it writes the parameters from the primary / standby machine's transaction log into the local file.
[0058] S202. When the original standby machine is switched to the new master machine and the new master machine is restarted, control the postmaster process in the new master machine to read the transaction log encryption parameters in the local files and configuration files of the new master machine.
[0059] After the original standby machine is switched to the new master machine, the new master machine can be restarted. When the new master machine restarts, the postmaster process in the new master machine reads the transaction log encryption parameters in the local files of the new master machine and the transaction log encryption parameters in the configuration file of the new master machine.
[0060] S203. Determine whether the transaction log encryption parameters in the local file of the new host are valid.
[0061] After obtaining the transaction log encryption parameters from the local file on the new host, the validity of these parameters can be determined by checking if they correspond to the value indicating that encryption is enabled. For example, if the encryption parameter in the local file corresponds to the value indicating that encryption is enabled, the transaction log encryption parameters are considered valid; if the parameter corresponds to the value indicating that encryption is disabled, the transaction log encryption parameters are considered invalid.
[0062] If yes, proceed to step S204; otherwise, proceed to step S205.
[0063] S204. Update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the local file of the new host.
[0064] Since the transaction log encryption parameters in the local files of the new host do not change when the new host restarts, and these parameters are updated based on the transaction log encryption parameters of the original host, the transaction log encryption parameters in the local files of the new host are consistent with those in the original host's transaction log. By updating the transaction log encryption parameters in the shared memory of the new host using the parameters in the local files, it can be ensured that the transaction log encryption parameters in the shared memory of the new host remain consistent with those in the original host's transaction log after the new host restarts.
[0065] S205. Update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the new host's configuration file.
[0066] If the transaction log encryption parameters in the local file of the new host are invalid, the transaction log encryption parameters in the shared memory of the new host are updated using the transaction log encryption parameters in the new host's configuration file. Normally, the transaction log encryption parameters in the new host's configuration file are not modified during the new host's startup process, and the transaction log encryption parameters in the new host's configuration file remain consistent with the transaction log encryption parameters of the original host.
[0067] S206. After the original standby machine is switched to the new master machine, the processes that control the writing of transaction logs in the new master machine obtain the transaction log encryption parameters only from the shared memory of the new master machine.
[0068] Among them, step S206 and Figure 1 The implementation of step S102 in the embodiment is similar, and will not be repeated here.
[0069] The transaction log encryption parameter processing method provided in this application, after obtaining the transaction log encryption parameters of the original host's transaction log, updates the transaction log encryption parameters in the local files and configuration files of the original standby host using the transaction log encryption parameters of the original host. When the original standby host is switched to a new host and the new host restarts, it obtains the transaction log encryption parameters in the local files and configuration files of the new host. If the transaction log encryption parameters in the local files of the new host are valid, it updates the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the local files of the new host. If the transaction log encryption parameters in the local files of the new host are invalid, it updates the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the configuration file of the new host. This ensures that the transaction log encryption parameters in the shared memory of the new host are consistent with the transaction log encryption parameters of the original host's transaction log, reducing the risk of information leakage.
[0070] Figure 3 A flowchart illustrating a method for processing transaction log encryption parameters according to an embodiment of this application is shown. Figure 1 Based on the aforementioned embodiment, this embodiment can also enable the encryption function of the original host's transaction logs to prevent information leakage from the original host's transaction logs. For example... Figure 3 As shown, with an electronic device as the execution subject, the method in this embodiment may include the following steps:
[0071] S301. Modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enabling transaction log encryption.
[0072] Enable encryption is used to indicate that the transaction logs should be encrypted. When it is necessary to encrypt the transaction logs of the original host, modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enable encryption. For example, change the transaction log encryption parameter from the value corresponding to disable encryption to the value corresponding to enable encryption.
[0073] S302. Send a reload signal to the postmaster process on the original host to control the postmaster process to load the configuration file of the original host and update the transaction log encryption parameters in the shared memory of the original host according to the transaction log encryption parameters in the configuration file of the original host.
[0074] After modifying the transaction log encryption parameters in the original host's configuration file to the value corresponding to enabling encryption, a reload (SIGHUP) signal is sent to the original host's postmaster process. Upon receiving the reload signal, the original host's postmaster process loads the contents of the configuration file and modifies the database configuration (Grand Unified Configuration, GUC) parameters at the reload parameter (PGC_SIGHUP) level in shared memory according to the transaction log encryption parameters in the configuration file. Modifying the GUC parameters includes changing the transaction log encryption parameters to the value corresponding to enabling encryption, thereby modifying the transaction log encryption parameters in shared memory to the value corresponding to enabling encryption by modifying the database configuration parameters at the reload parameter level in shared memory.
[0075] S303: Control each process writing transaction logs on the original host to obtain transaction log encryption parameters only from the shared memory of the original host.
[0076] The system controls each process writing transaction logs on the original host to retrieve transaction log encryption parameters only from the original host's shared memory, ensuring consistency in the encryption parameters across all processes. Since these processes do not modify the encryption parameters in the shared memory and all retrieve them from there, the same encryption parameters are read simultaneously across all processes. This ensures that transaction log encryption is enabled synchronously across all processes, preventing information leakage due to some processes failing to enable encryption.
[0077] S304. Control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host.
[0078] S305. After the original standby machine is switched to the new master machine, the processes that write transaction logs in the new master machine are controlled to obtain the transaction log encryption parameters from the shared memory of the new master machine.
[0079] Among them, step S304 and Figure 1 Step S101 in the embodiment is implemented in a similar manner, and step S305 is similar to... Figure 1 The implementation of step S102 in the embodiment is similar, and will not be repeated here.
[0080] The transaction log encryption parameter processing method provided in this application controls the postmaster process of the original host to update the transaction log encryption parameters in the shared memory of the original host according to the transaction log encryption parameters in the configuration file of the original host, and each process writing transaction logs on the original host only obtains the transaction log encryption parameters from the shared memory of the original host, so that each process on the original host reads the same transaction log encryption parameters at the same time, thereby enabling the transaction log encryption function to be enabled synchronously in each process writing transaction logs, thus avoiding the situation where user information is leaked due to some processes not enabling the transaction log encryption function.
[0081] Figure 4 A flowchart illustrating a method for processing transaction log encryption parameters according to an embodiment of this application is shown. Figure 1 Based on the aforementioned embodiment, this embodiment can also enable the encryption function of the original host's transaction logs to prevent information leakage from the original host's transaction logs. For example... Figure 4 As shown, with an electronic device as the execution subject, the method in this embodiment may include the following steps:
[0082] S401. Modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enabling transaction log encryption.
[0083] S402. Send a reload signal to the postmaster process on the original host to control the postmaster process to load the configuration file of the original host and write the transaction log encryption parameters in the configuration file of the original host to the transaction log and local file of the original host.
[0084] After receiving the reload signal, the postmaster process on the original host writes the transaction log encryption parameters from the original host's configuration file into the original host's transaction log and its local file.
[0085] S403. When the original host restarts, the postmaster process that controls the original host reads the transaction log encryption parameters in the original host's local files and configuration files.
[0086] S404. Determine whether the transaction log encryption parameters in the local file of the original host are valid.
[0087] After obtaining the transaction log encryption parameters from the local file on the original host, the validity of the transaction log encryption parameters can be determined by checking whether the parameters in the local file on the original host correspond to the value corresponding to enabling encryption. For example, if the transaction log encryption parameters in the local file on the original host correspond to the value corresponding to enabling encryption, the transaction log encryption parameters in the local file on the original host are determined to be valid; if the parameters in the local file on the original host correspond to the value corresponding to disabling encryption, the transaction log encryption parameters in the local file on the original host are determined to be invalid.
[0088] If yes, proceed to step S405; otherwise, proceed to step S406.
[0089] S405. Update the transaction log encryption parameters in the shared memory of the original host using the transaction log encryption parameters in the local file of the original host.
[0090] During the host restart process, the transaction log encryption parameters in the host's local files will not change. The transaction log encryption parameters in the host's shared memory will be updated according to the transaction log encryption parameters in the host's local files, so as to avoid the transaction log encryption parameters in the host's shared memory changing after the host restarts, thereby reducing the risk of data loss.
[0091] S406. Update the transaction log encryption parameters in the shared memory of the original host using the transaction log encryption parameters in the original host's configuration file.
[0092] If the transaction log encryption parameters in the local files of the original host are invalid, the transaction log encryption parameters in the shared memory of the original host are updated using the transaction log encryption parameters in the original host's configuration file. Normally, the transaction log encryption parameters in the original host's configuration file are not modified during the original host's startup process. Using the transaction log encryption parameters in the original host's configuration file to update the transaction log encryption parameters in the shared memory reduces the risk of information loss.
[0093] S407: Control each process writing transaction logs on the original host to obtain transaction log encryption parameters from the shared memory of the original host.
[0094] The system controls each process writing transaction logs on the original host to retrieve transaction log encryption parameters only from the original host's shared memory, ensuring consistency in the encryption parameters across all processes. Since these processes do not modify the encryption parameters in the shared memory and all retrieve them from there, the same encryption parameters are read simultaneously across all processes. This ensures that transaction log encryption is enabled synchronously across all processes, preventing information leakage due to some processes failing to enable encryption.
[0095] S408: Control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host.
[0096] S409. After the original standby machine is switched to the new master machine, the processes that write transaction logs in the new master machine are controlled to obtain the transaction log encryption parameters from the shared memory of the new master machine.
[0097] Among them, step S408 and Figure 1 Step S101 in the embodiment is implemented in a similar manner, and step S409 is similar to... Figure 1 The implementation of step S102 in the embodiment is similar, and will not be repeated here.
[0098] The transaction log encryption parameter processing method provided in this application obtains the transaction log encryption parameters in the local file and the configuration file of the original host when the original host restarts. When the transaction log encryption parameters in the local file of the original host are valid, the transaction log encryption parameters in the shared memory of the original host are updated using the transaction log encryption parameters in the local file of the original host. When the transaction log encryption parameters in the local file of the original host are invalid, the transaction log encryption parameters in the shared memory of the original host are updated using the transaction log encryption parameters in the configuration file of the original host. This keeps the transaction log encryption parameters in the shared memory of the original host unchanged and reduces the risk of information leakage.
[0099] Figure 5 This illustration shows a schematic diagram of a processing device for transaction log encryption parameters according to an embodiment of this application. Figure 5 As shown, the transaction log encryption parameter processing device 10 of this embodiment is used to implement the operation corresponding to the electronic device in any of the above method embodiments. The transaction log encryption parameter processing device 10 of this embodiment includes:
[0100] The first control module 11 is used to control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host.
[0101] The second control module 12 is used to control each process writing transaction logs in the new host to obtain transaction log encryption parameters only from the shared memory of the new host after the original standby machine is switched to the new host.
[0102] The transaction log encryption parameter processing device 10 provided in this application embodiment can execute the above method embodiment. Its specific implementation principle and technical effect can be found in the above method embodiment, and will not be repeated here.
[0103] Figure 6 A schematic diagram of the hardware structure of an electronic device according to an embodiment of this application is shown. Figure 6 As shown, the electronic device 20 is used to implement the operation corresponding to the electronic device in any of the above method embodiments. The electronic device 20 in this embodiment may include: a memory 21, a processor 22, and a communication interface 23.
[0104] The memory 21 is used to store computer instructions. The memory 21 may include high-speed random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0105] Processor 22 is used to execute computer instructions stored in memory to implement the transaction log encryption parameter processing method in the above embodiments. For details, please refer to the relevant descriptions in the foregoing method embodiments. The processor 22 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0106] Alternatively, the memory 21 can be either standalone or integrated with the processor 22.
[0107] The communication interface 23 can be connected to the processor 22. The processor 22 can control the communication interface 23 to realize the functions of receiving and sending information.
[0108] The electronic device provided in this embodiment can be used to execute the above-described method for processing transaction log encryption parameters. Its implementation and technical effects are similar, and will not be described again here.
[0109] This application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, are used to implement the methods provided in the various embodiments described above.
[0110] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. At least one processor of the device can read the computer instructions from the computer-readable storage medium, and the at least one processor executes the computer instructions to cause the device to perform the methods provided in the various embodiments described above.
[0111] This application also provides a chip including a memory and a processor. The memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory, causing a device equipped with the chip to perform the methods described in the various possible embodiments described above.
[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for processing transaction log encryption parameters, characterized in that, The method includes: The system controls the primary and standby machines to read the transaction log encryption parameters from the transaction log of the primary host, and updates the transaction log encryption parameters in the shared memory of the primary and standby machines according to the transaction log encryption parameters from the transaction log of the primary host. After the original standby machine is switched to the new host, the processes controlling each transaction log writing process in the new host only obtain the transaction log encryption parameters from the shared memory of the new host. Specifically, updating the transaction log encryption parameters in the shared memory of the original standby machine based on the transaction log encryption parameters in the original host's transaction log includes: Update the transaction log encryption parameters in the local file and configuration file of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host; When the original standby machine is switched to the new host and the new host is restarted, the postmaster process in the new host is controlled to read the transaction log encryption parameters in the local files and configuration files of the new host; Determine whether the transaction log encryption parameters in the local file of the new host are valid; If so, update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the local file of the new host; If not, update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the new host's configuration file.
2. The method according to claim 1, characterized in that, The determination of whether the transaction log encryption parameters in the local file of the new host are valid specifically includes: Determine whether the transaction log encryption parameter in the local file of the new host is the value corresponding to enabling encryption.
3. The method according to claim 1, characterized in that, The method further includes: Modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enabling transaction log encryption; A reload signal is sent to the postmaster process on the original host to control the postmaster process to load the configuration file of the original host and update the transaction log encryption parameters in the shared memory of the original host according to the transaction log encryption parameters in the configuration file of the original host.
4. The method according to claim 3, characterized in that, The method further includes: Modify the transaction log encryption parameter in the original host's configuration file to the value corresponding to enabling transaction log encryption; A reload signal is sent to the postmaster process on the original host to control the postmaster process to load the configuration file of the original host and write the transaction log encryption parameters in the configuration file of the original host into the transaction log and local file of the original host. When the original host restarts, the postmaster process of the original host reads the transaction log encryption parameters in the local files and configuration files of the original host. Determine whether the transaction log encryption parameters in the local file of the original host are valid; If so, update the transaction log encryption parameters in the shared memory of the original host using the transaction log encryption parameters in the local file of the original host; If not, update the transaction log encryption parameters in the shared memory of the original host using the transaction log encryption parameters in the original host's configuration file.
5. The method according to claim 3 or 4, characterized in that, The method further includes: The processes controlling each write transaction log on the original host obtain the transaction log encryption parameters only from the shared memory of the original host.
6. The method according to claim 4, characterized in that, The determination of whether the transaction log encryption parameters in the local file of the original host are valid specifically includes: Determine whether the transaction log encryption parameter in the local file of the original host is the value corresponding to enabling encryption.
7. A processing device for transaction log encryption parameters, characterized in that, The device includes: The first control module is used to control the original standby machine to read the transaction log encryption parameters in the transaction log of the original host, and update the transaction log encryption parameters in the shared memory of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host. The second control module is used to control each process writing transaction logs in the new host to obtain transaction log encryption parameters only from the shared memory of the new host after the original standby machine is switched to the new host. Specifically, updating the transaction log encryption parameters in the shared memory of the original standby machine based on the transaction log encryption parameters in the original host's transaction log includes: Update the transaction log encryption parameters in the local file and configuration file of the original standby machine according to the transaction log encryption parameters in the transaction log of the original host; When the original standby machine is switched to the new host and the new host is restarted, the postmaster process in the new host is controlled to read the transaction log encryption parameters in the local files and configuration files of the new host; Determine whether the transaction log encryption parameters in the local file of the new host are valid; If so, update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the local file of the new host; If not, update the transaction log encryption parameters in the shared memory of the new host using the transaction log encryption parameters in the new host's configuration file.
8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the transaction log encryption parameter processing method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, which, when executed by a processor, are used to implement the method for processing transaction log encryption parameters as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Distributed cache system
CN107463598A
Host / standby switching method and device, computer equipment and storage medium
CN108762992A