Persistent functionality in database system

By introducing an isolated computing environment into the database system to generate and manage state variable value sets, it solves the difficulties of suspending, updating, and redeploying functions for complex workloads, achieves fast response and data consistency of functions, and simplifies computing resources. manage.

CN118829980APending Publication Date: 2024-10-22SINGLESTORE INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380023547.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-02-24
Filing Date
2023-02-23
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

When existing database systems handle complex workloads, it is difficult to effectively pause, update, and redeploy functions, resulting in difficulty in computing resource management, inability to quickly respond to user needs, and possible loss of data consistency and durability.

Method used

By introducing an isolated computing environment into the database system, the state variable value set in the function definition is generated and stored, allowing the function to be operated and managed in the isolated environment, supporting the suspension, update and redeployment of the function, ensuring the persistence and consistency of the data sex.

Benefits of technology

It realizes the flexible suspension, update and redeployment of functions, simplifies computing resource management, improves the response speed and data consistency of the database system, and ensures rapid response to user requests and data protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118829980A_ABST
    Figure CN118829980A_ABST
Patent Text Reader

Abstract

A database system and a computer-implemented method for managing functions in the database system are provided. The method implemented using instructions storable in the database system involves obtaining first data representing a set of one or more operations to be performed on data in the database system. Second data representing a functional definition is derived from the first data, and the functional definition includes the set of one or more operation and state variable sets. A function is generated from the second data. Generating the functionality includes storing one or more sets of values for respective ones of the state variables. A set of values is stored in an isolated computing environment in the database system, and the functionality is configured to operate on the values in the isolated computing environment.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art Technical Field

[0001] The present application relates to database management systems, and more particularly, to methods and systems for implementing functions in relational database management systems.

[0002] Related technical notes

[0003] As technology advances, the amount of information stored in electronic form and the need for real-time or pseudo-real-time capabilities to search, organize, and / or manipulate such information continue to increase. Database management systems (sometimes also referred to as database systems, databases, data stores, and data warehouses) organize data in a form that facilitates efficient searching, retrieval, and / or manipulation of selected information. A typical database management system allows a user to submit a "query" in a query language or invoke one or more functions to search, organize, retrieve, and / or manipulate information that meets specific criteria.

[0004] Some databases may be transactional, that is, their primary purpose is to record transactions. Such transactions can be considered as one or more operations performed on data recorded in a log. The log may include a continuous stream of log records, each of which corresponds to a transaction. This may allow transactions to be replayed or undone after an event such as a system crash. Some databases may additionally or alternatively be analytical, that is, their purpose is to perform queries and generate analysis on the data stored in the database.

[0005] The demands on a database system may vary, and to handle the increased demands, the database system may be scaled up (and down) by increasing (and decreasing) the resources of existing servers by adding (or decreasing) memory or updating CPUs. Horizontally scaling a database system increases capacity by adding new nodes (e.g., in the form of new machines) to the database system.

[0006] User-defined workloads can be deployed to operate on data stored in a database. Implementing these workloads in a database system presents challenges when trying to allocate resources, manage interactions between workloads, and maintain data consistency and persistence across the database system. It is desirable to provide a system that can flexibly and efficiently handle complex workloads that operate on data stored in a database for multiple users. Summary of the invention

[0007] According to a first aspect of the present disclosure, a computer-implemented method for managing functions in a database system is provided, the method comprising: obtaining first data representing a set of one or more operations to be performed on data in a database managed by the database system; deriving second data from the first data, the second data representing a function definition for implementation in the database system, wherein the function definition includes the set of operations and one or more sets of state variables; and generating a function based on the second data, wherein generating the function includes storing one or more value sets for corresponding state variables in the state variables, wherein the value sets are stored in an isolated computing environment in the database system, and the function is configured to operate on the value sets in the isolated computing environment.

[0008] The computer-implemented method of the present disclosure is intended to provide a method for enabling a function to be implemented in a database system, which can be easily suspended, updated and redeployed. In particular, providing a corresponding value set that can be modified by the function in an isolated computing environment allows the state and operating status of the function to be maintained persistently. Other functions or users can query these values ​​to determine the state and operating state of the function, thereby allowing other functions or workloads to operate and indicate the function in a manner that maintains the consistency and persistence of the function and its associated values. These functions can be suspended, for example, by first determining whether there are any active operations being implemented by the function, and then issuing instructions for stopping the execution of the operation. For example, by copying the function from one computing resource set to another computing resource set, and by transferring the value set from the isolated computing environment to different isolated computing environments on different computing resource sets, the function can also be redeployed in different database systems or on different computing resource sets. Providing functions in this way enables these functions to be effectively suspended, updated and redeployed, thereby allowing the database system to more easily manage computing resources, comply with relevant jurisdictional data protection laws, and quickly respond to user requests, such as updates and / or modifications to these functions. These functions can be durable in the sense that each corresponding set of values ​​is persistently maintained in an isolated environment, the values ​​operate with durable transactionality, and the functions can be redistributed and redeployed within the database system in a manner that maintains the consistency and characteristics of the functions.

[0009] According to a second aspect of the present disclosure, there is provided a database system for implementing one or more functions, wherein the one or more functions are configured to operate on data stored in the database system, the database system comprising: at least one processor; and a storage device, wherein the storage device comprises computer executable instructions, wherein the computer executable instructions, when executed by the at least one processor, enable the at least one processor to: obtain first data representing a set of one or more operations to be performed on data in a database managed by the database system; derive second data from the first data, wherein the second data represents a function definition for implementation in the database system, wherein the function definition comprises the set of operations and one or more sets of state variables; and generate a function according to the second data, wherein generating the function comprises storing one or more value sets for corresponding state variables in the state variables, wherein the value sets are stored in an isolated computing environment in the database system, and the function is configured to operate on the value sets in the isolated computing environment.

[0010] According to a third aspect of the present disclosure, a non-transitory computer-readable storage medium comprising computer-executable instructions is provided, which, when executed by at least one processor, causes the at least one processor to: obtain first data representing a set of one or more operations to be performed on data in a database managed by a database system; derive second data from the first data, the second data representing a function definition for implementation in the database system, wherein the function definition includes the set of operations and one or more sets of state variables; and generate a function based on the second data, wherein generating the function includes storing one or more value sets for corresponding state variables in the state variables, wherein the value sets are stored in an isolated computing environment in the database system, and the function is configured to operate on the value sets in the isolated computing environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 is a schematic diagram of a database system illustrating an instance of an implementation database according to an example.

