CN115809301B - Database processing method, device, electronic device and readable storage medium - Google Patents
Database processing method, device, electronic device and readable storage medium Download PDFInfo
- Publication number
- CN115809301B CN115809301B CN202310054559.1A CN202310054559A CN115809301B CN 115809301 B CN115809301 B CN 115809301B CN 202310054559 A CN202310054559 A CN 202310054559A CN 115809301 B CN115809301 B CN 115809301B
- Authority
- CN
- China
- Prior art keywords
- data
- server
- sub
- target
- lock
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 20
- 238000012545 processing Methods 0.000 claims abstract description 257
- 238000000034 method Methods 0.000 claims abstract description 59
- 230000008569 process Effects 0.000 claims description 20
- 238000012937 correction Methods 0.000 claims description 10
- 230000004044 response Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 3
- 238000004891 communication Methods 0.000 description 7
- 238000011084 recovery Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 235000019580 granularity Nutrition 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000003780 insertion Methods 0.000 description 2
- 230000037431 insertion Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000000429 assembly Methods 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本申请属于计算机技术领域,特别是涉及一种数据库处理方法、装置、电子设备及可读存储介质。The present application belongs to the field of computer technology, and in particular relates to a database processing method, device, electronic equipment and readable storage medium.
背景技术Background technique
分布式数据库是一种将数据存储在分布式服务器的不同数据子服务器上,而逻辑上是一个统一整体的数据库,客户端可以通过网络连接访问分布式数据库,对分布式数据库中的数据进行插入、更新、删除等操作。A distributed database is a database that stores data on different data sub-servers of a distributed server, and is logically a unified database. Clients can access the distributed database through a network connection and insert data in the distributed database. , update, delete and other operations.
现有技术中,分布式服务器的数据子服务器接收到客户端发送的数据处理请求,会直接通过查询分布式数据库找到客户端所请求处理的目标数据,并执行数据处理请求中的处理流程对目标数据进行操作。In the prior art, when the data sub-server of the distributed server receives the data processing request sent by the client, it will directly find the target data requested by the client by querying the distributed database, and execute the processing flow in the data processing request to target data to operate.
由于对分布式数据库中的目标数据进行处理之后,需要基于数据子服务器中与目标数据对应的锁资源,对不同数据子服务器上的目标数据进行同步处理。现有技术中在进行数据处理之后,可能会存在无法对不同数据子服务器上的目标数据进行同步处理,从而导致分布式数据库的数据不一致的问题。After the target data in the distributed database is processed, it is necessary to synchronize the target data on different data sub-servers based on the lock resources corresponding to the target data in the data sub-servers. In the prior art, after data processing, there may be a problem that the target data on different data sub-servers cannot be synchronously processed, resulting in data inconsistency in the distributed database.
发明内容Contents of the invention
本申请提供一种数据库处理方法、装置、电子设备及可读存储介质,以便解决无法对数据进行同步处理导致的分布式数据库数据不一致的问题。The present application provides a database processing method, device, electronic equipment, and readable storage medium, so as to solve the problem of data inconsistency in distributed databases caused by inability to synchronize data.
为了解决上述技术问题,本申请是这样实现的:In order to solve the above-mentioned technical problems, the application is implemented as follows:
第一方面,本申请提供一种数据库处理方法,应用于分布式服务器,所述分布式服务器上设置有分布式数据库,所述分布式服务器包括多个数据子服务器,所述方法包括:In a first aspect, the present application provides a method for processing a database, which is applied to a distributed server, the distributed server is provided with a distributed database, the distributed server includes a plurality of data sub-servers, and the method includes:
接收针对所述分布式数据库的数据处理请求,并根据所述数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数;所述目标数据是所述数据处理请求所请求处理的数据;Receive a data processing request for the distributed database, and determine lock resource parameters according to lock resource information associated with target data in the data processing request; the target data is the data requested to be processed by the data processing request ;
根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源;所述目标锁资源是与所述目标数据对应的锁资源;Acquiring target lock resources in the lock managers of each of the data sub-servers according to the lock resource parameters; the target lock resources are lock resources corresponding to the target data;
在成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,根据所述数据处理请求所指示的操作对所述目标数据进行指定处理。In the case of successfully acquiring the target lock resources in the lock managers of all the data sub-servers, perform specified processing on the target data according to the operation indicated by the data processing request.
可选的,所述数据处理请求包括数据处理代码;所述接收针对所述分布式数据库的数据处理请求,并根据所述数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数,包括:Optionally, the data processing request includes a data processing code; receiving the data processing request for the distributed database, and determining lock resource parameters according to the lock resource information associated with the target data in the data processing request ,include:
通过所述分布式服务器中的目标数据子服务器,接收针对所述分布式数据库的数据处理请求;receiving a data processing request for the distributed database through the target data sub-server in the distributed server;
基于所述目标数据子服务器对所述数据处理代码进行切面处理,以从所述数据处理代码中分离出锁资源子代码;performing aspect processing on the data processing code based on the target data sub-server, so as to separate the lock resource sub-code from the data processing code;
根据所述锁资源子代码中与目标数据相关联的锁资源信息,确定锁资源参数。Determine lock resource parameters according to lock resource information associated with the target data in the lock resource subcode.
可选的,所述根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源,包括:Optionally, the acquiring target lock resources in the lock managers of each of the data sub-servers according to the lock resource parameters includes:
根据所述锁资源参数,获取所述目标数据子服务器的锁管理器中的目标锁资源;Acquiring the target lock resource in the lock manager of the target data sub-server according to the lock resource parameter;
基于预设的协调服务组件中各所述数据子服务器对应的注册节点,将所述锁资源参数同步给所述多个数据子服务器中除所述目标数据子服务器以外的其他数据子服务器;Synchronize the lock resource parameters to other data sub-servers in the plurality of data sub-servers except the target data sub-server based on the preset registration nodes corresponding to the data sub-servers in the coordination service component;
对于任一所述其他数据子服务器,通过所述其他数据子服务器根据所述锁资源参数获取所述其他数据子服务器的锁管理器中的目标锁资源。For any of the other data sub-servers, the other data sub-server obtains the target lock resource in the lock manager of the other data sub-server according to the lock resource parameter.
可选的,所述基于预设的协调服务组件中各所述数据子服务器对应的注册节点,将所述锁资源参数同步给所述多个数据子服务器中除所述目标数据子服务器以外的其他数据子服务器,包括:Optionally, the registration node corresponding to each of the data sub-servers in the preset-based coordination service component synchronizes the lock resource parameters to all of the multiple data sub-servers except the target data sub-server Other data subservers, including:
建立所述目标数据子服务器与预设的协调服务组件中所述目标数据子服务器对应的注册节点的第一连接;Establishing a first connection between the target data sub-server and the registration node corresponding to the target data sub-server in the preset coordination service component;
基于所述目标数据子服务器将所述锁资源参数通过所述第一连接发送给所述协调服务组件;sending the lock resource parameter to the coordination service component through the first connection based on the target data sub-server;
对于任一所述其他数据子服务器,基于所述协调服务组件中所述其他数据子服务器对应的注册节点,将所述锁资源参数发送给所述其他数据子服务器。For any of the other data sub-servers, based on the registration node corresponding to the other data sub-servers in the coordination service component, the lock resource parameter is sent to the other data sub-servers.
可选的,所述根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源之前,所述方法还包括:Optionally, before acquiring the target lock resource in the lock manager of each data sub-server according to the lock resource parameter, the method further includes:
响应于所述数据处理请求,通过所述目标数据子服务器建立客户端与所述分布式数据库的第二连接;所述客户端是向所述目标数据子服务器发送所述数据处理请求的设备;In response to the data processing request, establishing a second connection between the client and the distributed database through the target data sub-server; the client is a device that sends the data processing request to the target data sub-server;
所述根据所述数据处理请求所指示的操作对所述目标数据进行指定处理,包括:The specified processing of the target data according to the operation indicated by the data processing request includes:
基于所述目标数据子服务器执行所述数据处理代码,以通过所述第二连接从所述客户端获取数据处理信息,并根据所述数据处理信息对所述分布式数据库中的所述目标数据进行指定处理;所述数据处理代码用于实现所述数据处理请求所指示的操作。Execute the data processing code based on the target data sub-server to obtain data processing information from the client through the second connection, and process the target data in the distributed database according to the data processing information Perform specified processing; the data processing code is used to implement the operation indicated by the data processing request.
可选的,所述方法还包括:Optionally, the method also includes:
在未成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,断开所述第二连接,以供其他客户端与所述分布式数据库建立连接并对所述分布式数据库中的数据进行处理。If the target lock resources in the lock managers of all the data sub-servers are not successfully obtained, the second connection is disconnected, so that other clients can establish a connection with the distributed database and update the distributed database. Data in the database is processed.
可选的,所述分布式服务器还包括备份子服务器,所述方法还包括:Optionally, the distributed server also includes a backup sub-server, and the method also includes:
在所述备份子服务器中的计时参数符合预设时间要求的情况下,通过所述备份子服务器获取各所述数据子服务器的操作日志,并将获得的操作日志存储在所述备份子服务器中;When the timing parameters in the backup sub-server meet the preset time requirements, obtain the operation logs of each of the data sub-servers through the backup sub-server, and store the obtained operation logs in the backup sub-server ;
在所述备份子服务器存储的操作日志中存在错误日志的情况下,基于所述备份子服务器对所述错误日志对应的数据子服务器中的数据进行纠错。If there is an error log in the operation log stored by the backup sub-server, the data in the data sub-server corresponding to the error log is corrected based on the backup sub-server.
可选的,所述基于所述备份子服务器对所述错误日志对应的数据子服务器中的数据进行纠错,包括:Optionally, the error correction of the data in the data sub-server corresponding to the error log based on the backup sub-server includes:
基于所述备份子服务器,根据所述错误日志确定错误数据,并将存储所述错误数据的数据子服务器确定为第一数据子服务器;Based on the backup sub-server, determine error data according to the error log, and determine the data sub-server storing the error data as the first data sub-server;
根据所述错误数据,选择存储有所述错误数据对应的正确数据的一个数据子服务器,作为第二数据子服务器;Selecting a data sub-server storing correct data corresponding to the erroneous data as a second data sub-server according to the erroneous data;
基于所述备份子服务器,获取所述第二数据子服务器中的所述正确数据,并将所述第一数据子服务器中的所述错误数据替换为所述正确数据。Based on the backup sub-server, acquire the correct data in the second data sub-server, and replace the erroneous data in the first data sub-server with the correct data.
第二方面,本申请提供一种数据库处理装置,应用于分布式服务器,所述分布式服务器上设置有分布式数据库,所述分布式服务器包括多个数据子服务器,所述装置包括:In a second aspect, the present application provides a database processing device, which is applied to a distributed server, the distributed server is provided with a distributed database, the distributed server includes a plurality of data sub-servers, and the device includes:
确定模块,用于接收针对所述分布式数据库的数据处理请求,并根据所述数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数;所述目标数据是所述数据处理请求所请求处理的数据;A determining module, configured to receive a data processing request for the distributed database, and determine lock resource parameters according to lock resource information associated with target data in the data processing request; the target data is the data processing request the data requested to be processed;
获取模块,用于根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源;所述目标锁资源是与所述目标数据对应的锁资源;An acquisition module, configured to acquire a target lock resource in the lock manager of each of the data sub-servers according to the lock resource parameter; the target lock resource is a lock resource corresponding to the target data;
处理模块,用于在成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,根据所述数据处理请求所指示的操作对所述目标数据进行指定处理。The processing module is configured to perform specified processing on the target data according to the operation indicated by the data processing request when the target lock resources in the lock managers of all the data sub-servers are successfully acquired.
可选的,所述数据处理请求包括数据处理代码;所述确定模块具体用于:Optionally, the data processing request includes a data processing code; the determining module is specifically used for:
通过所述分布式服务器中的目标数据子服务器,接收针对所述分布式数据库的数据处理请求;receiving a data processing request for the distributed database through the target data sub-server in the distributed server;
基于所述目标数据子服务器对所述数据处理代码进行切面处理,以从所述数据处理代码中分离出锁资源子代码;performing aspect processing on the data processing code based on the target data sub-server, so as to separate the lock resource sub-code from the data processing code;
根据所述锁资源子代码中与目标数据相关联的锁资源信息,确定锁资源参数。Determine lock resource parameters according to lock resource information associated with the target data in the lock resource subcode.
可选的,所述获取模块具体用于:Optionally, the acquiring module is specifically used for:
根据所述锁资源参数,获取所述目标数据子服务器的锁管理器中的目标锁资源;Acquiring the target lock resource in the lock manager of the target data sub-server according to the lock resource parameter;
基于预设的协调服务组件中各所述数据子服务器对应的注册节点,将所述锁资源参数同步给所述多个数据子服务器中除所述目标数据子服务器以外的其他数据子服务器;Synchronize the lock resource parameters to other data sub-servers in the plurality of data sub-servers except the target data sub-server based on the preset registration nodes corresponding to the data sub-servers in the coordination service component;
对于任一所述其他数据子服务器,通过所述其他数据子服务器根据所述锁资源参数获取所述其他数据子服务器的锁管理器中的目标锁资源。For any of the other data sub-servers, the other data sub-server obtains the target lock resource in the lock manager of the other data sub-server according to the lock resource parameter.
可选的,所述获取模块具体还用于:Optionally, the acquisition module is also specifically used for:
建立所述目标数据子服务器与预设的协调服务组件中所述目标数据子服务器对应的注册节点的第一连接;Establishing a first connection between the target data sub-server and the registration node corresponding to the target data sub-server in the preset coordination service component;
基于所述目标数据子服务器将所述锁资源参数通过所述第一连接发送给所述协调服务组件;sending the lock resource parameter to the coordination service component through the first connection based on the target data sub-server;
对于任一所述其他数据子服务器,基于所述协调服务组件中所述其他数据子服务器对应的注册节点,将所述锁资源参数发送给所述其他数据子服务器。For any of the other data sub-servers, based on the registration node corresponding to the other data sub-servers in the coordination service component, the lock resource parameter is sent to the other data sub-servers.
可选的,所述装置还包括:Optionally, the device also includes:
连接模块,用于所述获取模块根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源之前,响应于所述数据处理请求,通过所述目标数据子服务器建立客户端与所述分布式数据库的第二连接;所述客户端是向所述目标数据子服务器发送所述数据处理请求的设备;The connection module is used for the acquisition module to establish through the target data sub-server in response to the data processing request before acquiring the target lock resource in the lock manager of each of the data sub-servers according to the lock resource parameters. A second connection between the client and the distributed database; the client is a device that sends the data processing request to the target data sub-server;
所述处理模块具体用于:基于所述目标数据子服务器执行所述数据处理代码,以通过所述第二连接从所述客户端获取数据处理信息,并根据所述数据处理信息对所述分布式数据库中的所述目标数据进行指定处理;所述数据处理代码用于实现所述数据处理请求所指示的操作。The processing module is specifically configured to: execute the data processing code based on the target data sub-server, so as to obtain data processing information from the client through the second connection, and process the distribution according to the data processing information. The specified processing is performed on the target data in the database; the data processing code is used to implement the operation indicated by the data processing request.
可选的,所述装置还包括:Optionally, the device also includes:
断开模块,用于在未成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,断开所述第二连接,以供其他客户端与所述分布式数据库建立连接并对所述分布式数据库中的数据进行处理。A disconnection module, configured to disconnect the second connection when the target lock resources in the lock managers of all the data sub-servers are not successfully obtained, so that other clients can establish with the distributed database Connect and process the data in the distributed database.
可选的,所述分布式服务器还包括备份子服务器,所述装置还包括:Optionally, the distributed server also includes a backup sub-server, and the device also includes:
存储模块,用于在所述备份子服务器中的计时参数符合预设时间要求的情况下,通过所述备份子服务器获取各所述数据子服务器的操作日志,并将获得的操作日志存储在所述备份子服务器中;A storage module, configured to obtain the operation logs of each of the data sub-servers through the backup sub-server when the timing parameters in the backup sub-server meet the preset time requirements, and store the obtained operation logs in the in the backup subserver;
纠错模块,用于在所述备份子服务器存储的操作日志中存在错误日志的情况下,基于所述备份子服务器对所述错误日志对应的数据子服务器中的数据进行纠错。The error correction module is configured to correct the data in the data sub-server corresponding to the error log based on the backup sub-server when there is an error log in the operation log stored in the backup sub-server.
可选的,所述纠错模块具体用于:Optionally, the error correction module is specifically used for:
基于所述备份子服务器,根据所述错误日志确定错误数据,并将存储所述错误数据的数据子服务器确定为第一数据子服务器;Based on the backup sub-server, determine error data according to the error log, and determine the data sub-server storing the error data as the first data sub-server;
根据所述错误数据,选择存储有所述错误数据对应的正确数据的一个数据子服务器,作为第二数据子服务器;Selecting a data sub-server storing correct data corresponding to the erroneous data as a second data sub-server according to the erroneous data;
基于所述备份子服务器,获取所述第二数据子服务器中的所述正确数据,并将所述第一数据子服务器中的所述错误数据替换为所述正确数据。Based on the backup sub-server, acquire the correct data in the second data sub-server, and replace the erroneous data in the first data sub-server with the correct data.
第三方面,本申请提供一种电子设备,包括:处理器、存储器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述程序时实现上述数据库处理方法。In a third aspect, the present application provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and operable on the processor, and the above-mentioned database is realized when the processor executes the program Approach.
第四方面,本申请提供一种可读存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行上述数据库处理方法。In a fourth aspect, the present application provides a readable storage medium. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the above database processing method.
在本申请实施例中,通过接收针对分布式数据库的数据处理请求,并根据数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数;目标数据是数据处理请求所请求处理的数据;根据锁资源参数,获取各数据子服务器的锁管理器中的目标锁资源;目标锁资源是与目标数据对应的锁资源;在成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,根据数据处理请求所指示的操作对目标数据进行指定处理。对于分布式数据库,由于网络错误或系统错误可能导致不同数据子服务器的锁资源存在差异,例如,有些数据子服务器的锁管理器中的锁资源包括目标锁资源,而有些数据子服务器的锁管理器中的锁资源不包括目标锁资源。由于对不同数据子服务器上的目标数据进行同步处理时,需要用到各数据子服务器上的目标数据对应的目标锁资源,在有些数据子服务器的锁管理器中的锁资源包括目标锁资源,而有些数据子服务器的锁管理器中的锁资源中不包括目标锁资源的情况下,就会导致无法对不同数据子服务器上的目标数据进行同步处理,从而导致分布式数据库的数据不一致的问题。本申请实施例中,在成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,才根据数据处理请求所指示的操作对目标数据进行指定处理。这样,可以避免后续进行同步处理时,由于不同数据子服务器的锁资源存在差异,即,有些数据子服务器的锁管理器中存在目标锁资源,而有些数据子服务器的锁管理器中不存在目标锁资源,导致无法对不同数据子服务器上的目标数据进行同步处理,从而确保分布式数据库的数据一致。In the embodiment of the present application, by receiving a data processing request for a distributed database, and according to the lock resource information associated with the target data in the data processing request, the lock resource parameters are determined; the target data is the data requested to be processed by the data processing request ;According to the lock resource parameters, obtain the target lock resource in the lock manager of each data sub-server; the target lock resource is the lock resource corresponding to the target data; successfully obtain the target lock resource in the lock manager of all data sub-servers In the case of , the specified processing is performed on the target data according to the operation indicated by the data processing request. For distributed databases, due to network errors or system errors, there may be differences in the lock resources of different data sub-servers. For example, the lock resources in the lock manager of some data sub-servers include target lock resources, while the lock management of some data sub-servers The lock resources in the server do not include the target lock resources. Because when synchronizing the target data on different data sub-servers, the target lock resources corresponding to the target data on each data sub-server need to be used. The lock resources in the lock manager of some data sub-servers include target lock resources. However, if the lock resource in the lock manager of some data sub-servers does not include the target lock resource, it will not be possible to synchronize the target data on different data sub-servers, resulting in data inconsistency in the distributed database. . In the embodiment of the present application, only when the target lock resources in the lock managers of all data sub-servers are successfully acquired, the target data is specified and processed according to the operation indicated by the data processing request. In this way, it can avoid the difference in lock resources of different data sub-servers during subsequent synchronization processing, that is, there are target lock resources in the lock managers of some data sub-servers, while there are no target lock resources in the lock managers of some data sub-servers. Lock resources, resulting in the inability to synchronize target data on different data sub-servers, thereby ensuring data consistency in distributed databases.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present application. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1是本申请实施例提供的一种数据库处理方法的步骤流程图;Fig. 1 is a flow chart of the steps of a database processing method provided in the embodiment of the present application;
图2是本申请实施例提供的一种数据库处理方法的应用场景示意图;FIG. 2 is a schematic diagram of an application scenario of a database processing method provided in an embodiment of the present application;
图3是本申请实施例提供的另一种数据库处理方法的步骤流程图;Fig. 3 is a flow chart of steps of another database processing method provided by the embodiment of the present application;
图4是本申请实施例提供的一种数据库处理装置的结构图;FIG. 4 is a structural diagram of a database processing device provided in an embodiment of the present application;
图5是本申请实施例提供的一种电子设备的结构图。FIG. 5 is a structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
图1是本申请实施例提供的一种数据库处理方法的步骤流程图,如图1所示,该方法应用于分布式服务器,所述分布式服务器上设置有分布式数据库,所述分布式服务器包括多个数据子服务器,所述方法包括:Fig. 1 is a flow chart of the steps of a database processing method provided by the embodiment of the present application. As shown in Fig. 1, the method is applied to a distributed server, and a distributed database is arranged on the distributed server, and the distributed server comprising a plurality of data sub-servers, the method comprising:
步骤101,接收针对所述分布式数据库的数据处理请求,并根据所述数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数;所述目标数据是所述数据处理请求所请求处理的数据。
本申请实施例中,分布式服务器是指包括分布于不同地理位置的多个子服务器的服务器设备集群。数据子服务器是指分布式服务器包括的多个子服务器中用于存储分布式数据库的数据的子服务器。数据处理请求可以是访问分布式数据库的计算机设备发送的网络数据包,该网络数据包中含有与目标数据相关联的锁资源信息。其中,访问分布式数据库的计算机设备可以是客户端或者转发客户端发送的数据处理请求的代理服务器,代理服务器与分布式服务器连接,作为客户端与分布式服务器的中间层,用于接收和转发客户端发送给分布式服务器的数据处理请求。In this embodiment of the present application, a distributed server refers to a server device cluster including multiple sub-servers distributed in different geographic locations. The data sub-server refers to a sub-server for storing data of the distributed database among the multiple sub-servers included in the distributed server. The data processing request may be a network data packet sent by a computer device accessing the distributed database, and the network data packet contains lock resource information associated with the target data. Among them, the computer equipment that accesses the distributed database can be a client or a proxy server that forwards the data processing request sent by the client. The proxy server is connected to the distributed server and acts as an intermediate layer between the client and the distributed server for receiving and forwarding The data processing request sent by the client to the distributed server.
本申请实施例中,锁资源参数可以是例如分布式数据库中锁资源对应的数据库主键、数据库的库名和表名等,锁资源信息可以包括目标数据对应的锁资源相关的数据库主键、数据库的库名和表名等信息,此处仅是举例说明,本申请实施例对此不做限制。其中,数据库主键指的是分布式数据库中数据表的每一行对应的标识值的一个列或多列组合,数据库的库名和表名分别指的是分布式数据库的各子数据库的标识和子数据库中数据表的标识。In this embodiment of the application, the lock resource parameter can be, for example, the database primary key corresponding to the lock resource in the distributed database, the library name and table name of the database, etc., and the lock resource information can include the database primary key related to the lock resource corresponding to the target data, the database library The information such as name and table name is just an example here, and this embodiment of the present application does not limit it. Among them, the primary key of the database refers to a column or a combination of multiple columns corresponding to each row of the data table in the distributed database, and the library name and table name of the database refer to the identification of each sub-database of the distributed database and The ID of the data table.
本申请实施例中,分布式服务器可以接收计算机设备例如客户端或者代理服务器,发送给分布式服务器的其中一个数据子服务器的数据处理请求。其中,数据处理请求可以是计算机设备基于自身对于分布式数据库中的数据的处理需求生成的,例如计算机设备需要对分布式数据库中的某些数据进行查询、更新、删除操作,或者需要在分布式数据库中插入数据等,根据所需处理的数据、需要执行的数据处理操作,以及分布式数据库中的数据对应的锁资源的相关信息生成数据处理请求。此处仅是举例说明,本申请实施例对此不做限制。In this embodiment of the present application, the distributed server may receive a data processing request sent by a computer device such as a client or a proxy server to one of the data sub-servers of the distributed server. Among them, the data processing request can be generated by the computer device based on its own processing requirements for the data in the distributed database. For example, the computer device needs to query, update, and delete certain data in the distributed Insert data into the database, etc., and generate a data processing request according to the data to be processed, the data processing operations to be performed, and the relevant information of the lock resource corresponding to the data in the distributed database. This is only for illustration, and this embodiment of the present application does not limit it.
本申请实施例中,分布式服务器在接收到数据处理请求后,可以对数据处理请求对应的网络数据包进行解析,获取网络数据包中与锁资源相关的一部分数据,即与目标数据相关联的锁资源信息,例如,数据库主键、数据库的库名和表名等信息,然后,将锁资源信息对应的实际数值作为锁资源参数。In this embodiment of the application, after the distributed server receives the data processing request, it can analyze the network data packet corresponding to the data processing request, and obtain a part of data related to the lock resource in the network data packet, that is, the data associated with the target data. Lock resource information, for example, information such as database primary key, database library name and table name, and then use the actual value corresponding to the lock resource information as the lock resource parameter.
步骤102,根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源;所述目标锁资源是与所述目标数据对应的锁资源。
本申请实施例中,可以将分布式数据库中的所有数据对应的全部锁资源集合成一个整体放在分布式锁管理器中进行管理,其中,分布式锁管理器在分布式服务器的每个数据子服务器上都存储有分布式锁管理器的映像,并将该映像作为数据子服务器的锁管理器。对于任一数据子服务器,可以将锁管理器对应的程序代码存储在该数据子服务器的内存中,通过该数据子服务器的中央处理器(Central Processing Unit, CPU)读取内存中锁管理器对应的程序代码调用锁管理器。In the embodiment of this application, all the lock resources corresponding to all the data in the distributed database can be integrated into a whole and managed in the distributed lock manager. The image of the distributed lock manager is stored on the subservers, and the image is used as the lock manager of the data subserver. For any data sub-server, the program code corresponding to the lock manager can be stored in the memory of the data sub-server, and the data corresponding to the lock manager in the memory can be read through the central processing unit (Central Processing Unit, CPU) of the data sub-server. The program code calls the lock manager.
本申请实施例中,对于任一数据子服务器的锁管理器,可以根据锁资源参数查找锁管理器中与该锁资源参数相匹配的锁资源,并获取实际参数与该锁资源参数一致的锁资源,得到目标锁资源。具体的,可以通过锁资源参数中的关键字查找锁管理器中目标关键字与查找的关键字匹配的锁资源,并比较锁资源的实际数值与锁资源参数对应的数值是否一致,若目标关键字与查找的关键字匹配且数值一致,则找到的锁资源是目标数据对应的目标锁资源。In this embodiment of the application, for the lock manager of any data sub-server, the lock resource matching the lock resource parameter in the lock manager can be searched according to the lock resource parameter, and the lock whose actual parameter is consistent with the lock resource parameter can be obtained. resource, get the target lock resource. Specifically, you can use the keyword in the lock resource parameter to find the lock resource whose target keyword matches the searched keyword in the lock manager, and compare whether the actual value of the lock resource is consistent with the value corresponding to the lock resource parameter. If the target key If the word matches the search keyword and the values are consistent, the found lock resource is the target lock resource corresponding to the target data.
步骤103,在成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,根据所述数据处理请求所指示的操作对所述目标数据进行指定处理。
本申请实施例中,锁管理器是分布式锁管理器存储在任一数据子服务器中的映像,锁管理器中包含分布式数据库的所有数据对应的锁资源。对于任一目标数据,每一个数据子服务器的锁管理器中都有该目标数据对应的目标锁资源,即使目标数据没有存储在所有的数据子服务器上,只存储在其中一个或多个数据子服务器上。因此,成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况,表示获取到了存储有目标数据的所有数据子服务器的全部锁资源,保证各数据子服务器上目标数据对应的目标锁资源同步被获取。In the embodiment of the present application, the lock manager is an image of the distributed lock manager stored in any data sub-server, and the lock manager includes lock resources corresponding to all data of the distributed database. For any target data, the lock manager of each data sub-server has a target lock resource corresponding to the target data, even if the target data is not stored in all data sub-servers, only one or more of them on the server. Therefore, the successful acquisition of the target lock resources in the lock managers of all data sub-servers means that all lock resources of all data sub-servers storing target data have been obtained, ensuring that the target locks corresponding to the target data on each data sub-server Resource synchronization is acquired.
本申请实施例中,在成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,可以根据数据处理请求所指示的操作通过分布式服务器中存储有目标数据的数据子服务器执行相应的插入、更新、删除等代码,分别对各存储有目标数据的数据子服务器上设置的分布式数据库的子数据库中的数据进行插入、更新、删除等指定处理,完成数据处理请求所指示的操作。In the embodiment of this application, if the target lock resources in the lock managers of all data sub-servers are successfully acquired, the operation indicated by the data processing request can be executed by the data sub-servers storing the target data in the distributed server Corresponding insert, update, delete, etc. codes respectively perform specified processing on the data in the sub-databases of the distributed database set on the data sub-servers storing the target data, such as insert, update, delete, etc., and complete the data processing request operate.
具体的,可以基于分布式服务器中接收数据处理请求的数据子服务器运行数据处理操作的代码,通过分布式服务器中各数据子服务器的通信网络,向存储有目标数据的数据子服务器发送数据处理指令,以指示各存储有目标数据的数据子服务器根据数据处理指令对各自的子数据库中的目标数据执行插入、更新、删除等指定处理,使得分布式数据库中的目标数据同步被处理,可以避免任一存储有目标数据的数据子服务器上的目标数据与其他存储有目标数据的数据子服务器上经过处理后的目标数据不一致的问题。例如,数据处理请求指示对分布式数据库中存储的设备台账中的某设备的数量进行更新,则分布式服务器可以通过接收数据处理请求的数据子服务器运行数据更新操作对应的数据库语言(Structured Query Language,SQL) ,同时对存储有某设备数量的数据子服务器上的设备数量值进行更新,或者可以依次对存储有某设备数量的数据子服务器上的设备数量值进行更新,此处仅是举例说明,本申请实施例对此不做限制。Specifically, the data processing operation code can be run based on the data sub-server receiving the data processing request in the distributed server, and send a data processing instruction to the data sub-server storing the target data through the communication network of each data sub-server in the distributed server , to instruct each data sub-server storing the target data to perform specified processing such as insertion, update, and deletion on the target data in their respective sub-databases according to the data processing instructions, so that the target data in the distributed database is processed synchronously, which can avoid any A problem that the target data on the data sub-server storing the target data is inconsistent with the processed target data on other data sub-servers storing the target data. For example, if the data processing request indicates to update the quantity of a certain device in the device ledger stored in the distributed database, the distributed server can run the database language (Structured Query) corresponding to the data update operation through the data sub-server receiving the data processing request. Language, SQL), at the same time, update the value of the number of devices on the data sub-server that stores a certain number of devices, or update the value of the number of devices on the data sub-server that stores a certain number of devices in turn, here is just an example It should be noted that this embodiment of the present application does not limit this.
在本申请实施例中,通过接收针对分布式数据库的数据处理请求,并根据数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数;目标数据是数据处理请求所请求处理的数据;根据锁资源参数,获取各数据子服务器的锁管理器中的目标锁资源;目标锁资源是与目标数据对应的锁资源;在成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,根据数据处理请求所指示的操作对目标数据进行指定处理。对于分布式数据库,由于网络错误或系统错误可能导致不同数据子服务器的锁资源存在差异,例如,有些数据子服务器的锁管理器中的锁资源包括目标锁资源,而有些数据子服务器的锁管理器中的锁资源不包括目标锁资源。由于对不同数据子服务器上的目标数据进行同步处理时,需要用到各数据子服务器上的目标数据对应的目标锁资源,在有些数据子服务器的锁管理器中的锁资源包括目标锁资源,而有些数据子服务器的锁管理器中的锁资源中不包括目标锁资源的情况下,就会导致无法对不同数据子服务器上的目标数据进行同步处理,从而导致分布式数据库的数据不一致的问题。本申请实施例中,在成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,才根据数据处理请求所指示的操作对目标数据进行指定处理。这样,可以避免后续进行同步处理时,由于不同数据子服务器的锁资源存在差异,即,有些数据子服务器的锁管理器中存在目标锁资源,而有些数据子服务器的锁管理器中不存在目标锁资源,导致无法对不同数据子服务器上的目标数据进行同步处理,从而确保分布式数据库的数据一致。In the embodiment of the present application, by receiving a data processing request for a distributed database, and according to the lock resource information associated with the target data in the data processing request, the lock resource parameters are determined; the target data is the data requested to be processed by the data processing request ;According to the lock resource parameters, obtain the target lock resource in the lock manager of each data sub-server; the target lock resource is the lock resource corresponding to the target data; successfully obtain the target lock resource in the lock manager of all data sub-servers In the case of , the specified processing is performed on the target data according to the operation indicated by the data processing request. For distributed databases, due to network errors or system errors, there may be differences in the lock resources of different data sub-servers. For example, the lock resources in the lock manager of some data sub-servers include target lock resources, while the lock management of some data sub-servers The lock resources in the server do not include the target lock resources. Because when synchronizing the target data on different data sub-servers, the target lock resources corresponding to the target data on each data sub-server need to be used. The lock resources in the lock manager of some data sub-servers include target lock resources. However, if the lock resource in the lock manager of some data sub-servers does not include the target lock resource, it will not be possible to synchronize the target data on different data sub-servers, resulting in data inconsistency in the distributed database. . In the embodiment of the present application, only when the target lock resources in the lock managers of all data sub-servers are successfully obtained, the target data is specified and processed according to the operation indicated by the data processing request. In this way, it can avoid the difference in the lock resources of different data sub-servers during subsequent synchronization processing, that is, some data sub-servers have target lock resources in the lock manager, while some data sub-servers do not have target lock resources in the lock manager. Lock resources, resulting in the inability to synchronize target data on different data sub-servers, thereby ensuring data consistency in distributed databases.
可选的,所述数据处理请求包括数据处理代码;步骤101可以包括以下步骤:Optionally, the data processing request includes a data processing code;
步骤1011,通过所述分布式服务器中的目标数据子服务器,接收针对所述分布式数据库的数据处理请求。Step 1011, receiving a data processing request for the distributed database through the target data sub-server in the distributed server.
本申请实施例中,分布式服务器可以包括分布在不同地理位置的多个数据子服务器,分布式服务器可以通过所包含的各数据子服务器接收计算机设备发送的针对分布式数据库的数据处理请求。其中,计算机设备可以直接发送数据处理请求给分布式服务器的数据子服务器,则接收数据处理请求的数据子服务器为目标数据子服务器。分布式服务器可以通过目标数据子服务器接收计算机设备发送的针对分布式数据库的数据处理请求,则目标数据子服务器成为计算机设备此次访问分布式数据库的连接节点,分布式服务器可以基于此连接节点对设置在各数据子服务器上的分布式数据库进行访问控制。In the embodiment of the present application, the distributed server may include multiple data sub-servers distributed in different geographical locations, and the distributed server may receive the data processing request for the distributed database sent by the computer device through each included data sub-server. Wherein, the computer device can directly send the data processing request to the data sub-server of the distributed server, and the data sub-server receiving the data processing request is the target data sub-server. The distributed server can receive the data processing request for the distributed database sent by the computer device through the target data sub-server, then the target data sub-server becomes the connection node for the computer device to access the distributed database this time, and the distributed server can use this connection node to Distributed databases set on each data sub-server for access control.
步骤1012,基于所述目标数据子服务器对所述数据处理代码进行切面处理,以从所述数据处理代码中分离出锁资源子代码。Step 1012, perform aspect processing on the data processing code based on the target data sub-server, so as to separate the lock resource sub-code from the data processing code.
本申请实施例中,数据处理代码可以是数据处理请求对应的网络数据包中的有关数据处理操作的数据库程序语言,数据处理代码包括目标数据对应的锁资源获取部分代码和目标数据处理部分代码。其中,目标数据处理部分代码可以是例如插入、更新、删除操作对应的insert、update、delete的SQL语句。锁资源获取部分代码即锁资源子代码,可以包括锁资源信息以及锁冲突、锁等待的处理逻辑等。In the embodiment of the present application, the data processing code may be a database programming language related to data processing operations in the network data packet corresponding to the data processing request, and the data processing code includes the lock resource acquisition part code corresponding to the target data and the target data processing part code. Wherein, the code of the target data processing part may be, for example, SQL statements of insert, update, and delete corresponding to insert, update, and delete operations. The lock resource acquisition part code is the lock resource subcode, which may include lock resource information, lock conflict, lock waiting processing logic, etc.
本申请实施例中,切面处理指的是对于封装好的代码进行切割,在原有代码里面添加一些新的代码对原有的代码进行增强处理。可以由目标数据子服务器通过在目标数据子服务器中运行切面程序语言对数据处理代码进行切割,在数据处理代码中添加分离代码,并通过分离代码查找数据处理代码中的锁资源子代码,以及从数据处理代码中提取出锁资源子代码,从而实现从数据处理代码中分离出锁资源子代码的操作。具体的,可以通过Java开发平台上开源应用工具的切面(Aspect)模块对数据处理代码进行切面处理,以从数据处理代码中分离出锁资源子代码。此处仅是举例说明,本申请实施例对此不做限制。In the embodiment of the present application, section processing refers to cutting the packaged code, and adding some new code to the original code to enhance the original code. The target data sub-server can cut the data processing code by running the aspect program language in the target data sub-server, add separation code in the data processing code, and find the lock resource sub-code in the data processing code through the separation code, and from The lock resource subcode is extracted from the data processing code, thereby realizing the operation of separating the lock resource subcode from the data processing code. Specifically, the aspect module of the open source application tool on the Java development platform can be used to perform aspect processing on the data processing code, so as to separate the lock resource subcode from the data processing code. This is only for illustration, and this embodiment of the present application does not limit it.
步骤1013,根据所述锁资源子代码中与目标数据相关联的锁资源信息,确定锁资源参数。Step 1013: Determine lock resource parameters according to the lock resource information associated with the target data in the lock resource subcode.
本申请实施例中,可以由目标数据子服务器对锁资源子代码进行解析,获取锁资源子代码中与获取目标数据对应的锁资源相关的代码语句,代码语句中包含的锁资源信息即与目标数据相关联的锁资源信息,例如数据库主键、数据库的库名和表名等信息,然后,将锁资源信息对应的实际数值确定为锁资源参数。In the embodiment of this application, the target data sub-server can analyze the lock resource sub-code, and obtain the code statement related to the lock resource corresponding to the acquired target data in the lock resource sub-code, and the lock resource information contained in the code statement is related to the target The lock resource information associated with the data, such as database primary key, database name and table name, etc., and then, the actual value corresponding to the lock resource information is determined as the lock resource parameter.
需要说明的是,分布式数据库对应的锁资源具有不同的锁级别,也称不同的锁粒度,获取不同的锁粒度的情况下分布式数据库的数据处理效率不同,获取较小粒度的锁资源后,分布式数据库所在的分布式服务器中各数据子服务器对应的每秒查询率(QueriesPer Second,QPS )和每秒事务数 (TransactionsPerSecond,TPS)明显提高,从而提高分布式数据库的数据处理效率。It should be noted that the lock resources corresponding to distributed databases have different lock levels, also known as different lock granularities. The data processing efficiency of distributed databases is different when different lock granularities are acquired. After acquiring lock resources with smaller granularity , the query rate per second (QueriesPer Second, QPS) and the number of transactions per second (TransactionsPerSecond, TPS) corresponding to each data sub-server in the distributed server where the distributed database is located are significantly improved, thereby improving the data processing efficiency of the distributed database.
本申请实施例中,通过对数据处理代码进行切面处理,并从数据处理代码中分离出锁资源子代码,可以根据锁资源子代码中与目标数据相关联的锁资源信息,确定更小粒度的锁资源对应的锁资源参数。In the embodiment of this application, by performing face-to-face processing on the data processing code and separating the lock resource subcode from the data processing code, the lock resource information associated with the target data in the lock resource subcode can be used to determine the lock resource information of a smaller granularity. Lock resource parameters corresponding to the lock resource.
在本申请实施例中,通过分布式服务器中的目标数据子服务器,接收针对分布式数据库的数据处理请求;基于目标数据子服务器对数据处理代码进行切面处理,以从数据处理代码中分离出锁资源子代码;根据锁资源子代码中与目标数据相关联的锁资源信息,确定锁资源参数。这样,可以方便地基于目标数据子服务器接收针对分布式数据库的数据处理请求,提高分布式数据库的响应速度,且由于对数据处理代码进行切面处理后分离出锁资源子代码,因此锁资源子代码中与目标数据相关联的锁资源信息更加细致,使得根据锁资源信息确定的锁资源参数对应的锁资源粒度更小,进一步地,使得分布式服务器获得的目标锁资源更加准确,从而提高分布式服务器的锁资源获取效率。In the embodiment of the present application, the data processing request for the distributed database is received through the target data sub-server in the distributed server; based on the target data sub-server, the data processing code is aspect-processed to separate the lock from the data processing code. The resource subcode; determine the lock resource parameters according to the lock resource information associated with the target data in the lock resource subcode. In this way, the data processing request for the distributed database can be conveniently received based on the target data sub-server, and the response speed of the distributed database can be improved, and since the lock resource subcode is separated after the data processing code is cut, the lock resource subcode The lock resource information associated with the target data is more detailed, so that the lock resource granularity corresponding to the lock resource parameters determined according to the lock resource information is smaller, and further, the target lock resource obtained by the distributed server is more accurate, thereby improving the distributed The server's lock resource acquisition efficiency.
可选的,步骤102可以包括以下步骤:Optionally,
步骤1021,根据所述锁资源参数,获取所述目标数据子服务器的锁管理器中的目标锁资源。Step 1021, according to the lock resource parameter, acquire the target lock resource in the lock manager of the target data sub-server.
本申请实施例中,分布式服务器可以通过目标数据子服务器接收针对分布式数据库的数据处理请求,并直接在目标数据子服务器中对数据处理代码进行切面处理分离出锁资源子代码,以及根据锁资源子代码中与目标数据相关联的锁资源信息确定锁资源参数,使得目标数据子服务器自身获得锁资源参数。可以由目标数据子服务器直接根据自身获得的锁资源参数调用锁管理器并获取锁管理器中的目标锁资源,具体的获取过程可以参考步骤102中的相关描述,此处不再赘述。In this embodiment of the application, the distributed server can receive the data processing request for the distributed database through the target data sub-server, and directly process the data processing code in the target data sub-server to separate the lock resource sub-code, and The lock resource information associated with the target data in the resource subcode determines the lock resource parameters, so that the target data subserver itself obtains the lock resource parameters. The target data sub-server can directly call the lock manager according to the lock resource parameters obtained by itself and acquire the target lock resource in the lock manager. For the specific acquisition process, refer to the related description in
步骤1022,基于预设的协调服务组件中各所述数据子服务器对应的注册节点,将所述锁资源参数同步给所述多个数据子服务器中除所述目标数据子服务器以外的其他数据子服务器。Step 1022, based on the registration node corresponding to each of the data sub-servers in the preset coordination service component, synchronize the lock resource parameters to other data sub-servers in the plurality of data sub-servers except the target data sub-server server.
本申请实施例中,协调服务组件指的是为分布式数据库提供一致性协调服务的软件,协调服务组件将协调服务封装成简单的接口提供给用户,用户通过在协调服务组件中为分布式服务器的各数据子服务器进行注册,使得通过协调服务组件可以对分布式服务器中的各数据子服务器进行协调管理。注册节点指的是各数据子服务器在协调服务组件中注册时创建的专用节点,该专用节点存储有数据子服务器对应的互联网协议地址(InternetProtocol Address,IP地址)、端口、调用方式 (协议、序列化方式)等。In the embodiment of this application, the coordination service component refers to the software that provides consistent coordination services for distributed databases. The coordination service component encapsulates the coordination service into a simple interface and provides it to users. Each data sub-server in the distributed server is registered, so that each data sub-server in the distributed server can be coordinated and managed through the coordination service component. The registration node refers to the dedicated node created when each data sub-server is registered in the coordination service component. The dedicated node stores the Internet protocol address (Internet Protocol Address, IP address), port, calling method (protocol, sequence) corresponding to the data sub-server way) etc.
本申请实施例中,可以由目标数据子服务器通过目标数据子服务器在协调服务组件中对应的注册节点建立目标数据子服务器与协调服务组件的连接,然后通过建立的连接将目标数据子服务器中的锁资源参数发送给协调服务组件,协调服务组件通过其他数据子服务器各自对应的注册节点建立与其他数据子服务器的连接,然后将锁资源参数发送给其他数据子服务器,实现将锁资源参数同步给多个数据子服务器中除目标数据子服务器以外的其他数据子服务器。In the embodiment of this application, the target data sub-server can establish a connection between the target data sub-server and the coordination service component through the corresponding registration node of the target data sub-server in the coordination service component, and then through the established connection, the target data sub-server The lock resource parameters are sent to the coordination service component, and the coordination service component establishes connections with other data sub-servers through their corresponding registration nodes, and then sends the lock resource parameters to other data sub-servers to realize the synchronization of the lock resource parameters to the Data subservers other than the target data subserver among multiple data subservers.
步骤1023,对于任一所述其他数据子服务器,通过所述其他数据子服务器根据所述锁资源参数获取所述其他数据子服务器的锁管理器中的目标锁资源。Step 1023, for any of the other data sub-servers, obtain the target lock resources in the lock manager of the other data sub-servers through the other data sub-servers according to the lock resource parameters.
本申请实施例中,对于任一其他数据子服务器,可以由该数据子服务器,根据锁资源参数查找该数据子服务器的锁管理器中与该锁资源参数相匹配的锁资源,并获取实际参数与该锁资源参数一致的锁资源,得到该数据子服务器的锁管理器中的目标锁资源。具体的查找及获取过程可以参考步骤102的相关描述,此处不再赘述。In the embodiment of this application, for any other data sub-server, the data sub-server can search for the lock resource matching the lock resource parameter in the lock manager of the data sub-server according to the lock resource parameter, and obtain the actual parameter The lock resource whose parameter is consistent with the lock resource obtains the target lock resource in the lock manager of the data subserver. For the specific search and acquisition process, reference may be made to the relevant description of
在本申请实施例中,通过根据锁资源参数,获取目标数据子服务器的锁管理器中的目标锁资源;基于预设的协调服务组件中各数据子服务器对应的注册节点,将锁资源参数同步给多个数据子服务器中除目标数据子服务器以外的其他数据子服务器;对于任一其他数据子服务器,通过其他数据子服务器根据锁资源参数获取其他数据子服务器的锁管理器中的目标锁资源。这样,可以方便地直接根据目标数据子服务器中的锁资源参数获取目标数据子服务器的锁管理器中的目标锁资源,且通过协调服务组件中各数据子服务器对应的注册节点,方便地将锁资源参数同步给其他数据子服务器,使得其他数据子服务器也可以根据锁资源参数获取自身的锁管理器中的目标锁资源,通过协调服务组件实现锁资源参数同步的操作可以加快获取各数据子服务器的锁管理器中的目标锁资源的速度,从而提高目标锁资源的获取效率。In the embodiment of the present application, by obtaining the target lock resource in the lock manager of the target data sub-server according to the lock resource parameter; based on the registration node corresponding to each data sub-server in the preset coordination service component, the lock resource parameter is synchronized To other data sub-servers in multiple data sub-servers except the target data sub-server; for any other data sub-server, obtain the target lock resource in the lock manager of other data sub-servers through other data sub-servers according to the lock resource parameters . In this way, it is convenient to directly obtain the target lock resource in the lock manager of the target data sub-server according to the lock resource parameters in the target data sub-server, and by coordinating the registration nodes corresponding to each data sub-server in the service component, it is convenient to transfer the lock to The resource parameters are synchronized to other data sub-servers, so that other data sub-servers can also obtain the target lock resources in their own lock manager according to the lock resource parameters, and the operation of synchronizing lock resource parameters through the coordination service component can speed up the acquisition of each data sub-server The speed of the target lock resource in the lock manager, thereby improving the acquisition efficiency of the target lock resource.
可选的,步骤1022可以包括以下步骤:Optionally, step 1022 may include the following steps:
步骤1022a,建立所述目标数据子服务器与预设的协调服务组件中所述目标数据子服务器对应的注册节点的第一连接。Step 1022a, establishing a first connection between the target data sub-server and the registration node corresponding to the target data sub-server in the preset coordination service component.
本申请实施例中,目标数据子服务器对应的注册节点是目标数据子服务器在协调服务组件中注册时创建的专用节点,该专用节点存储有目标数据子服务器对应的互联网协议地址(Internet Protocol Address,IP地址)、端口、调用方式 (协议、序列化方式)等。可以由目标数据子服务器按照对应的注册节点中存储的调用方式,调用目标数据子服务器对应的目标端口,从而通过该目标端口建立目标数据子服务器与协调服务组件中对应的注册节点的连接,并将建立的连接作为第一连接。In the embodiment of the present application, the registration node corresponding to the target data sub-server is a dedicated node created when the target data sub-server is registered in the coordination service component, and the dedicated node stores the corresponding Internet Protocol Address (Internet Protocol Address, IP address), port, calling method (protocol, serialization method), etc. The target data sub-server can call the target port corresponding to the target data sub-server according to the calling method stored in the corresponding registration node, so as to establish a connection between the target data sub-server and the corresponding registration node in the coordination service component through the target port, and Use the established connection as the first connection.
步骤1022b,基于所述目标数据子服务器将所述锁资源参数通过所述第一连接发送给所述协调服务组件。Step 1022b, based on the target data sub-server, send the lock resource parameter to the coordination service component through the first connection.
本申请实施例中,可以由目标数据子服务器基于目标数据子服务器与协调服务组件中对应的注册节点的第一连接,将目标数据子服务器中的锁资源参数发送到协调服务组件中目标数据子服务器对应的目标端口,然后协调服务组件通过目标端口接收锁资源参数,从而实现将锁资源参数通过第一连接发送给协调服务组件。In this embodiment of the application, the target data sub-server may send the lock resource parameters in the target data sub-server to the target data sub-server in the coordination service component based on the first connection between the target data sub-server and the corresponding registration node in the coordination service component. The target port corresponding to the server, and then the coordination service component receives the lock resource parameter through the target port, so that the lock resource parameter is sent to the coordination service component through the first connection.
步骤1022c,对于任一所述其他数据子服务器,基于所述协调服务组件中所述其他数据子服务器对应的注册节点,将所述锁资源参数发送给所述其他数据子服务器。Step 1022c, for any of the other data sub-servers, based on the registration node corresponding to the other data sub-servers in the coordination service component, send the lock resource parameter to the other data sub-servers.
本申请实施例中,参照步骤1022中的相关描述,对于任一其他数据子服务器,协调服务组件中设置有该数据子服务器注册时创建的专用节点即注册节点,且注册节点存储有该数据子服务器对应的互联网协议地址(Internet Protocol Address,IP地址)、端口、调用方式 (协议、序列化方式)等。可以由目标数据子服务器按照该数据子服务器对应的注册节点中存储的调用方式,调用该数据子服务器对应的目标端口,通过该目标端口建立该数据子服务器与协调服务组件中对应的注册节点的连接,然后通过建立的连接将锁资源参数从协调服务组件发送给该数据子服务器,从而实现基于协调服务组件中其他数据子服务器对应的注册节点,将锁资源参数发送给其他数据子服务器。In this embodiment of the application, referring to the relevant description in step 1022, for any other data sub-server, the coordination service component is set with a dedicated node created when the data sub-server is registered, that is, a registration node, and the registration node stores the data sub-server The corresponding Internet protocol address (Internet Protocol Address, IP address), port, calling method (protocol, serialization method), etc. of the server. The target data sub-server can call the target port corresponding to the data sub-server according to the call method stored in the registration node corresponding to the data sub-server, and establish the connection between the data sub-server and the corresponding registration node in the coordination service component through the target port. connection, and then send the lock resource parameters from the coordination service component to the data sub-server through the established connection, so as to send the lock resource parameters to other data sub-servers based on the registration node corresponding to other data sub-servers in the coordination service component.
在本申请实施例中,通过建立目标数据子服务器与预设的协调服务组件中目标数据子服务器对应的注册节点的第一连接;基于目标数据子服务器将锁资源参数通过第一连接发送给协调服务组件;对于任一其他数据子服务器,基于协调服务组件中其他数据子服务器对应的注册节点,将锁资源参数发送给其他数据子服务器。这样,可以通过目标数据子服务器与协调服务组件中对应的注册节点的第一连接,方便地从目标数据子服务器获取锁资源参数,并基于协调服务组件中其他数据子服务器各自对应的注册节点,方便地将锁资源参数同步给其他数据子服务器,从而通过协调服务组件中各数据子服务器对应的注册节点提高锁资源参数的同步效率。In the embodiment of this application, by establishing the first connection between the target data sub-server and the registration node corresponding to the target data sub-server in the preset coordination service component; based on the target data sub-server, the lock resource parameter is sent to the coordination Service component; for any other data sub-server, based on the registration node corresponding to other data sub-server in the coordination service component, send the lock resource parameter to other data sub-server. In this way, through the first connection between the target data sub-server and the corresponding registration node in the coordination service component, the lock resource parameters can be easily obtained from the target data sub-server, and based on the corresponding registration nodes of other data sub-servers in the coordination service component, Conveniently synchronize the lock resource parameters to other data sub-servers, thereby improving the synchronization efficiency of lock resource parameters by coordinating the registration nodes corresponding to each data sub-server in the service component.
可选的,步骤102之前,所述方法还包括:Optionally, before
步骤201,响应于所述数据处理请求,通过所述目标数据子服务器建立客户端与所述分布式数据库的第二连接;所述客户端是向所述目标数据子服务器发送所述数据处理请求的设备。Step 201, in response to the data processing request, establish a second connection between the client and the distributed database through the target data sub-server; the client sends the data processing request to the target data sub-server device of.
本申请实施例中,客户端中可以预先安装分布式数据库对应的管理工具,管理工具中存储有分布式服务器的各数据子服务器的IP地址,客户端可以根据目标数据子服务器的IP地址向目标数据子服务器发送数据处理请求。目标数据子服务器接收到数据处理请求后,响应于数据处理请求,首先建立客户端与目标数据子服务器的通信连接,然后根据数据处理请求对应的网络数据包中客户端发送的用户名和密码查询分布式数据库进行验证,若验证通过则目标数据子服务器通过与分布式服务器中其他数据子服务器的通信网络连接分布式数据库,实现通过目标数据子服务器建立客户端与分布式数据库的连接,并将建立的连接作为第二连接。In the embodiment of this application, the management tool corresponding to the distributed database can be pre-installed in the client, and the IP address of each data sub-server of the distributed server is stored in the management tool. The data sub-server sends a data processing request. After receiving the data processing request, the target data sub-server first establishes a communication connection between the client and the target data sub-server in response to the data processing request, and then queries the distribution of the user name and password sent by the client in the network data packet corresponding to the data processing request. If the verification is passed, the target data sub-server will connect to the distributed database through the communication network with other data sub-servers in the distributed server, so as to realize the connection between the client and the distributed database through the target data sub-server, and will establish connection as the second connection.
可选的,步骤103可以包括以下步骤:Optionally,
步骤1031,基于所述目标数据子服务器执行所述数据处理代码,以通过所述第二连接从所述客户端获取数据处理信息,并根据所述数据处理信息对所述分布式数据库中的所述目标数据进行指定处理;所述数据处理代码用于实现所述数据处理请求所指示的操作。Step 1031: Execute the data processing code based on the target data sub-server, so as to obtain data processing information from the client through the second connection, and process all data in the distributed database according to the data processing information The target data is specified for processing; the data processing code is used to implement the operation indicated by the data processing request.
本申请实施例中,数据处理信息可以是对目标数据进行指定处理时所需的操作信息和数据信息。例如数据处理请求指示对目标数据执行插入、更新、删除等指定处理,则数据处理信息可以包括需要插入到分布式数据库中的数据,对目标数据进行更新操作对应的更新数据,或需要删除的分布式数据库中目标数据的信息等。此处仅是举例说明,本申请实施例对此不做限制。In this embodiment of the present application, the data processing information may be operation information and data information required for specified processing of target data. For example, the data processing request indicates to perform specified processing such as insertion, update, and deletion on the target data, and the data processing information may include the data that needs to be inserted into the distributed database, the update data corresponding to the update operation on the target data, or the distribution that needs to be deleted. Information about the target data in the database, etc. This is only for illustration, and this embodiment of the present application does not limit it.
本申请实施例中,可以基于目标数据子服务器运行数据处理代码,首先向客户端发送信息获取指令,指示客户端发送数据处理信息,然后通过分布式服务器中各数据子服务器的通信网络,向存储有目标数据的数据子服务器发送数据处理指令,其中,数据处理指令可以包括数据处理信息。各存储有目标数据的数据子服务器接收到数据处理指令,响应于数据处理指令,根据数据处理信息中的操作信息和数据信息分别对设置在数据子服务器上的子数据库中的目标数据进行指定处理。In the embodiment of this application, the data processing code can be run based on the target data sub-server, first send an information acquisition instruction to the client, instruct the client to send data processing information, and then send the data to the storage through the communication network of each data sub-server in the distributed server. A data sub-server with target data sends a data processing instruction, wherein the data processing instruction may include data processing information. Each data sub-server storing the target data receives the data processing instruction, and in response to the data processing instruction, performs specified processing on the target data in the sub-databases set on the data sub-server according to the operation information and data information in the data processing information .
在本申请实施例中,通过响应于数据处理请求,通过目标数据子服务器建立客户端与分布式数据库的第二连接;客户端是向目标数据子服务器发送数据处理请求的设备;基于目标数据子服务器执行数据处理代码,以通过第二连接从客户端获取数据处理信息,并根据数据处理信息对分布式数据库中的目标数据进行指定处理;数据处理代码用于实现数据处理请求所指示的操作。这样,可以基于目标数据子服务器通过客户端与分布式数据库的第二连接方便地获取数据处理信息,进一步地,通过目标数据子服务器执行数据处理代码加快对目标数据的处理速度,从而提高分布式数据库的数据处理效率。In this embodiment of the application, by responding to the data processing request, the second connection between the client and the distributed database is established through the target data sub-server; the client is a device that sends a data processing request to the target data sub-server; based on the target data sub-server The server executes the data processing code to obtain data processing information from the client through the second connection, and performs specified processing on the target data in the distributed database according to the data processing information; the data processing code is used to implement the operation indicated by the data processing request. In this way, the data processing information can be conveniently obtained based on the second connection between the client and the distributed database based on the target data sub-server. Further, the processing speed of the target data is accelerated by executing the data processing code through the target data sub-server, thereby improving the distributed database. The data processing efficiency of the database.
可选的,所述方法还包括:Optionally, the method also includes:
步骤301,在未成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,断开所述第二连接,以供其他客户端与所述分布式数据库建立连接并对所述分布式数据库中的数据进行处理。Step 301, if the target lock resources in the lock managers of all the data sub-servers are not successfully acquired, disconnect the second connection so that other clients can establish connections with the distributed database and The data in the distributed database is processed.
本申请实施例中,未成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况,原因可能包括:第一,目标数据对应的目标锁资源已经被其他客户端发送的数据处理请求占用,此时目标数据正在被其他客户端发送的数据处理请求所指示的操作进行处理,因此目标锁资源不能被获取。第二,由于网络错误或系统错误出现一个或多个数据子服务器上目标数据对应的锁资源异常,即与其他正常的数据子服务器的锁管理器中的目标锁资源不一致,因此锁资源异常的数据子服务器的锁管理器中不存在目标锁资源,也获取不到锁资源异常的数据子服务器的锁管理器中目标锁资源。In the embodiment of this application, if the target lock resources in the lock managers of all data sub-servers are not successfully acquired, the reasons may include: first, the target lock resources corresponding to the target data have been sent by other clients for data processing requests Occupied. At this time, the target data is being processed by the operation indicated by the data processing request sent by other clients, so the target lock resource cannot be acquired. Second, due to a network error or system error, the lock resource corresponding to the target data on one or more data sub-servers is abnormal, that is, it is inconsistent with the target lock resource in the lock manager of other normal data sub-servers, so the lock resource exception The target lock resource does not exist in the lock manager of the data sub-server, and the target lock resource in the lock manager of the data sub-server where the lock resource is abnormal cannot be obtained.
本申请实施例中,为保证数据处理过程不发生逻辑冲突,以及分布式数据库的数据一致性,在成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,才根据数据处理请求所指示的操作对目标数据进行指定处理。而在未成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,可以由目标数据子服务器断开第二连接,根据数据处理代码中锁等待部分的处理逻辑,等待一定时间后重新通过目标数据子服务器建立客户端与分布式数据库的第二连接,以根据数据处理请求所指示的操作对目标数据进行指定处理。断开第二连接后,分布式服务器可以接收其他客户端针对分布式数据的数据处理请求,并建立其他客户端与分布式数据库的连接,以对分布式数据库中的数据进行处理。In the embodiment of this application, in order to ensure that there is no logical conflict in the data processing process and the data consistency of the distributed database, only when the target lock resources in the lock managers of all data sub-servers are successfully obtained, the data processing The operation indicated by the request performs the specified processing on the target data. However, if the target lock resource in the lock manager of all data sub-servers is not successfully obtained, the second connection can be disconnected by the target data sub-server, and wait for a certain period of time according to the processing logic of the lock waiting part in the data processing code Then re-establish the second connection between the client and the distributed database through the target data sub-server, so as to perform specified processing on the target data according to the operation indicated by the data processing request. After the second connection is disconnected, the distributed server can receive data processing requests from other clients for distributed data, and establish connections between other clients and the distributed database to process data in the distributed database.
在本申请实施例中,通过在未成功获取到所有数据子服务器的锁管理器中的目标锁资源的情况下,断开第二连接,可以方便其他客户端与分布式数据库建立连接,并对分布式数据库中的数据进行处理,从而提到本申请的数据库处理方法的合理性和实用性。In this embodiment of the application, by disconnecting the second connection when the target lock resources in the lock managers of all data sub-servers are not successfully obtained, it is convenient for other clients to establish a connection with the distributed database, and to The data in the distributed database is processed, thus the rationality and practicability of the database processing method of the present application are mentioned.
可选的,所述分布式服务器还包括备份子服务器,所述方法还包括:Optionally, the distributed server also includes a backup sub-server, and the method also includes:
步骤401,在所述备份子服务器中的计时参数符合预设时间要求的情况下,通过所述备份子服务器获取各所述数据子服务器的操作日志,并将获得的操作日志存储在所述备份子服务器中。Step 401, when the timing parameters in the backup sub-server meet the preset time requirements, obtain the operation logs of each of the data sub-servers through the backup sub-server, and store the obtained operation logs in the backup sub-server in the subserver.
本申请实施例中,备份子服务器用于定期对各数据子服务器对应的操作日志进行备份,并根据备份的操作日志执行数据恢复任务,以对分布式数据库中的错误数据进行纠错。数据子服务器的操作日志记录有该数据子服务器的服务器标识例如IP地址,以及对某个数据进行插入、更新或删除等操作的操作记录。计时参数可以是定时归零的时间变量,用于对备份子服务器的定期备份任务进行计时。预设时间要求可以根据备份子服务器的定期备份任务的时间周期性要求确定,例如,预设时间要求可以是一天、一周或一月。此处仅是举例说明,本申请实施例对此不做限制。In the embodiment of the present application, the backup sub-server is used to regularly back up the operation logs corresponding to each data sub-server, and perform data recovery tasks according to the backup operation logs, so as to correct the error data in the distributed database. The operation log of the data sub-server records the server identifier of the data sub-server, such as the IP address, and the operation record of inserting, updating or deleting certain data. The timing parameter may be a time variable that is regularly reset to zero, and is used to time the periodic backup task of the backup sub-server. The preset time requirement may be determined according to the time period requirement of the regular backup task of the backup sub-server, for example, the preset time requirement may be one day, one week or one month. This is only for illustration, and this embodiment of the present application does not limit it.
本申请实施例中,备份子服务器中的计时参数符合预设时间要求的情况指的是计时参数当前的参数值与预设时间要求的预设值一致,表示当前时刻符合备份子服务器的定期备份任务的触发条件,在此情况下,自动触发计时参数归零,且分布式服务器通过备份子服务器扫描各数据子服务器并获取各数据子服务器的操作日志,以及将获得的操作日志存储在备份子服务器中的指定内存区域,以定期对各数据子服务器对应的操作日志进行备份。In the embodiment of this application, the fact that the timing parameters in the backup sub-server meet the preset time requirements means that the current parameter value of the timing parameters is consistent with the preset value required by the preset time, indicating that the current moment meets the regular backup of the backup sub-server The trigger condition of the task. In this case, the timing parameter is automatically triggered to be reset to zero, and the distributed server scans each data sub-server through the backup sub-server and obtains the operation log of each data sub-server, and stores the obtained operation log in the backup sub-server. The specified memory area in the server to regularly back up the operation logs corresponding to each data sub-server.
步骤402,在所述备份子服务器存储的操作日志中存在错误日志的情况下,基于所述备份子服务器对所述错误日志对应的数据子服务器中的数据进行纠错。Step 402, if there is an error log in the operation log stored in the backup sub-server, correct the data in the data sub-server corresponding to the error log based on the backup sub-server.
本申请实施例中,错误日志可以是所记录的操作记录表征该错误日志对应的数据子服务器与其他数据子服务器的数据不一致的操作日志。其中,导致数据不一致的操作记录可以包括:第一,错误日志对应的数据子服务器上的目标数据修改后与其他数据子服务器上的目标数据不一致。或者,第二,其他存储有目标数据的数据子服务器的操作日志记录有对目标数据的操作,而错误日志中没有相应的操作记录,也即错误日志对应的数据子服务器上的目标数据没有同步被处理。In this embodiment of the present application, the error log may be an operation log in which the recorded operation record indicates that data of the data sub-server corresponding to the error log is inconsistent with data of other data sub-servers. Wherein, the operation record that causes data inconsistency may include: first, the target data on the data sub-server corresponding to the error log is inconsistent with the target data on other data sub-servers after modification. Or, secondly, the operation logs of other data sub-servers that store the target data record operations on the target data, but there is no corresponding operation record in the error log, that is, the target data on the data sub-server corresponding to the error log is not synchronized be processed.
本申请实施例中,在备份子服务器存储的操作日志中存在错误日志的情况下,可以基于备份子服务器根据错误日志记录的数据子服务器的服务器标识找到错误日志对应的数据子服务器,对于第一种情况,撤销该数据子服务器上对于目标数据的操作,恢复数据处理前的数据,使得错误日志对应的数据子服务器上的目标数据与其他数据子服务器上的目标数据保持一致即数据恢复。对于第二种情况,根据其他存储有目标数据的数据子服务器的操作日志记录的对目标数据的操作,对错误日志对应的数据子服务器上的目标数据进行同步处理,使得错误日志对应的数据子服务器上的目标数据与其他数据子服务器上的目标数据保持一致即数据同步。通过数据恢复或者数据同步的过程,实现基于备份子服务器对错误日志对应的数据子服务器中的数据进行纠错。In the embodiment of the present application, when there is an error log in the operation log stored by the backup sub-server, the data sub-server corresponding to the error log can be found based on the server identification of the data sub-server recorded by the backup sub-server according to the error log. For the first In this case, undo the operation on the target data on the data sub-server, and restore the data before data processing, so that the target data on the data sub-server corresponding to the error log is consistent with the target data on other data sub-servers, that is, data recovery. For the second case, according to the operations on the target data recorded in the operation logs of other data sub-servers that store the target data, the target data on the data sub-server corresponding to the error log is synchronously processed, so that the data sub-server corresponding to the error log The target data on the server is consistent with the target data on other data sub-servers, that is, data synchronization. Through the process of data recovery or data synchronization, the error correction of the data in the data sub-server corresponding to the error log is implemented based on the backup sub-server.
在本申请实施例中,通过在备份子服务器中的计时参数符合预设时间要求的情况下,通过备份子服务器获取各数据子服务器的操作日志,并将获得的操作日志存储在备份子服务器中;在备份子服务器存储的操作日志中存在错误日志的情况下,基于备份子服务器对错误日志对应的数据子服务器中的数据进行纠错。这样,可以根据计时参数和预设时间要求,方便地通过备份子服务对各数据子服务器的操作日志进行备份,且通过备份子服务器对错误日志对应的数据子服务器中的数据进行纠错,可以减少分布式数据库中的错误数据,从而提高分布式数据库的数据一致性。In this embodiment of the application, when the timing parameters in the backup sub-server meet the preset time requirements, the backup sub-server obtains the operation logs of each data sub-server, and stores the obtained operation logs in the backup sub-server ; If there is an error log in the operation log stored in the backup sub-server, correct the data in the data sub-server corresponding to the error log based on the backup sub-server. In this way, according to the timing parameters and preset time requirements, the operation logs of each data sub-server can be easily backed up through the backup sub-service, and the data in the data sub-server corresponding to the error log can be corrected through the backup sub-server, which can Reduce erroneous data in distributed databases, thereby improving data consistency in distributed databases.
可选的,步骤402可以包括以下步骤:Optionally, step 402 may include the following steps:
步骤4021,基于所述备份子服务器,根据所述错误日志确定错误数据,并将存储所述错误数据的数据子服务器确定为第一数据子服务器。Step 4021, based on the backup sub-server, determine error data according to the error log, and determine the data sub-server storing the error data as the first data sub-server.
本申请实施例中,可以基于备份子服务器对错误日志进行解析,确定错误日志中导致错误日志对应的数据子服务器与其他数据子服务器的目标数据不一致的情况下,错误日志中错误的操作记录或者缺失的操作记录。其中,错误的操作记录或者缺失的操作记录可以参考步骤402中的相关描述,此处不再赘述。然后,根据错误日志中错误的操作记录或者缺失的操作记录找到与其他数据子服务器上存储的数据不一致的数据,将找到的数据确定为错误数据。可以根据错误日志记录的数据子服务器的服务器标识找到存储错误数据的数据子服务器,并找到的数据子服务器确定为第一数据子服务器。In the embodiment of the present application, the error log can be analyzed based on the backup sub-server, and it is determined that when the data sub-server corresponding to the error log is inconsistent with the target data of other data sub-servers in the error log, the wrong operation record in the error log or Missing action record. Wherein, for the wrong operation record or the missing operation record, reference may be made to the relevant description in step 402, which will not be repeated here. Then, according to the erroneous operation records or missing operation records in the error log, the data inconsistent with the data stored on other data sub-servers is found, and the found data is determined as erroneous data. The data sub-server storing the erroneous data can be found according to the server identifier of the data sub-server recorded in the error log, and the found data sub-server is determined as the first data sub-server.
步骤4022,根据所述错误数据,选择存储有所述错误数据对应的正确数据的一个数据子服务器,作为第二数据子服务器。Step 4022, according to the erroneous data, select a data sub-server storing the correct data corresponding to the erroneous data as the second data sub-server.
本申请实施例中,错误数据指的是错误日志中错误的操作记录或者缺失的操作记录对应的存储在第一数据子服务器中的数据,可以根据错误数据相应的错误的操作记录或者缺失的操作记录确定正确的操作记录对应的操作日志,并根据正确的操作日志中记录的服务器标识确定存储有错误数据对应的正确数据的数据子服务器。可以从存储有正确数据的数据子服务器中任选一个数据子服务器作为第二数据子服务器,或者选择存储有正确数据的数据子服务器中,地址位置距离第一数据子服务器最近的数据子服务器,作为第二数据子服务器,本申请实施例对此不做限制。In this embodiment of the application, the error data refers to the data stored in the first data sub-server corresponding to the wrong operation record or missing operation record in the error log, and the wrong operation record or missing operation corresponding to the error data can be Record and determine the operation log corresponding to the correct operation record, and determine the data sub-server storing the correct data corresponding to the error data according to the server identification recorded in the correct operation log. One of the data sub-servers with correct data can be selected as the second data sub-server, or the data sub-server whose address is closest to the first data sub-server among the data sub-servers with correct data can be selected, As the second data sub-server, this embodiment of the present application does not limit it.
步骤4023,基于所述备份子服务器,获取所述第二数据子服务器中的所述正确数据,并将所述第一数据子服务器中的所述错误数据替换为所述正确数据。Step 4023, based on the backup sub-server, obtain the correct data in the second data sub-server, and replace the wrong data in the first data sub-server with the correct data.
本申请实施例中,可以基于备份子服务器连接分布式服务器中各数据子服务器的通信网络,并通过通信网络从第二数据子服务器上设置的子数据库中获取正确数据并发送给第一数据子服务器,然后将第一数据子服务器上设置的子数据库中的错误数据替换为正确数据。In the embodiment of this application, the communication network of each data sub-server in the distributed server can be connected based on the backup sub-server, and the correct data can be obtained from the sub-database set on the second data sub-server through the communication network and sent to the first data sub-server. server, then replace the wrong data in the sub-database set on the first data sub-server with correct data.
可选的,备份子服务器中可以设置恢复队列,备份子服务器发现所存储的操作日志中存在错误日志的情况下,可以将错误日志存放到恢复队列中。分布式服务器通过恢复线程依次从恢复队列取出错误日志,并对错误日志进行分析处理,以根据错误日志对分布式数据库中的错误数据进行纠错。Optionally, a recovery queue can be set in the backup sub-server, and when the backup sub-server finds that there is an error log in the stored operation log, it can store the error log in the recovery queue. The distributed server takes out the error log from the recovery queue sequentially through the recovery thread, and analyzes and processes the error log, so as to correct the error data in the distributed database according to the error log.
在本申请实施例中,通过基于备份子服务器,根据错误日志确定错误数据,并将存储错误数据的数据子服务器确定为第一数据子服务器;根据错误数据,选择存储有错误数据对应的正确数据的一个数据子服务器,作为第二数据子服务器;基于备份子服务器,获取第二数据子服务器中的正确数据,并将第一数据子服务器中的错误数据替换为正确数据。这样,可以基于备份子服务器方便地对存储有错误数据的数据子服务器中的数据进行纠错,提高数据纠错效率,进一步提高分布式数据库的数据一致性。In the embodiment of the present application, the error data is determined according to the error log based on the backup sub-server, and the data sub-server storing the error data is determined as the first data sub-server; according to the error data, the correct data corresponding to the error data is selected One of the data sub-servers is used as the second data sub-server; based on the backup sub-server, the correct data in the second data sub-server is obtained, and the wrong data in the first data sub-server is replaced with correct data. In this way, error correction can be conveniently performed on the data in the data sub-server storing erroneous data based on the backup sub-server, thereby improving the efficiency of data error correction and further improving the data consistency of the distributed database.
图2是本申请实施例提供的数据库处理方法的应用场景示意图,如图2所示,分布式服务器中各数据子服务器、备份子服务器根据各自的功能可以作为分布式数据库对应的不同功能的物理节点。其中,接收数据处理请求的目标数据子服务器可以作为分布式数据库的计算节点,存储有目标数据的数据子服务器可以作为分布式数据库的存储节点,备份子服务器可以作为备份节点。此外,协调服务组件可以作为分布式数据库的协调服务节点,协调服务节点可以是虚拟节点并设置在分布式服务器上。客户端和分布式服务器之间可以通过代理服务器连接,代理服务器可以是代理节点,作为客户端与分布式服务器的中间层,用于接收和转发客户端发送给分布式服务器的计算节点的数据处理请求。由客户端、代理节点、计算节点、存储节点、备份节点和协调服务节点构成分布式数据库系统,系统内各节点之间彼此双向通信连接,可以传输查询指令和数据,用于实现本申请实施例的数据库处理方法。Fig. 2 is a schematic diagram of the application scenario of the database processing method provided by the embodiment of the present application. As shown in Fig. 2, each data sub-server and backup sub-server in the distributed server can be used as physical sub-servers with different functions corresponding to the distributed database according to their respective functions. node. Wherein, the target data sub-server receiving the data processing request can be used as a computing node of the distributed database, the data sub-server storing the target data can be used as a storage node of the distributed database, and the backup sub-server can be used as a backup node. In addition, the coordination service component can be used as the coordination service node of the distributed database, and the coordination service node can be a virtual node and be set on the distributed server. The client and the distributed server can be connected through a proxy server. The proxy server can be a proxy node, which acts as an intermediate layer between the client and the distributed server, and is used to receive and forward the data processing sent by the client to the computing node of the distributed server. ask. A distributed database system is composed of clients, proxy nodes, computing nodes, storage nodes, backup nodes, and coordination service nodes. The nodes in the system are connected to each other in two-way communication, and can transmit query instructions and data, which is used to realize the embodiment of this application database processing method.
图3是本申请实施例提供的另一种数据库处理方法的步骤流程图,如图3所示,该方法包括:S1,对连接分布式数据库的数据处理代码进行切面处理,获取到与目标锁资源相关的锁资源参数。S2,基于目标数据子服务器获取目标数据子服务器的锁管理器中的目标锁资源。S3,通过协调服务组件获取其他数据子服务器的锁管理器中的目标锁资源。S4,根据是否成功获取到所有数据子服务器的锁管理器中的目标锁资源,执行数据处理代码,或者断开客户端与分布式数据库的连接。S5,基于备份子服务器获取各数据子服务器的操作日志进行备份。S6,备份子服务器在发现错误日志的情况下,根据错误日志对数据子服务器中存储的错误数据进行纠错。Fig. 3 is a flow chart of the steps of another database processing method provided by the embodiment of the present application. As shown in Fig. 3, the method includes: S1, performing face-to-face processing on the data processing code connected to the distributed database, and obtaining the lock with the target Resource-related lock resource parameters. S2. Obtain the target lock resource in the lock manager of the target data sub-server based on the target data sub-server. S3, obtain the target lock resource in the lock manager of other data sub-servers through the coordination service component. S4, according to whether the target lock resources in the lock managers of all data sub-servers are successfully obtained, execute the data processing code, or disconnect the client from the distributed database. S5. Acquiring the operation logs of each data sub-server based on the backup sub-server for backup. S6. When the backup sub-server finds the error log, it corrects the error data stored in the data sub-server according to the error log.
图4是本申请实施例提供的一种数据库处理装置的结构图,该数据库处理装置应用于分布式服务器,所述分布式服务器上设置有分布式数据库,所述分布式服务器包括多个数据子服务器,该装置50可以包括:Fig. 4 is a structural diagram of a database processing device provided by an embodiment of the present application, the database processing device is applied to a distributed server, a distributed database is set on the distributed server, and the distributed server includes a plurality of data sub- server, the device 50 may include:
确定模块501,用于接收针对所述分布式数据库的数据处理请求,并根据所述数据处理请求中与目标数据相关联的锁资源信息,确定锁资源参数;所述目标数据是所述数据处理请求所请求处理的数据;The determining
获取模块502,用于根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源;所述目标锁资源是与所述目标数据对应的锁资源;An
处理模块503,用于在成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,根据所述数据处理请求所指示的操作对所述目标数据进行指定处理。The
可选的,所述数据处理请求包括数据处理代码;所述确定模块501具体用于:Optionally, the data processing request includes a data processing code; the determining
通过所述分布式服务器中的目标数据子服务器,接收针对所述分布式数据库的数据处理请求;receiving a data processing request for the distributed database through the target data sub-server in the distributed server;
基于所述目标数据子服务器对所述数据处理代码进行切面处理,以从所述数据处理代码中分离出锁资源子代码;performing aspect processing on the data processing code based on the target data sub-server, so as to separate the lock resource sub-code from the data processing code;
根据所述锁资源子代码中与目标数据相关联的锁资源信息,确定锁资源参数。Determine lock resource parameters according to lock resource information associated with the target data in the lock resource subcode.
可选的,所述获取模块502具体用于:Optionally, the obtaining
根据所述锁资源参数,获取所述目标数据子服务器的锁管理器中的目标锁资源;Acquiring the target lock resource in the lock manager of the target data sub-server according to the lock resource parameter;
基于预设的协调服务组件中各所述数据子服务器对应的注册节点,将所述锁资源参数同步给所述多个数据子服务器中除所述目标数据子服务器以外的其他数据子服务器;Synchronize the lock resource parameters to other data sub-servers in the plurality of data sub-servers except the target data sub-server based on the preset registration nodes corresponding to the data sub-servers in the coordination service component;
对于任一所述其他数据子服务器,通过所述其他数据子服务器根据所述锁资源参数获取所述其他数据子服务器的锁管理器中的目标锁资源。For any of the other data sub-servers, the other data sub-server obtains the target lock resource in the lock manager of the other data sub-server according to the lock resource parameter.
可选的,所述获取模块502具体还用于:Optionally, the acquiring
建立所述目标数据子服务器与预设的协调服务组件中所述目标数据子服务器对应的注册节点的第一连接;Establishing a first connection between the target data sub-server and the registration node corresponding to the target data sub-server in the preset coordination service component;
基于所述目标数据子服务器将所述锁资源参数通过所述第一连接发送给所述协调服务组件;sending the lock resource parameter to the coordination service component through the first connection based on the target data sub-server;
对于任一所述其他数据子服务器,基于所述协调服务组件中所述其他数据子服务器对应的注册节点,将所述锁资源参数发送给所述其他数据子服务器。For any of the other data sub-servers, based on the registration node corresponding to the other data sub-servers in the coordination service component, the lock resource parameter is sent to the other data sub-servers.
可选的,所述装置50还包括:Optionally, the device 50 also includes:
连接模块,用于所述获取模块502根据所述锁资源参数,获取各所述数据子服务器的锁管理器中的目标锁资源之前,响应于所述数据处理请求,通过所述目标数据子服务器建立客户端与所述分布式数据库的第二连接;所述客户端是向所述目标数据子服务器发送所述数据处理请求的设备;The connection module is used for the
所述处理模块503具体用于:基于所述目标数据子服务器执行所述数据处理代码,以通过所述第二连接从所述客户端获取数据处理信息,并根据所述数据处理信息对所述分布式数据库中的所述目标数据进行指定处理;所述数据处理代码用于实现所述数据处理请求所指示的操作。The
可选的,所述装置50还包括:Optionally, the device 50 also includes:
断开模块,用于在未成功获取到所有所述数据子服务器的锁管理器中的目标锁资源的情况下,断开所述第二连接,以供其他客户端与所述分布式数据库建立连接并对所述分布式数据库中的数据进行处理。A disconnection module, configured to disconnect the second connection when the target lock resources in the lock managers of all the data sub-servers are not successfully obtained, so that other clients can establish with the distributed database Connect and process the data in the distributed database.
可选的,所述分布式服务器还包括备份子服务器,所述装置50还包括:Optionally, the distributed server also includes a backup sub-server, and the device 50 also includes:
存储模块,用于在所述备份子服务器中的计时参数符合预设时间要求的情况下,通过所述备份子服务器获取各所述数据子服务器的操作日志,并将获得的操作日志存储在所述备份子服务器中;A storage module, configured to obtain the operation logs of each of the data sub-servers through the backup sub-server when the timing parameters in the backup sub-server meet the preset time requirements, and store the obtained operation logs in the in the backup subserver;
纠错模块,用于在所述备份子服务器存储的操作日志中存在错误日志的情况下,基于所述备份子服务器对所述错误日志对应的数据子服务器中的数据进行纠错。The error correction module is configured to correct the data in the data sub-server corresponding to the error log based on the backup sub-server when there is an error log in the operation log stored in the backup sub-server.
可选的,所述纠错模块具体用于:Optionally, the error correction module is specifically used for:
基于所述备份子服务器,根据所述错误日志确定错误数据,并将存储所述错误数据的数据子服务器确定为第一数据子服务器;Based on the backup sub-server, determine error data according to the error log, and determine the data sub-server storing the error data as the first data sub-server;
根据所述错误数据,选择存储有所述错误数据对应的正确数据的一个数据子服务器,作为第二数据子服务器;Selecting a data sub-server storing correct data corresponding to the erroneous data as a second data sub-server according to the erroneous data;
基于所述备份子服务器,获取所述第二数据子服务器中的所述正确数据,并将所述第一数据子服务器中的所述错误数据替换为所述正确数据。Based on the backup sub-server, acquire the correct data in the second data sub-server, and replace the erroneous data in the first data sub-server with the correct data.
对于装置实施例而言,由于其与方法实施例基本相似,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to part of the description of the method embodiment.
所述数据库处理装置与如上述所述的数据库处理方法相对于现有技术所具有的优势相同,此处不再赘述。The database processing device has the same advantages as the above-mentioned database processing method over the prior art, and will not be repeated here.
本申请还提供了一种电子设备60,参见图5,包括:处理器601、存储器602以及存储在所述存储器602上并可在所述处理器601上运行的计算机程序6021,所述处理器601执行所述程序时实现前述实施例的数据库处理方法。The present application also provides an
本申请还提供了一种可读存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行前述实施例的数据库处理方法。The present application also provides a readable storage medium. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the database processing method of the foregoing embodiments.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其他设备固有相关。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本申请也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本申请的内容,并且上面对特定语言所做的描述是为了披露本申请的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. The structure required to construct such a system is apparent from the above description. Furthermore, this application is not directed to any particular programming language. It should be understood that various programming languages can be used to implement the content of the application described here, and the description of specific languages above is to disclose the best implementation mode of the application.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本申请的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that the embodiments of the application may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本申请并帮助理解各个发明方面中的一个或多个,在上面对本申请的示例性实施例的描述中,本申请的各个特征有时被一起分组到单个实施例、图,或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本申请要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本申请的单独实施例。Similarly, it should be understood that in the above description of exemplary embodiments of the application, in order to streamline the application and to facilitate understanding of one or more of the various inventive aspects, various features of the application are sometimes grouped together in a single embodiment, figure, or in its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following this Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this application.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings), as well as any method or method so disclosed, may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
本申请的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本申请的排序设备中的一些或者全部部件的一些或者全部功能。本申请还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序。这样的实现本申请的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present application may be realized in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the sorting device according to the present application. The present application can also be implemented as a device or an apparatus program for performing a part or all of the methods described herein. Such a program implementing the present application may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本申请进行说明而不是对本申请进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本申请可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内所做的任何修改、等同替换和改进等,均应包含在本申请的保护范围之内。The above is only a preferred embodiment of the application, and is not intended to limit the application. Any modifications, equivalent replacements and improvements made within the spirit and principles of the application should be included in the scope of the application. within the scope of protection.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
需要说明的是,本申请实施例中获取各种数据相关过程,都是在遵照所在地国家相应的数据保护法规政策的前提下,并获得由相应装置所有者给予授权的情况下进行的。It should be noted that the various data-related processes in this embodiment of the application are all carried out under the premise of complying with the corresponding data protection laws and policies of the country where the device is located, and with the authorization granted by the corresponding device owner.
Claims (13)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310054559.1A CN115809301B (en) | 2023-02-03 | 2023-02-03 | Database processing method, device, electronic device and readable storage medium |
PCT/CN2023/139656 WO2024159949A1 (en) | 2023-02-03 | 2023-12-18 | Database processing method and apparatus, electronic device, and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310054559.1A CN115809301B (en) | 2023-02-03 | 2023-02-03 | Database processing method, device, electronic device and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115809301A CN115809301A (en) | 2023-03-17 |
CN115809301B true CN115809301B (en) | 2023-04-21 |
Family
ID=85487795
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310054559.1A Active CN115809301B (en) | 2023-02-03 | 2023-02-03 | Database processing method, device, electronic device and readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115809301B (en) |
WO (1) | WO2024159949A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115809301B (en) * | 2023-02-03 | 2023-04-21 | 天翼云科技有限公司 | Database processing method, device, electronic device and readable storage medium |
Family Cites Families (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8271437B2 (en) * | 2008-07-28 | 2012-09-18 | International Business Machines Corporation | Managing locks across distributed computing nodes |
CN104283906B (en) * | 2013-07-02 | 2018-06-19 | 华为技术有限公司 | Distributed memory system, clustered node and its section management method |
CN104239418B (en) * | 2014-08-19 | 2018-01-19 | 天津南大通用数据技术股份有限公司 | Support the distribution locking method and distributed data base system of distributed data base |
CN105426469A (en) * | 2015-11-16 | 2016-03-23 | 天津南大通用数据技术股份有限公司 | Database cluster metadata management method and system |
US11567837B2 (en) * | 2018-08-25 | 2023-01-31 | Panzura, Llc | Journaling data received in a cloud-based distributed computing environment |
CN112306743B (en) * | 2019-07-26 | 2023-11-21 | 阿里巴巴集团控股有限公司 | Data processing method, device, electronic equipment and computer storage medium |
CN110888858B (en) * | 2019-10-29 | 2023-06-30 | 北京奇艺世纪科技有限公司 | Database operation method and device, storage medium and electronic device |
CN113392051A (en) * | 2021-05-26 | 2021-09-14 | 上海轻轻信息科技有限公司 | Universal cloud-native distributed real-time streaming data bus system |
CN115114305B (en) * | 2022-04-08 | 2023-04-28 | 腾讯科技(深圳)有限公司 | Lock management method, device, equipment and storage medium for distributed database |
CN115277712B (en) * | 2022-07-08 | 2023-07-25 | 北京城市网邻信息技术有限公司 | Distributed lock service providing method, device and system and electronic equipment |
CN115809301B (en) * | 2023-02-03 | 2023-04-21 | 天翼云科技有限公司 | Database processing method, device, electronic device and readable storage medium |
-
2023
- 2023-02-03 CN CN202310054559.1A patent/CN115809301B/en active Active
- 2023-12-18 WO PCT/CN2023/139656 patent/WO2024159949A1/en unknown
Also Published As
Publication number | Publication date |
---|---|
WO2024159949A1 (en) | 2024-08-08 |
CN115809301A (en) | 2023-03-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11928029B2 (en) | Backup of partitioned database tables | |
US20240179212A1 (en) | Hosted file sync with stateless sync nodes | |
US6539381B1 (en) | System and method for synchronizing database information | |
US20180322017A1 (en) | Restoring partitioned database tables from backup | |
US11799798B1 (en) | Generating infrastructure templates for facilitating the transmission of user data into a data intake and query system | |
US11922222B1 (en) | Generating a modified component for a data intake and query system using an isolated execution environment image | |
US20230106118A1 (en) | Distributed processing of transactions in a network using timestamps | |
US20080256248A1 (en) | Single server access in a multiple tcp/ip instance environment | |
WO2020168692A1 (en) | Mass data sharing method, open sharing platform and electronic device | |
US20190278746A1 (en) | Metadata call offloading in a networked, clustered, hybrid storage system | |
WO2021238796A1 (en) | Asynchronous processing method, apparatus, and system for download tasks, and storage medium | |
US20190278749A1 (en) | Profiling performance in a networked, clustered, hybrid storage system | |
CN102012944B (en) | Distributed NOSQL (not only structured query language) database capable of providing replication property | |
US20240248810A1 (en) | Systems and methods for cross-regional back up of distributed databases on a cloud service | |
US20230161760A1 (en) | Applying data-determinant query terms to data records with different formats | |
US20190281113A1 (en) | System for communicating between computing and storage nodes | |
US6058425A (en) | Single server access in a multiple TCP/IP instance environment | |
CN115809301B (en) | Database processing method, device, electronic device and readable storage medium | |
US7752225B2 (en) | Replication and mapping mechanism for recreating memory durations | |
CN111427950A (en) | Data transmitting and receiving method, corresponding device, equipment and storage medium | |
CN113448775B (en) | Multi-source heterogeneous data backup method and device | |
JP7568898B2 (en) | COMMUNICATION PROGRAM, COMMUNICATION METHOD, AND COMMUNICATION DEVICE | |
CN118170557B (en) | Nacos-based distributed lock implementation method, distributed lock and system | |
US20230244661A1 (en) | Intelligent parity service with database query optimization | |
US20240022615A1 (en) | Communication sessions in cluster computing environment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP02 | Change in the address of a patent holder |
Address after: 100007 room 205-32, floor 2, building 2, No. 1 and No. 3, qinglonghutong a, Dongcheng District, Beijing Patentee after: Tianyiyun Technology Co.,Ltd. Address before: 100093 Floor 4, Block E, Xishan Yingfu Business Center, Haidian District, Beijing Patentee before: Tianyiyun Technology Co.,Ltd. |
|
CP02 | Change in the address of a patent holder | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20230317 Assignee: CHINATELECOM FUFU INFORMATION TECHNOLOGY Co.,Ltd. Assignor: Tianyiyun Technology Co.,Ltd. Contract record no.: X2024990000700 Denomination of invention: Database processing method, device, electronic equipment, and readable storage medium Granted publication date: 20230421 License type: Common License Record date: 20241225 |
|
EE01 | Entry into force of recordation of patent licensing contract |