Branch management method, system, electronic device, storage medium and computer program product

By creating immutable target storage paths and independent storage metadata in physical storage space, combined with branch topology database management, the problems of high branch creation cost and low management efficiency are solved, storage space isolation and independent evolution are realized, and branch management efficiency is improved.

CN123177754APending Publication Date: 2026-11-27ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611676575.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies suffer from high branch creation costs and low branch management efficiency, making it difficult to support the need for multiple storage branches to evolve independently while sharing underlying data.

Method used

By creating an immutable target storage path in the physical storage space and generating independent second storage metadata based on the storage metadata of the parent branch, and combining the creation log position of the sub-branch with the branch topology database, the sub-branch is kept active, thus realizing the mapping relationship between logical namespaces and physical files.

Benefits of technology

It reduces the latency and resource overhead of branch creation, improves branch management efficiency, realizes storage space isolation and independent evolution capabilities, and solves the problems of high branch creation cost and low management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123177754A_ABST
    Figure CN123177754A_ABST
Patent Text Reader

Abstract

The application discloses a branch management method and system, electronic equipment, a storage medium and a computer program product, and relates to the technical field of data storage. The method comprises the following steps: in response to a creation request of a sub-branch, determining a parent branch of the sub-branch, and determining a creation log point of the sub-branch; creating a target storage path corresponding to the sub-branch in a physical storage space, wherein the physical storage space remains in an immutable state after a physical file is written; generating second storage metadata in the target storage path based on first storage metadata of the parent branch at the creation log point, wherein the second storage metadata is used to represent a mapping relationship between a logical namespace of the sub-branch and the physical file; and associating the creation log point and the second storage metadata to a branch identifier of the sub-branch in a branch topology database, so that the sub-branch remains in an active state. The application solves the technical problems of high branch creation cost and low branch management efficiency in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage technology, and more specifically, to a branch management method, system, electronic device, storage medium, and computer program product. Background Technology

[0002] With the growth of data volume, cloud computing and storage scenarios require the ability to build storage branches or snapshots to support the needs of parallel development and test rollback across multiple environments. Related technical solutions typically require performing a full copy operation on the relevant data in the underlying storage system and rely on a centralized metadata management mechanism to maintain the relationship between the data view and the underlying data. This approach results in significant resource and time consumption for branch creation and makes it difficult to support the independent evolution of multiple storage branches while sharing underlying data, leading to low overall efficiency in branch management. Currently, no effective solution has been proposed to address the issues of high branch creation costs and low branch management efficiency. Summary of the Invention

[0003] This application provides a branch management method, system, electronic device, storage medium, and computer program product to at least solve the technical problems of high branch creation cost and low branch management efficiency in related technologies.

[0004] According to one aspect of the embodiments of this application, a branch management method is provided, comprising: in response to a sub-branch creation request, determining the parent branch of the sub-branch and determining the creation log position of the sub-branch; creating a target storage path corresponding to the sub-branch in physical storage space, wherein physical files in the physical storage space remain immutable after being written; generating second storage metadata in the target storage path based on first storage metadata of the parent branch at the creation log position, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace of the sub-branch and physical files; associating the creation log position and the second storage metadata with the branch identifier of the sub-branch in a branch topology database, so that the sub-branch remains active.

[0005] According to another aspect of the embodiments of this application, a branch management system is provided, including: a control module, a computing layer, and an object storage layer; the object storage layer is used to provide physical storage space, wherein physical files in the physical storage space remain immutable after being written; the control module is configured to, in response to a sub-branch creation request, determine the parent branch of the sub-branch and determine the creation log position of the sub-branch; the computing layer is configured to, create a target storage path corresponding to the sub-branch in the physical storage space, and generate second storage metadata in the target storage path based on first storage metadata of the parent branch at the creation log position, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace of the sub-branch and the physical file; the control module is further configured to, associate the creation log position and the second storage metadata with the branch identifier of the sub-branch in the branch topology database, so that the sub-branch remains active.

[0006] According to another aspect of the embodiments of this application, an electronic device is provided, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the branch management method of any one of the above-mentioned methods during runtime.

[0007] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the storage medium is located to execute any of the above-mentioned branch management methods.

[0008] According to another aspect of the embodiments of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the branch management method according to any one of the above.

[0009] In this embodiment, upon receiving a sub-branch creation request, the creation log positions of the parent branch and the sub-branch are determined; and a target storage path corresponding to the sub-branch is created in the physical storage space, wherein the physical file in the physical storage space remains immutable after being written; subsequently, based on the first storage metadata of the parent branch at the creation log position, a second storage metadata is generated in the target storage path, which is used to characterize the mapping relationship between the logical namespace of the sub-branch and the physical file. Since the second storage metadata is independently constructed in the target storage path, its mapping relationship ensures the independence of the sub-branch in the logical view; furthermore, the creation log position and the second storage metadata are associated with the branch identifier of the sub-branch in the branch topology database, so that the sub-branch remains active.

[0010] As described above, this application embodiment, through immutable physical storage space and independently constructed second storage metadata, enables sub-branches to obtain a complete independent logical namespace without copying physical files during creation. Combined with the associated records in the branch topology database, the sub-branch has its corresponding physical storage path and a logical view independent of the parent branch. In implementations where the target storage path and the existing storage path of the parent branch are independent of each other, storage space isolation between branches can be further achieved. Based on this, sub-branches and parent branches can have independent subsequent evolution capabilities, effectively realizing storage space isolation between branches in multi-branch development scenarios. This application embodiment achieves the technical effects of reducing branch creation latency and resource overhead, and improving branch management efficiency, thereby solving the technical problems of high branch creation cost and low branch management efficiency in related technologies.

[0011] It is worth noting that the general description above and the detailed description that follow are merely for illustrative purposes and do not constitute a limitation on this application. Attached Figure Description

[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0013] Figure 1 This is a hardware structure block diagram of a computing device for implementing the methods provided in the embodiments of this application;

[0014] Figure 2 This is a flowchart of a branch management method according to an embodiment of this application;

[0015] Figure 3 This is a schematic diagram of an optional data storage and management system architecture according to an embodiment of this application;

[0016] Figure 4 This is a schematic diagram of an optional branch creation execution flow according to an embodiment of this application;

[0017] Figure 5 This is a schematic diagram of an optional branch evolution process according to an embodiment of this application;

[0018] Figure 6 This is a schematic diagram of an optional physical storage path structure according to an embodiment of this application;

[0019] Figure 7 This is a schematic diagram of an optional metadata mapping structure according to an embodiment of this application;

[0020] Figure 8This is a schematic diagram of the interaction timing of an optional branch deletion according to an embodiment of this application;

[0021] Figure 9 This is a schematic diagram illustrating the interaction timing of an optional new file according to an embodiment of this application;

[0022] Figure 10 This is a schematic diagram illustrating the interaction timing of an optional logical file deletion according to an embodiment of this application;

[0023] Figure 11 This is a logical diagram illustrating an optional file recycling determination according to an embodiment of this application;

[0024] Figure 12 This is a schematic diagram of an optional decentralized file recycling process according to an embodiment of this application;

[0025] Figure 13 This is a schematic diagram of the interaction timing of an optional branch separation operation according to an embodiment of this application;

[0026] Figure 14 This is a schematic diagram of an optional branch topology change according to an embodiment of this application;

[0027] Figure 15 This is a schematic diagram of the interaction timing of an optional branch re-hanging operation according to an embodiment of this application;

[0028] Figure 16 This is a schematic diagram of an optional lazy resolution process according to an embodiment of this application;

[0029] Figure 17 This is a structural block diagram of a branch management system according to an embodiment of this application;

[0030] Figure 18 This is a schematic diagram of an optional branch management system architecture according to an embodiment of this application;

[0031] Figure 19 This is a structural block diagram of a branch management device according to an embodiment of this application;

[0032] Figure 20 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0033] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0035] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0036] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows.

[0037] Write-Ahead Log (WAL) is a mechanism for database transaction persistence. The system records the order of data changes in the log before they are written to disk, thus ensuring data consistency and durability in the database system. A write-ahead log stream refers to continuous write-ahead log records used to record the database's change history in chronological order.

[0038] Log-as-Database: This refers to a database storage architecture that uses the Write-Ahead Log (WAL) as the authoritative source of data. Under this architecture, data pages can be reconstructed from the log as needed.

[0039] Log Sequence Number (LSN): A globally monotonically increasing position identifier in the WAL (Write-Ahead Log). The system uses the LSN to logically pinpoint any data change location in the log stream.

[0040] Storage Branch: This refers to a storage layer capability that allows the creation of file namespaces from specific LSN locations within the Write-Ahead Log (WAL). This storage branch can then be evolved as an independent write copy.

[0041] Object Storage Service (OSS) is an immutable storage layer for persistent data files, providing underlying data persistence capabilities for upper-layer applications.

[0042] Branch LSN: This refers to the parent branch LSN position corresponding to the creation of the sub-branch, and can be used as the creation log point. The sub-branch will inherit the data of the parent branch before this position and evolve independently on this basis.

[0043] Garbage collection (GC) refers to the system's automatic cleanup and deletion of physical files that are no longer referenced by any existing branch, in order to release underlying physical storage space in a timely manner.

[0044] Point-in-Time Recovery (PITR) refers to the ability to allow users to create new branches from any historical LSN site. The system supports this function by retaining complete historical data within a time window.

[0045] Point-in-Time Recovery Window (PITR Interval): This represents a constraint window that allows users to create branches from any historical point in time within a recent period, such as 7 days.

[0046] Garbage collection threshold (GC Horizon): This refers to the WAL increment corresponding to the PITR Interval, used to derive the GC cutoff point. Deleted data exceeding the garbage collection threshold can generally be considered as safe storage resources for reclamation.

[0047] Applied GC Cutoff LSN: equal to the current LSN minus gc_horizon. When a file's deletion log sequence number is lower than this value, it indicates that its deletion time has exceeded the PITR window and it can no longer be referenced by future branches.

[0048] Retained LSNs: These are the LSNs corresponding to the creation points of each sub-branch. The system needs to retain the data at these LSNs to ensure the availability of each sub-branch.

[0049] The file creation log number (Create LSN) refers to the WAL LSN position corresponding to the creation of a physical file. This file creation log number is used to mark the beginning of the physical file's lifecycle in the log stream.

[0050] The file deletion log number (Delete LSN) refers to the WAL LSN position corresponding to when a physical file is marked for deletion. This file deletion log number is used to mark the end of the physical file's lifecycle in the log stream.

[0051] Storage metadata is system data that maintains the mapping between logical filenames and physical paths. This mapping can be used as a criterion for determining the visibility of file data within a branch.

[0052] Detach: This refers to the operation of separating a child branch from its parent branch. This operation decouples the child branch from its parent branch, making it a completely independent root branch.

[0053] Reparenting: This refers to the operation of removing a child branch from its original parent branch and reattaching it to another parent branch. This operation is used to change the branch topology.

[0054] An ancestor chain is a link in the branch topology database that traces upwards from the current branch to each of its parent branches and ancestor branches. If the current branch is the root branch, its ancestor chain only contains itself.

[0055] Serverless architecture refers to an architecture where database instances can be scaled down to zero computing resources. In this serverless architecture, compute nodes can be started and elastically scaled on demand.

[0056] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 This is a hardware structure block diagram of a computing device for implementing the methods provided in the embodiments of this application. For example... Figure 1As shown, the computing device 10 may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processors 102 may include, but are not limited to, microprocessors (MCUs) or field-programmable gate arrays (FPGAs), etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, the computing device 10 may also include: a display, an input / output interface (I / O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of a computer bus), a network interface, a cursor control device (such as a mouse, touchpad, etc.), a keyboard, a power supply, and / or a camera.

[0057] Those skilled in the art will understand that Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned arithmetic device. For example, the arithmetic device 10 may also include a ratio Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0058] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element of the computing device 10. As involved in the embodiments of this application, the data processing circuit serves as a processor control circuit (e.g., selection of a variable resistor termination path connected to an interface).

[0059] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the branch management method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the aforementioned branch management method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computing device 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0060] The transmission device 106 is used to connect to a network via a network interface to receive or send data. Specific examples of the network described above may include wired and / or wireless networks provided by the communication provider of the computing device 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module for wireless communication with the Internet.

[0061] like Figure 1 The display shown can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computing device 10.

[0062] Figure 1 The illustrated hardware block diagram can serve as an exemplary block diagram not only for the aforementioned computing device 10 but also for the aforementioned server. In one alternative embodiment, the computing device 10 can be any mobile computing device, etc. The data network connection can be a local area network (LAN) connection, a wide area network (WAN) connection, an internet connection, or other types of data network connection. The computing device 10 can execute network services to connect to a network service performed by a server (e.g., a security server) or a group of servers. The network server provides network-based user services such as social networks, cloud resources, email, online payments, or other online applications.