[0012] Figure 2 is a flow chart illustrating a method according to an example.

[0013] Figure 3 This is an example implementation Figure 2 Schematic diagram of a database system shown in and according to an example method.

[0014] Figure 4 is a schematic diagram illustrating a database system including multiple functions according to an example.

[0015] Figure 5 is a schematic diagram illustrating a database management system including an execution log according to an example.

[0016] Figure 6 is a schematic diagram illustrating functionality configured to react to an event according to an example.

[0017] Figure 7 is a schematic diagram illustrating functionality for performing a number of operations according to an example.

[0018] Figure 8 is a schematic diagram illustrating functions implemented using a stack-based virtual machine according to an example.

[0019] Fig. 9 is a schematic diagram illustrating an update of a function according to an example execution.

[0020] Fig.10 is a schematic diagram showing an update of a function according to an example execution, wherein a new state table is generated.

[0021] Fig.11 is a diagram illustrating that an update to a function is performed while the function is performing an operation according to an example.

[0022] Fig.12 is a schematic diagram illustrating migration of functionality from a first set of computing resources to a second set of computing resources according to an example.

[0023] Fig.13 is a schematic diagram illustrating a non-transitory computer-readable storage medium according to an example. DETAILED DESCRIPTION

[0024] With reference to the accompanying drawings, details of the systems and methods according to the examples will become apparent from the following description. For the purpose of explanation, this description includes numerous specific details of certain examples. References to "examples" or similar language in the specification mean that a particular feature, structure, or characteristic described in conjunction with the example is included in at least one example, but not necessarily in other examples. It should be further noted that certain examples are schematically described in order to facilitate explanation and understanding of the concepts behind the examples, in which certain features are omitted and / or necessarily simplified.

[0025] A database can generally be viewed as an organized collection of data stored electronically in a computer system. A computer system that stores and manages a database and the data stored in the database is often referred to as a database management system or database system. In addition to storing databases, database systems can also be configured to perform certain management functions, such as replicating databases to provide resilience to crashes, and performing operations to record new data in the database and / or modify data already stored in the database. Some database management systems can also provide interfaces to enable users to implement workloads that are configured to perform operations on the data stored in the database.

[0026] A workload is typically a computer program or application configured to perform one or more operations. In some cases, a workload may be simple, for example, a workload may be a very specific program for performing one or more operations, such as reading, writing, or otherwise modifying data in a database system. Alternatively, a workload may be a complex program configured to implement many functions, each of which is configured to perform one or more low-level operations on data stored in a database. For example, a simple workload may be a program configured to traverse a database and modify a single data value type for multiple entries in the database. An example of a more complex workload may be a program written to manage data for a large number of clients or users whose data is stored in a database and to perform analysis on the data. A complex workload such as this workload may include a function for monitoring the state of each client whose data is stored in the database, a function configured to run analysis on client data in the database, and a function configured to manage the implementation of other functions in the database system to ensure concurrency, consistency, and efficient distribution of computing resources in the database system.

[0027] Generally speaking, workloads configured to perform operations on data stored in a database can be implemented on computing resources separate from the database system, and can use interfaces provided by the database system to access the data stored in the database. Alternatively, these workloads can be deployed within these database systems. As technology advances, the amount of data stored in databases and the complexity of workloads that operate on this data are increasing.

[0028] Complex workloads (such as workloads that perform machine learning and artificial intelligence operations) may run for a long time and may compete with other workloads for computing resources. In addition, these workloads may need to be retrained and deployed in the same database system or deployed to other database systems. The long-running nature of these workloads can bring challenges when trying to pause, redeploy, and modify these workloads. Long-running workloads are generally very expensive to start from scratch, and valuable data generated during the operation of the workload may be lost when pausing or canceling, and / or the database system may not be configured to analyze and process real-time or pseudo-real-time events to be fully processed. Pseudo-real-time events can generally be events that appear to occur in real time in a computer system logically, but may be related to events that occur asynchronously in time.

[0029] Certain examples described herein are intended to provide a database system and methods for managing functions in a database system that make it easier for functions to be paused, redeployed, updated, and monitored. The functions described herein have the ability to control and modify corresponding values ​​corresponding to state variables defined in the functions. These values ​​are isolated in the database system so that they are protected from modification by other functions. Isolating these values ​​simplifies the management of these functions by making it easier to identify the state of a function and to copy or move functions between computing resources in a database system.

[0030] Figure 1 The database system 100 is shown, which includes a set of one or more processors 102, a storage device 104, and one or more communication modules 106. The processor 102, the storage device 104, and the communication module 106 are connected via an interface 108 (e.g., a bus). The processor 102 includes any suitable combination of processing circuits that can be configured to perform the operations referred to herein. Figures 2 to 12 For example, processor 102 may include a central processing unit (CPU), a graphics processing unit (GPU), a neural processing unit (NPU), a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a fixed function processing circuit, any other suitable processing circuit, and / or any combination of these.

[0031] Storage 104 may include volatile storage or a combination of memory and non-volatile storage, which may be referred to as disk storage. Volatile storage may include a combination of random access memory (RAM), static random access memory (SRAM), and / or various types of dynamic random access memory (DRAM). Although volatile storage has been described with respect to storage 104 in some cases, some or all of the volatile storage may be directly attached to or integrated with processor 102.

[0032] Although sometimes referred to as "disks" or "disk storage," non-volatile storage may include any suitable combination of non-volatile storage types. For example, non-volatile storage may include hard disk drives, solid-state drives, flash memory, tape storage, or any combination of these storage types. In some cases, non-volatile storage may include tiered storage in which different storage types are used to store data depending on the age and / or access frequency of the data. For example, a solid-state drive may be used to store data that is frequently accessed or is likely to be frequently accessed. A hard disk drive or tape storage that has a higher read / write latency than a solid-state drive or flash memory may be used to store data that is older or less likely to be frequently accessed.

