Data operation method, device and server
By recording the location of the target data in a distributed database and performing batch operations, the inefficiency problem in the prior art is solved, and efficient data update and deletion processing is achieved.
Patent Information
- Application Number
- CN202211538990.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2042-12-02
AI Technical Summary
When batch update or delete data in distributed databases, the prior art requires multiple read and write files, resulting in inefficient efficiency and waste of computing resources.
Batch operations are realized by recording multiple target data in a preset string at the location of the distributed file, and operating multiple target data at one time according to the recorded location, including marking data bit identification and updating data status.
Improves the efficiency of batch operations, reduces the number of file read and writes, and saves computing resources.
Smart Images

Figure CN115712687B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data management, and in particular, to a data operation method, apparatus, and server. Background Art
[0002] A distributed database refers to a large database in which many computers located at different locations are interconnected through a network to jointly form a complete, globally logically centralized and physically distributed database. It can be seen that a distributed database is logically a unified whole and physically stored on different physical nodes respectively.
[0003] Currently, when performing operations such as batch updating or deleting data in a distributed database, for each data deletion or update, it is necessary to first read out the file where the data to be updated or deleted is located from the distributed database, update or delete the target data, and then rewrite the processed file into the distributed database. In this way, multiple file reads and writes are required, resulting in low efficiency and wasted computing resources. Summary of the Invention
[0004] This application provides a data operation method, apparatus, and server, which are used to solve the problem in the prior art that when performing operations such as batch updating or deleting data in a distributed database, multiple file reads and writes are required, resulting in low efficiency and wasted computing resources.
[0005] In a first aspect, this application provides a data operation method applied to a server. The method provided by this application includes: the server, in response to an operation instruction for multiple target data from a terminal device, reads a distributed file including multiple target data from the distributed database; the server marks different data bit identifiers for each data in the distributed file; the server updates the first character at the data bit corresponding to the data bit identifier of each target data in a preset string to a second character, where a first character is set at each data bit of the string before the update; the server performs corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction; the server writes the processed distributed file into the distributed database.
[0006] In a possible implementation manner, the server marks different data bit identifiers for each data in the distributed file, including: the server generates a data bit identifier for each data according to the ID of each data and the partition ID of the distributed file to which it belongs; the server marks the corresponding data bit identifier for each data in the distributed file.
[0007] In this way, according to the ID of each data and the partition ID of the distributed file to which it belongs, data bit identifiers for each data are generated, which can clearly and accurately express the positions of each data.
[0008] In a possible implementation, the server marks corresponding data bit identifiers for each data in the distributed file, including: the server traverses each data in the distributed file and uses the sequence number when each data is traversed as the data bit identifier for each data; the server marks different data bit identifiers for each data in the distributed file.
[0009] It can be understood that using the sequence number when each data is traversed as the data bit identifier for each data can clearly and accurately express the positions of each data.
[0010] In a possible implementation, when the data volume in the distributed file is lower than a preset threshold, the preset string includes 2 32 bits; when the data volume in the distributed file is greater than or equal to the preset threshold, the preset string includes 2 64 bits.
[0011] It can be understood that when the data volume in the distributed file is lower than the preset threshold, the preset string includes 2 32 bits, which can reduce the use of storage space; when the data volume in the distributed file is greater than or equal to the preset threshold, the preset string includes 2 64 bits, which can clearly and accurately express the positions of each data.
[0012] In a possible implementation, while the server marks different data bit identifiers for each data, it also marks the data status of each data as the new status; according to the operation instruction, the server performs corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file, including: the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new status to the data status associated with the operation instruction; the server performs corresponding operation processing on the target data with the data status associated with the operation instruction.
[0013] In this way, the server can perform corresponding operation processing on the target data according to the data status associated with the operation instruction.
[0014] In a possible implementation manner, the operation instruction is a deletion instruction. The server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the data status associated with the operation instruction, including: the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the deletion status associated with the deletion instruction; the server performs corresponding operation processing on the target data with the data status associated with the operation instruction, including: the server performs deletion processing on the target data in the deletion status.
[0015] In this way, the server can perform corresponding deletion processing on the target data according to the deletion status associated with the deletion instruction.
[0016] In a possible implementation manner, the operation instruction is an update instruction. The server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the data status associated with the operation instruction, including: the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the update status associated with the update instruction; the server performs corresponding operation processing on the target data with the data status associated with the operation instruction, including: the server performs deletion processing on the target data in the update status and inserts the updated target data into the distributed file to which the target data belongs.
[0017] In this way, the server can perform corresponding update processing on the target data according to the update status associated with the deletion instruction.
[0018] In a possible implementation manner, before the server marks different data bit identifiers for each data in the distributed file, the method provided by this application further includes: the server locks the distributed file; after the server writes the updated distributed file into the distributed database, the method provided by this application further includes: releasing the lock on the distributed file written into the distributed database.
[0019] In this way, it can ensure that there will be no concurrent conflict situations in the operation of the target data of the distributed file.
[0020] In a second aspect, the present application further provides a data operation device, including: a data reading unit, configured to read a distributed file including a plurality of target data from a distributed database in response to an operation instruction for the plurality of target data from a terminal device; a data marking unit, configured to mark different data bit identifiers for each data in the distributed file; a data bit updating unit, configured to update a first character on a data bit corresponding to the data bit identifier of each target data in a preset string to a second character, wherein a first character is set on each data bit of the string before the update; a data processing unit, configured to perform corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction; and a data writing unit, configured to write the distributed file after the operation processing into the distributed database.
[0021] In a third aspect, the present application further provides a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the server is caused to execute the method provided in the first aspect.
[0022] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the computer is caused to execute the method provided in the first aspect as executed by the terminal device.
[0023] In a fifth aspect, the present application further provides a computer program product including a computer program. When the computer program is run, the computer is caused to execute the method provided in the first aspect.
[0024] For a data operation method provided by the present application, the server marks different data bit identifiers for each data in a distributed file including a plurality of target data to be operated. In this way, the server can update a first character on a data bit corresponding to the data bit identifier of each target data in a preset string to a second character to record the positions of the plurality of target data in the distributed file. Furthermore, corresponding operation processing can be performed on the plurality of distributed target data at one time according to the recorded positions of the plurality of target data. In this way, when performing batch operations on the data in the distributed database, only one read and write operation is required for the distributed file, which is highly efficient and saves computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] 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 required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0026] Figure 1 One of the flowcharts of the data operation method provided by the embodiments of the present application;
[0027] Figure 2 Another flowchart of the data operation method provided by the embodiments of the present application;
[0028] Figure 3 The third flowchart of the data operation method provided by the embodiments of the present application;
[0029] Figure 4 Schematic diagram of the preset string before update provided by the embodiments of the present application;
[0030] Figure 5 Schematic diagram of the preset string after update provided by the embodiments of the present application;
[0031] Figure 6 The fourth flowchart of the data operation method provided by the embodiments of the present application;
[0032] Figure 7 Functional module block diagram of the data operation device provided by the embodiments of the present application. Detailed implementation manners
[0033] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application under the inspiration of this embodiment belong to the scope of protection of the present application.
[0034] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily need to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0035] Currently, when performing operations such as batch updating or deleting data in a distributed database, for each data deletion or update, it is necessary to first read out the file where the data to be updated or deleted is located from the distributed database, perform the update or deletion on the target data, and then rewrite the processed file back into the distributed database. In this way, multiple file reads and writes are required, resulting in low efficiency and wasting computing resources.
[0036] Based on the above technical problems, the inventive concept of this application lies in: recording the positions of multiple target data in a distributed file through a preset string. Furthermore, corresponding operation processing can be performed on multiple distributed target data at one time according to the recorded positions of the multiple target data. In this way, when performing batch operations on the data in the distributed database, only one read and write operation on the distributed file is required, which is highly efficient and saves computing resources.
[0037] Next, specific embodiments will be used to elaborate in detail on the technical solutions of this application and how the technical solutions of this application solve the above technical problems. These specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below in conjunction with the accompanying drawings.
[0038] This application provides a data operation system, which is used to operate on target data in a distributed file. The system includes a server and a terminal device. Specifically, the server is communicatively connected to the terminal device. Among them, the terminal device can be, but is not limited to, a computer.
[0039] On the above system, Figure 1 is a flowchart of the data operation method provided by the embodiment of this application. As Figure 1 shown, the data operation method provided by this application includes:
[0040] S101: The server responds to an operation instruction for multiple target data from the terminal device, and reads a distributed file including multiple target data from the distributed database.
[0041] Exemplarily, the terminal device is provided with a business application. When the terminal device displays the business data management interface of the business application, the terminal device 100 can receive the data search conditions of the user on the business data management interface. Among them, the data search conditions can include business type, business generation time, and business affiliated city. Specifically, the business type can include, but is not limited to, calls, text messages, emails, etc., which are not limited herein.
[0042] Exemplarily, when the service type is a call, the service generation time is from 9:00 to 10:00, and the city is City I, the target data can be the call record data of calls generated in City I from 9:00 to 10:00; when the service type is a text message, the service generation time is from 10:00 to 11:00, and the city is City II, the target data can be the text message data of text messages generated in City II from 10:00 to 11:00.
[0043] Exemplarily, as shown in Table 1, the distributed file may include Data A, Data B....., Data N.
[0044] Table 1
[0045] Data Data A Data B Data C ...... Data N
[0046] S102: The server marks different data bit identifiers for each data in the distributed file.
[0047] Exemplarily, the specific implementation manners of S102 include but are not limited to the following two:
[0048] The first one: As Figure 2 shown, S102 includes:
[0049] S201: The server generates data bit identifiers for each data according to the ID of each data and the partition ID of the distributed file to which it belongs.
[0050] Among them, the server can use the monotonically_increasing_id() method built in Spark to generate data bit identifiers.
[0051] Exemplarily, the server can use the partition ID of the distributed file to which it belongs as the high bit of the data bit identifier, and use the ID of the data as the low bit of the data bit identifier. For example, when the data volume is less than 1 billion, the partition ID of the distributed file to which it belongs may include 2 9 bits, and the ID of the data may include 2 23 bits. Of course, it can also be to use the partition ID of the distributed file to which it belongs as the low bit of the data bit identifier, and use the ID of the data as the high bit of the data bit identifier, which is not limited here.
[0052] In this way, generating data bit identifiers for each data according to the ID of each data and the partition ID of the distributed file to which it belongs can clearly and accurately express the positions of each data.
[0053] The second one: As Figure 3 shown, S102 includes:
[0054] S301: The server traverses each piece of data in the distributed file, and uses the sequence number when each piece of data is traversed as the data bit identifier of each piece of data.
[0055] For example, when data A is traversed first, the data bit identifier of data A is 1; when data B is traversed second, the data bit identifier of data B is 2;......; when data N is traversed for the nth time, the data bit identifier of data A is n. It can be understood that using the sequence number when each piece of data is traversed as the data bit identifier of each piece of data can clearly and accurately represent the position of each piece of data.
[0056] S302: The server marks the corresponding data bit identifiers for each piece of data in the distributed file.
[0057] Specifically, the distributed file in which each piece of data is marked with a data bit identifier can be as shown in Table 2 below.
[0058] Table 2
[0059] Data Data bit identifier Data A 1 Data B 2 Data C ...... ...... Data N n
[0060] S103: The server updates the first character on the data bit corresponding to the data bit identifier of each target data in the preset string to the second character. Wherein, a first character is set on each data bit of the string before the update.
[0061] It should be noted that when the amount of data in the distributed file is lower than the preset threshold, the preset string can include 2 32 bits; when the amount of data in the distributed file is greater than or equal to the preset threshold, the preset string can include 2 64 bits. Wherein, the preset threshold can be, but is not limited to, one billion.
[0062] It can be understood that when the amount of data in the distributed file is lower than the preset threshold, the preset string including 2 32 bits can reduce the use of storage space; when the amount of data in the distributed file is greater than or equal to the preset threshold, the preset string including 2 64 bits can clearly and accurately represent the position of each piece of data.
[0063] Exemplarily, the first character can be "0", and the second character can be 1. Furthermore, as Figure 4 shown, the first string is "0 0 0...0 0" before the update. When the data with the data bit identifier of "2" needs to be updated, the first character "0" sorted from right to left as "2" in the first string can be updated to the second character "1". In this way, as Figure 5As shown, the server can record the position of the target data to be operated on in the distributed file by updating the first character '0' sorted as '2' from right to left to the second character '1'.
[0064] Similarly, when there are multiple target data, the first character '0' on the corresponding data bit of the data bit identifier of each target data in the string can be updated to the second character '1'.
[0065] S104: The server performs corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction.
[0066] Exemplarily, when there are multiple second characters '1' set on multiple data bits in the first string, the data bits set with the second character '1' are determined. Furthermore, the server determines the corresponding target data in the distributed file according to the data bits set with the second character '1'. In this way, operation processing is performed on the determined target data.
[0067] S105: The server writes the distributed file after operation processing into the distributed database.
[0068] In summary, for a data operation method provided in an embodiment of the present application, the server can mark different data bit identifiers for each data in a distributed file including multiple target data to be operated on. In this way, the server can update the first character on the data bit corresponding to the data bit identifier of each target data in a preset string to the second character to record the positions of multiple target data in the distributed file. Furthermore, corresponding operation processing can be performed on multiple distributed target data at one time according to the recorded positions of the multiple target data. In this way, when performing batch operations on the data in the distributed database, only one read and write operation is required for the distributed file, which is highly efficient and saves computing resources.
[0069] It should be noted that, based on the above corresponding embodiments, as Figure 1 shown, the above S102 further includes: while marking different data bit identifiers for each data, the server also marks the data status of each data as the new state. Among them, marking the new state for each data can be as shown in Table 3 below. In Table 3, 'C' is used to indicate that the data status is the new state. Figure 6
[0070] Table 3
[0071] Data Data bit identifier Data status Data A 1 C Data B 2 C Data C ...... ...... C Data N n C
[0072] Furthermore, the above S105 can specifically include:
[0073] S701: The server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the data status associated with the operation instruction.
[0074] S702: The server performs corresponding operation processing on the target data with the data status associated with the operation instruction.
[0075] Based on the above S701 - S702, the server can perform corresponding operation processing on the target data according to the data status associated with the operation instruction.
[0076] Specifically, the specific implementation of the above S701 - S702 may include but is not limited to the following two cases:
[0077] First: When the operation instruction is a deletion instruction, the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the deletion status associated with the deletion instruction.
[0078] Exemplarily, based on the embodiment corresponding to Table 3, if the first character '0' ranked '2' from right to left in the first string is updated to the second character '1', then the data status of data B with the data bit '2' is updated to the deletion status associated with the deletion instruction. Among them, the distributed file with the data status of data B with the data bit '2' updated to the deletion status can be as shown in Table 4 below. In Table 4, 'D' is used to indicate that the data status is the deletion status.
[0079] Table 4
[0080] Data Data bit identifier Data status Data A 1 C Data B 2 D Data C 3 C ...... ...... C Data N n C
[0081] In this way, the server can perform corresponding deletion processing on the target data according to the deletion status associated with the deletion instruction.
[0082] Based on the embodiment corresponding to Table 4, after the data status of data B with the data bit '2' is updated to the deletion status, data B is deleted. At this time, the distributed file written to the database can be as shown in Table 5 below.
[0083] Table 5
[0084] Data Data bit identifier Data status Data A 1 C Data C 2 C ...... ...... C Data N n C
[0085] Second: The operation instruction is an update instruction, and the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the update status associated with the update instruction.
[0086] Exemplarily, based on the embodiment corresponding to Table 3, if the first character '0' ranked '2' from right to left in the first string is updated to the second character '1', then the data state of data B with the data bit '2' is updated to the update state associated with the update instruction. Among them, the distributed file in which the data state of data B with the data bit '2' is updated to the update state can be as shown in Table 6 below. In Table 6, 'U' is used to indicate that the data state is the update state.
[0087] Table 6
[0088] Data Data bit identifier Data status Data A 1 C Data B 2 U Data C 3 C ...... ...... C Data N n C
[0089] Furthermore, the server performs a deletion process on the target data in the update state, and inserts the updated target data into the distributed file to which the target data belongs.
[0090] Based on the embodiment corresponding to Table 5, after the data state of data B with the data bit '2' is updated to the update state, data B is deleted, and then the updated data B1 is inserted at the end. At this time, the distributed file written to the database can be as shown in Table 7 below.
[0091] Table 7
[0092] Data Data bit identifier Data status Data A 1 C Data C 2 ...... ...... C Data N n-1 C Data B1 n C
[0093] In this way, the server can perform corresponding update processing on the target data according to the update state associated with the deletion instruction.
[0094] In addition, based on the corresponding embodiment, before S102, the method provided by the embodiments of the present application further includes: the server locks the distributed file; after S105, the method provided by the embodiments of the present application further includes: releasing the lock on the distributed file after writing it to the distributed database. In this way, it can ensure that the operation on the target data of the distributed file will not have a concurrency conflict situation. Figure 1 Please refer to
[0095] Please refer to Figure 7 , the present application also provides a data operation device 700. It should be noted that the basic principle and the technical effects generated by the data operation device 700 provided by the embodiments of the present application are the same as those of the above embodiments. For the sake of brief description, for the parts not mentioned in the embodiments of the present application, reference can be made to the corresponding content in the above embodiments. Among them, the data operation device 700 provided by the embodiments of the present application includes a data reading unit 701, a data marking unit 702, a data bit update unit 703, a data processing unit 704, and a data writing unit 705, where,
[0096] A data reading unit 701, configured to read a distributed file including multiple target data from a distributed database in response to an operation instruction for multiple target data from a terminal device.
[0097] A data marking unit 702, configured to mark different data bit identifiers for each data in the distributed file.
[0098] In a possible implementation manner, the data marking unit 702 may specifically be configured to generate data bit identifiers for each data according to the ID of each data and the partition ID of the distributed file to which it belongs; and mark the corresponding data bit identifiers for each data in the distributed file.
[0099] In another possible implementation manner, the data marking unit 702 may also specifically be configured to traverse each data in the distributed file, and use the sequence number of each data when it is traversed as the data bit identifier for each data; and the server marks different data bit identifiers for each data in the distributed file.
[0100] A data bit updating unit 703, configured to update the first character on the data bit corresponding to the data bit identifier of each target data in a preset string to a second character, where each data bit on the string is set with a first character before the update.
[0101] Exemplarily, when the amount of data in the distributed file is lower than a preset threshold, the preset string includes 2 32 bits; when the amount of data in the distributed file is greater than or equal to the preset threshold, the preset string includes 2 64 bits.
[0102] A data processing unit 704, configured to perform corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction.
[0103] A data writing unit 705, configured to write the distributed file after the operation processing into the distributed database.
[0104] In a possible implementation manner, the data marking unit 702 is further configured to, while marking different data bit identifiers for each data, also mark the data status of each data as a new status.
[0105] The data marking unit 702 is further configured to update the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new status to the data status associated with the operation instruction.
[0106] The data processing unit 704 is further configured to perform corresponding operation processing on the target data with the data status associated with the operation instruction.
[0107] In a possible implementation, the operation instruction is a deletion instruction. The data marking unit 702 is specifically configured to update the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the deletion state associated with the deletion instruction. The data processing unit 704 is specifically configured to perform a deletion process on the target data in the deletion state.
[0108] In a possible implementation, the operation instruction is an update instruction. The data marking unit 702 is specifically configured to update the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new state to the update state associated with the update instruction. The data processing unit 704 is configured to perform a deletion process on the target data in the update state and insert the updated target data into the distributed file to which the target data belongs.
[0109] In a possible implementation, the apparatus 700 provided in the embodiments of the present application further includes: a data locking unit for locking the distributed file; a data unlocking unit for releasing the lock on the distributed file after writing it into the distributed database.
[0110] The embodiments of the present application further provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the computer is caused to execute the method provided in the above embodiments.
[0111] The embodiments of the present application further provide a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the server is caused to execute the method provided in the above embodiments.
[0112] The embodiments of the present application further provide a computer program product, including a computer program. When the computer program is run, the computer is caused to execute the method provided in the above embodiments.
[0113] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: various media such as ROM, RAM, magnetic disk, or optical disc that can store program codes.
[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data operation method, characterized in that, Applied to a server, the method includes: The server responds to an operation instruction for multiple target data from a terminal device, and reads a distributed file including the multiple target data from a distributed database; The server marks different data bit identifiers for each data in the distributed file; The server updates the first character on the data bit corresponding to the data bit identifier of each target data in a preset string to a second character, where each data bit on the string is set with the first character before the update; The server performs corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction; The server writes the distributed file after the operation processing into the distributed database.
2. The method according to claim 1, characterized in that, The server marks different data bit identifiers for each data in the distributed file, including: The server generates data bit identifiers for each data according to the ID of each data and the partition ID of the distributed file to which it belongs; The server marks corresponding data bit identifiers for each data in the distributed file.
3. The method according to claim 1, characterized in that, The server marks different data bit identifiers for each data in the distributed file, including: The server traverses each data in the distributed file, and uses the sequence number of each data when it is traversed as the data bit identifier of each data; The server marks different data bit identifiers for each data in the distributed file.
4. The method according to claim 2 or 3, wherein When the amount of data in the distributed file is lower than a preset threshold, the preset string includes 2 32 bits; When the amount of data in the distributed file is greater than or equal to the preset threshold, the preset string includes 2 64 bits.
5. The method according to claim 1, characterized in that, When the server marks different data bit identifiers for each data, it also marks the data status of each data as a new status; the server performs corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction, including: The server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new status to the data status associated with the operation instruction; The server performs corresponding operation processing on the target data with the data status associated with the operation instruction.
6. The method according to claim 5, wherein When the operation instruction is a delete instruction, the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new status to the data status associated with the operation instruction, including: The server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new status to the delete status associated with the delete instruction; The server performs corresponding operation processing on the target data with the data status associated with the operation instruction, including: the server performs a delete process on the target data in the delete status.
7. The method according to claim 5, wherein When the operation instruction is an update instruction, the server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new status to the data status associated with the operation instruction, including: The server updates the data status of the target data corresponding to the data bit set with the second character in the distributed file from the new - created state to the update state associated with the update instruction; The server performs corresponding operation processing on the target data of the data status associated with the operation instruction, including: the server performs deletion processing on the target data in the update state, and inserts the updated target data into the distributed file to which the target data belongs.
8. The method according to claim 1, characterized in that, Before the server marks different data - bit identifiers for each data in the distributed file, the method further includes: The server locks the distributed file; After the server writes the updated distributed file into the distributed database, the method further includes: Releasing the lock on the distributed file after it is written into the distributed database.
9. A data operation device, characterized in that, The device includes: A data reading unit, configured to respond to an operation instruction for multiple target data from a terminal device, and read a distributed file including the multiple target data from a distributed database; A data marking unit, configured to mark different data - bit identifiers for each data in the distributed file; A data - bit updating unit, configured to update the first character on the data bit corresponding to the data - bit identifier of each target data in a preset string to a second character, where each data bit on the string is set with the first character before the update; A data processing unit, configured to perform corresponding operation processing on the target data corresponding to the data bit set with the second character in the distributed file according to the operation instruction; A data writing unit, configured to write the operation - processed distributed file into the distributed database.
10. A server, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the server is caused to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data writing method, device and equipment
CN110691062A
Data identifier generation method and device, equipment and medium
CN114297734A