[0063] Under the aforementioned operating environment, this application provides the following: Figure 2 The branch management method shown. Figure 2 This is a flowchart of a branch management method according to an embodiment of this application. For example... Figure 2 As shown, the method may include the following steps S201 to S204.

[0064] Step S201: In response to the sub-branch creation request, determine the parent branch of the sub-branch and the creation log position of the sub-branch.

[0065] The aforementioned sub-branch creation request can be used to instruct the system to create a new, independent storage branch based on the parent branch at a specific data state location. This creation request can be initiated by the user terminal during application development, proactively triggered by the automated testing system during code merging, or generated during data backup or migration tasks. The creation request may carry indication information identifying the data inheritance starting point of the sub-branch, as well as identification information related to the parent branch.

[0066] The parent branch, as the existing data branch upon which the child branches are based, stores all the data states of the parent branch before the creation of the log point. After the log point is created, the parent branch and the child branch can evolve their data independently without interfering with each other.

[0067] The aforementioned creation log point is the fork position on the write-ahead log stream corresponding to the parent branch, used to determine the starting point of data inheritance for the child branch. For example, the creation log point could be the LSN when the creation request is received, i.e., the branch LSN. The child branch inherits the data state of the parent branch at this creation log point; therefore, this creation log point represents a snapshot time point in the parent branch's data history.

[0068] In the application scenario, after receiving the aforementioned sub-branch creation request, the system parses the request to determine the target parent branch, and then locates the specific fork position, specified by the request or determined by system logic, from the write-ahead log (WAL) stream corresponding to that parent branch. Once the aforementioned creation log point is determined, it serves as the fork point of the parent branch's data stream, and subsequent write operations on the parent branch and sub-branch will be recorded in their respective independent log streams.

[0069] Based on step S201, when the creation request for a sub-branch is received, this embodiment of the application can determine the creation log location and clarify the data inheritance boundary of the sub-branch, providing a precise positioning basis for subsequently building an independent storage path and storing metadata for the sub-branch in the physical storage space.

[0070] Step S202: In the physical storage space, create the target storage path corresponding to the sub-branch, wherein the physical file in the physical storage space remains immutable after being written.

[0071] The aforementioned physical storage space is used to store the underlying physical files and can be a shared distributed storage system based on cloud services. For example, this physical storage space can specifically be an immutable storage layer corresponding to Object Storage Service (OSS). The aforementioned target storage path can be a data storage location allocated to the sub-branch, located in the same or different physical storage space as the existing storage path of the parent branch. Furthermore, the target storage path of the sub-branch and the existing storage path of the parent branch are independent and parallel storage paths, without any nesting or dependency relationship.

[0072] Once written, the physical file remains immutable. This means that after the write operation is complete, the system will not modify or overwrite the contents of the physical file. When an update to the original physical file is needed, the system will write the updated data to a new physical file. The original physical file will remain in the same physical storage space and will not be overwritten or deleted temporarily.

[0073] After determining the log creation point, the system establishes a dedicated target storage path for the sub-branch in the underlying physical storage space. This target storage path is independent of the parent branch's physical storage directory and will hold any physical files subsequently added or written by the sub-branch. Furthermore, in certain situations, it may be necessary to remove the dependency between the sub-branch and the parent branch. In this case, the target storage path can also be used to store physical files pointed to by logical mappings copied from the parent branch (also known as inherited physical files). Due to the immutable nature of physical files, when the system writes new file data to the target storage path, it will not overwrite existing file data in the physical storage space. That is, the file data in the physical storage space maintains a stable correspondence with a specific version, while different versions of file data may coexist independently.

[0074] Based on step S202, this embodiment of the application ensures that the sub-branch has a dedicated write area at the physical level by creating an independent target storage path for the sub-branch in the physical storage space and combining this with the immutable property of physical files. This target storage path is independent of the parent branch's storage path, providing a physical isolation basis for the subsequent independent evolution of the sub-branch and parent branch without interference.

[0075] Step S203: Based on the first storage metadata of the parent branch at the log creation point, generate the second storage metadata in the target storage path, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace and physical files of the child branch.

[0076] The aforementioned first storage metadata refers to the state of file mapping information maintained by the parent branch at the log creation point. The first storage metadata records the association between each logical filename in the parent branch's logical namespace and the physical storage path of the physical file in the physical storage space at that moment. The aforementioned second storage metadata refers to the metadata version independently created by the system for the child branch in the target storage path. The data content of the second storage metadata is consistent with that of the first storage metadata in the initial state, but they evolve independently thereafter. The aforementioned logical namespace refers to the set of file system levels and filenames perceived by the user when accessing the child branch. The aforementioned mapping relationship is used to bind each logical filename in the logical namespace to a physical storage path.

[0077] The system extracts the mapping record maintained by the parent branch in the first storage metadata and reconstructs the content of this mapping record in the target storage path of the child branch, thereby generating the second storage metadata. Specifically, the generation process of the second storage metadata does not involve copying the underlying physical files; instead, it copies the mapping record in the storage metadata, resulting in low resource consumption and high efficiency. After the second storage metadata is generated, the child branch manages the mapping relationship between the logical namespace and physical files through this second storage metadata, and can no longer rely on the parent branch's first storage metadata to determine whether a file exists or is visible.

[0078] Based on step S203, this embodiment of the application generates independent second storage metadata for the child branch according to the first storage metadata at the creation log point of the parent branch, thus constructing a file mapping system exclusive to the child branch. The above process avoids copying the underlying physical files during the branch creation stage, while ensuring that the child branch and the parent branch have a consistent and independent content view, thereby enabling the branch creation process to be both real-time and lightweight.

[0079] Step S204: In the branch topology database, the creation log position and the second storage metadata are associated with the branch identifier of the sub-branch to keep the sub-branch active.

[0080] The aforementioned branch topology database is a globally maintained information recording module used to store the association information and lifecycle status of each storage branch in the system. The aforementioned branch identifier is a globally unique identifier assigned by the system to the current sub-branch, used for indexing and locating the sub-branch in the branch topology database. The aforementioned active status indicates that the sub-branch is in a created and usable working state in the system, allowing upper-layer applications to perform data write and read operations on the sub-branch.

[0081] In the application scenario, the system uses the branch identifier as the primary key to store the creation log location, the storage location information of the second storage metadata, and the target storage path information into the associated data entries in the branch topology database, thereby completing the association record. Furthermore, the current lifecycle status of the sub-branch is marked as active. The aforementioned associated data entries recorded in the branch topology database can be used to determine the branch status when performing subsequent operations such as deleting, detaching, or reattaching storage branches.

[0082] Based on step S204, this embodiment of the application establishes the basic attributes of sub-branches at the management level by associating the creation of log positions and the second stored metadata with the branch identifier in the branch topology database. After a sub-branch is marked as active by the system, it can be accessed and used as an independent data environment, and at the same time, it provides subsequent branch management operations with searchable metadata entity basis.

[0083] The parent and child branches described in this embodiment are not necessarily in a fixed hierarchical relationship. For a specific creation log point, the branch that has branched can be considered the parent branch of the current child branch; however, this parent branch may also have branched from another branch at an earlier log point, meaning it can be a child branch of other branches (such as ancestor branches). Correspondingly, after the current child branch is created and remains active, it can also create new descendant branches based on subsequent creation log points, in which case the current child branch can be the parent branch of the descendant branches. This multi-level nested branching mechanism enables the system to handle complex branch topologies. Different branches can achieve deep forking and data state inheritance based on different creation log points, thus allowing each branch to maintain an independent logical namespace and physical storage path in the physical storage space, and to continuously evolve independently.

[0084] The branch management method provided in this application can be applied to a cloud-native compute-database separation data storage and management system based on a log-as-a-database architecture. The executing entity of this branch management method can be a database engine module deployed in the compute layer, or a control module that coordinates compute layer nodes. The applicable scenarios for the branch management method provided in this application include, but are not limited to: developer environment isolation for cloud-native databases, building preview environments for continuous integration and continuous deployment, and multi-version data management and analysis—scenarios requiring the rapid creation of independent logical namespaces and physical storage paths based on log streams.

[0085] As described above, this application embodiment, through immutable physical storage space and independently constructed second storage metadata, enables sub-branches to obtain a complete independent logical namespace without copying physical files during creation. Combined with the associated records in the branch topology database, the sub-branch has its corresponding physical storage path and a logical view independent of the parent branch. In implementations where the target storage path and the existing storage path of the parent branch are independent of each other, storage space isolation between branches can be further achieved. Based on this, sub-branches and parent branches can have independent subsequent evolution capabilities, effectively realizing storage space isolation between branches in multi-branch development scenarios. This application embodiment achieves the technical effects of reducing branch creation latency and resource overhead, and improving branch management efficiency, thereby solving the technical problems of high branch creation cost and low branch management efficiency in related technologies.

[0086] The following will further explain and illustrate other optional embodiments of the branch management method in this application, in conjunction with specific application scenarios.

[0087] The branch management method provided in this application can be widely applied to various cloud-native data storage and management scenarios. In a typical application scenario, when a software project is developed in parallel, the system can create corresponding sub-branches for different functional features or code branches based on the same parent branch. Each sub-branch has an independent target storage path, logical namespace, and storage metadata. Therefore, developers can independently upload, delete, or modify unstructured files (such as images and documents) in their respective branch environments without interfering with other development branches or the production environment, thus achieving complete isolation of the development environment.

[0088] In another application scenario, combined with a Continuous Integration / Continuous Deployment (CI / CD) pipeline, when code is committed and a build is triggered, the system can automatically create a corresponding sub-branch and preview environment for this build. Since sub-branch creation does not require copying the underlying physical files, but only copies the storage metadata, the preview environment can be built within seconds, greatly improving the efficiency of code review and integration feedback. Simultaneously, because the storage branch and database branch maintain a strict correspondence through the creation of log points, the consistency of the database state and file state in the preview environment is ensured.

[0089] Furthermore, in multi-version data management and rollback testing scenarios, the system can leverage its branch management capabilities to quickly create sub-branches of older versions of data based on historical log locations. Through these sub-branches, developers or testers can access and verify unstructured data from historical versions, reproduce issues, or compare data without affecting current production data. When a rollback is required, the system can directly switch to the target sub-branch, enabling a joint rollback of the database and storage states.

[0090] In an exemplary application scenario, such as Figure 3 The diagram illustrates an architecture for a data storage and management system applicable to cloud-native compute-reality separation scenarios. This data storage and management system can adopt a log-as-a-database architecture. Figure 3 As shown, the system's logical architecture, from top to bottom, includes a compute layer (Compute Nodes), a log store cluster, a page store cluster, and a remote storage layer.

[0091] In the compute layer (Compute Nodes), the system hosts multiple instances of the intelligent agent database (which can also be viewed as compute nodes). Figure 3 The example illustrates two instances: a parent branch and a child branch of the intelligent agent database. Each instance integrates multiple functional service modules, such as Realtime, Auth, Vector, Functions, and Storage. These services all run on a serverless query engine, enabling the compute nodes to achieve on-demand elastic scaling in a serverless architecture.

[0092] like Figure 3 As shown, parent and child branches can transmit and interact through their respective compute nodes and storage service modules. For example, a child branch can send an upload request to the parent branch, or the parent branch can synchronize data to the child branch. The storage services of each branch in the compute layer can interact with the remote storage layer via upload / download. Furthermore, each branch can send data page retrieval requests to the page storage cluster through an LSN-based data page retrieval interface (e.g., the GetPage@LSN interface) to obtain data views corresponding to specific log positions on demand.

[0093] In a log store cluster, the system deploys multiple log storage nodes. Figure 3 The diagram exemplifies log storage node 1, log storage node 2 through log storage node N. This log storage cluster can receive write-ahead log (WAL) streams written by each compute node and persist them. Upon receiving the WAL stream, the log storage cluster serves the consumption needs of the page storage cluster and, through the WAL Upload mechanism, uploads and persistently saves the WAL data stream to the remote storage layer, thereby ensuring the persistence and reliability of the write-ahead log as a single source of truth.

[0094] In a Page Store Cluster, the system deploys multiple page store nodes. Figure 3 The diagram illustrates page storage nodes 1, 2, and M. Each page storage node receives Write-Ahead Logs (WALs) from the log storage cluster and materializes data pages by consuming these write-ahead logs, thereby generating user-visible data page files. Furthermore, the page storage nodes use a Persist Layer Upload mechanism to transfer the materialized data page files and other persistent data to the underlying remote storage layer.

[0095] In the remote storage layer, the system can use Object Storage Service (OSS) as the underlying persistent storage space. This storage space can store various types of underlying data, including but not limited to: object data, model data, page store files, write-ahead log files (WAL files), and storage files related to the storage service.