[0033] The storage device 104 is used to store computer executable instructions 110 and a database 112. The computer executable instructions 110 can implement one or more programs when executed by the processor 102. These programs may include general database management programs for maintaining data in the database 112, performing backup and replication processes, providing interfaces to the database 112, etc. The computer executable instructions 110 may also include instructions for implementing user-defined workloads. The database 112 included in the storage device 104 may include a collection of structured data in the form of a combination of row storage format data and column storage format data, as well as a collection of unstructured data such as binary large objects.

[0034] The communication module 106 may include any suitable combination of a network-enabled communication module and / or a user interface. For example, the communication module 106 may include a network interface to enable the database system 100 to communicate with one or more additional computer systems via a network such as a local area network, a wide area network (such as the Internet), etc. Alternatively or in addition, the communication module 106 may include a user interface, such as an input and output device, such as a screen, a keyboard, a touch screen, etc.

[0035] Although the database system 100 Figure 1 100 is shown as a single device, but it will be appreciated that database system 100 may include a collection of independent computing systems. For example, database system 100 may be implemented on one or more collocated servers or clustered computers. Alternatively, database system 100 may be a distributed database system, implemented as multiple computers or servers, remote from each other and communicatively coupled via a network.

[0036] Computer executable instructions 110 include an instruction set 114 that, when executed by processor 102, causes database system 100 to perform a computer implemented method 200 for managing functions in database system 100, the computer implemented method being Figure 2 is shown in and will be discussed below with respect to Figures 2 to 12 Further description.

[0037] refer to Figure 2 and Figure 3, the method 200 includes obtaining 202 first data 300 representing a set of one or more operations 302 to be performed on data in a database 112 managed by the database system 100. Obtaining 202 the first data 300 may include receiving the first data 300 through one or more communication modules 106. For example, the first data 300 may be received through a network from a user operating a terminal or an external computing device, the terminal or the external computing device being configured to interface with the database system 100. The user may write a program in a high-level computer programming language such as Python or Java, C++, etc., and upload the program to the database system 100 via the communication module 106.

[0038] Alternatively, the first data 300 may alternatively be distributed by a centralized management system that is configured to distribute the first data 300 to one or more database systems 100. For example, the first data 300 may represent a set of one or more operations 302 that are to be implemented in a variety of different database systems provided and / or managed by a centralized database management service.

[0039] In other examples, obtaining 202 the first data 300 may include reading the first data 300 from a storage device 104 (such as a non-volatile storage device) in the database system 100. In the case where the database system 100 includes a user interface, a developer environment may be provided in the database system 100, thereby allowing a user to directly write programs in the database system 100, including writing programs represented by the first data 300. When implementing the method 200, this first data 300 may be written to the storage device 104 and obtained 202 from the storage device.

[0040] Second data 304 representing a function definition 306 for implementation in the database system 100 is derived 204 from the first data 300. The function definition 306 represents information for creating a specific instance of a function in the database system 100. An instance of a function definition 306 is generally referred to as a function. The function definition 306 includes a set of operations 302 and one or more sets of state variables 308.

[0041] As described above, a set of operations 302 may include low-level operations to be performed on data in a database, such as reading, writing, and / or otherwise modifying data. These operations 302 may also include more complex operations, each of which involves reading multiple data values ​​from a database, operating on these data values ​​and / or using these data values, and storing the results in a database.

[0042] One or more state variable sets 308 represent variables used to define each instance of a function generated from function definition 306 and may represent data that the operations in the function are configured to operate. State variable sets 308 in function definition 306 may be implemented as part of a pattern that defines state variable sets 308 and data structures within which state variable sets 308 are implemented and mapped.

[0043] By way of illustration, one implementation of the function definition 306 may be that a company uses the function definition 306 to build a system for managing client data and lifecycles in the database system 100. According to this example, one or more sets of state variables 308 may represent data associated with an individual, such as age, height, location, subscription type, etc. In this case, a set of operations 302 may represent operations for, for example, modifying such data, making predictions about the individual based on such data, or causing certain operations or events to be performed in response to certain conditions represented by the individual's data.

[0044] Exporting the second data 304 may in some cases include processing the first data 300 and / or converting the data into a format suitable for implementation in the database system 100. As described above, the first data 300 may represent a program written by a developer, which includes a set of operations 302. The developer may write this program in a language of their choice, for example, in a high-level computing language such as Python, C++, Java, etc. In the case where the database system 100 is configured to implement such a language, exporting 204 the second data 304 may be a simple operation of copying, moving, and / or compiling the first data 300 so that the simple operation can be implemented in the database system 100. In other examples, exporting 204 the second data 304 may be a more complex process involving identifying a set of operations 302, any associated variables, and generating a function definition 306 suitable for implementation in the database system 100, the function definition being written, for example, in a language suitable for the database system 100 and / or using a data structure suitable for the database system.

[0045] Function 310 is generated 206 from second data 304, which may involve storing one or more value sets 312 for respective ones of state variables 308. Value sets 312 may be data values ​​that may be used to perform one or more operations 302. For example, value sets 312 may be user data associated with users of database system 100 or their clients.

[0046] exist Figure 3, the value sets 312 are each represented by a subscript number that corresponds to the subscript number of the corresponding variable 308. The generating 206 function 310 can be triggered by a request to generate a new function 310. In the request to generate 206 the new function 310, an initial set of values ​​312 can be provided, each of which is associated with a corresponding state variable 308. Taking the example provided above as an example, where the function definition 306 defines a function 310 that stores, manages and controls the data and life cycle of an individual, the request to generate the function 310 can be triggered when, for example, a new customer signs up for a service provided by a company. The customer will provide an initial set of values ​​including their age, height, location and selected subscription type. The function 310 associated with this customer can then be generated 206 and these values ​​312 are stored.

[0047] In a preferred arrangement, the value set 312 is stored in an isolated computing environment 314 in the database system 100, and the function 310 is configured to operate on the value set 312 in the isolated computing environment 314. This prevents the value set 312 from being modified by requests from functions that are not authorized to perform such operations and / or unauthorized users. By limiting the ability to operate and / or modify the value set 312 to the function 310, the persistence and consistency of the value set 312 can be maintained.

