Partition management method and apparatus for short write pause durations, electronic device, and storage medium
By freezing the source partition's memory table and creating the destination partition, and executing data write commands based on the partition's state, the problem of excessively long write pause times during partition splitting or merging is solved, resulting in a better user experience.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2026-03-12
AI Technical Summary
In existing technologies, the source partition remains in a write-stop state for a long time during partition splitting or merging, resulting in a poor user experience.
By freezing the memory table of the source partition and creating at least one destination partition, data write instructions are executed based on whether the memory table of the source partition is frozen, whether structural changes are occurring, and whether the destination partition has been created, thus shortening the write pause time.
When splitting or merging partitions in the source partition, the write pause time is significantly reduced, improving the user experience.
Smart Images

Figure CN2025119888_12032026_PF_FP_ABST
Abstract
Description
Partition management method and device for short stop-write duration, electronic device, and storage medium TECHNICAL FIELD
[0001] One or more embodiments of the present specification relate to the technical field of database, and in particular to a partition management method and device for short stop-write duration, an electronic device, and a storage medium. BACKGROUND
[0002] A database can store and manage data, such as adjusting a data storage structure, writing data, querying data, and the like. In order to adapt to the rapid development of the Internet, in recent years, the form and function of the database have become increasingly rich, such as the gradual emergence of a new type of database form, such as a distributed database, and the gradual development of the database with functions such as partition splitting and partition merging.
[0003] In related technologies, during the process of partition splitting or partition merging, the source partition stops providing external services, and the destination partition needs to wait for the memory table of the source partition to be flushed to the disk before providing external services by referencing the data on the disk of the source partition, i.e., the partition is in a stop-write state for the duration of the memory table of the source partition being flushed to the disk. The duration of the stop-write state is long, resulting in poor user experience. SUMMARY
[0004] Therefore, one or more embodiments of the present specification provide a partition management method and device for short stop-write duration, an electronic device, and a storage medium.
[0005] To achieve the above object, the technical solutions of one or more embodiments of the present specification are as follows:
[0006] According to a first aspect of one or more embodiments of the present specification, a partition management method for short stop-write duration is provided, and the method comprises:
[0007] receiving a structure change instruction for a source partition, freezing a memory table of the source partition, and creating at least one destination partition, wherein the structure change instruction comprises a partition splitting instruction or a partition merging instruction;
[0008] If a data write instruction for the source partition is received, the data write instruction is executed according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change.
[0009] In one or more embodiments of the present specification, before the at least one destination partition is created, the method further comprises:
[0010] The data write instruction that is not completed when the memory table of the source partition is frozen is executed.
[0011] In one or more embodiments of the present specification, after the creating the at least one destination partition, the method further comprises:
[0012] committing a structure change transaction for the source partition; wherein the committing of the structure change transaction characterizes that the partition split or the partition merge is write-end.
[0013] In one or more embodiments of the present specification, before the freezing the in-memory table of the source partition, the method further comprises:
[0014] modifying a state of the source partition to a source partition state; wherein the source partition state indicates that the source partition is undergoing a structure change.
[0015] In one or more embodiments of the present specification, the executing the data write instruction according to whether the in-memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed creating when the source partition is undergoing a structure change, comprises:
[0016] if the data write instruction for the source partition is received in a case that the in-memory table of the source partition is frozen, the source partition is undergoing a structure change, and the at least one destination partition is completed creating, sending the data write instruction to a corresponding destination partition, and causing the destination partition to write data indicated by the data write instruction into an in-memory table of the destination partition.
[0017] In one or more embodiments of the present specification, the executing the data write instruction according to whether the in-memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed creating when the source partition is undergoing a structure change, comprises:
[0018] if the data write instruction for the source partition is received in a case that the in-memory table of the source partition is frozen, the source partition is undergoing a structure change, and the at least one destination partition is not completed creating, waiting for the structure change transaction to be committed.
[0019] In one or more embodiments of the present specification, the executing the data write instruction according to whether the in-memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed creating when the source partition is undergoing a structure change, comprises:
[0020] If a data write instruction for the source partition is received when the memory table of the source partition is frozen and no structural change occurs in the source partition, a new memory table is created and data indicated by the data write instruction is written into the new memory table.
[0021] In one or more embodiments of the present specification, when the structural change instruction is a partition splitting instruction, the executing the data query instruction based on the memory tables and the ordered string tables of the source partition and the corresponding destination partition comprises:
[0022] The data query instruction is executed based on the filtering results of the memory table and the ordered string table of the source partition, and the memory table and the ordered string table of the corresponding destination partition.
[0023] In one or more embodiments of the present specification, the method further comprises:
[0024] Dividing data in the source partition to the corresponding destination partition.
[0025] In one or more embodiments of the present specification, the method further comprises:
[0026] If all data in the source partition is completed to be divided, the source partition is deleted.
[0027] In one or more embodiments of the present specification, the method further comprises:
[0028] If a data query instruction for the source partition is received, the data query instruction is executed based on the memory tables and the ordered string tables of the source partition and the corresponding destination partition.
[0029] According to a second aspect of one or more embodiments of the present specification, a partition management device for short stop write duration is provided, the device comprising:
[0030] A stop-write module is configured to receive a structural change instruction for a source partition, freeze a memory table of the source partition, and create at least one destination partition, wherein the structural change instruction comprises a partition splitting instruction or a partition merging instruction.
[0031] A write module is configured to execute a data write instruction for the source partition according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structural change, and whether the at least one destination partition is completed to be created when the source partition is undergoing a structural change.
[0032] In one or more embodiments of the present specification, the stop-write module is further configured to:
[0033] The data write instruction that is not completed when the memory table of the source partition is frozen is executed after the at least one target partition is created.
[0034] In one or more embodiments of the present specification, the write module is further configured to:
[0035] The structure change transaction for the source partition is committed after the at least one target partition is created; wherein the commitment of the structure change transaction represents that the stop-write of the partition split or the partition merge has ended.
[0036] In one or more embodiments of the present specification, the write module is further configured to:
[0037] The state of the source partition is modified to a source partition state before the memory table of the source partition is frozen; wherein the source partition state indicates that the source partition is undergoing a structure change.
[0038] In one or more embodiments of the present specification, the write module is specifically configured to:
[0039] If a data write instruction for the source partition is received in a case where the memory table of the source partition is frozen, the source partition is undergoing a structure change, and the at least one target partition has been created, the data write instruction is sent to a corresponding target partition, and the target partition writes data indicated by the data write instruction into a memory table of the target partition.
[0040] In one or more embodiments of the present specification, the write module is specifically configured to:
[0041] If a data write instruction for the source partition is received in a case where the memory table of the source partition is frozen, the source partition is undergoing a structure change, and the at least one target partition has not been created, the structure change transaction is waited for.
[0042] In one or more embodiments of the present specification, the write module is specifically configured to:
[0043] If a data write instruction for the source partition is received in a case where the memory table of the source partition is frozen, and the source partition is not undergoing a structure change, a new memory table is created and data indicated by the data write instruction is written into the new memory table.
[0044] In one or more embodiments of the present specification, the apparatus further comprises a query module configured to:
[0045] If a data query instruction for the source partition is received, the data query instruction is executed on the basis of reference to the memory tables and the ordered string tables of the source partition and the corresponding target partitions.
[0046] In one or more embodiments of the present specification, in the case that the structure change instruction is a partition split instruction, the query module is configured to:
[0047] execute the data query instruction based on the filtering results of the memory table and the ordered string table of the source partition, and the memory table and the ordered string table of the corresponding destination partition.
[0048] In one or more embodiments of the present specification, the apparatus further comprises a division module configured to:
[0049] divide the data in the source partition to the corresponding destination partition.
[0050] In one or more embodiments of the present specification, the apparatus further comprises a deletion module configured to:
[0051] delete the source partition if all the data in the source partition is completed to be divided.
[0052] According to a third aspect of one or more embodiments of the present specification, a computer program product is provided, comprising computer programs / instructions, which, when executed by a processor, implement the steps of the method of the first aspect.
[0053] According to a fourth aspect of one or more embodiments of the present specification, an electronic device is provided, comprising:
[0054] a processor;
[0055] a memory for storing processor-executable instructions;
[0056] wherein the processor implements the method of the first aspect by running the executable instructions.
[0057] According to a fifth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, having stored thereon computer instructions, which, when executed by a processor, implement the steps of the method of the first aspect.
[0058] The technical solutions provided by the embodiments of the present specification can include the following beneficial effects:
[0059] The partition management method for short stop-write duration provided by the embodiments of the present specification, if a structure change instruction such as a partition splitting instruction or a partition merging instruction is received for a source partition, the memory table of the source partition is frozen, and at least one destination partition is created; if a data write instruction is received for the source partition, the data write instruction can be executed according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change. That is, when the source partition is split or merged, the source partition can be stopped and written by using the freezing of the memory table of the source partition, the judgment of the structure change of the source partition, and the creation progress of the destination partition created when the source partition is undergoing a structure change. Generally, the source partition is in a stop-write state only during a period of the freezing of the memory table of the source partition, and the duration of the stop-write is greatly shortened compared with the duration of the writing of the memory table of the source partition to the disk in the related art, thereby improving the user experience. BRIEF DESCRIPTION OF DRAWINGS
[0060] FIG. 1 is a structural diagram of a distributed database provided by an example embodiment.
[0061] FIG. 2 is a flowchart of a partition management method for short stop-write duration provided by an example embodiment.
[0062] FIG. 3 is a schematic diagram of partition splitting and partition merging provided by an example embodiment.
[0063] FIG. 4 is a structural schematic diagram of an apparatus provided by an example embodiment.
[0064] FIG. 5 is a block diagram of a partition splitting management device provided by an example embodiment. DETAILED DESCRIPTION
[0065] The example embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following example embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Instead, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of the present specification as detailed in the appended claims.
[0066] It should be noted that the steps of the corresponding method are not necessarily performed in the order shown and described in the specification in other embodiments. In some other embodiments, the steps included in the method thereof can be more or less than described in the specification. In addition, a single step described in the specification can be divided into multiple steps for description in other embodiments; and multiple steps described in the specification can be combined into a single step for description in other embodiments.
[0067] Based on the technical problems mentioned in the background, at least one embodiment of the specification provides a short stop-write duration partition management method, which can shorten the stop-write time of the partition during the partition structure change process such as partition splitting and partition merging, thereby avoiding the influence of the too long stop-write time in the process on the user experience.
[0068] The method can be applied to a distributed database based on an LSM-Tree storage engine as shown in FIG. 1.
[0069] Please refer to FIG. 2, which exemplarily shows the flow of the short stop-write duration partition management method, including steps S201 to S203.
[0070] In step S201, a structure change instruction for a source partition is received, the memory table of the source partition is frozen, and at least one destination partition is created, wherein the structure change instruction includes a partition splitting instruction or a partition merging instruction.
[0071] Please refer to FIG. 3. If the structure change instruction is a partition splitting instruction, the source partition is multiple and the destination partition is one; if the structure change instruction is a partition merging instruction, the source partition is one and the destination partition is multiple. It should be noted that the source partition mentioned in the specification is only a certain partition in the distributed database, and it is only because it has partition splitting or partition merging in most embodiments of the specification that the source partition is used to refer to the partition, but the reference is not specific but general to any partition in the distributed database; moreover, for the sake of continuity and consistency of the description, the source partition is also used to refer to the partition in the embodiments of the specification in which the partition does not have partition splitting and partition merging, but this has no limiting effect.
[0072] Among them, freezing the memory table (MemTable) of the source partition means that the memory table no longer receives data write instructions.
[0073] Exemplarily, before the memory table of the source partition is frozen, the method further comprises: modifying a state of the source partition to a source partition state. Wherein, the source partition state indicates that the source partition is undergoing a structural change. Since the structural change instruction comprises a partition splitting instruction or a partition merging instruction, accordingly, the source partition undergoing a structural change means that the source partition is undergoing a partition splitting or a partition merging. For a source partition that is not in the source partition state, the source partition is neither undergoing a partition splitting nor undergoing a partition merging at this time.
[0074] Exemplarily, before the at least one destination partition is created, the data write instruction that is not completed when the memory table of the source partition is frozen can be executed.
[0075] Exemplarily, after the at least one destination partition is created, the method further comprises: committing a structural change transaction of the source partition. Wherein, the commitment of the structural change transaction represents that the stop-write of the partition splitting or the partition merging has ended, i.e., the source partition can receive data write instructions again, and the destination partition can provide data query, data write and other services to the outside. It should be noted that, since the structural change transaction is committed after the at least one destination partition is created, the committed structural change transaction means that the at least one destination partition has been created, and the uncommitted structural change transaction means that the at least one destination partition has not been created.
[0076] It should be understood that, after the structural change transaction is committed, subsequent operations of the partition splitting or the partition merging can be executed, i.e.: dividing the data in the source partition to the corresponding destination partition; and deleting the source partition if all the data in the source partition is divided. Wherein, when the data in the source partition is divided to the corresponding destination partition, the data in the source partition can be copied (replicated) to the corresponding destination partition. For example, the data in the ordered string table of the source partition is replicated to the corresponding destination partition; the data in the frozen memory table of the source partition is replicated to the corresponding destination partition, or the data in the frozen memory table is flushed to the disk of the source partition and then replicated to the corresponding destination partition.
[0077] In step S202, if a data write instruction for the source partition is received, according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structural change, and whether the at least one destination partition is created when the source partition is undergoing a structural change, the data write instruction is executed.
[0078] For any one partition in the database, if a data write instruction for the partition is received, the data write instruction can be executed according to whether the in-memory table of the partition is frozen, whether the partition is undergoing a structural change (when the partition is undergoing a structural change, the partition becomes a source partition), and whether at least one destination partition created when the partition is undergoing a structural change is completed.
[0079] For example, for the source partition, if a data write instruction for the source partition is received when the in-memory table of the source partition is frozen, the source partition is undergoing a structural change, and the at least one destination partition is completed, the data write instruction can be sent to the corresponding destination partition, and the destination partition can write the data indicated by the data write instruction into the in-memory table of the destination partition.
[0080] Specifically, whether the source partition is undergoing a structural change can be determined by whether the state of the source partition is a source partition state. If the state of the source partition is a source partition state, it can be determined that the source partition is undergoing a structural change, i.e., the source partition is undergoing a partition split or a partition merge. If the state of the source partition is not a source partition state, it can be determined that the source partition is not undergoing a structural change, i.e., the source partition is not undergoing a partition split or a partition merge.
[0081] Whether the at least one destination partition corresponding to the source partition is completed can be determined by whether a structural change transaction for the source partition is committed. If the structural change transaction for the source partition is committed, it can be determined that the at least one destination partition corresponding to the source partition is completed. If the structural change transaction for the source partition is not committed, it can be determined that the at least one destination partition corresponding to the source partition is not completed.
[0082] For example, for the source partition, if a data write instruction for the source partition is received when the in-memory table of the source partition is frozen, the source partition is undergoing a structural change, and the at least one destination partition is not completed, the data write instruction is waited to be committed.
[0083] It should be noted that after the in-memory table of the source partition is frozen, the data write instruction that has occurred but is not completed on the in-memory table needs to be executed, and the destination partition corresponding to the source partition needs to be completed. The time length is short, so the data write instruction in this embodiment does not need to be rolled back or rejected, but can be directly waited to be completed by the destination partition corresponding to the source partition. After the destination partition corresponding to the source partition is completed, the data indicated by the data write instruction can be written into the corresponding destination partition in the manner provided in the above embodiment.
[0084] The committing of the structure change transaction represents that the stop-write of the partition split or the partition merge is completed, that is, the source partition can receive data write instructions again, and the target partition can provide data write services externally. It can be seen that the partition that is split or merged in the method only stops writing when the memory table of the source partition is frozen, and the target partition that needs to be split or merged is not completed. The stop-write time is greatly shortened relative to the time length of the memory table of the source partition being flushed to the disk in the related art, thereby improving the user experience.
[0085] For example, if a data write instruction for the source partition is received when the memory table of the source partition is frozen and no structure change occurs in the source partition, a new memory table is created, and the data indicated by the data write instruction is written into the new memory table.
[0086] The state of the source partition does not change, that is, the source partition is not split or merged, and the memory table of the source partition is frozen in the normal state, for example, the memory table is frozen after the data amount reaches a preset threshold, and the disk is flushed. Therefore, in this case, only a new memory table needs to be created, and data is written into the new memory table.
[0087] For example, if a data query instruction for the source partition is received, the data query instruction is executed on the basis of the memory tables and the ordered string tables (SSTable) of the source partition and the corresponding target partition.
[0088] After the source partition starts the partition split or the partition merge, the source partition stops providing services externally, including data write services and data query services. When the partition split or the partition merge is not completed, the target partition does not have corresponding data (that is, the data that the target partition should store after the completion of the partition split or the partition merge), and therefore, the data in the source partition needs to be referred to, that is, the data in the frozen memory table and the data in the ordered string table in the disk.
[0089] The corresponding target partition refers to the target partition in which the data to which the data query instruction is directed is located after the completion of the partition split or the partition merge.
[0090] Further, in the case of the structure change instruction being a partition split instruction, the data stored in the target partition after the completion of the partition split is part of the data of the source partition, that is, when the data query instruction is executed, the entire data of the source partition does not need to be referred to, but only part of the data needs to be referred to, that is, the data query instruction can be executed on the basis of the filtering results of the memory table and the ordered string table of the source partition and the memory table and the ordered string table of the corresponding target partition. The filtering results of the memory table and the ordered string table of the source partition can be the results of filtering the memory table and the ordered string table of the source partition according to the data range of the corresponding target partition.
[0091] The short stop-write duration partition management method provided by the embodiments of the present specification, if a structure change instruction such as a partition split instruction or a partition merge instruction is received for a source partition, freezes the memory table of the source partition, and creates at least one destination partition; if a data write instruction is received for the source partition, the data write instruction can be executed according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change. That is, when the source partition is split or merged, the source partition can be stopped and written by using the freezing of the memory table of the source partition, the judgment of the structure change of the source partition, and the creation progress of the destination partition created when the source partition is undergoing a structure change. Generally, the source partition is in a stop-write state only during a period of the freezing of the memory table of the source partition, and the duration of the stop-write is greatly shortened relative to the duration of the writing of the memory table of the source partition to the disk in the related art, thereby improving the user experience.
[0092] FIG. 4 is a schematic structural diagram of a device provided by an exemplary embodiment. Referring to FIG. 4, at the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, and can also include other hardware required by tasks. One or more embodiments of the present specification can be implemented in a software manner, such as reading a corresponding computer program from the non-volatile memory 410 into the memory 408 by the processor 402 and then running. Of course, in addition to the software implementation, one or more embodiments of the present specification do not exclude other implementation manners, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or a logic device.
[0093] Referring to FIG. 5, the short stop-write duration partition management apparatus can be applied to the device shown in FIG. 4 to implement the technical solutions of the present specification. The short stop-write duration partition management apparatus can include:
[0094] A stop-write module 501 configured to receive a structure change instruction for a source partition, freeze the memory table of the source partition, and create at least one destination partition, wherein the structure change instruction includes a partition split instruction or a partition merge instruction;
[0095] A write module 502 configured to, if a data write instruction is received for the source partition, execute the data write instruction according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change.
[0096] In one or more embodiments of the present specification, the stop-write module is further configured to:
[0097] The data write instruction that is not completed when the memory table of the source partition is frozen is executed after the at least one destination partition is created.
[0098] In one or more embodiments of the present specification, the stop-write module is further configured to:
[0099] The structural change transaction for the source partition is committed after the at least one destination partition is created; wherein the commitment of the structural change transaction represents that the stop-write of the partition split or the partition merge has ended.
[0100] In one or more embodiments of the present specification, the stop-write module is further configured to:
[0101] The state of the source partition is modified to a source partition state before the memory table of the source partition is frozen; wherein the source partition state indicates that the source partition is undergoing a structural change.
[0102] In one or more embodiments of the present specification, the write module is specifically configured to:
[0103] If a data write instruction for the source partition is received in a case where the memory table of the source partition is frozen, the source partition is undergoing a structural change, and the at least one destination partition has completed creation, the data write instruction is sent to a corresponding destination partition, and the destination partition writes data indicated by the data write instruction into a memory table of the destination partition.
[0104] In one or more embodiments of the present specification, the write module is specifically configured to:
[0105] If a data write instruction for the source partition is received in a case where the memory table of the source partition is frozen, the source partition is undergoing a structural change, and the at least one destination partition has not completed creation, the write module waits for the structural change transaction to be committed.
[0106] In one or more embodiments of the present specification, the write module is specifically configured to:
[0107] If a data write instruction for the source partition is received in a case where the memory table of the source partition is frozen, and the source partition is not undergoing a structural change, a new memory table is created and data indicated by the data write instruction is written into the new memory table.
[0108] In one or more embodiments of the present specification, the apparatus further comprises a query module configured to:
[0109] If a data query instruction for the source partition is received, the data query instruction is executed based on reference to the memory table and the ordered string table of the source partition and the corresponding destination partition.
[0110] In one or more embodiments of the present specification, in a case where the structure change instruction is a partition split instruction, the query module is configured to:
[0111] The data query instruction is executed based on reference to the filtering result of the memory table and the ordered string table of the source partition, and the memory table and the ordered string table of the corresponding destination partition.
[0112] In one or more embodiments of the present specification, the apparatus further comprises a division module configured to:
[0113] Divide data in the source partition to the corresponding destination partition.
[0114] In one or more embodiments of the present specification, the apparatus further comprises a deletion module configured to:
[0115] If all data in the source partition is completed to be divided, the source partition is deleted.
[0116] The system, apparatus, module or unit illustrated in the above embodiments can be specifically implemented by a computer chip or entity, or by a product with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0117] In a typical configuration, a computer includes one or more processors (CPU), input / output interface, network interface, and memory.
[0118] The memory can include a non-persistent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer readable medium.
[0119] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can implement information storage by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, disk storage, quantum memory, graphene-based storage medium or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0120] It should also be noted that the terms "comprising," "including," or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0121] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from the order in the embodiments and still achieve the desired result. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are possible or can be advantageous.
[0122] The terms used in one or more embodiments of the present specification are merely for the purpose of describing specific embodiments and are not intended to limit one or more embodiments of the present specification. The singular forms "a", "an" and "the" used in one or more embodiments of the present specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein means and includes any or all possible combinations of one or more associated listed items.
[0123] The user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the specification are information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.
[0124] It should be understood that, although one or more embodiments of the specification can use the terms first, second, third, etc. to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the specification, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "when" or "when" or "in response to determining".
[0125] The above only describes the preferred embodiments of one or more embodiments of the specification, and does not limit one or more embodiments of the specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the specification shall be included in the protection scope of one or more embodiments of the specification.
Claims
1. A method for managing partitions with short pause write duration, the method comprising: receiving a structure change instruction for a source partition, freezing a memory table of the source partition, and creating at least one destination partition, wherein the structure change instruction comprises a partition split instruction or a partition merge instruction; if a data write instruction for the source partition is received, executing the data write instruction according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change. 2.The method for managing partitions with short pause write duration according to claim 1, before the creating at least one destination partition, the method further comprising: executing a data write instruction that is not completed when the memory table of the source partition is frozen. 3.The method for managing partitions with short pause write duration according to claim 2, after the creating at least one destination partition, the method further comprising: committing a structure change transaction for the source partition; wherein the committing of the structure change transaction represents that a pause write of the partition split or the partition merge has ended. 4.The method for managing partitions with short pause write duration according to claim 3, before the freezing the memory table of the source partition, the method further comprising: modifying a state of the source partition to a source partition state; wherein the source partition state indicates that the source partition is undergoing a structure change. 5.The method for managing partitions with short pause write duration according to claim 1, the executing the data write instruction according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change, comprises: if the data write instruction for the source partition is received when the memory table of the source partition is frozen, the source partition is undergoing a structure change, and the at least one destination partition is completed, sending the data write instruction to a corresponding destination partition, and causing the destination partition to write data indicated by the data write instruction into a memory table of the destination partition. 6.The method for managing partitions with short pause write duration according to claim 1, the executing the data write instruction according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change, comprises: if the data write instruction for the source partition is received when the memory table of the source partition is frozen, the source partition is undergoing a structure change, and the at least one destination partition is not completed, waiting for the structure change transaction to be committed. 7.The method for managing partitions with short pause write duration according to claim 1, the executing the data write instruction according to whether the memory table of the source partition is frozen, whether the source partition is undergoing a structure change, and whether the at least one destination partition is completed when the source partition is undergoing a structure change, comprises: If a data write instruction for the source partition is received when the memory table of the source partition is frozen and no structural change occurs in the source partition, a new memory table is created and data indicated by the data write instruction is written into the new memory table.
8. The method of claim 1, further comprising: if a data query instruction for the source partition is received, executing the data query instruction based on the memory tables and the ordered string tables of the source partition and the corresponding destination partition.
9. The method of claim 8, wherein if the structural change instruction is a partition split instruction, the executing the data query instruction based on the memory tables and the ordered string tables of the source partition and the corresponding destination partition comprises: executing the data query instruction based on the filtering results of the memory table and the ordered string table of the source partition, and the memory table and the ordered string table of the corresponding destination partition.
10. The method of claim 1, further comprising: dividing data in the source partition to the corresponding destination partition.
11. The method of claim 1, further comprising: if all data in the source partition is completed to be divided, deleting the source partition.
12. An apparatus for managing partitions with short stop-write duration, the apparatus comprising: a stop-write module configured to receive a structural change instruction for a source partition, freeze a memory table of the source partition, and create at least one destination partition, wherein the structural change instruction comprises a partition split instruction or a partition merge instruction; a write module configured to, if a data write instruction for the source partition is received, execute the data write instruction based on whether the memory table of the source partition is frozen, whether a structural change is occurring in the source partition, and whether the at least one destination partition is completed to be created when the structural change is occurring in the source partition.
13. A computer program product comprising computer programs / instructions, which, when executed by a processor, implement the steps of the method of any one of claims 1 to 11.
14. An electronic device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor, by running the executable instructions, implements the method of any one of claims 1 to 11.
15. A computer-readable storage medium having stored thereon computer instructions, which, when executed by a processor, implement the steps of the method of any one of claims 1 to 11.
Citation Information
Patent Citations
Database operation method, device and system
CN107239485A
Partition splitting method and device, electronic equipment and readable storage medium
CN110032549A
Partition management method and device for short write stop duration, electronic equipment and storage medium
CN119166062A
Methods for partitioning an object
US20080034181A1