Search

CN-122027269-A - Data processing method, device, electronic equipment and storage medium

CN122027269ACN 122027269 ACN122027269 ACN 122027269ACN-122027269-A

Abstract

The application provides a data processing method, a data processing device, electronic equipment and a storage medium. The method comprises the steps of receiving a service request and determining whether the service request carries a flow identifier, intercepting a database operation statement generated by executing the service request when the service request carries the flow identifier, wherein the database operation statement points to a formal data environment, rewriting operation objects in the database operation statement from the formal data environment to corresponding shadow data environments based on the flow identifier to generate a new database operation statement, and executing the new database operation statement to enable data operation generated by the service request to be executed in the shadow data environment. The method and the device realize test and verification by directly utilizing the real flow on the production environment service link, ensure the authenticity of a verification scene, and simultaneously improve the reliability and efficiency of verification on the premise of ensuring the safety of a production system through a data isolation mechanism.

Inventors

  • ZHOU GUOJING

Assignees

  • 北京奇艺世纪科技有限公司

Dates

Publication Date
20260512
Application Date
20260205

Claims (10)

  1. 1. A method of data processing, the method comprising: receiving a service request and determining whether the service request carries a flow identification; when the service request carries the flow identifier, intercepting a database operation statement generated by executing the service request, wherein the database operation statement points to a formal data environment; Rewriting the operation object in the database operation statement from the formal data environment to a corresponding shadow data environment based on the flow identification to generate a new database operation statement; And executing the new database operation statement so that the data operation generated by the service request is executed in the shadow data environment.
  2. 2. The method of claim 1, wherein the rewriting the operation objects in the database operation statement from the formal data environment to the corresponding shadow data environment based on the traffic identification to generate a new database operation statement comprises: analyzing the database operation statement into a grammar structure tree; traversing the syntax structure tree, locating a first object identifier from syntax nodes of the syntax structure tree for characterizing the formal data environment; And replacing the first object identifier with a second object identifier for representing the shadow data environment, and generating a new database operation statement according to the grammar structure tree with the replaced identifier.
  3. 3. The method of claim 2, further comprising, prior to said executing said new database operation statement: verifying whether the second object identifier belongs to a set of shadow objects that are allowed to be accessed; when the verification is passed, executing the new database operation statement; And when the verification is not passed, preventing the execution of the new database operation statement.
  4. 4. The method according to claim 1, wherein the method further comprises: When the service request is processed, storing the flow identification in a local storage bound with the current execution thread; And when the downstream service needs to be called to continue to process the service request, acquiring the flow identification from the local storage, and adding the flow identification into the context information of the first service call request initiated to the downstream service so that the downstream service can identify the service request according to the flow identification.
  5. 5. The method according to claim 1, wherein the method further comprises: intercepting a second service invocation request intended for the external service system by executing the service request in response to the traffic identification; Based on the flow identification and the type of the second service call request, generating response data simulating the success of the second service call request, and returning the response data; And generating a simulated event record based on the flow identification and the identification information of the second service call request, and storing the simulated event record into the shadow data environment.
  6. 6. The method according to claim 1, wherein the method further comprises: Acquiring a service policy to be issued corresponding to the flow identifier; Comparing and analyzing the effective conditions of the service policies to be distributed with the effective conditions of the effective service policies to obtain analysis results; And when the analysis result meets the safety release condition, marking the state of the service strategy to be released as a release-possible state.
  7. 7. The method of claim 6, wherein comparing the validation condition of the service policy to be issued with the validation condition of the validated service policy to obtain the analysis result comprises: Calculating an overlapping interval between the effective condition of the service policy to be issued and the effective condition of each effective service policy; Judging whether each overlapping interval has conflict or not according to a predefined strategy conflict rule; and generating the analysis result based on conflict judgment results of all the overlapped sections.
  8. 8. A data processing apparatus, the apparatus comprising: The receiving module is used for receiving the service request and determining whether the service request carries a flow identifier or not; the interception module is used for intercepting database operation sentences generated by executing the service request when the service request carries the flow identification, wherein the database operation sentences point to a formal data environment; The rewriting module is used for rewriting the operation objects in the database operation statement from the formal data environment to the corresponding shadow data environment based on the flow identification so as to generate a new database operation statement; And the execution module is used for executing the new database operation statement so as to enable the data operation generated by the service request to be executed in the shadow data environment.
  9. 9. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; a memory for storing a computer program; A processor for implementing the data processing method according to any one of claims 1 to 7 when executing a program stored on a memory.
  10. 10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the data processing method according to any of claims 1-7.

Description

Data processing method, device, electronic equipment and storage medium Technical Field The present application relates to the field of computer software technologies, and in particular, to a data processing method, a data processing device, an electronic device, and a storage medium. Background With the popularity of internet subscription services (e.g., video, music, software, i.e., services), automatic renewal has become a dominant business model. In order to reduce the user churn rate, service providers commonly adopt an automatic saving strategy based on real-time data decision, for example, when a user triggers a renewing operation, the service providers automatically issue preferential interests or display saving information according to the historical behaviors, portrait labels and cancelling reasons. Efficient operation of such policies relies on complex linkages and data exchanges between policy configuration centers, online business systems, databases, and multiple external service systems. Currently, one common practice in the industry to verify new policies or functional changes is to perform in a separate test environment that is physically isolated from the online production environment. The method comprises the specific processes that a strategy operator firstly creates and issues a new strategy in a configuration management background of a test environment, then, the tester simulates a user request through a tool, triggers business logic execution of the test environment, and observes system logs, database records and interface feedback to evaluate expected effects and system behaviors of the strategy. However, since the test environment in the prior art cannot completely reproduce the real data and complex scene of the production environment, the verification result is often misaligned. This makes it possible to face the risk of unexpected effects or the initiation of an online fault after the new strategy is brought online. Disclosure of Invention The embodiment of the application aims to provide a data processing method, a device, electronic equipment and a storage medium, which are used for solving the problem that in the prior art, a test environment cannot completely reproduce real data and complex scenes of a production environment, so that verification results are often inaccurate. The specific technical scheme is as follows: In a first aspect, the present application provides a data processing method, including: receiving a service request and determining whether the service request carries a flow identification; when the service request carries the flow identifier, intercepting a database operation statement generated by executing the service request, wherein the database operation statement points to a formal data environment; Rewriting the operation object in the database operation statement from the formal data environment to a corresponding shadow data environment based on the flow identification to generate a new database operation statement; And executing the new database operation statement so that the data operation generated by the service request is executed in the shadow data environment. In one possible implementation manner, the rewriting, based on the traffic identifier, the operation object in the database operation sentence from the formal data environment to the corresponding shadow data environment to generate a new database operation sentence includes: analyzing the database operation statement into a grammar structure tree; traversing the syntax structure tree, locating a first object identifier from syntax nodes of the syntax structure tree for characterizing the formal data environment; And replacing the first object identifier with a second object identifier for representing the shadow data environment, and generating a new database operation statement according to the grammar structure tree with the replaced identifier. In one possible implementation manner, before the executing the new database operation statement, the method further includes: verifying whether the second object identifier belongs to a set of shadow objects that are allowed to be accessed; when the verification is passed, executing the new database operation statement; And when the verification is not passed, preventing the execution of the new database operation statement. In one possible embodiment, the method further comprises: When the service request is processed, storing the flow identification in a local storage bound with the current execution thread; And when the downstream service needs to be called to continue to process the service request, acquiring the flow identification from the local storage, and adding the flow identification into the context information of the first service call request initiated to the downstream service so that the downstream service can identify the service request according to the flow identification. In one possible embodiment, the method further co