[0048] Furthermore, by simplifying the number of functions that can modify value set 312, it becomes easier to move or modify value set 312 and function 310 to a different set of computing resources in database system 100 while ensuring that the value set and function are not actively operated, which could otherwise result in errors or data corruption.

[0049] Function 310 can be configured to operate on value set 312 in a manner that maintains properties such as atomicity, consistency, isolation, and durability (ACID) so that the integrity and transactionality of value set 312 are maintained. For example, operations can be performed by functions in computational units called transactions, which are atomic in database system 100. Transactions can involve one or more low-level operations. When a transaction is executed, the individual operations included in the transaction can be logically executed in memory and persisted to disk only when all transactions have been completed, so that the operations are permanent in database system 100. Persisting transactions to disk and executing appropriate backup procedures can ensure the durability of database system 100. Once a transaction is completed, it is said to be committed in database system 100. Because value set 312 is operated only by transactions executed by function 310, transactions are isolated, which means that value set 312 may not undergo two or more operations at the same time. Isolation and consistency can also be supported by configuring function 310 to perform operations asynchronously, which will be referred to below. Figure 7 Further description.

[0050] The value set 312 may be configured to allow one or more additional functions in the database system 100 to query the value set 312, such that the additional functions can read the value set 312, but cannot perform operations on or modify the value set 312. In this way, other functions in the database system 100 may monitor the value sets 312 associated with the functions 310, while also ensuring that permissions to modify these values ​​312 are restricted, thereby simplifying the management of the value sets 312 in the database system 100 and enabling the system to maintain the ACID properties described above.

[0051] The value sets 312 may be stored in a relational data table referred to as a state table 316 that can be queried using appropriate computational instructions. The data structure and mapping of the state table 316 for storing the value sets 312 may be defined as state variables 308 in the function definition 306. Where the value sets 312 are stored in the state table 316, the values ​​may be queried by appropriately authorized functions and / or systems, for example using structured query language (SQL).

[0052] The isolated computing environment 314 can be implemented in a variety of ways. In a first example, the isolated computing environment 314 is implemented using a private table, for example, the state table 316 can be a private table. Function 310 can be configured to have authorization to modify the value set 312 stored in the private table. For example, the private table can require the presentation of a key or other type of identification before allowing the value stored therein to be processed or modified. Function 310 can be configured with this key or other type of identification. In the case where the isolated computing environment 314 is implemented using a private table, the table can be stored in a database including a plurality of private tables each associated with a corresponding function.

[0053] In a second example, the isolated computing environment 314 is implemented using a virtual machine. The function 310 can be configured to interface with the virtual machine and / or can be implemented using the same virtual machine on which the value 312 is stored. In other examples, the value set 312 can be logically isolated in a database system so that only the function 310 has the information, such as a schema, required to locate the value set 312 in order to operate and / or modify the values.

[0054] Storing value set 312 in isolated computing environment 314 and configuring function 310 to operate on value set 312 in isolated computing environment may involve providing function 310 with control over value set 312. This control may be exclusive, such that function 310 has sole authority to modify value set 312 in isolated computing environment 314.

[0055] By storing the value set 312 in the isolated computing environment 314 and configuring the function 310 to operate on the value set 312, control over the value set 312 can be simplified. Providing a system in which only the function 310 or other authorized functions associated with the value set 312 can operate on these values ​​makes it possible to quickly and consistently determine the current state of the function and its associated values. This is because it is not necessary to query the data value set distributed in tables throughout the database, nor is it necessary to confirm that any other function with access to the data value set 312 is actively operating on these values ​​312.

[0056] Simplifying access and control of value sets 312 associated with functions 310 in this manner makes it possible to quickly suspend, modify, redeploy, and / or redistribute functions 310 within database system 100 without having to manage other functions that might otherwise be operating on value sets 312 simultaneously.

[0057] Figure 3 The functionality 310 shown in FIG. 3 includes a set of operations 302 as defined in the functionality definition 306. However, it will be appreciated that including the set of operations 302 may involve storing a reference to the set of operations 302 in the functionality 310. When performing one of the operations 302, the functionality 310 may call the operation from the functionality definition 306 and provide values ​​and / or references to values ​​when calling the operation.

[0058] At least one operation in the set of operations 302 can be configured to update one or more values ​​in a value set 312 stored in the isolated computing environment 314. In this manner, the function 310 provides a way to update the value set 312. Other functions that need to modify one or more value sets 312 can do so using the operations provided in the function 310. A user or other function independent of the function 310 can send a request to the function 310 to update the value set 312.

[0059] Figure 4An example of a database system 100 is shown in which the method 200 has been performed and the database system 100 includes a plurality of functions 310A to 310D, each of which is configured to operate on a corresponding set of values ​​stored in a corresponding isolated computing environment 314A to 314D. As described above, these isolated computing environments 314A to 314D can be private tables in a database, isolated physical computing resources in a database, and / or isolated virtual machines in the database system 100. Each of the functions 310A to 310D can include a reference to a function definition 306 by which these functions are generated. In this way, changes to the function definition 306 can be related to the functions 310A to 310D. In addition, it is possible to easily identify a set of operations 302 and state variables 308 associated with the functions 310A to 310D. Each of the functions 310A- 310D may include a corresponding unique identification number or ID, thereby allowing the functions 310A- 310D to be referenced, called, or queried by other functions operating in the database system 100 .

[0060] Method 200 may involve storing an execution log 502, such as Figure 5 As shown in the example of , the execution log includes data indicating operations 302 that have been performed by function 310. Function 310 can be configured to write data to execution log 502, which indicates the operations performed by function 310, for example in the form of log records. Each log record can store data representing a specific operation or computing unit. By storing records of operations 302 performed by function 310, the following operations become possible: monitoring past and ongoing operations performed by function 310, and identifying whether function 310 has successfully performed an operation, and / or whether the operation requires attention from an administrator. In this case, the administrator can be a user who actively monitors database system 100 and / or an automatic function that is configured to identify erroneous or stalled operations and take action accordingly to mitigate and / or correct these events in database system 100.