[0096] based on Figure 3 The data storage and management system shown has an architecture that supports storage-compute separation and database branching. However, while similar systems in related technical fields provide WAL-based branching capabilities for database tables, indexes, and data rows, they lack storage branching functionality for the object storage layer, which is closely associated with the database. In other words, when a database branch is created, the corresponding unstructured file storage layer still points to the same physical file space. This leads to several negative consequences: uploading or deleting files in the development branch environment affects the production environment; automatically generated preview environments can only handle database requests and cannot isolate file operations; database metadata references within the branch (such as user avatar fields) will point to incorrect physical files, resulting in data consistency breaches; and the storage layer cannot cooperate with the database to achieve consistent PITR rollback based on log positions. Therefore, how to introduce complete branch management capabilities to the object storage layer, while achieving storage sharing and write isolation, and simultaneously ensuring PITR-compatible garbage collection and topology changes, has become a pressing technical problem that needs to be solved in related technical fields.

[0097] In combination with the above Figure 3 The data storage and management system shown is Figure 4 This application further illustrates an optional branch creation execution flow provided by an embodiment of the present application. For example... Figure 4 As shown, in the branch creation process, firstly, when a user request to create a sub-branch is detected, the system receives the branch creation request initiated by the user and parses it to obtain the parent branch identifier and the specified creation log position. Then, the system performs a topology information recording operation, recording the parent branch corresponding to the sub-branch to be created in the branch topology database, as well as recording the creation log position corresponding to the sub-branch.

[0098] Furthermore, the system creates the object storage directory corresponding to the sub-branch. Specifically, the system creates a target storage path for the sub-branch in the physical storage space, such as creating a corresponding independent subdirectory " / bucket / branch_child / " in the object storage service (OSS), and providing a storage location with immutable attributes for subsequent physical file writing.

[0099] Next, copy-on-write (CoW) is performed on the storage metadata. Based on the first storage metadata at the creation log point of the parent branch, the system generates the second storage metadata in the target storage path through the copy-on-write (CoW) mechanism. The above copy-on-write operation does not involve copying the underlying physical files, but rather copies the mapping relationship between the logical namespace and physical files in the parent branch, thereby constructing an independent logical view of the child branch.

[0100] Furthermore, the system associates the aforementioned creation log location and the second storage metadata with the branch identifier of the sub-branch in the branch topology database, completing the sub-branch creation. At this point, the sub-branch is in an active state. The time complexity of the above sub-branch creation process is constant, and it involves little or no physical replication. Subsequently, the parent branch and the sub-branch will undergo subsequent data evolution based on their respective independent storage paths and logical namespaces.

[0101] Figure 4 The branch creation execution flow shown can be effectively applied to Figure 3 This is illustrated in the real-world scenarios of data storage and management systems. Specifically, in scenarios such as multi-environment parallel development of cloud-native applications and automatic preview environment construction, when a user or automated system initiates a branch creation request, a new branch with an independent target storage path, independent logical namespace, and independent metadata view can be instantly built within constant time using a metadata copy-on-write (CoW) mechanism that does not copy the underlying physical data. This not only ensures complete isolation between development branches and between development and production environments in terms of physical storage and logical views, avoiding data pollution and reference conflicts caused by branches sharing the same file storage, but also enables the storage layer to work with the database to achieve consistent point-in-time recovery (PITR) rollback based on log positions. This provides efficient and secure technical support for Serverless storage branch management to meet the needs of large-scale concurrent development.

[0102] As an optional embodiment, in the branch management method, the creation log point is used to characterize the fork position in the log sequence corresponding to the parent branch. The fork position is used to indicate the creation point on the write-ahead log stream of the parent branch corresponding to the child branch. The child branch inherits the data state of the parent branch at the creation log point.

[0103] The aforementioned creation log point is a fork in the write-ahead log stream corresponding to the parent branch. This fork indicates the specific creation point in the parent branch's log sequence corresponding to the child branch, i.e., the data inheritance point of the child branch. Optionally, the creation log point can be the current log sequence number determined by the system when it receives the child branch creation request, a historical log sequence number determined by the system based on a user-specified backtracking time point, or a log position identifier containing a specific timestamp automatically assigned by the build system.

[0104] At the creation log point, the child branch inherits the data state of the parent branch. For example, all logical namespace and physical file mappings stored by the parent branch before the creation log point are copied to the child branch as initial storage metadata. Furthermore, after the fork point is determined, the parent and child branches each have independent subsequent write operation records. In other words, after the creation log point, the parent and child branches evolve in independent log streams without interfering with each other.

[0105] In one exemplary implementation, after receiving a sub-branch creation request from a user terminal, the system locates the write-ahead log stream of the parent branch based on the parent branch identifier carried in the creation request. Then, according to the branch point specified in the request (e.g., creating the sub-branch from the most recent backup point, or creating the sub-branch from the current moment), the system determines the corresponding creation log point in the parent branch's log stream. This creation log point can be a fork LSN. Subsequent data changes made by the parent branch after the creation log point are isolated from data changes written by the sub-branch in its own log sequence.

[0106] Through the above optional embodiments, this application clarifies the data inheritance starting point of the child branch by determining the fork position in the write-ahead log stream of the parent branch, so that the creation of the child branch is based on a clear log stream fork point, ensuring the integrity and consistency of the inherited data of the child branch, and providing a clear isolation boundary for the subsequent independent evolution of the parent branch and the child branch.

[0107] In conjunction with the above optional embodiments, Figure 5 This further illustrates an optional branch evolution process on the WAL stream in an embodiment of this application. For example... Figure 5 As shown, taking branch A as the main branch as an example, the log sequence of branch A includes multiple discrete log positions, such as... Figure 5 The diagram shows L1 to L6. Branches B and C are both sub-branches of branch A.

[0108] During the creation of branch B, based on the branch creation request, the creation log point is determined to be L3, meaning that branch B branches off from the log sequence point L3 of branch A. Branch B inherits all the data states of branch A up to L3 at this creation log point L3, and has its own independent subsequent evolution sequence in its own write-ahead log stream, such as... Figure 5 The branch B shown corresponds to L3.1, L3.2, and L3.3.

[0109] Similarly, during the creation of branch C, the creation log point is determined to be L1, meaning that branch C branches off from the log sequence point L1 of branch A. Branch C inherits all the data states of branch A up to L1 at this creation log point L1 and has its own independent subsequent evolution sequence in its own write-ahead log stream, such as... Figure 5 The branch C shown corresponds to L1.1 and L1.2.

[0110] Thus, different creation log points clearly define the data inheritance boundaries between the parent branch and each child branch, enabling each branch to continue evolving in an independent log stream without interfering with each other after completing data inheritance based on its own creation log point.

[0111] As an optional embodiment, in the branch management method, the target storage path corresponding to the sub-branch is independent of the existing storage path corresponding to the parent branch in the physical storage space.

[0112] The target storage path mentioned above is a dedicated storage path allocated by the system for the sub-branch in the physical storage space. This target storage path is independent of the existing storage path corresponding to the parent branch in the physical storage space. Specifically, the target storage path and the existing storage path are at parallel levels in the directory structure of the physical storage space, and there is no path nesting or directory inclusion relationship.

[0113] In application scenarios, when the system establishes a target storage path for a sub-branch in the physical storage space, it does not need to create a subdirectory under the existing storage path of the parent branch, nor does it need to use the storage path of the parent branch as a prefix or base path of the target storage path.

[0114] For example, in an object storage service bucket, the existing storage path of the parent branch is represented as " / bucket / parent_branch / ...", while the target storage path of the child branch is represented as " / bucket / child_branch / ...". Both belong to independent directories within the same bucket and independently host the physical files of their respective branches. When the system performs the creation operation of the target storage path, it reserves and establishes an independent, dependency-free storage layer for that child branch in the physical storage space.

[0115] In conjunction with the above optional embodiments, Figure 6 The storage path structure of a physical storage space in an embodiment of this application is further illustrated. For example... Figure 6 As shown, physical storage space can contain buckets ( / bucket / ). Under each bucket, each branch has its own independent and parallel target storage path. For example, the target storage path for branch A is / bucket / branch_a, the target storage path for branch B is / bucket / branch_b, and the target storage path for branch C is / bucket / branch_c. The target storage paths of each branch belong to the same bucket level and are not nested or dependent on each other.

[0116] Through the above optional embodiments, this application achieves complete isolation of branches at the physical storage level by constructing physical storage paths that are independent of the parent branch for the sub-branch. This provides independent storage space for subsequent file writing, deletion and evolution of the sub-branch, and avoids data conflicts and permission confusion caused by overlapping storage paths between storage branches.

[0117] As an optional embodiment, in step S203, based on the first storage metadata, a second storage metadata is generated in the target storage path, including the following method steps: Step S231, read the first storage metadata corresponding to the creation log position from the storage metadata table corresponding to the parent branch, wherein the first storage metadata is used to characterize the mapping relationship between the logical namespace and physical file of the parent branch, and the first storage metadata corresponds to the data status of the parent branch at the creation log position; Step S232, create a data copy of the first storage metadata in the target storage path to obtain the second storage metadata.

[0118] The aforementioned storage metadata table can be a structured data table maintained by the system to record the mapping relationship between the logical namespaces of each branch and physical files, and can be denoted as storage.objects. Each record in this storage metadata table can contain information such as the logical file name, physical storage path, and the creation log point corresponding to the mapping record. The first storage metadata refers to the set of active mapping records saved by the parent branch at the specific moment of the creation log point. The second storage metadata is a copy of the metadata independently built by the child branch in the target storage path based on the first storage metadata. Its content is consistent with the first storage metadata in the initial state, but can evolve independently with the file operations of the child branch.

[0119] In one exemplary implementation, after determining the parent branch and the creation log point, the system first queries the storage metadata table (storage.objects) corresponding to the parent branch to retrieve all mapping records at that point, i.e., the first storage metadata, based on the parent branch's identifier information and the creation log point. The first storage metadata not only records the physical storage paths corresponding to each logical filename in the parent branch but also includes the creation log point of each mapping record, thus accurately reflecting the data snapshot of the parent branch at that fork position. Subsequently, the system copies the first storage metadata to the target storage path of the child branch to obtain the second storage metadata. This copying process only involves the processing of metadata mapping records and does not involve the copying of underlying physical files, therefore it has extremely low resource consumption and high execution efficiency.

[0120] Figure 7 This application further illustrates an optional metadata mapping structure in an embodiment of the present application. For example... Figure 7 As shown, the mapping structure can include three layers: the logical namespace from the user's perspective, the intermediate layer of storage metadata, and the underlying physical storage space.

[0121] From the user's perspective, the system exposes the logical names of files within a logical namespace. For example, logical name T1 could be table1.dat, logical name T2 could be table2.dat, and logical name T3 could be index1.dat.

[0122] Physical storage space is used to actually store physical files, which have a specific physical storage path. For example, storage path b1 could be branch_b / file_b001.dat, storage path a1 could be branch_a / file_a002.dat, and storage path b2 could be branch_b / file_b002.dat.

[0123] In the storage metadata of branch B, mapping entries can record the correspondence between the logical names of physical files and their physical storage paths. For example, logical name T1 corresponds to storage path b1, logical name T2 corresponds to storage path a1, and logical name T3 corresponds to storage path b2.

[0124] In addition, the mapping entries can also record the write log position (i.e., the create_LSN corresponding to the physical file when it is created). For example, logical name T1 and storage path b1 correspond to log position w1, which can be L3.2 when the physical file is written on branch B; logical name T2 and storage path a1 correspond to log position w2, which can be L2 when the physical file is written on branch A; logical name T3 and storage path b2 correspond to log position w3, which can be L3.1 when the physical file is written on branch B.

[0125] It is easy to notice that, such as Figure 7 As shown, the storage path a1 and log position w2 corresponding to the logical name T2 point to the physical storage path of the parent branch (i.e., branch A) corresponding to branch B. That is, the file is not physically stored in the directory of the current branch B, but inherits the data state of the parent branch before the creation of the log position of branch B through cross-branch reference to the physical file of the parent branch.

[0126] Through the above optional embodiments, this application achieves rapid replication of branch data status at the metadata level by reading the first storage metadata corresponding to the creation log position from the storage metadata table of the parent branch and generating a copy of it in the target storage path as the second storage metadata. The above technical solution avoids copying the underlying physical files during branch creation, significantly reducing the time overhead and storage space occupied by branch creation, thereby improving the overall efficiency of branch creation.

[0127] As an optional embodiment, the branch management method further includes the following steps: Step S251, in response to a deletion request for a sub-branch, performing a topology query on the branch topology database to obtain query results, wherein the branch topology database is used to record creation information corresponding to multiple active branches globally; Step S252, in response to the query results indicating that there are no descendant branches of the sub-branch among the multiple active branches, deleting the target storage path and the second storage metadata, and canceling the association between the creation log position and the branch identifier of the sub-branch from the branch topology database, so that the sub-branch ends its active state.

