Data query method, device and storage medium in cloud environment
By marking intermediate dirty tables in the SQLite database and modifying the data, the problem of excessive database access in cloud computing and cloud containers is solved, enabling timely data updates and system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2023-06-29
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, cloud computing and cloud containers experience excessive database access connections and high network pressure when accessing databases, leading to increased network overhead and the inability to update data in a timely manner, resulting in access errors.
By obtaining modification instructions from the SQLite database, intermediate data tables are marked as intermediate dirty tables, and data is modified according to the modification type, updating the data in a timely manner; when the target data is detected in an intermediate dirty table, the container's access request is denied until the data modification is completed.
With a large number of containers, excessive database access connections and data access errors are avoided, improving system stability and data consistency.
Smart Images

Figure CN116842084B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a data query method, device, and storage medium in a cloud environment. Background Technology
[0002] Cloud computing and cloud containers are increasingly being used by modern enterprises, enabling computing tasks to be broken down into multiple containers. At the same time, as the number and requirements of computing tasks increase, the demand for accessing data in databases also increases.
[0003] In existing technologies, database access and processing are typically achieved through a single connection. However, with the increasing number of cloud computing and cloud container applications, each application needs to access the database individually to read data. Furthermore, when the database data is modified or updated, cloud computing and cloud container applications cannot read the updated data in a timely manner, which may lead to increased network overhead due to excessive database access connections and high network pressure.
[0004] Existing technologies still fall short in addressing the issues of excessive database access connections and increased network overhead due to high network pressure. Summary of the Invention
[0005] This application provides a data query method, device, and storage medium in a cloud environment to address the shortcomings of existing technologies in terms of excessive database access connections and high network pressure, which leads to increased network overhead.
[0006] Firstly, this application provides a data query method in a cloud environment, including:
[0007] The system obtains modification instructions sent by the database, the modification instructions include modification type and modification content identifier, retrieves the corresponding intermediate data table in the SQLite database according to the modification content identifier, marks the corresponding intermediate data table as an intermediate dirty table, and modifies the data of the intermediate dirty table according to the modification type. The SQLite database is used to provide data query for multiple containers in the physical host.
[0008] Obtain an access request for the container. The access request includes at least one target data and a corresponding request data identifier. The request data identifier is used to indicate the intermediate data table where the target data is located. Detect whether the intermediate data table where the target data is located is an intermediate dirty table based on the request data identifier.
[0009] If the intermediate data table containing the target data is not the intermediate dirty table, then the intermediate data table containing the target data in the SQLite database is confirmed as the target data table so that the container can access the data.
[0010] In one possible design, if no modification instruction is received from the database, the process includes: searching the SQLite database for a retrieval identifier that is the same as the requested data identifier; identifying the intermediate data table where the target data is located based on the retrieval identifier; and using the intermediate data table where the target data is located as the target data table. The retrieval identifier is stored in the SQLite database in association with the intermediate table information, and the intermediate table information is used to indicate the corresponding intermediate data table.
[0011] In one possible design, if the intermediate data table containing the target data is the intermediate dirty table, then the intermediate dirty table is not identified as the target data table, and the container does not perform any access operations on the intermediate dirty table.
[0012] In one possible design, the number of target data tables is obtained. If the number of target data tables is equal to the number of target data in the access request, the container performs an access operation based on at least one target data table. If the number of target data tables is less than the number of target data in the access request, it is confirmed that the container cannot perform an access operation until the intermediate dirty table mark in the access request is removed, so that the number of target data tables is equal to the number of target data in the access request.
[0013] In one possible design, canceling the intermediate dirty table mark in the access request includes: obtaining a modification completion signal sent by the database, the modification completion signal including at least one modification completion identifier; obtaining the modified intermediate data table in the SQLite database according to the modification completion identifier; canceling the intermediate dirty table mark of the modified intermediate data table; if the number of target data tables is equal to the number of target data in the access request after canceling the intermediate dirty table mark of the modified intermediate data table, then confirming that the container performs an access operation based on the target data table.
[0014] In one possible design, a shared disk space is allocated on the physical host, and multiple containers on the physical host contain the shared disk space. The SQLite database is set in the shared disk space so that the multiple containers on the physical host can access the data content of the modified intermediate data tables in the SQLite database.
[0015] In one possible design, the modification types include inserting data, updating data, and deleting data, wherein the inserting data is used to indicate adding a new data type or new data information to the intermediate dirty table, the updating data is used to indicate replacing the original data type or data information in the intermediate dirty table with the new data type or data information, and the deleting data is used to indicate deleting the original data type or data information in the intermediate dirty table.
[0016] Secondly, this application provides a data query device in a cloud environment, comprising:
[0017] The acquisition module is used to acquire modification instructions sent by the database. The modification instructions include modification type and modification content identifier. Based on the modification content identifier, the module acquires the corresponding intermediate data table in the SQLite database and marks the corresponding intermediate data table as an intermediate dirty table. Based on the modification type, the module modifies the data in the intermediate dirty table. The SQLite database is used to provide data query for multiple containers in the physical host.
[0018] The processing module is used to obtain the access request of the container. The access request includes at least one target data and a corresponding request data identifier. The request data identifier is used to indicate the intermediate data table where the target data is located. The module detects whether the intermediate data table where the target data is located is an intermediate dirty table based on the request data identifier.
[0019] The execution module is configured to, if the intermediate data table containing the target data is not the intermediate dirty table, confirm the intermediate data table containing the target data in the SQLite database as the target data table so that the container can access the operation.
[0020] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0021] The memory stores computer-executed instructions;
[0022] The processor executes computer execution instructions stored in the memory to implement a data query method in a cloud environment.
[0023] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement a data query method in a cloud environment.
[0024] The data query method, device, and storage medium provided in this application for a cloud environment obtain the modification type and modification content identifier from the modification instructions sent by the physical database, retrieve the corresponding intermediate data table in the SQLite database, mark the corresponding intermediate data table as an intermediate dirty table, and modify the data in the intermediate dirty table according to the modification type, thereby updating the data in SQLite in a timely manner. When an access request sent by a container, including the target data and the corresponding request data identifier, is received, if it is detected that the intermediate data table where the target data is located is an intermediate dirty table, the access request sent by the container cannot be responded to until the data in the intermediate dirty table is modified. Thus, when there are a large number of container requests and when the data in the database is modified, excessive database access connections and data access errors are avoided, thereby improving the stability of the system. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 System architecture diagram provided for embodiments of this application;
[0027] Figure 2 A flowchart illustrating the data query method in a cloud environment provided in this application embodiment. Figure 1 ;
[0028] Figure 3 A flowchart illustrating the data query method in a cloud environment provided in this application embodiment. Figure 2 ;
[0029] Figure 4 This is a schematic diagram of the structure of a data query device in a cloud environment provided in an embodiment of this application;
[0030] Figure 5 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0031] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0032] SQLite, as a lightweight database, can create data files as a simple disk file and use SQL statements to query the disk file. Because SQLite only has a single data file, it consumes very little space resources, yet can support large-volume data files. However, SQLite does not update data frequently; data updates are generally performed by creating a new text file.
[0033] As a collection of processes, a container isolates other system resources and has its own independent resource view. Multiple containers can be started on a single physical host to access SQLite or other physical databases. Multiple physical machines can be combined to form a resource cloud and provide cloud containers to the outside world. Therefore, a cloud container is essentially a collection of processes with isolated views, limited resources, and an independent file system.
[0034] As application scenarios become increasingly refined, the number and requirements for computing tasks are also constantly increasing. This necessitates breaking down computing tasks into multiple containers for processing. When these containers process data, they need to access and retrieve data from the database. Current technologies typically involve a single database connection for data access and processing, with each container or application requiring individual database access. When there are many containers or applications needing data access, this generally requires a large number of database connections and network bandwidth. Multiple containers and corresponding SQLite instances are configured on each physical host to prevent errors or program crashes in containers or applications due to unexpected situations such as network fluctuations or database connection limits. However, when data in the database is modified, the SQLite data cannot be updated promptly, leading to data errors accessed by the containers. Therefore, current technologies, especially with a large number of containers or applications and when database data is modified, may cause excessive database access connections and data access errors.
[0035] This application provides a data query method in a cloud environment, such as Figure 1As shown, SQLite is configured between multiple containers and the database (i.e., the physical database) for the corresponding containers to access. The physical database exchanges data with multiple corresponding physical hosts. By obtaining the modification type and modification content identifier from the modification instructions sent by the physical database, the corresponding intermediate data table is retrieved from the SQLite database and marked as an intermediate dirty table. Data in the intermediate dirty table is modified according to the modification type, thereby updating the data in SQLite in a timely manner. When an access request from a container, including the target data and the corresponding request data identifier, is received, if the request data identifier indicates that the intermediate data table containing the target data is an intermediate dirty table, the access request from the container cannot be responded to until the data in the intermediate dirty table is modified. This avoids excessive database access connections and data access errors, even when there are many container requests and when data in the database is modified, thus improving the stability of the system.
[0036] The technical solutions of this application and how they solve the aforementioned technical problems are described in detail below using specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0037] Example 1
[0038] Figure 2 A schematic flowchart of a data query method in a cloud environment provided in this application embodiment. Figure 1 .like Figure 2 As shown, the method includes:
[0039] S201. Obtain the modification instruction sent by the database. The modification instruction includes a modification type and a modification content identifier. Obtain the corresponding intermediate data table in the SQLite database according to the modification content identifier and mark the corresponding intermediate data table as an intermediate dirty table. Modify the data of the intermediate dirty table according to the modification type. The SQLite database is used to provide data query for multiple containers in the physical host.
[0040] Specifically, when data in the physical database is modified, a modification instruction including the modification type and modification content identifier is sent to the corresponding physical host to update the data in the SQLite database on the physical host. The SQLite database serves as an intermediate database on the physical host to store the data in the physical database. When a container on the physical host needs to access data, it uses the SQLite database on the local physical host instead of the physical database on the network, thereby improving read and write efficiency while reducing the network overhead of the physical host.
[0041] S202. Obtain the access request of the container. The access request includes at least one target data and a corresponding request data identifier. The request data identifier is used to indicate the intermediate data table where the target data is located. Detect whether the intermediate data table where the target data is located is an intermediate dirty table based on the request data identifier.
[0042] Specifically, when an access request is received from a container on a physical host, the system checks whether the data in the physical database has been modified, i.e., whether a modification instruction has been received from the physical database. If the data in the physical database has not been modified, the system finds the corresponding intermediate data table based on the target data and the corresponding request data identifier in the access request, and confirms that the container on the physical host can access the data in the corresponding intermediate data table. If the data in the physical database has been modified, and if it is confirmed that the corresponding intermediate data table found based on the target data and the corresponding request data identifier is a dirty intermediate table, then it is confirmed that the container on the physical host cannot access the data in the corresponding intermediate data table.
[0043] S203. If the intermediate data table where the target data is located is not the intermediate dirty table, then the intermediate data table where the target data is located in the SQLite database is confirmed as the target data table so that the container can access the operation.
[0044] Specifically, once it is confirmed that the data in the physical database has been modified, that is, after obtaining the modification instruction issued by the physical database, if it is confirmed that the corresponding intermediate data table found based on the target data and the corresponding request data identifier is not a dirty intermediate table, then it is confirmed that the container in the physical host can access the data in the corresponding intermediate data table, and the corresponding intermediate data table in the SQLite database is confirmed as the target data table, so that the corresponding container that issued the access request can perform access operations.
[0045] This application provides a data query method in a cloud environment. By obtaining the modification type and modification content identifier in the modification instruction, the corresponding intermediate data table is retrieved from the SQLite database, and the corresponding intermediate data table is marked as an intermediate dirty table. The data in the intermediate dirty table is modified according to the modification type, thereby updating the data in SQLite in a timely manner. When an access request sent by the container, including the target data and the corresponding request data identifier, is received, if the request data identifier indicates that the intermediate data table containing the target data is an intermediate dirty table, the access request sent by the container cannot be responded to until the data in the intermediate dirty table is modified. Thus, when there are a large number of container requests and when the data in the database is modified, excessive database access connections and data access errors are avoided, improving the stability of the system.
[0046] The following specific embodiment will be used to describe in detail the data query method in the cloud environment of this application.
[0047] Example 2
[0048] Figure 3 A schematic flowchart of a data query method in a cloud environment provided in this application embodiment. Figure 2 .like Figure 3 As shown, the method includes:
[0049] S301. Obtain the access request of the container, wherein the access request includes at least one target data and a corresponding request data identifier;
[0050] Specifically, when a container in a physical host requests access to multiple target data, these multiple target data may involve multiple different intermediate data tables. Therefore, the corresponding intermediate data table where each target data is located can be obtained by accessing the request data identifier in the request.
[0051] S302. If no modification instruction is received from the database, search for a search identifier in the SQLite database that is the same as the requested data identifier.
[0052] Specifically, when the data in the physical database has not been modified, that is, when the physical host has not received the modification instruction sent by the physical database, the system searches the SQLite database for a retrieval identifier that is the same as the requested data identifier. If a retrieval identifier that is the same as the requested data identifier is found, it is confirmed that the container in the physical host can access the data in the corresponding intermediate data table. If a retrieval identifier that is the same as the requested data identifier is not found, a prompt message is returned to remind the client associated with the physical database to update or modify the data.
[0053] S303. Based on the retrieval identifier, confirm the intermediate data table where the target data is located, and use the intermediate data table where the target data is located as the target data table;
[0054] Specifically, the system searches the SQLite database for a retrieval identifier that matches the requested data identifier. Based on the target data in the access request and the corresponding request data identifier, it locates the corresponding intermediate data table. In other words, the intermediate data table containing the target data is used as the target data table. The retrieval identifier and intermediate table information are associated and stored in the SQLite database, and the intermediate table information is used to indicate the corresponding intermediate data table.
[0055] S304. Obtain the modification instruction sent by the database, wherein the modification instruction includes a modification type and a modification content identifier;
[0056] Specifically, when data in the physical database is modified, that is, when the physical host receives a modification instruction sent by the physical database including the modification type and modification content identifier, the intermediate data table that needs to be modified is determined according to the modification content identifier, and the data in the intermediate data table that needs to be modified is modified according to the modification type. The modification types include inserting data, updating data, and deleting data.
[0057] Furthermore, inserting data indicates adding a new data type or new data information to the intermediate data table that needs to be modified; updating data indicates replacing the original data type or data information with the new data type or data information in the intermediate data table that needs to be modified; and deleting data indicates deleting the original data type or data information in the intermediate data table that needs to be modified.
[0058] S305. Obtain the corresponding intermediate data table in the SQLite database according to the modified content identifier, and mark the corresponding intermediate data table as an intermediate dirty table;
[0059] Specifically, after receiving the modification instruction sent by the physical database, which includes the modification type and the modification content identifier, the system searches for a retrieval identifier in the SQLite database that is the same as the modification content identifier. Based on the intermediate table information associated with the retrieval identifier that is the same as the modification content identifier, the system obtains the corresponding intermediate data table in the SQLite database and marks the obtained intermediate data table as an intermediate dirty table.
[0060] S306. Modify the data of the intermediate dirty table according to the modification type, wherein the SQLite database is used to provide data query for multiple containers in the physical host;
[0061] Specifically, after marking the corresponding intermediate data table as an intermediate dirty table in the SQLite database according to the modification content identifier, the data in the intermediate dirty table is modified and updated according to the modification type: inserting data, updating data, or deleting data. The SQLite database is set up in a shared disk space on the physical host, and multiple containers on the physical host are included in the shared disk space, so that the data content of the intermediate data table modified in the SQLite database can be accessed by multiple containers on the physical host.
[0062] S307. Detect whether the intermediate data table where the target data is located is a dirty intermediate table based on the requested data identifier;
[0063] Specifically, when modifying intermediate dirty tables in the SQLite database according to the modification type and modification content identifier, the access request issued by the container in the physical host is obtained. The corresponding intermediate data table where the target data is located is obtained through the request data identifier in the access request. If the request data identifier and the modification content identifier in the SQLite database point to the same retrieval identifier, it is confirmed that the intermediate data table where the target data is located is an intermediate dirty table; otherwise, it is confirmed that the intermediate data table where the target data is located is not an intermediate dirty table.
[0064] S308. If the intermediate data table where the target data is located is not the intermediate dirty table, then the intermediate data table where the target data is located in the SQLite database is confirmed as the target data table so that the container can access the operation.
[0065] Specifically, after obtaining the modification instructions issued by the physical database and the access requests issued by the container in the physical host, if the request data identifier and the modification content identifier in the access request do not point to the same retrieval identifier, it is confirmed that the intermediate data table where the target data is located is not an intermediate dirty table. At this time, the intermediate data table where the target data is located is confirmed as the target data table that the container can access.
[0066] S309. If the intermediate data table where the target data is located is the intermediate dirty table, then the intermediate dirty table is not identified as the target data table, and the container does not perform access operations on the intermediate dirty table.
[0067] Specifically, after receiving the modification instructions from the physical database and the access request from the container in the physical host, the request data identifier and the modification content identifier point to the same retrieval identifier, confirming that the intermediate data table where the target data is located is an intermediate dirty table. At this time, the container in the physical host cannot access the intermediate data table where the target data is located, i.e., the intermediate dirty table, until the data in the intermediate dirty table is modified and the intermediate dirty table identifier is canceled. Only then can the container access the intermediate data table where the target data is located.
[0068] S310. Obtain the number of target data tables. If the number of target data tables is equal to the number of target data in the access request, then the container performs an access operation based on at least one target data table.
[0069] Specifically, when a container in a physical host requests to access multiple target data, and after confirming the intermediate data table obtained according to the request data identifier corresponding to each target data as the target data table, the number of target data tables is compared with the number of target data in the access request. If it is detected that the number of target data tables is equal to the number of target data in the access request, it is confirmed that the multiple intermediate data tables corresponding to the multiple target data in the access request have not been modified, and the container can access and operate on the data of at least one of the target data tables.
[0070] S311. If the number of target data tables is less than the number of target data in the access request, then it is confirmed that the container cannot perform an access operation until the intermediate table mark in the access request is canceled, so that the number of target data tables is equal to the number of target data in the access request.
[0071] Specifically, the number of target data tables is compared with the number of target data in the access request. If the number of target data tables is less than the number of target data in the access request, it is confirmed that there are intermediate dirty tables in the multiple intermediate data tables corresponding to the multiple target data in the access request. That is, the multiple intermediate data tables corresponding to the multiple target data have been modified. At this time, it is confirmed that the access request issued by the container in the physical host cannot be responded to.
[0072] Furthermore, when a modification completion signal including at least one modification completion identifier is received from the database, the intermediate data table that has been modified is retrieved from the SQLite database according to the modification completion identifier, and the intermediate dirty table mark of the intermediate data table that has been modified is removed. If the number of target data tables is equal to the number of target data in the access request after removing the intermediate dirty table mark of the intermediate data table that has been modified, then the container is confirmed to perform the access operation based on the target data table.
[0073] This application provides a data query method in a cloud environment. By obtaining the modification type and modification content identifier in the modification instruction, the corresponding intermediate data table is retrieved from the SQLite database, and the corresponding intermediate data table is marked as an intermediate dirty table. The data in the intermediate dirty table is modified according to the modification type, thereby updating the data in SQLite in a timely manner. When an access request sent by the container, including the target data and the corresponding request data identifier, is received, if the request data identifier indicates that the intermediate data table containing the target data is an intermediate dirty table, the access request sent by the container cannot be responded to until the data in the intermediate dirty table is modified. Thus, when there are a large number of container requests and when the data in the database is modified, excessive database access connections and data access errors are avoided, improving the stability of the system.
[0074] In this embodiment of the invention, electronic devices or main control devices can be divided into functional modules according to the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional module. It should be noted that the module division in this embodiment of the invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0075] Figure 4 This is a schematic diagram of the structure of a data query device in a cloud environment provided in an embodiment of this application. Figure 4 As shown, the device 40 includes:
[0076] The acquisition module 401 is used to acquire modification instructions sent by the database. The modification instructions include modification type and modification content identifier. Based on the modification content identifier, the corresponding intermediate data table is acquired in the SQLite database and marked as an intermediate dirty table. Data is modified in the intermediate dirty table according to the modification type. The SQLite database is used to provide data query for multiple containers in the physical host.
[0077] Processing module 402 is used to obtain an access request for a container. The access request includes at least one target data and a corresponding request data identifier. The request data identifier is used to indicate the intermediate data table where the target data is located. Based on the request data identifier, it is detected whether the intermediate data table where the target data is located is an intermediate dirty table.
[0078] The execution module 403 is configured to, if the intermediate data table containing the target data is not the intermediate dirty table, confirm the intermediate data table containing the target data in the SQLite database as the target data table so that the container can access the operation.
[0079] Furthermore, the acquisition module 401 is specifically used to, if no modification instruction sent by the database is acquired, search for a retrieval identifier in the SQLite database that is the same as the requested data identifier, confirm the intermediate data table where the target data is located based on the retrieval identifier, and use the intermediate data table where the target data is located as the target data table. The retrieval identifier is stored in the SQLite database in association with the intermediate table information, and the intermediate table information is used to indicate the corresponding intermediate data table.
[0080] Furthermore, the execution module 403 is specifically configured to, if the intermediate data table where the target data is located is the intermediate dirty table, not to identify the intermediate dirty table as the target data table, and the container not to perform access operations on the intermediate dirty table.
[0081] Furthermore, the execution module 403 is specifically used to obtain the number of target data tables. If the number of target data tables is equal to the number of target data in the access request, the container performs an access operation based on at least one target data table. If the number of target data tables is less than the number of target data in the access request, it is confirmed that the container cannot perform an access operation until the intermediate table marker in the access request is canceled, so that the number of target data tables is equal to the number of target data in the access request.
[0082] Furthermore, the execution module 403 is specifically used to obtain a modification completion signal sent by the database. The modification completion signal includes at least one modification completion identifier. Based on the modification completion identifier, the module obtains the intermediate data table that has been modified in the SQLite database and cancels the intermediate dirty table mark of the intermediate data table that has been modified. If, after canceling the intermediate dirty table mark of the intermediate data table that has been modified, the number of target data tables is equal to the number of target data in the access request, then the module confirms that the container performs an access operation based on the target data table.
[0083] Furthermore, the acquisition module 401 is also used to create a shared disk space in the physical host, and to enable multiple containers in the physical host to contain the shared disk space, with the SQLite database set in the shared disk space, so that the multiple containers in the physical host can access the data content of the modified intermediate data table in the SQLite database.
[0084] Furthermore, the acquisition module 401 is used to indicate that the modification type includes inserting data, updating data, and deleting data. The inserting data is used to indicate adding a new data type or new data information to the intermediate dirty table. The updating data is used to indicate replacing the original data type or data information in the intermediate dirty table with the new data type or data information. The deleting data is used to indicate deleting the original data type or data information in the intermediate dirty table.
[0085] The electronic device provided in this embodiment can execute the data query method in the cloud environment described in the above embodiment. Its implementation principle and technical effect are similar, and will not be described again in this embodiment.
[0086] In the specific implementation of the aforementioned data query method device in a cloud environment, each module can be implemented as a processor. The processor can execute computer execution instructions stored in the memory, thereby enabling the processor to execute the aforementioned data query method in a cloud environment.
[0087] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 50 includes at least one processor 501 and a memory 502. The electronic device 50 also includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus 504.
[0088] In the specific implementation process, at least one processor 501 executes the computer execution instructions stored in the memory 502, causing at least one processor 501 to execute the data query method in the cloud environment as executed on the electronic device side.
[0089] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0090] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0091] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.
[0092] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0093] The above description of the functions implemented by electronic devices and main control devices has introduced the solutions provided by the embodiments of the present invention. It is understood that, in order to implement the above functions, the electronic device or main control device includes hardware structures and / or software modules corresponding to the execution of each function. By combining the units and algorithm steps of the various examples described in the embodiments of the present invention, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of the embodiments of the present invention.
[0094] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the data query method in the cloud environment described above.
[0095] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0096] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in an electronic device or a host device.
[0097] This application also provides a computer program product, comprising: a computer program stored in a readable storage medium, wherein at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the electronic device to perform the scheme provided in any of the above embodiments.
[0098] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data query method in a cloud environment, the method comprising: The system receives modification instructions from the database, which include a modification type and a modification content identifier. Based on the modification content identifier, it retrieves the corresponding intermediate data table from the SQLite database and marks it as an intermediate dirty table. The system then modifies the data in the intermediate dirty table according to the modification type. The SQLite database is used to provide data queries for multiple containers on a physical host. The modification types include inserting data, updating data, and deleting data. Inserting data indicates adding a new data type or new data information to the intermediate dirty table; updating data indicates replacing the existing data type or data information in the intermediate dirty table with a new data type or data information; and deleting data indicates deleting the existing data type or data information from the intermediate dirty table. Obtain the container access request, the access request includes at least one target data and a corresponding request data identifier, the request data identifier is used to indicate the intermediate data table where the target data is located, and detect whether the intermediate data table where the target data is located is an intermediate dirty table based on the request data identifier; If the intermediate data table containing the target data is not the intermediate dirty table, then the intermediate data table containing the target data in the SQLite database is confirmed as the target data table so that the container can access the operation; A shared disk space is allocated in the physical host, and multiple containers in the physical host contain the shared disk space. The SQLite database is set in the shared disk space so that the multiple containers in the physical host can access the data content of the intermediate data table that has been modified in the SQLite database.
2. The data query method in a cloud environment according to claim 1, characterized in that, If no modification instruction is received from the database, the method includes: The system searches for a retrieval identifier in the SQLite database that is identical to the requested data identifier. Based on the retrieval identifier, it identifies the intermediate data table where the target data is located and uses the intermediate data table as the target data table. The retrieval identifier and intermediate table information are stored together in the SQLite database, and the intermediate table information is used to indicate the corresponding intermediate data table.
3. The data query method in a cloud environment according to claim 1, characterized in that, The method includes: if the intermediate data table where the target data is located is the intermediate dirty table, then the intermediate dirty table is not identified as the target data table, and the container does not perform access operations on the intermediate dirty table.
4. The data query method in a cloud environment according to claim 1, characterized in that, The number of target data tables is obtained. If the number of target data tables is equal to the number of target data in the access request, the container performs an access operation based on at least one target data table. If the number of target data tables is less than the number of target data in the access request, then the container is confirmed to be unable to perform an access operation until the intermediate dirty table mark in the access request is removed, so that the number of target data tables is equal to the number of target data in the access request.
5. The data query method in a cloud environment according to claim 4, characterized in that, The method of removing the intermediate table marker in the access request further includes: Obtain the modification completion signal sent by the database, the modification completion signal including at least one modification completion identifier, obtain the intermediate data table that has been modified in the SQLite database according to the modification completion identifier, and cancel the intermediate dirty table mark of the intermediate data table that has been modified. If, after removing the intermediate dirty table marker from the modified intermediate data table, the number of target data tables equals the number of target data tables in the access request, then the container is confirmed to perform an access operation based on the target data tables.
6. A data query device in a cloud environment, characterized in that, include: The acquisition module is used to acquire modification instructions sent by the database. The modification instructions include a modification type and a modification content identifier. Based on the modification content identifier, the module acquires the corresponding intermediate data table in the SQLite database and marks the corresponding intermediate data table as an intermediate dirty table. The module then modifies the data in the intermediate dirty table according to the modification type. The SQLite database is used to provide data queries for multiple containers on a physical host. The acquisition module is also used to indicate that the modification type includes inserting data, updating data, and deleting data. Inserting data indicates adding a new data type or new data information to the intermediate dirty table; updating data indicates replacing the existing data type or data information in the intermediate dirty table with a new data type or data information; and deleting data indicates deleting the existing data type or data information from the intermediate dirty table. The processing module is used to obtain the access request of the container. The access request includes at least one target data and a corresponding request data identifier. The request data identifier is used to indicate the intermediate data table where the target data is located. The module detects whether the intermediate data table where the target data is located is an intermediate dirty table based on the request data identifier. An execution module is configured to, if the intermediate data table containing the target data is not the intermediate dirty table, confirm the intermediate data table containing the target data in the SQLite database as the target data table so that the container can access the operation. The acquisition module is further configured to allocate a shared disk space in the physical host, and to enable multiple containers in the physical host to contain the shared disk space. The SQLite database is set in the shared disk space so that the multiple containers in the physical host can access the data content of the modified intermediate data table in the SQLite database.
7. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data access method, device, computer equipment and storage medium
CN110716947A