[0061] In some examples, the execution log 502 for storing data indicating operations performed by the function 310 may be unique to the function 310. That is, the execution log 502 may only record operations performed by the function 310 and may not include data indicating operations performed by other functions in the database system 100. Alternatively, the execution log 502 may be used to store data indicating operations performed by multiple functions 310A to 310D implemented in the database system 100. In this case, the execution log 502 may be used to store data indicating operations performed by all functions 310A to 310D in the database system 100, or to store data indicating operations performed by a subset of the functions 310A to 310D implemented in the database system 100. The subset of functions 310A to 310D may include functions of the same type and / or functions 310A to 310D associated with the same corresponding function definition 306.

[0062] The operations 302 defined in the function 310 may be event driven, that is, the operations 302 may be called by the function 310 in response to an event. To this end, each operation may be associated with one or more events, so that after the event, the corresponding operation to be executed may be identified. Figure 6 An example is shown in which method 200 involves configuring functionality 310 to obtain an indication 602 of an event and to perform at least one associated operation in response to indication 602. Each operation may be associated with a respective event ID, which may correspond to the event ID included in indication 602.

[0063] Upon completion, the operation generates an output. The output may include data used to modify 604 one or more values ​​in the value set 312 and / or data provided to one or more additional functions. For example, the output of the operation performed by the function 310 may be such that Figure 6 An event in which another function not shown performs another operation.

[0064] The operations performed by the function 310 in response to the indication 602 can be recorded 606 in the execution log 502 by writing data indicating the operation into the execution log 502. The data written to the execution log 502 may include any one or more of the following: an indication of the operation performed, an indication of whether the operation was successfully performed, an indication of the output of the operation, and / or an indication of an event associated with the operation. Writing data indicating the successful or unsuccessful execution of the operation into the execution log 502 makes it possible to easily identify whether the operation has been completed, is in progress, is waiting for input, and / or is competing for resources in the database system 100 and cannot be completed.

[0065] Data indicating one or more events occurring in the database system 100 may also be stored in the execution log 502. For example, when the function obtains an indication 602 of an event, the execution log 502 may be updated with data indicating this event. By storing data indicating the operation performed by the function 310 and data indicating the event occurring in the database system 100, it is possible to identify that the operation expected to be performed in response to a given event has not been successfully called and / or has not been successfully completed. This may be used to identify that the function 310 strives to compete for computing resources to achieve a given operation. In addition to the recording of operations and events, the execution log 502 may also be used to store additional metadata associated with the function 310 for diagnostic and analytical purposes. General signal services and communications sent to and from the operation may also be stored in the execution log 502, and an administrator may review the log to adjust or otherwise reconfigure the database system 100.

[0066] The aforementioned events may include any one or more of the following: input from a user, instructions from one or more other functions operating in database system 100, output from one or more other functions operating in database system 100, or output from another operation performed by function 310.

[0067] The input from the user may include the user providing instructions to the function 310 through the user interface and / or the communication module 106 to perform one or more operations in the set of operations 302. The database system 100 may convert the input from the user into an indication of the event 602, for example including an associated event ID that can be used to identify which operation in the set of operations 302 is to be performed in response to the event and, if applicable, input data to be used when performing one of the operations in the set of operations 302.

[0068] Some functions 310 may include operations 302 that rely on calling one or more additional operations, which are included in the same function 310 or in other functions in the database system 100. For example, in the case where the function 310 involves managing the data and life cycle of a particular individual, one of the operations in the set of operations 302 may involve generating a prediction of one or more values ​​associated with the individual at a future point in time. In this case, generating the prediction may require one or more additional functions operating in the database system 100 to provide an output that is used to generate a prediction for the individual associated with the function 310. The function 310 can send an indication of an event representing a request for a specific output to one or more additional functions in the database system 100, which is then used by the one or more additional functions to identify and perform the corresponding operation. Upon completion, the output from this operation is returned to the function 310, allowing the function to complete its prediction.

[0069] As described above, an output from an operation within function 310 or from another function in database system 100 can be used as an event to cause function 310 to perform one or more additional operations. In this way, operation 302 and / or function 310 can be nested within database system 100, meaning that operation 302 can wait for the output of one or more additional operations to complete before completing. This allows complex operations (which might otherwise be implemented as multi-threaded programs) to be implemented in a linear fashion using a single thread in database system 100 instead, as will now be explained.

[0070] Function 310 and other functions 310A to 310D generated according to second data 304 may be configured to perform operations asynchronously, such as Figure 7 This means that functionality can be easily paused, updated, and redeployed. Figure 7In the example shown in, there are several active operations 702, 704 and 706, but only one operation is processed at any one time. For example, several events may occur in the database system 100, so that the function 310 starts to perform the corresponding operations 702, 704 and 706. In some cases, none of the corresponding operations 702, 704 and 706 can take precedence over other operations 702, 704 and 706, so the function 310 can process operations 702, 704 and 706 based on first-come-first-served, wherein the operation 702 corresponding to the first indication of the event received by the function 310 is first executed. While performing the first operation 702, other operations 704, 706 can be suspended. In some cases, the operation 704 will not be able to be completed until input from another operation is received or until specific data is available to the operation 704. In this case, the operation 704 can be suspended until input is received. While the operation 704 is suspended, the function 310 can continue to perform another active operation in the active operation 706. Using a single-threaded process in the database system 100 in this manner simplifies the implementation of the function 310 in the database system 100 and enables the database system 100 to cancel or suspend operations when the function 310 is redeployed or updated, while mitigating any potential errors that would otherwise affect the consistency and / or persistence of the value set 312.

[0071] Alternatively, performing operations 302 asynchronously may include having only one operation active at any one time and queuing additional operations to be activated when the current operation completes.

[0072] refer to Figure 8 , the function 310 can be implemented using a stack-based virtual machine 800, that is, the virtual machine uses interactions to process data that involve using push and pull operations to move short-term temporary values ​​to and from a push-down stack according to a last-in-first-out data structure. In this case, the method 200 can involve configuring the function 310 to create a stack 802 in response to obtaining an indication of the event 602, use the stack 802 to perform the operation 702, and delete the stack 802 in response to the operation 702 generating an output. In this way, each stack 802, 804, 806 can correspond to a respective operation 702, 704, 706 performed by the function 310.