[0128] The aforementioned branch topology database records the creation information of multiple active branches globally, as well as the parent-child inheritance relationships between them. Descendant branches refer to other branches created directly or indirectly using the current child branch as their ancestor. Upon receiving a deletion request for the current child branch, the system first performs a topology query on the branch topology database to confirm whether the current child branch to be deleted has any active descendant branches.

[0129] Furthermore, if the query results indicate that the sub-branch has no active descendant branches, the system can perform a delete operation on the sub-branch. Specifically, this involves deleting the target storage path and secondary storage metadata corresponding to the sub-branch, and simultaneously removing the association between the creation log point and the sub-branch's branch identifier in the branch topology database, thus recording the sub-branch as inactive. If the query results indicate that the sub-branch has active descendant branches, the system can either abort the delete operation or generate a prompt message indicating that the descendant branch should be processed first.

[0130] Based on this, this application provides a constraint implementation method for branch deletion operations. Specifically, only leaf branches, i.e., branches without child branches, are allowed to be deleted. If a parent branch to be deleted still has active child branches, the parent branch needs to first perform a branch detachment (Detach) operation to separate the parent branch from the active child branches, or first delete the active child branches, and then perform the deletion operation after confirming that the parent branch no longer has any active child branches. The above constraint implementation method, by limiting the deletion to only leaf branches and combining the branch detachment operation to copy the referenced physical files to its own directory, avoids the existence of physical files directly referenced by other active branches in the storage directory of the deleted branch, thereby supporting the system to safely delete the entire target storage path without additional garbage collection (GC) process.

[0131] Figure 8 This is a schematic diagram illustrating the interaction timing of an optional branch deletion method provided in an embodiment of this application. For example... Figure 8 As shown, when a sub-branch needs to be deleted, step S801 is executed first, where the user initiates a branch deletion request (DELETE Branch child) to the management interface. This management interface can be an Application Programming Interface (API) provided by the management module. Then, step S802 is executed, where the management interface responds to the branch deletion request by performing a topology query on the branch topology database to confirm whether the sub-branch has any active descendant branches. If the query result shows that the sub-branch does not have any active descendant branches, the management interface removes the creation log point (child.branch_LSN) corresponding to the sub-branch.

[0132] Next, the management interface executes step S803, sending a deletion command to the Object Storage Service (OSS) to delete the target storage path corresponding to the sub-branch (e.g., deleting the / bucket / branch_child / directory). Since the deleted sub-branch is restricted to a leaf branch, all physical files under its target storage path belong to the sub-branch itself, so the target storage path can be deleted directly without triggering GC intervention. Further, the management interface executes step S804, deleting the branch metadata record of the sub-branch and removing the association between the creation log point and the branch identifier of the sub-branch from the branch topology database, thus ending the sub-branch's active state.

[0133] Through the above optional embodiments, this application confirms whether a sub-branch is a leaf branch without active descendant branches through topological query. Only when this condition is met will the storage path and metadata be deleted and the association canceled. This avoids the problem of incorrect references to active descendant branches due to accidental deletion of parent branches. Thus, while achieving efficient recycling of branch storage space, it ensures the data integrity and traceability of the branch topology structure.

[0134] As an optional embodiment, the branch management method further includes the following steps: Step S261, in response to a file addition request for a sub-branch, writing the new file to the target storage path of the sub-branch, and determining the write log position corresponding to the new file; Step S262, generating a first mapping entry based on the logical name, target storage path and write log position corresponding to the new file, and adding the first mapping entry to the second storage metadata.

[0135] The aforementioned write log position is the current log sequence position in the WAL stream synchronously recorded by the system when a new file is written to the target storage path; it can be denoted as `create_LSN`. The aforementioned first mapping entry is an independent mapping record generated by the system for the new file. This first mapping entry specifically includes the logical name (logical_name), the physical storage path of the new file (i.e., the physical_path of the sub-branch), and the write log position. The aforementioned file addition request can be triggered by a `Write New File` operation.

[0136] Upon receiving a file addition request, the system first writes the data content of the new file to the target storage path of the sub-branch and determines the write log position corresponding to this write operation. Further, based on the logical name of the new file, its specific physical storage location in the target storage path, and the write log position, the system generates a first mapping entry and adds this first mapping entry to the second storage metadata of the sub-branch. Based on this, the new file belongs to the logical namespace of the sub-branch and can be accessed and manipulated normally within the sub-branch.

[0137] Furthermore, since the newly added file is a physical file and remains immutable after being written, once the first mapping entry is added to the second storage metadata, the newly added file is associated with a specific write log location (create_LSN) and remains isolated from the historical version physical file corresponding to the same logical name.

[0138] Figure 9 This is a schematic diagram illustrating the interaction timing for adding a new file to a sub-branch, provided in an embodiment of this application. For example... Figure 9 As shown, when adding a new file, the database engine of branch B first executes step S901 to determine the current log position (current_LSN) of the write-ahead log (WAL) stream and designate it as the write log position (create_LSN).

[0139] Then, in step S902, the database engine writes the new file to the dedicated directory corresponding to branch B (i.e., the target storage path of branch B) in the object storage service. The physical storage path of the new file can be represented as " / bucket / branch_b / {uuid}.dat", where uuid is used to identify the globally unique physical filename of the physical file. Further, in step S903, the database engine inserts a mapping entry into the storage metadata corresponding to sub-branch B. This mapping entry can include the logical name of the new file, its physical storage path, and the write log position (create_LSN).

[0140] It is easy to note that the new file in step S902 above will be written to the exclusive directory of the current sub-branch, and the physical storage path will be globally unique through a globally unique identifier, thereby avoiding overwriting existing physical files in the target storage path.

[0141] Through the above optional embodiments, this application achieves the synchronous creation of new files in the physical storage space and logical view of the sub-branch by independently responding to file addition requests within the sub-branch, writing the new file to the target storage path, and synchronously generating the first mapping entry. The file data of the new file and its related mapping relationships are independent of the parent branch, providing complete write and record guarantees for the continuous independent evolution of the sub-branch.

[0142] As an optional embodiment, the branch management method further includes the following steps: Step S263, in response to a file deletion request for a sub-branch, reading the write log position and physical storage path from the second mapping entry corresponding to the file to be deleted in the second storage metadata, and determining the deletion log position of the file to be deleted; Step S264, generating a file recycling entry based on the write log position, physical storage path, and deletion log position, and adding the file recycling entry to the file recycling event table, wherein the file recycling entry is used to characterize that the file to be deleted belongs to a logically deleted file in the logical namespace; Step S265, deleting the second mapping entry from the second storage metadata, and determining the file to be deleted as a logically deleted file that has been deleted within the logical namespace.

[0143] The file deletion request mentioned above can be triggered by a logical delete operation. A logically deleted file refers to a file that has been marked for deletion in the logical namespace (i.e., from the user's perspective), but whose corresponding original physical file remains in the physical storage space. The deletion log position mentioned above is the current log sequence number position of the WAL stream recorded by the system when responding to a file deletion request, which can be denoted as delete_LSN. The file reclamation entry mentioned above is used to record the complete lifecycle information of the logically deleted file, specifically including the write log position (create_LSN), physical storage path (physical_path), and deletion log position (delete_LSN). The file reclamation event table mentioned above is a data table used by the system to centrally store the lifecycle information of logically deleted files to be reclaimed, which can be denoted as GC_events. After receiving a deletion request for a file within a sub-branch, the system first locates the second mapping entry corresponding to the file to be deleted from the second storage metadata, reads the write log position of the file to be deleted at its creation time and its physical storage path in the target storage path from the second mapping entry, and determines the current deletion log position.

[0144] Furthermore, the system constructs a file reclamation entry based on the read write log location, physical storage path, and determined delete log location, and adds this file reclamation entry to the file reclamation event table. This file reclamation entry indicates that the file to be deleted has been deleted in the logical namespace, but the corresponding physical file remains in the physical storage space. Subsequently, the system removes the second mapping entry from the second storage metadata of the sub-branch, making the file to be deleted no longer visible in the user's logical view.

[0145] Optionally, the above logical deletion process can adopt an atomic transaction mechanism to deploy the operations corresponding to steps S263 to S265 in the same atomic transaction for execution, thereby ensuring the consistency of stored metadata.

[0146] Figure 10 This is a schematic diagram illustrating the interactive timing of an optional logical file deletion provided in an embodiment of this application. For example... Figure 10 As shown, when performing logical deletion on files within a sub-branch, the database engine first executes step S1001 to initiate an atomic transaction (BEGIN TRANSACTION).

[0147] Then, in step S1002, the database engine sends a read request to the storage metadata table (storage.objects) to obtain the physical storage path (physical_path) and write log position (create_LSN) of the file to be deleted. Next, in step S1003, the storage metadata table returns the query results to the database engine. These results may include the logical name of the file to be deleted (e.g., "img.png"), the physical storage path (e.g., "branch_a / uuid1.dat"), and the write log position (e.g., "create_LSN=L2").

[0148] Further, the database engine executes step S1004, determining the current log position (current_LSN) as the delete log position (delete_LSN), and generating a file reclamation entry based on the physical storage path of the file to be deleted, the write log position, and the delete log position, inserting the file reclamation entry into the file reclamation event table (GC_events). Then, in step S1005, the database engine deletes the active mapping entry with the logical name "img.png" from the storage metadata table. In step S1006, the database engine commits the above atomic transaction, completing the logical deletion operation.

[0149] It is noteworthy that after the atomic transaction processing in steps S1001 to S1006, the file to be deleted has been successfully deleted from the user's perspective, but the corresponding physical file remains in the object storage service. The file reclamation event table (GC_events) records the lifecycle information of the file to be deleted in the form of [create_LSN=L2, delete_LSN=current_LSN], awaiting safety determination and physical reclamation by the subsequent garbage collection (GC) process. When the physical storage path of the file to be deleted belongs to an existing storage path of the parent branch, since the creation log position of the branch performing the deletion is within the lifecycle range of the file, the second condition mentioned above will block reclamation until the corresponding reference relationship is eliminated. All of the above file reclamation event tables belong to the local storage of the branch performing the deletion operation.

[0150] Through the above optional embodiments, this application breaks down the file deletion operation into stages including logical mapping deletion and physical file retention, and records the lifecycle information of the file to be deleted in the file recycling event table, thereby achieving efficient and secure execution of file deletion operations within the storage branch. This mechanism ensures that file deletion operations do not affect references to physical files in other storage branches and provides an accurate basis for subsequent physical file garbage collection.

[0151] As an optional embodiment, the branch management method further includes the following steps: Step S271, in response to the file recycling task being triggered, obtain the recycling cutoff log position; Step S272, traverse the file recycling entries in the file recycling event table, determine the lifecycle range of the logically deleted file based on the write log position and delete log position in the file recycling entry, if the delete log position is earlier than the recycling cutoff log position, and the multiple creation log positions corresponding to the multiple active branches globally are all outside the lifecycle range, then delete the physical file corresponding to the logically deleted file from the physical storage path.

[0152] The aforementioned reclaim cutoff log position is a critical log position calculated based on a pre-configured recovery time window. It is used to determine whether a physical file is allowed to be reclaimed and can be denoted as `applied_GC_cutoff_LSN`. The aforementioned lifecycle interval defines the survival range of the logically deleted file in the write-ahead log stream. It can be represented as a half-open interval with the write log position as one end and the delete log position as the other, mathematically denoted as `[write log position, delete log position]`. The left endpoint of this lifecycle interval is closed, indicating that the physical file begins to survive from that write log position; the right endpoint is open, indicating that the physical file has been logically deleted at that delete log position. Therefore, if the creation log position of an active branch is exactly equal to the deletion log position, then that branch should not inherit this logically deleted file; that is, the creation log position is excluded from the lifecycle interval of the logically deleted file.

[0153] When the system triggers a file reclamation task, it first obtains the reclamation cutoff log position, and then iterates through all file reclamation entries recorded in the file reclamation event table. For each file reclamation entry, the system first determines the lifecycle interval [create_LSN, delete_LSN] of the logically deleted file, using the write log position of the file reclamation entry as the start point and the delete log position as the end point. Then, it judges according to the following conditions: First condition, the delete log position of the file reclamation entry is earlier than the reclamation cutoff log position; second condition, multiple creation log positions corresponding to multiple active branches globally all fall outside this lifecycle interval. When the first and second conditions are met simultaneously, it indicates that the logically deleted file corresponding to the file reclamation entry not only has its delete log position exceeded the reclamation safety window, but also no active branch was created and referenced by the physical file corresponding to the logically deleted file during its active period. At this time, the system deletes the physical file corresponding to the logically deleted file from the physical storage path. Optionally, the above lifecycle interval is defined as a half-open interval, which can ensure that branches whose creation log position is exactly equal to the deletion log position will not inherit the file, and the corresponding physical file will not be erroneously reclamated.

[0154] Figure 11 This is a logical diagram illustrating an optional file recycling determination method provided in an embodiment of this application. For example... Figure 11 As shown, with the log sequence number (LSN) as the horizontal axis, the topology scenario is shown where branch C and branch B are created at L1 and L3 respectively under branch A.

[0155] In the decision-making logic, the system uses the retained log position (retained_LSN) as a reference benchmark. L1 is the retained log position for branch C, and L3 is the retained log position for branch B. Simultaneously, based on a preset recovery time window, the system determines L5 as the log retrieval cutoff point, and the current log position is L6. The lifecycle interval is represented in the form of a left-closed, right-open half-open interval [create_LSN, delete_LSN). Figure 11 The lifecycle status and GC determination results of five logically deleted files (files FA, FB, FC, FD, and FE in the figure) are shown.

[0156] Specifically, the lifecycle of file FE is [L0.5, L0.8), its deletion log point is earlier than the reclamation cutoff log point L5, and the retention log points L1 and L3 do not fall within this lifecycle range. Since file FE was logically deleted before the creation of branches B and C, file FE will be marked as reclaimable.

[0157] The lifecycle interval of file FD is [L0, L4). The log deletion point is earlier than L5, but the log retention points L1 and L3 both fall within this lifecycle interval, indicating that both branch C and branch B inherit the file FD. Therefore, file FD is marked as unrecoverable.

[0158] The lifecycle interval of file FB is [L2, L4). Its log deletion point is earlier than L5, but the log retention point L3 falls within this lifecycle interval, indicating that branch B inherited file FB when L3 was created. Therefore, file FB is marked as unrecoverable.

[0159] The lifecycle of file FA is in the range [L4, L4.5). Its deletion log point is earlier than L5, and the retention log points L1 and L3 do not fall within this lifecycle range. File FA was generated after branches B and C were created, and no other active branches inherit it. Therefore, file FA is marked as reclaimable.

[0160] The lifecycle of file FC is [L4.5, L5.5). Its deletion log point L5.5 is later than the reclamation cutoff log point L5, indicating that the deletion log point of file FC has not exceeded the preset PITR window. Even if no branch references file FC, it needs to be retained to support point-in-time recovery. Therefore, file FC is marked as non-reclaimable.

[0161] Through the above garbage collection judgment logic, the system can accurately identify the life status of each logically deleted file, and accordingly determine the physical files that can be safely recycled, as well as the physical files that need to be retained to support references to active branches or point-in-time recovery needs.

[0162] Figure 12 This is a schematic diagram of an optional decentralized file recycling process provided in an embodiment of this application, such as... Figure 12 As shown, the waste recycling process can be executed periodically according to the following procedure.

[0163] First, the garbage collection process is periodically woken up. After being woken up, the system sends a query request to the page storage cluster to obtain the currently preset garbage collection cutoff log position (applied_GC_cutoff_LSN) and the retained log positions (retained LSN) corresponding to multiple active branches globally.

[0164] Next, the system scans the locally maintained file GC event table (GC_events). This file GC event table records each file GC entry that was recorded due to a logical deletion operation. Each file GC entry contains at least the write log position (create_LSN) and delete log position (delete_LSN) corresponding to the logically deleted file.

[0165] Subsequently, the system enters the traversal phase, sequentially performing dual condition judgments based on the lifecycle interval for each file recycling entry in the file recycling event table, namely the first condition and the second condition mentioned above.

[0166] When both of the above conditions are met, it indicates that the logically deleted file has exceeded the preset PITR window and is not referenced by any active branch. In this case, the system will perform a physical file deletion operation, removing the physical file corresponding to the logically deleted file from the Object Storage Service (OSS). After successful physical file deletion, the system synchronously updates the file recycling event table and removes the file recycling entry. If either of the above two conditions is not met, the system skips the currently traversed file recycling entry and continues traversing and processing the next file recycling entry in the file recycling event table until the file recycling event table traversal is complete.

[0167] Once the file reclamation event table has been traversed, the system will enter a temporary sleep state (e.g., sleep for 5 to 30 minutes). After the sleep period ends, the GC process will be woken up again according to the above procedure to enter a new garbage collection cycle.

[0168] Figure 12 The decentralized GC execution process shown allows each branch instance to independently complete the safe judgment and execution of garbage collection by combining the local file recycling event table and global parameters obtained from the page storage cluster without relying on the central scheduling node. This makes it better suited to the scaling characteristics of serverless architecture (such as Scale to Zero).

[0169] Through the above optional embodiments, this application, in the process of file reclamation, uses the reclamation cutoff log position to limit the deletion log position of logically deleted files to be earlier than the critical log position corresponding to the preset recovery time window (PITR window), and uses the life cycle interval to exclude the situation where the creation log position of the globally active branch is within the life cycle of the logically deleted file. Through the cooperation of the above dual judgment criteria in the time dimension and branch topology dimension, safe physical file reclamation under the dual constraints of PITR window and active branch is achieved, avoiding the problem of historical position recovery failure or active branch data loss due to GC accidental deletion.

[0170] As an optional embodiment, in step S271, obtaining the recycling cutoff log position includes the following steps: step S2711, obtaining the current log position and the preset recovery time window; step S2712, obtaining the recycling cutoff log position based on the log increment corresponding to the current log position and the recovery time window.

[0171] The aforementioned preset recovery time window refers to the time range within which historical branches are allowed to be created, pre-set by the system to support Point-in-Time Recovery (PITR) capabilities. This recovery time window can be configured to a fixed duration, such as 7 days, meaning the system needs to retain data change history from the most recent 7 days. When the system starts a garbage collection task, it first obtains the current log position in the write-ahead log stream and reads the pre-configured recovery time window parameters. Subsequently, the system calculates the garbage collection cutoff log position based on the current log position and the log increment corresponding to the recovery time window. The current log position can be denoted as `current_LSN`, the log increment corresponding to the recovery time window can be denoted as `gc_horizon`, and the calculated garbage collection cutoff log position can be denoted as `applied_GC_cutoff_LSN`.

[0172] In one exemplary implementation, the calculation process for the garbage collection cutoff log position can be represented as follows: the garbage collection cutoff log position equals the current log position minus the log increment corresponding to the recovery time window. When the deletion log position of a physical file is earlier than the garbage collection cutoff log position, it indicates that the deletion time of the physical file is outside the preset recovery time window range. When a new branch is created at any time point within the PITR window, the physical file will not be referenced again. Therefore, the physical file can be included in the candidate scope for garbage collection.

[0173] Through the above optional embodiments, this application calculates the garbage collection cutoff log position by the difference between the current log position and the preset recovery time window, clarifies the cutoff judgment boundary of the garbage collection operation, ensures that the garbage collection mechanism and the system's recovery time window are coordinated, and releases storage space without destroying the integrity and recoverability of historical data within the PITR window.

[0174] As an optional embodiment, the branch management method further includes: in response to a file update request for a sub-branch, performing the following operations in the same transaction: removing the second mapping entry corresponding to the file to be updated from the second storage metadata, generating a file recycling entry based on the second mapping entry and adding it to the file recycling event table, writing the updated file to the target storage path, and generating a new mapping entry based on the updated file and adding it to the second storage metadata, wherein the logical name in the new mapping entry is the same as the logical name of the file to be updated, and the physical storage path points to the updated file.

[0175] As an optional embodiment, the write log location and physical storage path are read from the second storage metadata, the file reclamation entry is added to the file reclamation event table, and the second mapping entry is deleted from the second storage metadata, all within the same atomic transaction.

[0176] As an optional embodiment, the branch management method further includes the following steps: Step S281, in response to a separation request for a sub-branch, determining at least one dependent file referenced by the sub-branch based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; Step S282, reading the original physical file corresponding to the dependent file based on the physical storage path of the dependent file; Step S283, storing a copy of the original physical file to the target storage path; Step S284, maintaining the physical storage path in the second storage metadata pointing to the existing storage path of the parent branch, and when the dependent file cannot be located based on the physical storage path, locating the current root branch along the ancestor chain of the sub-branch and reading the copy of the physical file under the storage path corresponding to the current root branch; Step S285, updating the branch topology database to cancel the association between the parent branch and the sub-branch, and converting the sub-branch into a root branch independent of the parent branch.

[0177] The aforementioned detach request can be triggered by a branch detachment operation (Detach), which aims to separate a child branch from its parent branch, making the child branch an independent root branch. The aforementioned dependent files refer to physical files currently referenced by the child branch whose underlying physical data is actually stored in the parent branch's existing storage path. The aforementioned root branch refers to a branch that does not depend on other branches and can completely independently manage its own physical storage space and logical namespace. After receiving a detach request for the current child branch, the system first scans the child branch's secondary storage metadata, identifying and determining physical files whose physical storage paths belong to the parent branch's existing storage path as dependent files.

[0178] The system reads the corresponding original physical files from the existing storage path of the parent branch based on the physical storage paths of these dependent files. Then, the system copies the original physical files to obtain duplicate physical files and stores them in the target storage path of the child branch. It should be noted that if the storage metadata of the child branch records referenced files pointing to the storage path of a higher-level ancestor branch (e.g., a grandparent branch), these referenced files are also copied to the storage path corresponding to the current root branch when the branch is split, ensuring data reachability in multi-level topologies.

[0179] Furthermore, after physical replication is complete, the system maintains the physical storage path in the second storage metadata, still pointing to the existing storage path of the parent branch, and does not rewrite the path in the metadata. Specifically, if the corresponding replica physical file cannot be located subsequently based on the physical storage path recorded in the second storage metadata, the system will trigger a lazy resolution mechanism, tracing upwards along the ancestor chain of the sub-branch to locate the current root branch to which the sub-branch belongs, and reading the replica physical file under the storage path corresponding to the current root branch, thus completing the lazy resolution. Afterwards, the system can cache the resolved replica physical file locally to optimize the efficiency of subsequent access to that replica physical file. Furthermore, the system can update the branch topology database, removing the parent-child relationship between the parent branch and the sub-branch, and converting the sub-branch into a completely independent root branch.

[0180] For example, when the physical storage path recorded in the storage metadata of a sub-branch points to an existing storage path of a parent branch, and that existing storage path has been deleted or the physical file under that physical storage path has been reclaimed, if the system fails to directly read the copy physical file based on the physical storage path recorded in the sub-branch's second storage metadata, an ancestor chain lookup will be triggered. The system will backtrack upwards along the ancestor chain in the branch topology database corresponding to the sub-branch until it locates the root branch closest to the sub-branch, and then read the copy physical file under the storage path corresponding to that root branch. During the branch splitting operation, if the sub-branch's storage metadata records a referenced file pointing to a higher-level ancestor branch's storage path, that referenced file will also be copied to the storage path corresponding to the current root branch, thus ensuring successful reading of the copy physical file under the current root branch. During this process, the physical storage path recorded in the sub-branch's second storage metadata does not need to be modified; the topology change is completely reflected at the file access time.

[0181] Figure 13 This is a schematic diagram illustrating the interactive timing of an optional branch separation (Detach) operation provided in an embodiment of this application. For example... Figure 13 As shown, the branch separation operation may include the following steps S1301 to S1306.

[0182] First, in step S1301, the management interface responds to a branch separation request for a sub-branch, such as separating branch B from branch A, and begins the branch separation process. Next, in step S1302, the management interface initiates a query request to the storage metadata of branch B to determine at least one dependency file currently referenced by branch B whose physical storage path belongs to an existing storage path of branch A, i.e., a dependency file pointing to branch A.

[0183] Subsequently, the system enters a loop processing phase, traversing the dependent files pointing to branch A. For each dependent file, step S1303 is executed, where the management interface reads the original physical file corresponding to the dependent file from the dedicated directory of branch A (i.e., the target storage path of branch A) based on the physical storage path of the dependent file. Then, step S1304 is executed, where the management interface copies the original physical file to generate a replica physical file and writes the replica physical file to the dedicated directory of branch B (i.e., the target storage path of branch B). Step S1305 is executed, keeping the physical storage path in the storage metadata of branch B unchanged, and temporarily not updating the physical storage path of the dependent file in the storage metadata of branch B. If locating the replica physical file based on this physical storage path fails later, the system will locate the current root branch along the ancestor chain of branch B and perform lazy resolution of the replica physical file under the storage path corresponding to the current root branch.

[0184] After the dependency files pointing to branch A are traversed, step S1306 is executed. The management interface updates the branch topology database to cancel the association between the parent branch (i.e., branch A) and the child branch (i.e., branch B). For example, the parent branch of branch B can be marked as empty "B.parent=NULL", and the creation log position of branch B can be removed from the list of reserved log positions of branch A, thereby converting branch B into a root branch independent of branch A.

[0185] Optionally, in some application scenarios, after storing the copy of the original physical file to the target storage path, the physical storage path in the second storage metadata can be updated based on the copy of the physical file in the target storage path. Then, the branch topology database can be updated to cancel the association between the parent branch and the child branch and convert the child branch into a root branch independent of the parent branch.

[0186] In the branch detachment (Detach) operation, after completing the physical file copy and storing the copy physical file in the target storage path of the sub-branch, the system can directly update the physical storage path in the second storage metadata based on the storage location of the copy physical file. This redirects the physical storage path, which originally pointed to the existing storage path of the parent branch, to the target storage path of the sub-branch, thus achieving complete independence of the sub-branch at the metadata level. Subsequently, the system updates the branch topology database, cancels the association between the parent branch and the sub-branch, and converts the sub-branch into a root branch independent of the parent branch. Compared to maintaining the stability of the second storage metadata and using lazy resolution, the above-mentioned alternative method still provides higher data access determinism and execution directness for branch detachment operations under simple topology structures, and can meet the needs of some application scenarios for simple operation steps and rapid isolation without relying on ancestor chain backtracking.

[0187] Through the above optional embodiments, on the one hand, this application provides a novel branch separation processing method based on a lazy resolution mechanism. After physically copying dependent files, the physical storage path in the second storage metadata remains unchanged, and the topology change is pushed down to the file access time. Lazy resolution of the physical file of the copy is achieved along the ancestor chain in the branch topology database, thereby avoiding the risk of metadata cascading rewriting caused by repeated separation and remounting operations. This effectively overcomes the limitation that metadata mapping cannot be centrally updated when the branch instance is shrunk to zero in the serverless scenario, ensuring the efficiency and elasticity of branch topology changes. On the other hand, this application can also directly update the physical storage path of the second storage metadata after physical copying, thereby achieving higher data access directness and operation atomicity in simple topology scenarios. The above-mentioned diverse implementation methods enable this application to ensure the overall elasticity of branch topology changes while taking into account the operational needs and system adaptability under different application scenarios.

[0188] As an optional embodiment, the branch management method further includes: in response to a separation request for a sub-branch, determining at least one dependent file referenced by the sub-branch based on second storage metadata, wherein the physical storage path of the dependent file belongs to an existing storage path of the parent branch; reading the original physical file corresponding to the dependent file based on the physical storage path; storing a copy of the original physical file to a target storage path; updating the physical storage path in the second storage metadata based on the copy of the physical file in the target storage path; and updating the branch topology database to cancel the association between the parent branch and the sub-branch, and converting the sub-branch into a root branch independent of the parent branch.

[0189] As an optional embodiment, the branch management method further includes: in response to a re-attachment request for a sub-branch, determining a re-attachment branch; in response to determining that the creation log position of the sub-branch is earlier than or equal to the creation log position of the re-attachment branch, determining at least one dependent file referenced by the sub-branch based on second storage metadata, wherein the physical storage path of the dependent file belongs to an existing storage path of the parent branch; redirecting and updating the physical storage path of the dependent file so that the updated physical storage path points to the existing storage path of the re-attachment branch; updating the branch topology database to cancel the association between the parent branch and the sub-branch, and establish the association between the re-attachment branch and the sub-branch.

[0190] As an optional embodiment, the branch management method further includes the following steps: Step S291, in response to a re-attachment request for a sub-branch, determining the re-attachment branch; Step S292, in response to determining that the creation log position of the sub-branch is earlier than or equal to the creation log position of the re-attachment branch, determining at least one dependent file referenced by the sub-branch based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; Step S293, maintaining the physical storage path of the dependent file pointing to the existing storage path of the parent branch, and when the dependent file cannot be located based on the physical storage path, locating the current root branch along the ancestor chain of the sub-branch and reading the dependent file under the storage path corresponding to the current root branch; Step S294, updating the branch topology database to cancel the association between the parent branch and the sub-branch, and establishing the association between the re-attachment branch and the sub-branch.

[0191] The aforementioned reparenting request can be triggered by a branch reparenting operation, which aims to move a child branch out of its original parent branch and reattach it to a new parent branch. The reparenting branch refers to the new target parent branch specified by the system for the current child branch. Upon receiving a branch reparenting request for the current child branch, the system first determines the reparenting branch that the request points to. Subsequently, the system performs a topology compatibility check, confirming that the creation log position of the current child branch is earlier than or equal to the creation log position of the reparenting branch. This timing condition ensures that no logical conflicts occur on the data timeline when the child branch inherits the reparenting branch's state.

[0192] In the application scenario, after the topology compatibility check passes (i.e., it is determined that the creation log position of the sub-branch is earlier than or equal to the creation log position of the reattached branch), the system determines the dependency files referenced by the current sub-branch whose physical storage paths belong to the existing storage paths of the original parent branch, based on the sub-branch's second storage metadata. During this process, the system keeps the physical storage paths of the aforementioned dependency files unchanged and does not redirect or update them. Subsequently, if the corresponding dependency file cannot be located based on the physical storage path, the system will trigger a lazy resolution mechanism, tracing upwards along the ancestor chain of the sub-branch to locate the current root branch to which the sub-branch belongs, and reading the dependency file under the storage path corresponding to the current root branch. This then updates the branch topology database, cancels the parent-child association between the current sub-branch and the original parent branch, and establishes a new parent-child association between the reattached branch and the current sub-branch.

[0193] Figure 14 This is a schematic diagram of an optional branch topology change provided in an embodiment of this application, such as... Figure 14As shown, before the operation, in the original branch topology, branch A's sub-branches include branch B (log creation point L3) and branch C (log creation point L1). In the branch topology after branch B is detached, branch B has been detached and become an independent root branch, while branch A retains branch C as its sub-branch. Further, in the branch topology after branch C is reattached to branch B, after the branch reattachment operation, branch C is reattached to the independent branch B. At this point, branch B has branch C as its sub-branch, while branch A becomes a state without sub-branches.

[0194] Figure 15 This is a schematic diagram of the interactive timing of an optional branch re-hanging operation provided in an embodiment of this application, as shown below. Figure 15 As shown, upon receiving a re-attachment request for branch C, the management interface first executes step S1501 to confirm the prerequisite states and compatibility conditions. Specifically, the prerequisite states to be confirmed can be that branch B has been separated from branch A, and that branch B has copied all physical files under the storage path of branch A that are still alive at the creation log point (L1) of branch C when it was separated, thereby ensuring that branch B can cover the dependent files referenced by branch C; the compatibility conditions to be confirmed can be that the creation log point (L1) of the branch to be reattached (B) is earlier than or equal to the creation log point (L3) of the target reattached branch B.

[0195] After confirming that the prerequisite states and compatibility conditions are met, step S1502 is executed to verify the topology compatibility of the control interface, that is, to confirm that the creation log position (L1) of branch C is earlier than or equal to the creation log position (L3) of the reattached branch B. This timing condition is used to ensure that the data state inherited by branch C can be overwritten by the data state of the reattached branch B at its own creation log position, thereby ensuring that after branch C is reattached, the dependent files it references can be correctly resolved in the storage path corresponding to the reattached branch B or its ancestor chain.

[0196] After the topology compatibility verification is passed, step S1503 is executed, whereby the management interface initiates an update operation to the branch topology database, setting the parent branch of branch C to branch B. It should be noted that, since the branch reattachment operation in this embodiment is a purely topology operation, this step does not involve copying or migrating physical files, nor does it involve modifying the physical storage path recorded in the storage metadata of branch C. That is, the storage metadata of branch B and branch C remain unchanged.

[0197] Further, in step S1504, the management interface synchronously updates the list of reserved log positions in the branch topology database. Specifically, the creation log position (L1) of branch C is removed from the list of reserved log positions of branch A, and the creation log position (L1) of branch C is added to the list of reserved log positions of branch B.

[0198] At this point, the branch reattachment operation is complete. During the operation, the relationship between branch C and branch A was adjusted; that is, the parent branch of branch C was changed from branch A to branch B. The storage metadata of each branch remained unchanged. Due to the lazy resolution mechanism described in the previous embodiment, the physical storage path recorded in the storage metadata of branch C remains unchanged. If locating the dependent file based on this physical storage path fails, the system will locate the current root branch along the ancestor chain of branch C and perform lazy resolution of the dependent file under the storage path corresponding to the current root branch, ensuring that branch C can access the physical file it references normally after reattaching.

[0199] Optionally, in some application scenarios, after determining at least one dependent file referenced by the sub-branch based on the second storage metadata, the physical storage path of the dependent file can be redirected and updated so that the updated physical storage path points to the existing storage path of the reattached branch. Then, the branch topology database is updated to cancel the association between the parent branch and the child branch and establish the association between the reattached branch and the child branch. Compared to the method of maintaining the stability of the second storage metadata and lazy resolution, the above optional method does not require ancestor chain backtracking under simple topology structures, thus possessing higher data access determinism and execution directness.

[0200] Through the above optional embodiments, on the one hand, this application provides a branch re-attachment processing method based on a lazy resolution mechanism. During the re-attachment process, the physical storage path in the second storage metadata remains unchanged, and the topology change is pushed down to the file access time. Lazy resolution of dependent files is achieved along the ancestor chain in the branch topology database, thereby avoiding the risk of metadata cascading rewriting caused by repeated separation and re-attachment operations. This effectively overcomes the limitation that metadata mapping cannot be centrally updated when a branch instance is scaled down to zero in a Serverless scenario, ensuring the efficiency and elasticity of branch topology changes. On the other hand, this application can also redirect the physical storage path, thereby achieving higher operational atomicity and direct data access in simple topology scenarios. These diverse implementation methods enable this application to ensure the overall elasticity of branch topology changes while also taking into account the operational needs and system adaptability under different application scenarios.

[0201] Figure 16 This is a schematic diagram of an optional lazy resolution process provided in an embodiment of this application. For example... Figure 16 As shown, when the system accesses a file in a sub-branch, it reads the physical storage path recorded in the second storage metadata of that sub-branch and accesses the file in the file directory pointed to by that physical storage path. Then, it determines whether the file exists in the current file directory. If the file exists (corresponding to...) Figure 16 If the system reads "Yes" in the format indicated by the missing string, it will directly read the file and return it. If the file is missing (corresponding to...), the system will read the file directly and return it. Figure 16 If the answer is "No", it indicates that the sub-branch has been previously split, and the root branch corresponding to the sub-branch has been changed. In this case, the system queries the ancestor chain of the sub-branch, locates its current root branch, and parses and reads the physical file in the storage path corresponding to the current root branch. Because referenced dependency files are copied or redirected to the storage path corresponding to the current root branch during branch splitting or reattaching, and because referenced files in the metadata pointing to higher-level ancestor branch storage paths are also copied to the storage path corresponding to the latest root branch during branch splitting (or redirected in optional redirection implementations), the success rate of lazy resolution is ensured. If the file is missing, it may indicate that the sub-branch has been previously split or reattached, or that the branch corresponding to the physical storage path has been deleted.

[0202] To ensure the proper functioning of the lazy resolution mechanism, the parent branch must wait for the child branch to complete its branch splitting operation and for all dependent files referenced by the child branch to be copied to the storage path corresponding to the new root branch before garbage collection can be performed on the referenced files in the old storage path. Since the parent branch updates the branch topology database after the dependent files are copied, the creation log point of the child branch is still within the lifecycle of the referenced files before the copying is complete. Therefore, the parent branch's garbage collection will not reclaim the referenced files based on the above conditions, thus implicitly achieving the aforementioned waiting effect. Subsequently, if a descendant branch accesses a missing physical file, it will automatically switch to ancestor chain lazy resolution, completely transparent to the application layer. After successful resolution, the child branch can cache the location result of the current root branch to avoid the redundant computation overhead caused by subsequent traversal of the ancestor chain.

[0203] Considering the aforementioned lazy resolution mechanism, during the garbage collection process, the required collection cutoff log positions and branch retention log positions are all retrieved from the page storage cluster. The page storage cluster maintains a complete branch topology, where the retention log positions are specifically the creation log positions (i.e., fork point log sequence numbers) of each sub-branch. The page storage cluster is always online and unaffected by the scaling down of compute layer instances to zero in serverless scenarios; therefore, the garbage collection process can obtain the aforementioned collection cutoff log positions and branch retention log positions at any time.

[0204] It should be noted that the management interface does not participate in garbage collection determination; its responsibility is to coordinate branch splitting and re-attaching processes that require cross-branch operations. When a user initiates a branch splitting or re-attaching request, the management interface calls the relevant compute layer branch instance to perform a physical file copy operation (this operation is only required for branch splitting) and updates the branch topology database. During this process, the storage metadata mapping of each branch remains unchanged, and missing physical files are obtained by the accessing party through the aforementioned ancestor chain lazy resolution mechanism.

[0205] To address the issue of physical file remnants, this application provides a conservative handling strategy. In degenerate scenarios where the retained log positions of globally active branches cannot be obtained and judgment can only rely on local information, when the file's write log position is less than or equal to the maximum value among the retained log positions of all active child branches, it indicates that the physical file existed before a certain child branch was created. The parent branch cannot independently determine whether the child branch still references the physical file, and in this case, the garbage collection process adopts a conservative strategy of not collecting it. However, if... Figure 11 In the scenario shown, since the garbage collection process can obtain the retained log positions of multiple active branches globally from the page storage cluster, the system will make an accurate determination based on the relationship between the file's lifecycle range and the global retained log position. This determination does not contradict the aforementioned conservative strategy. The scope of the aforementioned residual files is limited to physical files generated before the creation of the sub-branch, marked as deleted in the parent branch, but still potentially referenced by the sub-branch.

[0206] It should be noted that, regarding the aforementioned residual files, this application embodiment also provides the following solutions: First, branch detachment triggers full cleanup: When a child branch performs a branch detachment operation, the system copies all physical files that depend on the parent branch to the target storage path corresponding to the child branch. Afterward, the parent branch can safely reclaim these residual files. Second, explicit deletion events in child branches: If a child branch also deletes the same logical file and records a file reclamation event, the child branch's own garbage collection process will automatically clean up the corresponding physical file. Third, the end of the branch's lifecycle: When a child branch is deleted, its corresponding reserved log position is removed, and the garbage collection conditions of the parent branch are relaxed accordingly, allowing residual files to be naturally reclaimed.

[0207] The embodiments of this application can achieve the following beneficial effects in application scenarios: Branch creation replicates the mapping relationship at the storage metadata layer, and its creation speed is not affected by the amount of physical data; at the same time, each branch can share unmodified physical files, and the actual storage overhead is only the increment of the differences between branches.

[0208] In terms of garbage collection, each branch instance independently determines its lifecycle range based on the file recycling event table stored locally, without relying on a global scheduling center, thus avoiding the risk of single point of failure and adapting to the dynamic scaling characteristics of the Serverless architecture. The garbage collection judgment is relatively conservative, and in conjunction with the cleanup mechanism of branch separation and branch deletion, it prevents the risk of data loss.

[0209] In terms of operational flexibility and architecture, the system supports complete lifecycle management operations such as branch creation, branch deletion, branch detachment, and branch reattachment, while ensuring the consistency of stored metadata. Particularly in branch detachment and reattachment operations, by maintaining the stability of stored metadata and establishing a lazy resolution mechanism along the ancestor chain, the system effectively solves the problem of cascading metadata rewriting caused by multiple topology changes, and avoids change blocking caused by branch instance offline in Serverless scenarios. The storage branch logic is implemented entirely at the storage metadata layer without intruding into the database engine kernel, exhibiting good architectural portability. Furthermore, the parallel directory structure combined with the immutability of physical files fully leverages the underlying characteristics of object storage services.

[0210] In summary, this application achieves real-time creation and efficient isolation of object storage branches by using a decoupled storage model that integrates a physical layer parallel directory, a mapping layer storing metadata, and a logical layer user perspective. This is combined with a decentralized garbage collection algorithm based on LSN interval comparison and a topology change mechanism based on maintaining the stability of storage metadata and lazy resolution of the ancestor chain, ensuring the integrity of branch data and the overall availability of the storage system.

[0211] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0212] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM), random access memory (RAM), disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0213] Embodiments of this application also provide a branch management system. Figure 17 This is a structural block diagram of a branch management system according to an embodiment of this application, such as... Figure 17 As shown, the branch management system includes: a management module 1701, a computing layer 1702, and an object storage layer 1703; the object storage layer 1703 provides physical storage space, wherein physical files in the physical storage space remain immutable after being written; the management module 1701 is configured to, in response to a sub-branch creation request, determine the parent branch of the sub-branch and determine the creation log position of the sub-branch; the computing layer 1702 is configured to, create a target storage path corresponding to the sub-branch in the physical storage space, and generate second storage metadata in the target storage path based on the first storage metadata of the parent branch at the creation log position, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace of the sub-branch and the physical file; the management module 1701 is also configured to, in the branch topology database, associate the creation log position and the second storage metadata with the branch identifier of the sub-branch, so that the sub-branch remains active.