[0073] Using stacks 802, 804, 806 to implement each operation 702, 704, 706 means that in the event that an operation 704 is paused, the corresponding stack 804 maintains the current state of the operation, thereby allowing the state to be easily restored from where the operation 704 stopped. Stacks 802, 804, 806 can also be implemented using contiguous memory blocks, thereby simplifying the read and write process when using the stack to process data. Thus, since the progress of operations 702 to 706 can be easily identified and copied from the stacks 802 to 806, the monitoring, pausing and redeployment functions 310 of actively performing operations 702 to 706 are simplified.

[0074] In some examples, function 310 may be implemented using a linear memory model. A linear memory model is a memory addressing technique in which memory is organized in a single continuous address space. This single continuous address space may be a physical storage space or may be implemented using virtual memory. Using a linear memory model to implement function 310 means that direct and linear access to memory locations is possible while processing operations in function 310. Using a linear memory model also enables database system 100 to easily identify and collect memory used to implement function 310, which is useful when migrating and updating function 310, as will be discussed below with respect to Figures 9 to 12 as described.

[0075] Go to Fig. 9 , the method 200 may include obtaining a request 902 to update the function definition 306. The request 902 may include third data 904 representing an update to be performed on the function definition 306. The update to be performed on the function definition 306 may include modifying the set of operations 302 in the function definition 306, such as adding a new operation, deleting an operation, and / or modifying an operation in the set of operations 302. Alternatively or in addition, the update may include modifying the state variable set 308, such as by adding a new state variable Var N+1 , deleting state variables and / or otherwise modifying state variables or data structures or patterns, defining relationships between sets of state variables 308.

[0076] The request 902 to update the function definition 306 may be provided by a user. For example, the user may update the program from which the function definition 306 is derived, and may upload the updated program to the database system 100 so that the database system 100 modifies the function definition 306 accordingly. Alternatively, the request to update 902 the function definition 306 may be automatically generated in the database system 100.

[0077] The second data 304 is then updated 906 based on the third data 904. That is, the second data 304 can be modified according to the update represented by the third data, which includes, for example, modifying the set of state variables 308, the set of one or more operations 302, and / or modifying metadata associated with the function definition 306. An updated function 910 is then generated 908 according to the updated second data 304. When the updated function 910 is generated, the updated function 910 can be pre-configured with a reference to the value set 312 associated with the original function 310. The updated function 910 can then be configured to operate on the value set 312 stored in the isolated computing environment 314.

[0078] In this way, a function 310 may be updated by creating a new updated function 910 and transferring control of the value set 312 to this updated function 910. This allows the function 310 to be updated seamlessly while reducing the amount of downtime that would otherwise occur if the function 310 had to be taken offline before being updated. After the updated function 910 is generated and configured to operate on the value set 312, the original function 310 may be directed to shut down and control of the value set 312 transferred to the updated function 910. The updated function 910 may be provided with an ID associated with and / or derived from the ID of the original function 310 so that a relationship with the original function 310 may be maintained in the metadata.

[0079] In the event that the updated function 910 is associated with an ID different from the original function 310, generating the updated function 910 may also involve updating metadata including the ID for the original function 310 by replacing the ID for the original function 310 with the ID associated with the updated function 910.

[0080] As mentioned above about Figure 3 As described above, the value set 312 may be stored in the state table 316. In the event that the value set 312 is stored in the state table 316 and the update includes modifying the state variables 308 associated with the function definition 306, generating the updated function 910 may involve modifying the state table 316. The state table 316 may be modified to account for the modifications made to the state variables 308 in the function definition 306. As described above, updating the state variables 308 may include adding state variables, removing state variables, and / or otherwise modifying the state variable set 308. Modifying the state table 316 may involve extending the state table 316 to account for additional values ​​corresponding to the additional state variables 308 in the updated function definition 306, deleting portions of the state table 316 to account for the removal of the state variables in the updated function definition 306, and / or otherwise modifying the data structure or mapping of the state table 316 to account for the changes made to the state variables 308.

[0081] Fig.10 An example of a procedure for updating a function 310 by generating an updated function 910 is shown, which is similar to the procedure described with respect to Fig. 9 Describe the process. Fig.10 In the example shown in , the generate updated function 910 includes generating an updated state table 1016 based on the modified state variables 308. Fig.10 In the example shown in FIG. 1 , the generated updated state table 1016 takes into account the additional state variable Var N+1 The update function 910 may be configured to transfer the value set 312 from the original state table 316 to the updated state table 1016, which now additionally includes the value Val N+1 .exist Fig.10 In the example shown in , the state table 1016 is stored in a new isolated computing environment 1014 corresponding to the updated function 910.

[0082] As mentioned above about Figure 8 As described, functions 310, 910 in the database system may be implemented using a stack-based virtual machine. If function 310 is to be updated while function 310 is performing operations 702 to 706, function 310 may be configured to handle this situation in one of a number of ways. Fig.11 In the example shown in , if operation 702 is being performed when updated function 910 is configured to operate on value set 312, function 310 can be configured to suspend operation 702. Data in stack 802 controlled by function 310 and used to perform operation 702 can be transferred to a new stack 1102 controlled by updated function 910. New stack 1102 controlled by updated function 910 can then be used to resume operation 702.

[0083] Alternatively, when the updated function 910 is configured to operate on the value set 312, the function 310 may be configured to monitor the operation 702. In this case, completing the configuration of the updated function 910 to operate on the value set 312 may be dependent on identifying the output from the operation 702. In this way, control of the value set 312 may only be fully handed over to the updated function 910 after the operation performed by the function 310 is completed. Waiting for the operation 702 to complete before handing over to the updated function 910 may simplify the procedures for the updated function 310, thereby mitigating the risk of errors and ensuring the persistence and consistency of the functions 310, 910, and the value set 312 across the database system 100.

[0084] When the updated functionality 910 is configured to operate on the value set 312 in the isolated computing environment 314, the functionality 310 in the database system 100 can be configured to treat some running operations 702 differently than other operations 704. For example, the functionality 310 can include rules for determining whether a particular operation 702 should be suspended, and the corresponding data transferred to the new stack 1102, whether a particular operation 702 should be left to complete, and / or whether such operation 702 should be canceled before completing the configuration of the updated functionality 910 to operate on the value set 312.

[0085] In some examples, database system 100 and / or functionality 310 may be configured to process ongoing operations 702 - 706 performed during an update procedure and determine whether each of ongoing operations 702 - 706 should be completed, canceled, or transferred to update functionality 910 .

[0086] As mentioned above about Figure 1 Briefly described, database system 100 can be implemented using cluster computers, where computing resources can be scaled up and down to suit demand. In such a device, it is possible to logically separate portions of computing resources from other computing resources and assign these resources to specific functions.

[0087] Fig.12 An example of implementing function 310 on a first computing resource set 1202 in database system 100 is shown. For example, function 310 can be implemented using a specific set of processors and / or storage devices in database system 100. Computing resource set 1202 can be a physical resource set reserved for implementing function 310. Alternatively, resource set 1202 can be virtualized to logically appear as a continuous resource set. In some examples, value set 312 and function 310 are implemented on computing resource set 1202, which is located in the same jurisdiction, that is, in the same country or in a location governed by the same laws. In jurisdictions where there are data protection laws governing the movement and storage of data related to citizens, implementing function 310 and value set 312 on computing resources 1202 in the same jurisdiction provides compliance with these laws.

[0088] The method 200 can include obtaining a request to migrate the function 310 from the first set of computing resources 1202 to a second, different set of computing resources 1204 .

[0089] The request to migrate the function 310 to the second computing resource in the computing resources 1204 can be triggered by any of a number of conditions, such as the first computing resource set 1202 not having sufficient capacity to effectively implement the function 310. This may occur when the first computing resource set 1202 is being used to implement multiple such functions and the function 310 is unsuccessfully competing for resources with these other functions. This may also occur when one or more of the set of operations 302 to be implemented by the function 310 requires a greater amount of processing power or storage than the amount of processing power or storage available in the first computing resource set 1202. The need to migrate the function 310 to the second computing resource set 1204 can be identified using the execution log 502, where there will be a record of the function 310 struggling to perform the operation by recording a large number of unfinished operations, errors, or high latency times for completing the operation in the execution log 502. In other examples, the need to migrate the function 310 can be determined based on a baseline comparison of the performance of the function 310 with one or more performance thresholds, which are related to, for example, latency, error rate, power consumption, etc.

[0090] Other conditions that may trigger a request to migrate the function 310 to the second set of resources 1202 are situations where one or more of the set of operations 302 to be performed by the function 310 require data stored in the second set of resources 1204. Implementing the function 310 on the same set of computing resources 1204 storing the related data may reduce latency when the function 310 performs the operation. In situations where one of the set of operations 302 implements a large number of reads and / or writes of data, even a small reduction in latency for each read operation and / or write operation may yield large gains in overall efficiency.

[0091] In some examples, there may be legal restrictions on the movement of data between jurisdictions. The data protection laws of some jurisdictions set forth restrictions on the movement of data related to citizens outside of those jurisdictions. Civil contracts may also be entered into between companies and / or individuals that restrict what can and cannot be done with an individual's data (including the movement of such data). In some examples, the first set of computing resources 1202 is in a first geographic location, and the second set of computing resources 120 is in a second geographic location different from the first geographic location. In this case, the geographic locations can involve separate physical computing devices that are located close to each other, such as in the same data warehouse, in separate physical computing devices located in different data centers or warehouses, or in different countries or jurisdictions.

[0092] In response to the request to migrate the function 310 to the second set of resources 1204, a new function 1206 may be generated based on the second data 304, the new function 1206 being implemented on the second set of computing resources 1204. The new function 1206 may be pre-configured with a reference to the value set 312. This reference may be a memory or storage address where the value set 312 is located in the first set of computing resources 1202, or, in the case where the value set 312 is stored in the state table 316, the reference may be a reference to the state table 316 and / or information required to search the state table 316 to identify or modify the value set 312 stored therein. In other examples, such as in the case where the isolated computing environment 314 is implemented as a virtual machine, the reference may be a virtual machine ID.

[0093] The method 200 may include configuring the new function 1206 to operate on the value set 312 in the isolated computing environment 314. This may involve providing a key to the new function 1206 and / or otherwise authorizing the second function 1206 to operate in the isolated computing environment 314. Fig.12 In the example shown in , method 200 may also include generating a new state table 1208 in the second computing resource set 1204, and the new function 1206 may migrate the value set 312 from the original state table 316 in the first resource set 1202 to the new state table 1208 in the second resource set 1204. In the example where the new function 1206 migrates the value set 312 to the second resource set 1204, an isolated computing environment 1210 may be established in the second computing resource set 1204 to store the value set 312. A new execution log 1212 may also be implemented in the second resource set 1204 to record operations performed by the new function 1206. Alternatively, the new function 1206 may use the same execution log 502 as the original function 310. Although the execution logs 502 and 1212 are in Fig.12 1204, but it should be understood that in other examples, the execution logs 502 and 1212 can be stored in the first computing resource set 1202 and the second computing resource set 1204, respectively. For example, the execution log 502 can be stored in a computing resource set separate from the first computing resource set or the second computing resource set, and can be used to record data indicating events and operations related to multiple different functions including the functions 310 and 1206.

[0094] Fig.13A non-transitory computer-readable storage medium 1302 is shown that includes computer-executable instructions 1304A to 1304C that, when executed by one or more processors 1306, cause the one or more processors 1306 to perform the method 200. The first instruction block 1304A, when executed, causes the processor 1306 to obtain first data 300 representing a set of one or more operations 302 to be performed on data in a database managed by the database system 100. The second instruction block 1304B, when executed, causes the processor 1306 to derive second data 304 from the first data 300, the second data 304 representing a function definition for implementation in the database system 100, for simplicity, Fig.12 The function definition is not shown in the figure. The function definition includes a set of operations and one or more state variable sets. The third instruction block 1304C, when executed, causes the processor 1306 to generate a function 310 according to the second data 304, wherein generating the function 310 includes storing one or more value sets 312 for corresponding state variables in the state variables. The value set 312 is stored in an isolated computing environment 314 in the database system 100, and the function 310 is configured to operate on the value set in the isolated computing environment 314.