[0214] In an exemplary application scenario, referring to the aforementioned branch management system, the following is provided: Figure 18 This illustrates one possible system architecture. For example... Figure 18 As shown, the branch management system may include a management interface, a computing layer, and a storage layer. The management interface internally maintains a branch topology database, used to record the creation information of multiple active branches globally and the parent-child topology relationships between branches. The computing layer hosts multiple branch instances, for example... Figure 18 The diagram shows branches A, B, and C. Each branch instance internally deploys a database engine, a file recycling process, and maintains its own storage metadata and file recycling event table. In the application scenario, the management interface corresponds to the aforementioned management module, and the storage layer corresponds to the aforementioned object storage layer.

[0215] The storage layer is used to actually store the physical file set of each branch. For example, the physical file set corresponding to branch A is configured ( / bucket / branch_a), the physical file set corresponding to branch B is configured ( / bucket / branch_b), and the physical file set corresponding to branch C is configured ( / bucket / branch_c).

[0216] Each branch instance in the compute layer establishes a mapping relationship between its logical namespace and the corresponding physical file set in the storage layer through its internal storage metadata, thereby achieving decoupling between the logical view and physical storage for each branch.

[0217] In an optional embodiment, the control module in the branch management system described above can also be configured to, in response to a deletion request for a sub-branch, perform a topology query on the branch topology database, and, when it is confirmed that the sub-branch does not have any active descendant branches, instruct the computing layer to delete the target storage path and the second storage metadata, and to remove the association between the creation log point and the branch identifier of the sub-branch from the branch topology database.