[0095] The above examples should be understood as illustrative. It should be understood that any feature described with respect to any example can be used alone or in combination with other features described, and can also be used in combination with one or more features of any other example, or in combination with any combination of any other example. In addition, equivalents and modifications not described above can also be used.

Claims

1. A computer-implemented method for managing functions in a database system, the method comprising: include: Obtaining first data representing a set of one or more operations to be performed on data in a database managed by a database system; deriving second data from the first data, the second data representing a function definition for implementation in the database system, wherein the function definition includes a set of the operations and a set of one or more state variables; and generating a function based on the second data, wherein generating the function comprises storing one or more value sets for respective ones of the state variables, The value set is stored in an isolated computing environment in the database system, and the function is configured to operate on the value set in the isolated computing environment.

2. The computer-implemented method of claim 1, in, The functionality comprises a set of the operations, and wherein at least one of the operations is configured to update one or more values ​​in the set of values.

3. A computer-implemented method according to claim 1 or claim 2, in, The computer-implemented method comprises storing an execution log comprising data indicative of operations that have been performed by the function, and wherein the function is configured to write the data indicative of operations performed by the function to the execution log.

4. A computer-implemented method according to any preceding claim, in, Each operation in a set of the operations is associated with an event, and wherein the computer-implemented method comprises configuring the functionality to: Get an indication of the event; and At least one associated operation is performed in response to the indication, wherein upon completion, the operation generates an output.

5. The computer-implemented method of claim 4, in, The events include any one or more of the following: Input from the user; instructions from one or more further functions operating in said database system; output from one or more further functions operating in the database system; or The output from the operations performed by the function.

6. The computer-implemented method of claim 4, in, The functionality is implemented using a stack-based virtual machine, and wherein the computer-implemented method comprises configuring the functionality to: creating a stack in response to obtaining the indication of the event, wherein performing the at least one associated operation comprises performing the associated operation using the stack; and The stack is deleted in response to an operation generating the output.

7. A computer-implemented method according to any preceding claim, in, The functionality is configured to perform operations asynchronously.

8. A computer-implemented method according to any preceding claim, in, The set of values ​​is stored in a state table, and wherein one or more further functions are configured to query the state table to read one or more values ​​stored in the state table.

9. A computer-implemented method according to any preceding claim, in, The set of values ​​and the function are implemented on a set of computing resources located in the same jurisdiction.

10. A computer-implemented method according to any preceding claim, in, The described functionality is implemented using a linear memory model.

11. A computer-implemented method according to any preceding claim, in, The functionality is a first functionality, and wherein the computer-implemented method comprises: obtaining a request to update the function definition, the request comprising third data representing an update to be performed on the function definition; updating the second data based on the third data; generating a second function according to the updated second data, wherein generating the second function comprises pre-pairing a reference to the value set associated with the first function to the second function; and The second function is configured to operate on the set of values ​​in the isolated computing environment.

12. The computer-implemented method of claim 11, in, The value set is stored in a state table, the updating comprises modifying the state variable associated with the function definition, and wherein generating the second function comprises modifying the state table, storing values ​​in the state table according to the modified state variable.

13. A computer-implemented method according to claim 11 or claim 12, in, The value set is stored in a first state table, the updating comprises modifying the state variables associated with the function definition, and wherein generating the second function comprises generating a second state table based on the modified state variables, the second function being configured to transfer the value set from the first state table to the second state table.

14. A computer-implemented method according to any one of claims 11 to 13, in, The first function and the second function are implemented using respective stack-based virtual machines, each operation is implemented using a stack, and wherein if the operation is being performed when the second function is configured to operate on the value set, the first function is configured to: suspending the operation; and Data in a first stack controlled by the first function and used to perform the operation is transferred to a second stack controlled by the second function.

15. A computer-implemented method according to any one of claims 11 to 14, in, The first function and the second function are implemented using respective stack-based virtual machines, each operation is implemented using a stack, and wherein, if the operation is being performed when the second function is configured to operate on the value set, the first function is configured to: monitor the operation to identify an output from the operation, wherein completing the configuring of the second function to operate on the value set is dependent on the first function identifying an output from the operation in the monitoring.

16. A computer-implemented method according to any preceding claim, in, The function is a first function, the database system includes a first set of computing resources on which the first function is implemented and a second set of computing resources different from the first set of computing resources, and wherein the computer-implemented method includes: Obtaining a request to migrate the first function from the first set of computing resources to the second set of computing resources; generating a second function based on the second data, the second function being implemented on the second set of computing resources, wherein generating the second function comprises pre-pairing a reference to the set of values ​​associated with the first function to the second function; and The second function is configured to operate on the set of values ​​in the isolated computing environment.

17. The computer-implemented method of claim 16, in, The value set is stored in a first state table, generating the second function includes generating a second state table, and the second function is configured to migrate the value set from the first state table to the second state table.

18. A computer implemented method according to claim 16 or claim 17, in, The first set of computing resources is in a first geographic location, and the second set of computing resources is in a second geographic location different from the first geographic location.

19. A database system for implementing one or more functions, wherein the one or more functions are configured to operate on data stored in the database system, wherein the database system include: one or more processors; as well as a storage device comprising computer executable instructions that, when executed by the one or more processors, cause the database system to: Obtaining first data representing a set of one or more operations to be performed on data in a database managed by a database system; deriving second data from the first data, the second data representing a function definition for implementation in the database system, wherein the function definition includes a set of the operations and a set of one or more state variables; and generating a function based on the second data, wherein generating the function comprises storing one or more value sets for respective ones of the state variables, The value set is stored in an isolated computing environment in the database system, and the function is configured to operate on the value set in the isolated computing environment.

20. A non-transitory computer-readable storage medium comprising computer-executable instructions that, when executed by one or more processors, cause the one or more processors to: Obtaining first data representing a set of one or more operations to be performed on data in a database managed by a database system; deriving second data from the first data, the second data representing a function definition for implementation in the database system, in, The functional definition includes a set of the operations and a set of one or more state variables; and generating a function based on the second data, wherein generating the function comprises storing one or more value sets for respective ones of the state variables, The value set is stored in an isolated computing environment in the database system, and the function is configured to operate on the value set in the isolated computing environment.