[0218] In an optional embodiment, the computation layer in the branch management system described above can also be configured to, in response to a file addition request for a sub-branch, write the new file to the target storage path, generate a first mapping entry based on the logical name, target storage path, and write log position of the new file, and add the first mapping entry to the second storage metadata. The computation layer can also be configured to, in response to a file deletion request for a sub-branch, read the write log position and physical storage path of the file to be deleted from the second storage metadata, generate a file reclamation entry and add it to the file reclamation event table, and delete the corresponding mapping entry from the second storage metadata. Optionally, the above operations can be performed within the same atomic transaction.

[0219] In an optional embodiment, the computation layer in the branch management system described above can also be configured to, in response to a file reclamation task being triggered, obtain the reclamation cutoff log position, traverse the file reclamation entries in the file reclamation event table, and determine the lifecycle interval based on the write log position and delete log position in the file reclamation entry; if the delete log position is earlier than the reclamation cutoff log position, and multiple creation log positions corresponding to multiple active branches globally are all outside the lifecycle interval, then the corresponding physical file is deleted from the physical storage space. Optionally, the computation layer can also be configured to obtain the current log position and a preset recovery time window, and calculate the reclamation cutoff log position based on the log increment corresponding to the current log position and the recovery time window.

[0220] In an optional embodiment, the control module in the branch management system described above can also be configured to, in response to a separation request for a sub-branch, instruct the computing layer to determine the dependent file referenced by the sub-branch based on the second storage metadata, store a copy of the original physical file corresponding to the dependent file in the target storage path, keep the physical storage path in the second storage metadata pointing to the existing storage path of the parent branch, and, if the dependent file cannot be located based on the physical storage path, locate the current root branch along the ancestor chain and read the copy of the physical file, and update the branch topology database to cancel the parent-child association.

[0221] In an optional embodiment, the control module in the branch management system described above can also be configured to, in response to a re-attachment request for a sub-branch, determine the re-attachment branch, and, if the creation log position of the sub-branch is earlier than or equal to the creation log position of the re-attachment branch, instruct the computing layer to keep the physical storage path in the second storage metadata pointing to the existing storage path of the parent branch, and, if the dependent file cannot be located according to the physical storage path, locate the current root branch along the ancestor chain and read the dependent file, and update the branch topology database to establish the association between the re-attachment branch and the sub-branch.

[0222] It should be noted that other implementations of the above branch management system can be found in the description of various optional embodiments of the branch management method above, and will not be repeated here.

[0223] According to an embodiment of this application, an apparatus embodiment for implementing the above-described branch management method is also provided. Figure 19 This is a structural block diagram of a branch management device according to an embodiment of this application, such as... Figure 19 As shown, the device includes: a determining module 1901, used to determine the parent branch of the sub-branch and the creation log position of the sub-branch in response to a sub-branch creation request; a creating module 1902, used to create a target storage path corresponding to the sub-branch in physical storage space, wherein the physical file in the physical storage space remains immutable after being written; a generating module 1903, used to generate second storage metadata in the target storage path based on the first storage metadata of the parent branch at the creation log position, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace of the sub-branch and the physical file; and an associating module 1904, used to associate the creation log position and the second storage metadata with the branch identifier of the sub-branch in the branch topology database, so that the sub-branch remains active.

[0224] Optionally, in the above branch management device, the creation log point is used to characterize the fork position in the log sequence corresponding to the parent branch, and the fork position is used to indicate the creation point on the write-ahead log stream of the parent branch corresponding to the child branch. The child branch inherits the data state of the parent branch at the creation log point.

[0225] Optionally, in the above-mentioned branch management device, the target storage path corresponding to the sub-branch is independent of the existing storage path corresponding to the parent branch in the physical storage space.

[0226] Optionally, the generation module 1903 is further configured to: read the first storage metadata corresponding to the creation log point from the storage metadata table corresponding to the parent branch, wherein the first storage metadata is used to characterize the mapping relationship between the logical namespace and physical file of the parent branch, and the first storage metadata corresponds to the data status of the parent branch at the creation log point; and create a data copy of the first storage metadata in the target storage path to obtain the second storage metadata.

[0227] Optionally, in addition to all the modules mentioned above, the branch management device also includes a branch deletion module (not shown in the figure), which is used to: in response to a deletion request for a sub-branch, perform a topology query on the branch topology database to obtain the query result, wherein the branch topology database is used to record the creation information corresponding to multiple active branches globally; in response to the query result indicating that there are no descendant branches of the sub-branch among the multiple active branches, delete the target storage path and the second storage metadata, and remove the association between the creation log position and the branch identifier of the sub-branch from the branch topology database, so that the sub-branch ends its active state.

[0228] Optionally, in addition to all the modules mentioned above, the branch management device also includes a file addition module (not shown in the figure), which is used to: in response to a file addition request for a sub-branch, write the new file to the target storage path of the sub-branch, and determine the write log position corresponding to the new file; generate a first mapping entry based on the logical name, target storage path and write log position corresponding to the new file, and add the first mapping entry to the second storage metadata.

[0229] Optionally, in addition to all the modules mentioned above, the branch management device also includes a file deletion module (not shown in the figure), which is used to: in response to a file deletion request for a sub-branch, read the write log position and physical storage path from the second mapping entry corresponding to the file to be deleted in the second storage metadata, and determine the deletion log position of the file to be deleted; generate a file recycling entry based on the write log position, physical storage path and deletion log position, and add the file recycling entry to the file recycling event table, wherein the file recycling entry is used to indicate that the file to be deleted belongs to a logically deleted file in the logical namespace; delete the second mapping entry from the second storage metadata, and determine the file to be deleted as a logically deleted file that has been deleted in the logical namespace.

[0230] Optionally, in addition to all the modules mentioned above, the branch management device also includes a file recycling module (not shown in the figure), which is used to: obtain the recycling cutoff log position in response to the file recycling task being triggered; traverse the file recycling entries in the file recycling event table, determine the life cycle range of the logically deleted file based on the write log position and delete log position in the file recycling entry, and if the delete log position is earlier than the recycling cutoff log position, and the multiple creation log positions corresponding to the multiple active branches globally are all outside the life cycle range, then delete the physical file corresponding to the logically deleted file from the physical storage path.

[0231] Optionally, the above-mentioned file recycling module is also used to: obtain the current log position and the preset recovery time window; and obtain the recycling cutoff log position based on the log increment corresponding to the current log position and the recovery time window.

[0232] Optionally, in addition to all the modules mentioned above, the branch management device also includes a file update module (not shown in the figure), which is used to: in response to a file update request for a sub-branch, perform the following operations in the same transaction: remove the second mapping entry corresponding to the file to be updated from the second storage metadata, generate a file recycling entry based on the second mapping entry and add it to the file recycling event table, write the updated file to the target storage path, and generate a new mapping entry based on the updated file and add it to the second storage metadata, wherein the logical name in the new mapping entry is the same as the logical name of the file to be updated, and the physical storage path points to the updated file.

[0233] Optionally, in the above file deletion module, reading the write log location and physical storage path from the second storage metadata, adding the file recycling entry to the file recycling event table, and deleting the second mapping entry from the second storage metadata are all performed in the same atomic transaction.

[0234] Optionally, in addition to all the modules mentioned above, the branch management device also includes a first separation module (not shown in the figure), configured to: in response to a separation request for a sub-branch, determine at least one dependent file referenced by the sub-branch based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; read the original physical file corresponding to the dependent file based on the physical storage path; store a copy of the original physical file in the target storage path; maintain the physical storage path in the second storage metadata pointing to the existing storage path of the parent branch, and when the dependent file cannot be located based on the physical storage path, locate the current root branch along the ancestor chain of the sub-branch and read the copy of the physical file in the storage path corresponding to the current root branch; update the branch topology database to cancel the association between the parent branch and the sub-branch, and convert the sub-branch into a root branch independent of the parent branch.

[0235] Optionally, in addition to all the modules mentioned above, the branch management device also includes a second separation module (not shown in the figure), configured to: in response to a separation request for a sub-branch, determine at least one dependent file referenced by the sub-branch based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; read the original physical file corresponding to the dependent file based on the physical storage path; store a copy of the original physical file in the target storage path; update the physical storage path in the second storage metadata based on the copy of the physical file in the target storage path; and update the branch topology database to cancel the association between the parent branch and the sub-branch, and convert the sub-branch into a root branch independent of the parent branch.

[0236] Optionally, in addition to all the modules mentioned above, the branch management device also includes a first re-attachment module (not shown in the figure), configured to: determine the re-attachment branch in response to a re-attachment request for a sub-branch; determine at least one dependent file referenced by the sub-branch based on second storage metadata in response to determining that the creation log position of the sub-branch is earlier than or equal to the creation log position of the re-attachment branch, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; maintain the physical storage path of the dependent file pointing to the existing storage path of the parent branch, and when the dependent file cannot be located based on the physical storage path, locate the current root branch along the ancestor chain of the sub-branch and read the dependent file under the storage path corresponding to the current root branch; update the branch topology database to cancel the association between the parent branch and the sub-branch, and establish the association between the re-attachment branch and the sub-branch.

[0237] Optionally, in addition to all the modules mentioned above, the branch management device also includes a second re-attachment module (not shown in the figure), used to: determine the re-attachment branch in response to a re-attachment request for a sub-branch; in response to determining that the creation log position of the sub-branch is earlier than or equal to the creation log position of the re-attachment branch, determine at least one dependent file referenced by the sub-branch based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; redirect and update the physical storage path of the dependent file so that the updated physical storage path points to the existing storage path of the re-attachment branch; update the branch topology database to cancel the association between the parent branch and the sub-branch, and establish the association between the re-attachment branch and the sub-branch.

[0238] It should be noted that the aforementioned determining module 1901, creating module 1902, generating module 1903, and associating module 1904 correspond to steps S201 to S204 in the embodiments. The four modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiments.

[0239] It should be noted that the aforementioned modules or units may be hardware or software components stored in memory and processed by one or more processors. These modules may also run as part of a device in a computer terminal. Preferred embodiments of this application can be found in the descriptions of the foregoing embodiments, and will not be repeated here. The preferred implementation schemes involved in the above embodiments of this application are the same as the solutions, application scenarios, and implementation processes provided in the above embodiments, but are not limited to the solutions provided in the above embodiments.

[0240] Embodiments of this application may provide an electronic device, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the branch management method of any of the foregoing items during runtime.

[0241] Figure 20 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 20 As shown, the electronic device 200 may include: one or more (only one is shown in the figure) processors 2002, memory 2004, memory controller, and peripheral interfaces.

[0242] The aforementioned electronic devices can be understood as integrated smart terminals, including but not limited to servers, desktop computers, personal computers (PCs), and all-in-one model machines.

[0243] Furthermore, the electronic device may also include data management (supporting the creation and management of model tuning datasets), a training center (providing rich training resources to help users learn and master artificial intelligence (AI) technology), and basic control capabilities (providing enterprise-level basic control capabilities to ensure the security and efficient operation of the system). Through the above functions, it provides a comprehensive and integrated device for AI development, training, deployment, and application.

[0244] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the methods in the above embodiments. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the electronic device 200 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0245] The processor can invoke an executable program stored in memory to execute any of the methods described in the above embodiments.

[0246] Those skilled in the art will understand that, Figure 20 The structure shown is for illustrative purposes only. Electronic devices can also be smart mobile devices (such as smartphones), tablets, PDAs, and mobile internet devices (MIDs) and other terminal devices. Figure 20 This does not limit the structure of the aforementioned electronic device. For example, electronic device 200 may also include components that are more... Figure 20 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 20 The different configurations shown.

[0247] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0248] Embodiments of this application also provide a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium includes a stored executable program, wherein, when the executable program runs, it controls the device where the computer-readable storage medium is located to execute any of the foregoing methods.

[0249] Optionally, in this embodiment, the storage medium may be located in an electronic device.

[0250] Optionally, in this embodiment, the computer-readable storage medium is configured to store an executable program, which, when the executable program is running, controls the device where the computer-readable storage medium is located to execute any of the methods described in the above embodiments.

[0251] Embodiments of this application also provide a computer program product. Optionally, in this embodiment, the computer program product may include a computer program that, when executed by a processor, implements the methods provided in the embodiments described above.

[0252] Optionally, the computer program product described above may include a non-volatile computer-readable storage medium, which can be used to store a computer program that, when executed by a processor, implements the method provided in the above embodiments.

[0253] Embodiments of this application also provide a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, it implements the method provided in the above embodiments.

[0254] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0255] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0256] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0257] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0258] If the aforementioned integrated units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, ROM, RAM, portable hard drives, magnetic disks, or optical disks.

[0259] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A branch management method, characterized in that, include: In response to a subbranch creation request, determine the parent branch of the subbranch and the creation log position of the subbranch; In the physical storage space, create the target storage path corresponding to the sub-branch, wherein the physical files in the physical storage space remain immutable after being written; Based on the first storage metadata of the parent branch at the log creation point, a second storage metadata is generated in the target storage path, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace of the child branch and the physical file; The creation log location and the second storage metadata are associated with the branch identifier of the sub-branch in the branch topology database so that the sub-branch remains active.

2. The branch management method according to claim 1, characterized in that, The creation log point is used to characterize the fork position in the log sequence corresponding to the parent branch. The fork position is used to indicate the creation point on the write-ahead log stream of the parent branch corresponding to the child branch. The child branch inherits the data state of the parent branch at the creation log point.

3. The branch management method according to claim 1, characterized in that, The target storage path corresponding to the sub-branch is independent of the existing storage path corresponding to the parent branch in the physical storage space.

4. The branch management method according to claim 1, characterized in that, Generating the second storage metadata in the target storage path based on the first storage metadata includes: Read the first storage metadata corresponding to the creation log position from the storage metadata table corresponding to the parent branch, wherein the first storage metadata is used to characterize the mapping relationship between the logical namespace of the parent branch and the physical file, and the first storage metadata corresponds to the data status of the parent branch at the creation log position; A data copy of the first storage metadata is created in the target storage path to obtain the second storage metadata.

5. The branch management method according to claim 1, characterized in that, The branch management method also includes: In response to a deletion request for the sub-branch, a topology query is performed on the branch topology database to obtain query results, wherein the branch topology database is used to record creation information corresponding to multiple active branches globally; In response to the query result indicating that no descendant branch of the sub-branch exists among the plurality of active branches, the target storage path and the second storage metadata are deleted, and the association between the creation log location and the branch identifier of the sub-branch is removed from the branch topology database, so that the sub-branch ends its active state.

6. The branch management method according to claim 1, characterized in that, The branch management method also includes: In response to a file addition request for the sub-branch, the new file is written to the target storage path of the sub-branch, and the write log position corresponding to the new file is determined; A first mapping entry is generated based on the logical name corresponding to the newly added file, the target storage path, and the write log position, and the first mapping entry is added to the second storage metadata.

7. The branch management method according to claim 1 or 5, characterized in that, The branch management method also includes: In response to a file deletion request for the sub-branch, the write log location and physical storage path are read from the second mapping entry corresponding to the file to be deleted in the second storage metadata, and the deletion log location of the file to be deleted is determined. A file recycling entry is generated based on the write log location, the physical storage path, and the delete log location, and the file recycling entry is added to the file recycling event table, wherein the file recycling entry is used to indicate that the file to be deleted belongs to the logically deleted file in the logical namespace; The second mapping entry is deleted from the second storage metadata, and the file to be deleted is identified as a logically deleted file that has been deleted within the logical namespace.

8. The branch management method according to claim 7, characterized in that, The branch management method also includes: In response to a file recycling task being triggered, retrieve the recycling deadline log position; Traverse the file recycling entries in the file recycling event table, and determine the lifecycle range of the logically deleted file based on the write log position and the delete log position in the file recycling entry. If the delete log position is earlier than the recycling cutoff log position, and the multiple creation log positions corresponding to multiple active branches in the world are all outside the lifecycle range, then delete the physical file corresponding to the logically deleted file from the physical storage path.

9. The branch management method according to claim 8, characterized in that, Obtaining the recycle cutoff log location includes: Get the current log position and the preset recovery time window; The recovery cutoff log position is obtained based on the current log position and the log increment corresponding to the recovery time window.

10. The branch management method according to claim 7, characterized in that, The branch management method also includes: In response to a file update request for the sub-branch, the following operations are performed within the same transaction: the second mapping entry corresponding to the file to be updated is removed from the second storage metadata, and a file recycling entry is generated based on the second mapping entry and added to the file recycling event table; the updated file is written to the target storage path, and a new mapping entry is generated based on the updated file and added to the second storage metadata, wherein the logical name in the new mapping entry is the same as the logical name of the file to be updated, and the physical storage path points to the updated file.

11. The branch management method according to claim 7, characterized in that, The process of reading the write log location and physical storage path from the second storage metadata, adding the file recycling entry to the file recycling event table, and deleting the second mapping entry from the second storage metadata are all performed in the same atomic transaction.

12. The branch management method according to claim 1, characterized in that, The branch management method also includes: In response to the separation request for the sub-branch, at least one dependent file referenced by the sub-branch is determined based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; Based on the physical storage path, read the original physical file corresponding to the dependent file; Store a copy of the original physical file in the target storage path; The physical storage path in the second storage metadata is kept pointing to the existing storage path of the parent branch. When the dependent file cannot be located according to the physical storage path, the current root branch is located along the ancestor chain of the child branch and the copy physical file is read under the storage path corresponding to the current root branch. The branch topology database is updated to cancel the association between the parent branch and the child branch and to convert the child branch into a root branch independent of the parent branch.

13. The branch management method according to claim 1, characterized in that, The branch management method also includes: In response to the separation request for the sub-branch, at least one dependent file referenced by the sub-branch is determined based on the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch; Based on the physical storage path, read the original physical file corresponding to the dependent file; Store a copy of the original physical file in the target storage path; Update the physical storage path in the second storage metadata according to the copy physical file in the target storage path; Update the branch topology database to remove the association between the parent branch and the child branch, and convert the child branch into a root branch independent of the parent branch.

14. The branch management method according to claim 1, characterized in that, The branch management method also includes: In response to the re-attachment request for the sub-branch, determine the re-attachment branch; In response to determining that the creation log position of the sub-branch is earlier than or equal to the creation log position of the reattached branch, at least one dependent file referenced by the sub-branch is determined according to the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch. The physical storage path of the dependent file is kept pointing to the existing storage path of the parent branch. If the dependent file cannot be located according to the physical storage path, the current root branch is located along the ancestor chain of the child branch and the dependent file is read under the storage path corresponding to the current root branch. The branch topology database is updated to cancel the association between the parent branch and the child branch and to establish the association between the reattached branch and the child branch.

15. The branch management method according to claim 1, characterized in that, The branch management method also includes: In response to the re-attachment request for the sub-branch, determine the re-attachment branch; In response to determining that the creation log position of the sub-branch is earlier than or equal to the creation log position of the reattached branch, at least one dependent file referenced by the sub-branch is determined according to the second storage metadata, wherein the physical storage path of the dependent file belongs to the existing storage path of the parent branch. The physical storage path of the dependent file is redirected and updated so that the updated physical storage path points to the existing storage path of the reattached branch; Update the branch topology database to cancel the association between the parent branch and the child branch, and establish the association between the reattached branch and the child branch.

16. A branch management system, characterized in that, include: The module consists of a control module, a computing layer, and an object storage layer. The object storage layer is used to provide physical storage space, wherein physical files in the physical storage space remain immutable after being written; The control module is configured to, in response to a sub-branch creation request, determine the parent branch of the sub-branch and determine the creation log position of the sub-branch; The computing layer is configured to create a target storage path corresponding to the sub-branch in the physical storage space, and generate second storage metadata in the target storage path based on the first storage metadata of the parent branch at the log creation point, wherein the second storage metadata is used to characterize the mapping relationship between the logical namespace of the sub-branch and the physical file; The control module is also configured to associate the creation log location and the second storage metadata with the branch identifier of the sub-branch in the branch topology database, so that the sub-branch remains active.

17. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the branch management method according to any one of claims 1 to 15.

18. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the storage medium is located to perform the branch management method according to any one of claims 1 to 15.

19. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the branch management method according to any one of claims 1 to 15.