Business data processing method and device, electronic device and storage medium

By writing data according to business attributes and adopting the strategy of writing aliases and rolling to create new indexes, the unreasonable problem of index management based on time granularity in cleaning business data is solved, and more efficient data management and query performance are achieved.

CN112925783BActive Publication Date: 2025-01-21BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110327832.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-26
Publication Date
2025-01-21
Estimated Expiration
2041-03-26

AI Technical Summary

Technical Problem

Time-grained index management method can easily lead to unreasonable data cleaning when cleaning business data, resulting in waste of storage space and inefficient query.

Method used

By writing data according to the business attributes of the business data, the target index matching the target business attributes is determined, and the data is written into the index. At the same time, the write alias mechanism and the strategy of rolling new index creation are adopted to ensure that each index is only used to store data of one business attribute, and a new index is created when the amount of data reaches a threshold.

Benefits of technology

It achieves more reasonable business data control, avoids data waste and low query efficiency caused by index-based cleaning, and improves storage space usage efficiency and query speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112925783B_ABST
    Figure CN112925783B_ABST
Patent Text Reader

Abstract

The present application provides a business data processing method and device, an electronic device and a storage medium, wherein the method comprises: obtaining first business data, wherein the first business data is business data to be written into a target database; determining a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is only used to store business data of one business attribute; and writing the first business data into the first target index. Through the present application, the problem that the index management method based on time granularity in the related art cleans business data in units of indexes, which easily leads to unreasonable data cleaning, is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a business data processing method and device, an electronic device, and a storage medium. Background Art

[0002] At present, some databases (for example, ES) use index management based on time granularity (single index). Take ES as an example, ES is a commonly used open source NoSQL database. This NoSQL database can use index management based on time granularity, and use index (similar to table in traditional database) as the smallest management unit to manage data. Among them, index is the smallest unit for managing data in ES, and management refers to data processing actions such as deleting data.

[0003] In big data usage scenarios, business data is often not stored in a single index. There are two reasons for this:

[0004] (1) It is not conducive to index management. For example, physical storage space is limited, and cleaning up historical data is a common problem. If all historical data is stored in a single index, all historical data needs to be cleaned up.

[0005] (2) Query efficiency will be greatly reduced. When performing data query, the entire index is required to obtain the query results, and the query efficiency is low.

[0006] In related technologies, time-granularity index management is usually used. Time-granularity-based index management means: first, add time granularity such as month, day, or hour to the index name, for example, "log.20201020", "log.2020102001", etc., and then clean up the historical data of a certain time.

[0007] However, the time-based index management method is used to store the business data of various users in the same database. Due to the limited storage space of the database, when the amount of data of some business data increases suddenly, data cleaning will be triggered. When cleaning historical data, it is deleted in units of indexes. Therefore, the data cleaning operation will also clean up other business data that is not desired to be deleted.

[0008] Therefore, the index management method based on time granularity in the related art has the problem that cleaning business data in units of indexes can easily lead to unreasonable data cleaning. Summary of the invention

[0009] The present application provides a business data processing method and device, an electronic device and a storage medium, so as to at least solve the problem in the related art that cleaning business data in units of indexes easily leads to unreasonable data cleaning.

[0010] According to one aspect of an embodiment of the present application, a business data processing method is provided, including: obtaining first business data, wherein the first business data is business data to be written into a target database; determining a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is only used to store business data of one business attribute; and writing the first business data into the first target index.

[0011] Optionally, determining the first target index that matches the target business attribute includes: determining a write alias that matches the target business attribute to obtain a target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes that match the write alias; and determining an index in a writable state among at least one first index associated with the target write alias as the first target index.

[0012] Optionally, after writing the first business data into the first target index, the method further includes: associating the target write alias with a second target index, wherein the second target index is an index created after writing the first business data into the first target index; configuring the write status of the first target index to a non-writable state, and configuring the write status of the second target index to a writable state, wherein only one index associated with the target write alias is allowed to be in a writable state at the same time.

[0013] Optionally, before associating the target write alias with the second target index, the method further includes: obtaining the data volume of the business data stored in the first target index by calling the target application interface, wherein the target application interface is used to trigger the creation of the index according to a trigger condition, and the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to a data volume threshold; and creating the second target index when the data volume of the business data stored in the first target index is greater than or equal to the data volume threshold.

[0014] Optionally, after determining the first target index that matches the target business attribute, the method further includes: determining a read alias that matches the first business data to obtain a first read alias, wherein the read alias is used to associate the time attribute of the stored business data with an index that matches the read alias; and when the first target index is not associated with the first read alias, associating the first target index with the first read alias.

[0015] Optionally, after writing the first business data into the first target index, the method further includes: receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range; determining a second read alias matching the target time range based on a time attribute field contained in each read alias, wherein the read alias is used to associate the time attribute of the stored business data with an index matching the read alias, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; obtaining second business data within the target time range from at least one second index associated with the second read alias; and sending the second business data to the target client in response to the target query instruction.

[0016] Optionally, after writing the first business data into the first target index, the method further includes: receiving a target deletion instruction, wherein the target deletion instruction is used to delete at least one index matching the target business attributes; in response to the target deletion instruction, deleting at least one index from at least one third index in the order in which the business data are stored, wherein the at least one third index is used to store business data having the target business attributes in sequence.

[0017] According to another aspect of an embodiment of the present application, a business data processing method is provided, including: receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range; determining a target read alias matching the target time range based on a time attribute field contained in each read alias, wherein the read alias is used to associate the time attribute of business data stored in a target database with an index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of business data stored in the index associated with the read alias; obtaining target business data within the target time range from at least one target index associated with the target read alias; and sending the target business data to the target client in response to the target query instruction.

[0018] According to another aspect of an embodiment of the present application, a business data processing device is provided, including: a first acquisition unit, used to acquire first business data, wherein the first business data is business data to be written into a target database; a first determination unit, used to determine a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is only used to store business data of one business attribute; and a first writing unit, used to write the first business data into the first target index.

[0019] Optionally, the first determination unit includes: a first determination module, used to determine a write alias that matches the target business attribute to obtain the target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes that match the write alias; and a second determination module, used to determine an index in a writable state among at least one first index associated with the target write alias as the first target index.

[0020] Optionally, the device also includes: a first association unit, used to associate the target write alias with a second target index after writing the first business data into the first target index, wherein the second target index is an index created after writing the first business data into the first target index; a configuration unit, used to configure the write status of the first target index to a non-writable state, and to configure the write status of the second target index to a writable state, wherein only one index associated with the target write alias is allowed to be in a writable state at the same time.

[0021] Optionally, the device also includes: a second acquisition unit, used to acquire the data volume of business data stored in the first target index by calling a target application interface before associating the target write alias with the second target index, wherein the target application interface is used to trigger the creation of an index according to a trigger condition, and the trigger condition includes that the data volume of business data stored in the index is greater than or equal to a data volume threshold; a creation unit, used to create the second target index when the data volume of business data stored in the first target index is greater than or equal to the data volume threshold.

[0022] Optionally, the device also includes: a second determination unit, used to determine a read alias matching the first business data after determining the first target index matching the target business attribute, so as to obtain a first read alias, wherein the read alias is used to associate the time attribute of the stored business data with the index matching the read alias; and a second associating unit, used to associate the first target index with the first read alias when the first target index is not associated with the first read alias.

[0023] Optionally, the device also includes: a first receiving unit, used to receive a target query instruction sent by a target client after writing the first business data into the first target index, wherein the target query instruction is used to query business data within a target time range; a third determination unit, used to determine a second read alias matching the target time range based on a time attribute field contained in each read alias, wherein the read alias is used to associate the time attribute of the stored business data with an index matching the read alias, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; a third acquisition unit, used to acquire second business data within the target time range from at least one second index associated with the second read alias; a target sending unit, used to send the second business data to the target client in response to the target query instruction.

[0024] Optionally, the device also includes: a second receiving unit, used to receive a target deletion instruction after writing the first business data into the first target index, wherein the target deletion instruction is used to delete at least one index matching the target business attributes; a deletion unit, used to respond to the target deletion instruction and delete at least one index from at least one third index in the order in which the business data is stored, wherein the at least one third index is used to store business data having the target business attributes in sequence.

[0025] According to another aspect of an embodiment of the present application, a business data processing device is provided, comprising: a receiving unit, configured to receive a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range; a determining unit, configured to determine a target read alias matching the target time range based on a time attribute field contained in each read alias, wherein the read alias is used to associate a time attribute of business data stored in a target database with an index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of business data stored in the index associated with the read alias; an acquiring unit, configured to acquire target business data within the target time range from at least one target index associated with the target read alias; and a sending unit, configured to send the target business data to the target client in response to the target query instruction.

[0026] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.

[0027] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.

[0028] In an embodiment of the present application, a method of writing data according to the business attributes of business data is adopted, by obtaining first business data, wherein the first business data is the business data to be written into a target database; determining a first target index that matches the target business attribute, wherein the target business attribute is the business attribute of the first business data, and each index in the target database is only used to store business data of one business attribute; writing the first business data into the first target index. Since data is written according to the business attributes of the business data, only business data of one business attribute is written in each index. When cleaning business data in units of indexes, deletion can be performed according to business types, thereby achieving the technical effect of improving the rationality of business data control, and further solving the problem that the index management method based on time granularity in the related technology cleans business data in units of indexes, which easily leads to unreasonable data cleaning. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0031] Figure 1 is a schematic diagram of a hardware environment of an optional business data processing method according to an embodiment of the present invention;

[0032] Figure 2 is a flowchart of an optional business data processing method according to an embodiment of the present application;

[0033] Figure 3 is a schematic diagram of an optional business data processing method according to an embodiment of the present application;

[0034] Figure 4 is a flowchart of another optional business data processing method according to an embodiment of the present application;

[0035] Figure 5 is a flowchart of another optional business data processing method according to an embodiment of the present application;

[0036] Figure 6 is a structural block diagram of an optional business data processing device according to an embodiment of the present application;

[0037] Figure 7 is a structural block diagram of another optional business data processing device according to an embodiment of the present application;

[0038] Figure 8 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0041] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretation:

[0042] Index: Similar to a table in a traditional database, it is the smallest unit for managing data in ES (Elasticsearch). The so-called management refers to actions such as deleting data.

[0043] NoSQL: Not Only SQL (Structured Query Language), generally refers to non-relational databases;

[0044] Alias: It is also a concept in ES. It can be understood as a virtual name given to an index. It can be associated with multiple indexes. Similarly, an index can also be associated with multiple aliases. The two are in a many-to-many relationship.

[0045] According to one aspect of an embodiment of the present application, a method for processing business data is provided. Optionally, in this embodiment, the above-mentioned method for processing business data can be applied to Figure 1 In the hardware environment composed of the terminal 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal 102 via a network, and can be used to provide services (such as application services, data storage services, etc.) for the terminal or a client installed on the terminal. One or more databases can be set on the server 104 (or independent of the server) to provide data storage services for the server 104, or the server 104 is a database server.

[0046] The network may include but is not limited to at least one of the following: a wired network, a wireless network. The wired network may include but is not limited to at least one of the following: a wide area network, a metropolitan area network, a local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal 102 may not be limited to a PC, a mobile phone, a tablet computer, etc.

[0047] The service data processing method of the embodiment of the present application can be executed by the server 104, or by the terminal 102, or by both the server 104 and the terminal 102. The terminal 102 can also execute the service data processing method of the embodiment of the present application by a client installed thereon.

[0048] Taking the server 104 (eg, a database server) as an example to execute the business data processing method in this embodiment, Figure 2 is a flow chart of an optional business data processing method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0049] Step S202: Acquire first business data, wherein the first business data is business data to be written into a target database.

[0050] The business data processing method in this embodiment can be applied to the scenario of writing business data into a database. The above-mentioned database can be a database that uses index as the smallest unit for managing data, such as an ES database, or other similar databases. The type of database is not limited in this embodiment.

[0051] For the target database, the target database may be a database that uses an index as the smallest unit for managing data. The target database may be used simultaneously by multiple accounts of the same user, and different accounts may be allowed to process one or more businesses (eg, projects).

[0052] A user of the target database (corresponding to an object) may send a write request (instruction) to the target database, and the write request may be used to request to write first business data into the target database, and the first business data may be business data of the target business. The database server may obtain the first business data, and the obtained first business data may be business data to be written into the target database.

[0053] Step S204 , determining a first target index that matches the target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is used to store business data of only one business attribute.

[0054] In the target database, the index can be used as the smallest unit for managing data, and business data can be stored according to the business attributes of the business data. Each index can be used to store and only store business data of one business attribute. Business data can have multiple attributes, including but not limited to: time attributes, business attributes.

[0055] The time attribute can be used to characterize the time associated with the business data, and may include but is not limited to at least one of the following: the processing time of the business, the generation time of the business data, the time when the business data is written into the database, etc. The time attribute can be carried in the business data, or it can be the time configured for the business data by the database, or the time configured for the business data by other means. The granularity of the time attribute can be configured as needed, for example, it can be a time granularity such as a month, a day, or an hour, or other time granularity. The time attribute of the business data is not limited in this embodiment.

[0056] Business attributes can be used to characterize the business type to which business data belongs (i.e., the type of business to which the business data corresponds). The business type can be a type divided according to the corresponding business (project) or a type divided in other ways. The business attributes of business data are not limited in this embodiment.

[0057] For the first business data, the database server may first determine the business attributes of the first business data, obtain the target business attributes, and determine a first target index matching the target business attributes. The first target index may be one of one or more indexes used only to store business data having the target business attributes.

[0058] Which business attribute of each index is used to store business data can be indicated by index indication information, and the index indication information is used to indicate the business attributes of the business data that each index is allowed to store, or to indicate the index in which business data of a certain business attribute is allowed to be stored. The implementation method of the index indication information can be configured as needed, and this is not limited in this embodiment.

[0059] Step S206: write the first business data into the first target index.

[0060] After determining the first target index, the database server may write the first business data into the first target index.

[0061] Whether it is the index management method based on time granularity or the index management method based on business type dimension, when the amount of data increases suddenly, a single index will become too large. Then, when cleaning historical data, a large amount of storage space will be wasted, and the efficiency of storage space usage will be greatly reduced. If a single index can be split into fine-grained parts, the amount of data involved in the query can be effectively reduced, and the query speed can be improved.

[0062] In order to improve the use efficiency of storage space, different business data of the same business attribute can be stored through at least one index, and different indexes corresponding to one business attribute can be generated in a rolling manner, that is, when the time to create a new index is reached, it is determined whether the current index meets the rolling condition, and if so, a new index is created, and the rolling condition is the condition for creating a new index. There can be many times to roll over and create a new index, and the present embodiment does not limit the time to roll over and create a new index.

[0063] As an optional method, after receiving new business data and before adding the business data to the current index, determine whether the current index meets the scrolling conditions. If the current index meets the scrolling conditions, create a new index and write the received business data to the newly created index; otherwise, write the received business data to the current index.

[0064] For example, when the scrolling condition is not satisfied in the first target index, the first business data is written into the first target index, and the scrolling condition is a condition for creating a new index; otherwise, a third target index is created and the first business data is written into the third target index.

[0065] As another optional method, after adding the business data to the current index, determine whether the current index meets the scrolling condition. If the current index meets the scrolling condition, create a new index and write the business data received subsequently to the newly created index (for example, the second target index); otherwise, continue to write the business data received subsequently to the current index.

[0066] As another optional method, you can periodically determine whether the current index meets the scrolling condition. If the current index meets the scrolling condition, create a new index and write the business data received subsequently into the newly created index (for example, the second target index); otherwise, continue to write the business data received subsequently into the current index.

[0067] It should be noted that the above-mentioned rolling conditions are conditions for creating a new index, which may include but are not limited to at least one of the following: the storage space exceeds the target size, the index existence time exceeds the target existence time, and the number of data items recorded in the index exceeds the target number. This is not limited in this embodiment.

[0068] Through the above steps S202 to S206, the first business data is obtained, wherein the first business data is the business data to be written into the target database; a first target index matching the target business attribute is determined, wherein the target business attribute is the business attribute of the first business data, and each index in the target database is only used to store business data of one business attribute; the first business data is written into the first target index, which solves the problem of unreasonable data cleaning caused by the time-granularity-based index management method in the related art, thereby improving the rationality of business data control.

[0069] As an optional embodiment, determining the first target index matching the target service attribute includes:

[0070] S11, determining a write alias matching a target business attribute, and obtaining the target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes matching the write alias;

[0071] S12: Determine an index in a writable state among at least one first index associated with the target write alias as a first target index.

[0072] An index alias in a target database (eg, ES) can be associated with multiple real indexes, and different index aliases can be used to store indexes matching different business attributes, so that an index matching the business type of business data can be determined based on the index.

[0073] The above index alias is the alias used when writing business data into the index, so it can be called a write alias, that is, the write alias is the index alias used to write business data into the index of the target database. In order to ensure the convenience of data writing and avoid data storage errors, each write alias can only match one business attribute, that is, there is a one-to-one relationship between the write alias and the business attribute, and all indexes associated with a write alias are used to store business data with a business attribute matching the write alias.

[0074] The target database may have multiple write aliases, and each of the multiple write aliases may be associated with at least one index. The at least one index associated with a write alias is used to store business data having business attributes matching the write alias.

[0075] For the target business attribute, the database server can determine the write alias that matches the target business attribute and obtain the target write alias. For example, the correspondence between the business attribute and the write alias can be recorded through metadata information or other methods. The write alias that matches the target business attribute can be determined by querying the metadata information.

[0076] In order to determine which index associated with the write alias that matches the business data should be written to, at least one index associated with a write alias can be configured so that the index that allows business data to be written is in a writable state and the index that does not allow business data to be written is in a non-writable state.

[0077] For example, ES can specify an alias for one or more indexes, and the content of one or more indexes can be found through the alias. Internally, ES will map (mount) the alias to the corresponding index.

[0078] After obtaining the target write alias, the database server may determine an index that is associated with the target write alias and is currently in a writable state as the first target index, that is, the index to which the first business data is to be written. If only one index is in a writable state, the first target index may be that index. If multiple indexes are in a writable state, the first target index may be one of them.

[0079] Through this embodiment, the index into which the business data is written is controlled by the index alias, so that the accuracy and efficiency of writing the business data can be improved.

[0080] As an optional embodiment, after writing the first service data into the first target index, the method further includes:

[0081] S21, associating the target write alias with a second target index, wherein the second target index is an index created after the first service data is written into the first target index;

[0082] S22, configuring the write status of the first target index to be a non-writable status, and configuring the write status of the second target index to be a writable status, wherein only one index among the indexes associated with the target write alias is allowed to be in a writable status at the same time.

[0083] In order to quickly determine which index associated with the matching write alias the business data should be written to, at least one index associated with a write alias can be configured to allow only one index to be in a writable state at the same time, and the other indexes are in a non-writable state.

[0084] At least one index can be created sequentially, and each index can be in the following states from creation to deletion: writable state, non-writable state. When an index is created, it is in a writable state; when it does not meet the rolling conditions, it remains in a writable state; when it meets the rolling conditions, it is configured to a non-writable state, and a new index is created, and the newly created index is configured to a writable state. Correspondingly, a write alias can be mounted on the index currently in the write state that is associated with it.

[0085] After writing the first business data into the first target index, if the time comes to scroll and create a new index, the database server can determine whether the first target index meets the scrolling conditions. If not, the first target index remains writable; if so, a new index is created, i.e., the second target index, and the target write alias is associated with the second target index.

[0086] When the target write alias is associated with the second target index, the database server may configure the second target index to be in a writable state and the first target index to be in a non-writable state, thereby ensuring that only one index is allowed to be in a writable state at the same time.

[0087] It should be noted that the write state and non-write state of an index can be represented by the index mounted by the alias. For example, the index where the target write alias is mounted in at least one first index associated with the target write alias is determined as the first target index; when the first target index meets the rolling condition, a second target index is created and the target index is mounted on the second target index. The index where the target write alias is mounted is the index in the writeable state, and the other indexes are the indexes in the non-writeable state.

[0088] Optionally, an index associated with an index alias can be generated rollingly through storage space, and the index name of the index contains an index name serial number. The index name of the newly created index can be incremented by the currently writable index name serial number, that is, the index name of the index created later can be generated in an incrementing manner according to the index name serial number. For the second target index, the index name of the second target index is generated according to the index name of the first target index in an incrementing manner according to the index name serial number, so that the time sequence of the business data stored in the index can be determined according to the index name serial number of the index.

[0089] For example, Figure 3 As shown, different write aliases can be used to associate indexes used to store business data with different business attributes. For a write alias named "log", the first created index (also known as the initial index) is named log.000001, with a 6-digit suffix (index name sequence number), and the current writable index is named log.000002, then the newly generated index will be named log.000003. When rolling occurs, you can set the current newly generated index to be writable, and all previous historical indexes will be set to be non-writable.

[0090] Through this embodiment, by configuring the newly created index to be in a writable state and configuring the previous index to be in a non-writable state, it can be ensured that only one index associated with an index alias is allowed to be in a writable state at the same time, thereby improving the efficiency of data writing and ensuring the timing of writing data.

[0091] As an optional embodiment, before associating the target writing alias with the second target index, the method further includes:

[0092] S31, acquiring the data volume of the business data stored in the first target index by calling a target application program interface, wherein the target application program interface is used to trigger the creation of the index according to a trigger condition, and the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to a data volume threshold;

[0093] S32: When the amount of business data stored in the first target index is greater than or equal to a data amount threshold, create a second target index.

[0094] The index can be generated in a rolling manner based on the storage size, that is, the rolling condition can be: the storage space exceeds the target size, that is, the amount of business data stored in the index is greater than or equal to the data volume threshold. For a write alias, the database server can periodically determine whether the index currently mounted by the alias meets the rolling condition. If so, it triggers the creation of a new index.

[0095] Optionally, in this embodiment, the operation of rolling index creation in the database server can be performed by calling a target API (Application Programming Interface), which can be used to trigger index creation according to trigger conditions, and the trigger conditions may include that the amount of business data stored in the index is greater than or equal to a data amount threshold.

[0096] For example, for ES, the rollover index API (i.e., an example of the target API) can be used to implement the rolling generation of a new index based on certain conditions (e.g., storage space size, index existence time, or number of index data items). The API format is as follows:

[0097]

[0098]

[0099] Among them, rollover-target is the index alias in ES, conditions is the trigger condition for ES to determine whether index rolling is required (the function is the same as the aforementioned rolling condition), max_age is the maximum index existence time, max_docs is the maximum number of index data items, and max_size is the maximum storage space size.

[0100] The rollover index API can be implemented based on the ES index alias mechanism. This mechanism ensures that only one of the real indices associated with the alias is writable. When calling this API, ES determines whether the writable index (for example, the first target index) in the index associated with the alias meets the rollover conditions. If so, ES will automatically create a new index (for example, the second target index).

[0101] Here, based on the ES index alias mechanism, specify which index the data is written to. When writing, specify the same rollover-target index alias as the above API, without specifying a specific index. This mechanism ensures that only the latest index can be written. In addition, the index name does not need to add the time dimension.

[0102] For the target write alias, the database server can call the target API to obtain the data volume of the business data stored in the first target index. For the timed trigger scenario, the target API can be called based on the target timer to obtain the data volume of the business data stored in the first target index. If the data volume of the business data stored in the first target index is greater than or equal to the data volume threshold, a new index can be created, that is, the second target index.

[0103] For ES, you can create a timer to call the rollover-api regularly to implement the function of rolling over and creating new indexes according to the storage size. For example, the trigger condition for index rolling is that the maximum storage space size (data volume threshold) is 5gb. If the storage space occupied by the index currently mounted by the target write alias is greater than or equal to 5gb, a new index will be automatically created and set to be writable on the current newly generated index. All previous historical indexes will be set to non-writable.

[0104] For example, the first index generated is assumed to be "log.000001", and data starts to be written to this index. We define the index to be created in units of 5gb storage size. When the data volume of "log.000001" reaches 5gb, a second index "log.000002" will be generated. At this time, new data will stop being written to "log.000001" and will be written to "log.000002" instead. This allows precise control of the index size.

[0105] Through this embodiment, the creation of a new index is controlled according to the storage space size of the index, which can avoid the waste of storage space and improve the use efficiency of the storage space.

[0106] As an optional embodiment, after determining the first target index matching the target service attribute, the method further includes:

[0107] S41, determining a read alias matching the first business data, and obtaining the first read alias, wherein the read alias is used to associate a time attribute of the stored business data with an index matching the read alias;

[0108] S42: When the first target index is not associated with the first read alias, associate the first target index with the first read alias.

[0109] In order to ensure that the index can be accurately located based on the query time (that is, the index query can be performed at a specific time granularity), at least one read alias (time series alias) can be associated with the index. The read alias is used to associate the index with the target time matching the read alias. For example, Figure 4 As shown, an index can be associated with at least one read alias, and a read alias can be associated with indexes associated with different write aliases. The target time can be the creation time of the index, or the time attribute of the business data stored in the index (for example, generation time, storage time).

[0110] The read alias may include a time attribute field, which is used to represent the time attribute of the business data stored in the index associated with the read alias, so that the index can be located based on the query time according to the index alias. The length of the time attribute field can be configured according to different time granularities. For example, the time attribute field can be in the format of "YYYYMMDD", where "YYYY" represents year, "MM" represents month, and "DD" represents day.

[0111] Optionally, the target time may be a time attribute of business data stored in the index. Correspondingly, the read alias may be used to associate the time attribute of the stored business data with an index that matches the read alias. The timing of associating the index and the read alias may be related to or unrelated to writing business data. As an optional real-time method, the current read alias corresponding to the current time period may be periodically determined, the length of a time period corresponding to the time granularity of the index alias; the currently writable index associated with each of the multiple write aliases is associated with the current read alias.

[0112] As another optional real-time method, associating the index and the read alias can be triggered when the business data is written to the index. After determining the first target index, the database server can determine the read alias that matches the first business data and obtain the first read alias. If the first target index is not associated with the first read alias, the database server can associate the first target index with the first read alias. Based on the time granularity of the read alias, the time attributes of the business data stored in an index may not all match the same read alias, so each index can be associated with at least one read alias.

[0113] For example, the read alias is "log.YYYYMMDD" and the time attribute field is "YYYYMMDD". If the business data stored in an index is business data of multiple days, then the index is associated with multiple read aliases.

[0114] Optionally, in order to reduce the number of times it is determined whether an index is associated with a read alias, an association identifier can be used to identify whether an index is associated with a read alias in the current time period. If it is already associated, the determination of the read alias that matches the business data will no longer be performed. Only when it is not associated, the operations of determining the read alias that matches the business data and associating the index and the read alias will be performed.

[0115] After determining the first target index, the target association identifier corresponding to the first target index can be read, wherein the target association identifier is used to identify whether the first target index is associated with a read alias in the current time period; if the target association identifier is not associated with a read alias in the current time period, determine the read alias that matches the first target index, obtain the first read alias, and associate the first target index with the first read alias.

[0116] For the above ES, when writing data, ES can support the use of index aliases instead of real indexes. ES queries can also be implemented based on the ES alias mechanism. In the above scenario where the rollover-api is called based on a timer to create a new index based on the storage size, when writing data to the index, it can be determined whether the index is associated with the read alias that matches the business data to be written. If not, it is associated.

[0117] Optionally, the read alias can also be used to store an index whose creation time matches the read alias. After creating the second target index, the database server can determine the read alias that matches the creation time of the second target index to obtain a third read alias; and associate the second target index with the third read alias.

[0118] For example, when associating a read alias, you can create a read alias at the current time, the format of the read alias is "log.YYYYMMDD", and associate it with the writable index corresponding to the current write alias. In the above scenario where the rollover-api is called based on a timer to create a new index based on the storage size, you can also associate a read alias with the latest index associated with the write alias specified by the rollover-api.

[0119] Optionally, the read alias may also distinguish indexes of different business attributes. The read alias may include a business attribute field, which may be used to indicate the business attributes of the business data stored in the associated index. Correspondingly, the database server may determine a read alias that matches the first business data, and obtain a first read alias, where the read alias is used to associate the business attributes of the stored business data and the index whose time attributes match the read alias, for example, the first read alias is used to associate the index of the business data whose stored business attributes are target business attributes and whose time attributes are target time attributes. In the case where the first target index is not associated with the first read alias, the first target index may be associated with the first read alias.

[0120] Through this embodiment, by associating a read alias (time series alias) with an index, it is possible to accurately locate the index based on the query time, thereby improving the efficiency and flexibility of the index query.

[0121] As an optional embodiment, after writing the first service data into the first target index, the method further includes:

[0122] S51, receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range;

[0123] S52, determining a second read alias matching the target time range according to a time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the stored business data with an index matching the read alias, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias;

[0124] S53, acquiring second business data within a target time range from at least one second index associated with the second read alias;

[0125] S54, responding to the target query instruction, sending the second service data to the target client.

[0126] When reading business data, you can use the read alias to perform the operation. The meaning of the read alias and the naming method of the read alias are similar to the above, and will not be repeated here. The database server can receive a target query instruction sent by the target client, and the target query instruction can be used to query business data within the target time range. The time granularity of the above target time range and the time granularity of the time attribute field in the read alias can be the same or different, which is not limited in this embodiment.

[0127] Since the time attribute field in the read alias is used to describe the time attribute of the business data stored in the index associated with the read alias, the index where the business data to be queried is stored can be located based on the time attribute field included in the read alias. For example, based on the time attribute field included in each read alias, the database server can determine a second read alias that matches the target time range, and determine at least one second index associated with the second read alias.

[0128] For example, the target time range may be business data from the 1st to the 5th of a certain month of a certain year, and the reading alias is named "log.YYYYMMDD" ("YYYYMMDD" is the time attribute field). Then, based on the time attribute field contained in the reading alias, the reading alias whose time represented by the time attribute field is within the target time range can be determined.

[0129] Since the time attribute field in the read alias is used to describe the time attribute of the business data stored in the index associated with the read alias, and one index can be associated with multiple read aliases, the time attribute of the business data stored in the index is not necessarily all within the target time range. After determining at least one second index, the database server can obtain the second business data within the target time range from the at least one second index, and return the queried business data to the target client.

[0130] Optionally, if the target query instruction is used to query business data whose business attribute is a first business attribute and whose time attribute is within a first time range, then, for the scenario in which the read alias contains the above-mentioned business attribute field, the database server can determine a fourth read alias (the number of fourth read aliases can be one or more) that matches both the first business attribute and the first time range based on the time attribute field and the business attribute field contained in each read alias; obtain third business data with the first business attribute within the first time range from at least one fourth index associated with the fourth read alias, and send the third business data to the target client in response to the target query instruction.

[0131] Optionally, if the target query instruction is used to query business data whose business attribute is a first business attribute and whose time attribute is within a first time range, then, for a scenario where the read alias does not contain the above-mentioned business attribute field, the database server can determine at least one read alias that matches the first time range based on the time attribute field contained in each read alias, and determine the index associated with each read alias in the at least one read alias to obtain a first index set; determine at least one write alias that matches the first business attribute based on the business attribute matched by each write alias, and determine the index associated with each write alias in the at least one write alias to obtain a second index set; determine the intersection of the first index set and the second index set to obtain at least one fifth index; obtain fourth business data within the target time range from the at least one fifth index, and send the fourth business data to the target client in response to the target query instruction.

[0132] Through this embodiment, by first locating the index in which the business data to be queried is stored, and then accurately determining the business data to be queried from the located index, the query efficiency of the business data can be improved.

[0133] As an optional embodiment, after writing the first service data into the first target index, the method further includes:

[0134] S61, receiving a target deletion instruction, wherein the target deletion instruction is used to delete at least one index matching a target service attribute;

[0135] S62, in response to the target deletion instruction, delete at least one index from at least one third index according to the order in which the business data is stored, wherein the at least one third index is used to sequentially store business data having target business attributes.

[0136] When deleting business data, the database server may receive a target deletion instruction for deleting at least one index matching a target business attribute. The target deletion instruction may also be used to indicate the number of indexes to be deleted or the total amount of data contained in the indexes to be deleted.

[0137] In response to the target deletion instruction, the database server determines at least one third index for storing the business data having the target business attribute. For example, a target write alias matching the target business attribute may be first determined, and then at least one index associated with the target write alias may be determined as at least one third index, and the at least one third index is used to sequentially store the business data having the target business attribute.

[0138] According to the number of indexes to be deleted or the total amount of data contained in the indexes indicated by the target deletion instruction, or the default number of indexes to be deleted or the default total amount of data, at least one index that meets the deletion condition can be determined from at least one third index in the order in which the business data is stored, and the determined at least one index can be deleted. Here, the determined at least one index can be an index with an earlier time attribute of the stored business data.

[0139] For a scenario where a write alias is used to associate an index storing business data of the same business attribute, the index name of at least one index associated with a write alias may be generated in an ascending manner according to the index name sequence number, and the time sequence of the business data stored in the index may be determined according to the index name sequence number of the index. Correspondingly, in response to a target deletion instruction, at least one index may be deleted from at least one third index in ascending order of the index name sequence number, for example, at least one index satisfying the deletion condition may be determined from at least one third index in ascending order of the index name sequence number, and the determined at least one index may be deleted.

[0140] Optionally, for a scenario in which a read alias is used to associate time attributes of stored business data and an index whose business attributes match the read alias, the process of deleting an index may be: receiving a target deletion instruction, wherein the target deletion instruction is used to delete an index within a second time range that matches a second business attribute; determining a fifth read alias that matches both the second time range and the second business attribute based on the time attribute field and the business attribute field of each read alias, wherein the read alias is used to associate time attributes of stored business data and an index whose business attributes match the read alias, the time attribute field is used to describe the time attributes of the business data stored in the index associated with the read alias, and the business attribute field is used to describe the business attributes of the business data stored in the index associated with the read alias; and deleting at least one index associated with the fifth read alias.

[0141] Through this embodiment, the business data is deleted according to the business attributes and deletion conditions indicated by the deletion instruction, which can improve the rationality of business data deletion.

[0142] The following is an explanation of the business data processing method in the embodiment of the present application in conjunction with an optional example. In this example, the target database is ES (not less than version 6.3), the target API is the rollover index API, and the business attribute is the business type (project type).

[0143] Considering that accurately locating the index according to the query time can narrow the scope of the query data, the business data processing method provided in this example can generate an index by considering the storage space dimension without losing the advantage of the time granularity index. The alias associated with an index can include a write alias and a read alias, so that business data can be written based on the write alias and read based on the read alias.

[0144] In this example, the writing alias is named as "business attribute", for example, "log", which is independent of the time granularity; the reading alias is named as "business attribute.time attribute", for example, "log.20201020", which is related to the time granularity.

[0145] Figure 4 is a flowchart of another optional business data processing method according to an embodiment of the present application, such as Figure 4 As shown, the process of the business data processing method in this optional example may include the following steps:

[0146] Step S402: Create a timer, and call the rollover-api regularly according to the timer to create a new index according to the storage size.

[0147] For example, for a write alias named "log", the rollover-api can be called periodically through a timer. Based on the index alias mechanism, if the currently writable index of "log" meets the rolling conditions (whether it is greater than or equal to 5gb), if the rolling conditions are met, a new index is generated and the newly generated index is set to be writable, and the previous historical indexes are set to be non-writable.

[0148] The index name of the newly generated index can be generated in an ascending manner according to the index name sequence number. If the currently writable index name is "log.000002", the newly generated index name is "log.000003".

[0149] Step S404, associating a read alias with the latest index associated with the write alias specified by rollover-api.

[0150] You can create a read alias for the current time, similar to "log.YYYYMMDD", which is related to the time granularity and associates the writable index corresponding to the current write alias.

[0151] Step S406: Use the write alias to write business data into the index, and use the read alias to read business data.

[0152] When writing business data, a matching write alias may be determined according to the business type of the business data, and the business data may be written into a writable index associated with the matching write alias.

[0153] When reading business data, you can determine the matching read alias according to the business type of the read business data and the reading time range, and then accurately read the business data from the index associated with the matching read alias.

[0154] Through this example, by using the ES rollover API and index alias mechanism, the controllability of ES storage space can be enhanced, the efficiency of storage space usage can be improved, and the query speed of time-based indexes can be retained.

[0155] According to another aspect of the embodiment of the present application, a business data processing method is also provided. Optionally, in this embodiment, the business data processing method can be applied to Figure 1 The hardware environment composed of the terminal 102 and the server 104 has been described above and will not be repeated here.

[0156] The service data processing method of the embodiment of the present application can be executed by the server 104, or by the terminal 102, or by both the server 104 and the terminal 102. The terminal 102 can also execute the service data processing method of the embodiment of the present application by a client installed thereon.

[0157] Taking the server 104 (eg, a database server) as an example to execute the business data processing method in this embodiment, Figure 5 is a flowchart of another optional business data processing method according to an embodiment of the present application, such as Figure 5 As shown, the process of the method may include the following steps:

[0158] Step S502, receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range;

[0159] Step S504, determining a target read alias matching the target time range according to the time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the business data stored in the target database with the index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias;

[0160] Step S506, acquiring target business data within a target time range from at least one target index associated with the target read alias;

[0161] Step S508, responding to the target query instruction, and sending the target service data to the target client.

[0162] The business data processing method in this embodiment can be applied to the scenario of querying business data from a database. The above-mentioned database can be a database that uses index as the smallest unit for managing data, such as an ES database, or other similar databases. The type of database is not limited in this embodiment.

[0163] Optionally, the business data processing method in this embodiment can be executed by a database server, which has been described and will not be repeated here. In addition, the business data processing method in this embodiment can be arbitrarily combined with the method steps in the above embodiments without contradiction.

[0164] Optionally, the descriptions of the target client, target query instruction, target time range, read alias, target database, business data, time attribute of business data, time attribute field, index, etc. in the aforementioned embodiments are also applicable to the present embodiment, and are not described in detail here. Optionally, the target read alias in the present embodiment is similar to the second read alias in the aforementioned embodiment, the target index in the embodiment is similar to the second index in the aforementioned embodiment, and the target business data in the embodiment is similar to the second business data in the aforementioned embodiment, and are not described in detail here.

[0165] Through the above steps S502 to S508, a target query instruction sent by a target client is received, wherein the target query instruction is used to query business data within a target time range; a target read alias matching the target time range is determined according to the time attribute field contained in each read alias, wherein the read alias is used to associate the time attribute of the business data stored in the target database with an index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; target business data within the target time range is obtained from at least one target index associated with the target read alias; in response to the target query instruction, the target business data is sent to the target client, since only business data of one business attribute is written in each index, when cleaning business data in units of indexes, it can be deleted according to business type, thereby achieving the technical effect of improving the rationality of business data control, thereby solving the problem in the related art that the index management method based on time granularity cleans business data in units of indexes, which easily leads to unreasonable data cleaning.

[0166] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0167] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0168] According to another aspect of an embodiment of the present application, a business data processing device for implementing the above-mentioned business data processing method is also provided. Figure 6 is a structural block diagram of an optional service data processing device according to an embodiment of the present application, such as Figure 6 As shown, the device may include:

[0169] A first acquisition unit 602 is used to acquire first business data, wherein the first business data is business data to be written into a target database;

[0170] A first determining unit 604, connected to the first acquiring unit 602, is used to determine a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is used to store business data of only one business attribute;

[0171] The first writing unit 606 is connected to the first determining unit 604, and is used to write the first service data into the first target index.

[0172] It should be noted that the first acquisition unit 602 in this embodiment can be used to execute the above step S202, the first determination unit 604 in this embodiment can be used to execute the above step S204, and the first writing unit 606 in this embodiment can be used to execute the above step S206.

[0173] Through the above module, the first business data is obtained, wherein the first business data is the business data to be written into the target database; the first target index matching the target business attribute is determined, wherein the target business attribute is the business attribute of the first business data, and each index in the target database is only used to store business data of one business attribute; the first business data is written into the first target index, which solves the problem of unreasonable data cleaning caused by the index management method based on time granularity in the related art, thereby improving the rationality of business data control.

[0174] As an optional embodiment, the first determining unit 604 includes:

[0175] a first determination module, configured to determine a write alias matching a target service attribute, and obtain the target write alias, wherein at least one index associated with the write alias is used to store service data having service attributes matching the write alias;

[0176] The second determination module is used to determine an index in a writable state among at least one first index associated with the target write alias as a first target index.

[0177] As an optional embodiment, the above device also includes:

[0178] A first associating unit is used to associate the target write alias with a second target index after writing the first business data into the first target index, wherein the second target index is an index created after writing the first business data into the first target index;

[0179] A configuration unit is used to configure the write state of the first target index to a non-writable state and configure the write state of the second target index to a writable state, wherein only one index associated with the target write alias is allowed to be in a writable state at the same time.

[0180] As an optional embodiment, the above device also includes:

[0181] A second acquisition unit is used to acquire the data volume of the business data stored in the first target index by calling a target application program interface before associating the target write alias with the second target index, wherein the target application program interface is used to trigger the creation of the index according to a trigger condition, and the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to a data volume threshold;

[0182] The creation unit is used to create a second target index when the amount of business data stored in the first target index is greater than or equal to a data amount threshold.

[0183] As an optional embodiment, the above device also includes:

[0184] A second determination unit is used to determine a read alias matching the first business data after determining a first target index matching the target business attribute, and obtain the first read alias, wherein the read alias is used to associate the time attribute of the stored business data with the index matching the read alias;

[0185] The second associating unit is used to associate the first target index with the first read alias when the first target index is not associated with the first read alias.

[0186] As an optional embodiment, the above device also includes:

[0187] A first receiving unit, configured to receive a target query instruction sent by a target client after writing the first service data into the first target index, wherein the target query instruction is used to query service data within a target time range;

[0188] A third determination unit is used to determine a second read alias matching the target time range according to a time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the stored business data with an index matching the read alias, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias;

[0189] A third acquisition unit, configured to acquire second business data within a target time range from at least one second index associated with the second read alias;

[0190] The target sending unit is used to respond to the target query instruction and send the second service data to the target client.

[0191] As an optional embodiment, the above device also includes:

[0192] A second receiving unit, configured to receive a target deletion instruction after writing the first service data into the first target index, wherein the target deletion instruction is used to delete at least one index matching the target service attribute;

[0193] The deleting unit is used to respond to the target deletion instruction and delete at least one index from at least one third index according to the order of storing the business data, wherein the at least one third index is used to sequentially store business data with target business attributes.

[0194] According to another aspect of an embodiment of the present application, a business data processing device for implementing the above-mentioned business data processing method is also provided. Figure 7 is a structural block diagram of another optional service data processing device according to an embodiment of the present application, such as Figure 7 As shown, the device may include:

[0195] A receiving unit 702 is configured to receive a target query instruction sent by a target client, wherein the target query instruction is used to query service data within a target time range;

[0196] A determination unit 704, connected to the receiving unit 702, is used to determine a target read alias matching the target time range according to a time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the business data stored in the target database with an index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias;

[0197] An acquisition unit 706, connected to the determination unit 704, configured to acquire target business data within a target time range from at least one target index associated with the target read alias;

[0198] The sending unit 708 is connected to the acquiring unit 706 and is used to respond to the target query instruction and send the target service data to the target client.

[0199] It should be noted that the receiving unit 702 in this embodiment can be used to execute the above step S502, the determining unit 704 in this embodiment can be used to execute the above step S504, the acquiring unit 706 in this embodiment can be used to execute the above step S506, and the sending unit 708 in this embodiment can be used to execute the above step S508.

[0200] Through the above module, a target query instruction sent by a target client is received, wherein the target query instruction is used to query business data within a target time range; a target read alias matching the target time range is determined according to the time attribute field contained in each read alias, wherein the read alias is used to associate the time attribute of the business data stored in the target database with an index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; target business data within the target time range is obtained from at least one target index associated with the target read alias; in response to the target query instruction, the target business data is sent to the target client, which solves the problem in the related art that the index management method based on time granularity cleans up business data in units of indexes, which easily leads to unreasonable data cleaning, and improves the rationality of business data control.

[0201] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.

[0202] According to another aspect of an embodiment of the present application, an electronic device for implementing the above-mentioned business data processing method is also provided. The electronic device may be a server, a terminal, or a combination thereof.

[0203] Figure 8 is a structural block diagram of an optional electronic device according to an embodiment of the present application, such as Figure 8 As shown, it includes a processor 802, a communication interface 804, a memory 806 and a communication bus 808, wherein the processor 802, the communication interface 804 and the memory 806 communicate with each other through the communication bus 808, wherein,

[0204] Memory 806, used for storing computer programs;

[0205] The processor 802 is used to implement the following steps when executing the computer program stored in the memory 806:

[0206] Acquire first business data, wherein the first business data is business data to be written into a target database;

[0207] Determine a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is used to store business data of only one business attribute;

[0208] The first service data is written into the first target index.

[0209] Optionally, the processor 802 is configured to implement the following steps when executing the computer program stored in the memory 806:

[0210] Receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range;

[0211] According to the time attribute field contained in each read alias, determine the target read alias matching the target time range, wherein the read alias is used to associate the time attribute of the business data stored in the target database with the index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias;

[0212] Obtaining target business data within a target time range from at least one target index associated with the target read alias;

[0213] Respond to the target query instruction and send the target business data to the target client.

[0214] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0215] The communication interface is used for communication between the above electronic device and other devices.

[0216] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0217] As an example, the memory 806 may include but is not limited to the first acquisition unit 602, the first determination unit 604 and the first writing unit 606 in the above-mentioned business data processing device. In addition, it may also include but is not limited to other module units in the above-mentioned business data processing device, which will not be repeated in this example.

[0218] As another example, the memory 806 may include, but is not limited to, the receiving unit 702, the determining unit 704, the acquiring unit 706, and the sending unit 708 in the above-mentioned service data processing device. In addition, it may also include, but is not limited to, other module units in the above-mentioned service data processing device, which will not be repeated in this example.

[0219] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0220] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0221] It can be understood by those skilled in the art that Figure 8 The structure shown is for illustration only. The device for implementing the above-mentioned business data processing method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 8 The structure of the electronic device is not limited. Figure 8 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 8 Different configurations shown.

[0222] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0223] According to another aspect of the embodiments of the present application, a storage medium is further provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the above-mentioned business data processing methods in the embodiments of the present application.

[0224] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.

[0225] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0226] Acquire first business data, wherein the first business data is business data to be written into a target database;

[0227] Determine a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is used to store business data of only one business attribute;

[0228] The first service data is written into the first target index.

[0229] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0230] Receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range;

[0231] According to the time attribute field contained in each read alias, determine the target read alias matching the target time range, wherein the read alias is used to associate the time attribute of the business data stored in the target database with the index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias;

[0232] Obtaining target business data within a target time range from at least one target index associated with the target read alias;

[0233] Respond to the target query instruction and send the target business data to the target client.

[0234] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.

[0235] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0236] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0237] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0238] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0239] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0240] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.

[0241] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0242] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A business data processing method, characterized in that: include: Acquire first business data, wherein the first business data is business data to be written into a target database; Determine a first target index that matches a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is used to store business data of only one business attribute; Writing the first service data into the first target index; Wherein, determining the first target index matching the target business attribute comprises: determining a write alias matching the target business attribute to obtain a target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes matching the write alias; determining an index in a writable state in at least one first index associated with the target write alias as the first target index; After writing the first business data into the first target index, the method further includes: associating the target write alias with a second target index, wherein the second target index is an index created after writing the first business data into the first target index; configuring the write state of the first target index to a non-writable state, and configuring the write state of the second target index to a writable state, wherein only one index among the indexes associated with the target write alias is allowed to be in a writable state at the same time; Before associating the target write alias with the second target index, the method also includes: obtaining the data volume of the business data stored in the first target index by calling the target application interface, wherein the target application interface is used to trigger the creation of the index according to a trigger condition, and the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to the data volume threshold; when the data volume of the business data stored in the first target index is greater than or equal to the data volume threshold, creating the second target index.

2. The method according to claim 1, characterized in that After determining the first target index matching the target service attribute, the method further includes: Determine a read alias matching the first business data to obtain a first read alias, wherein the read alias is used to associate a time attribute of the stored business data with an index matching the read alias; If the first target index is not associated with the first read alias, the first target index is associated with the first read alias.

3. The method according to claim 1, characterized in that After writing the first service data into the first target index, the method further includes: Receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range; Determine a second read alias matching the target time range according to a time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the stored business data with an index matching the read alias, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; Acquire second business data within the target time range from at least one second index associated with the second read alias; In response to the target query instruction, the second service data is sent to the target client.

4. The method according to any one of claims 1 to 3, characterized in that After writing the first service data into the first target index, the method further includes: Receiving a target deletion instruction, wherein the target deletion instruction is used to delete at least one index matching the target service attribute; In response to the target deletion instruction, at least one index is deleted from at least one third index according to the order in which the business data is stored, wherein the at least one third index is used to sequentially store business data having the target business attribute.

5. A business data processing method, characterized in that: include: Receiving a target query instruction sent by a target client, wherein the target query instruction is used to query business data within a target time range; Determine a target read alias matching the target time range according to the time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the business data stored in the target database with the index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; Acquire target business data within the target time range from at least one target index associated with the target read alias; In response to the target query instruction, the target service data is sent to the target client; Wherein, before receiving the target query instruction sent by the target client, it also includes: determining a write alias matching the target business attribute to obtain the target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes matching the write alias; determining an index in a writable state in at least one first index associated with the target write alias as a first target index; Associating the target write alias with a second target index, wherein the second target index is an index created after the business data is written into the first target index; configuring the write state of the first target index to be a non-writable state, and configuring the write state of the second target index to be a writable state, wherein only one index among the indexes associated with the target write alias is allowed to be in a writable state at the same time; Before associating the target write alias with the second target index, the method further includes: acquiring the data volume of the business data stored in the first target index by calling a target application program interface, wherein the target application program interface is used to trigger the creation of an index according to a trigger condition, wherein the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to a data volume threshold; when the data volume of the business data stored in the first target index is greater than or equal to the data volume threshold, In this case, the second target index is created.

6. A business data processing device, characterized in that: include: A first acquisition unit, configured to acquire first business data, wherein the first business data is business data to be written into a target database; A first determining unit, configured to determine a first target index matching a target business attribute, wherein the target business attribute is a business attribute of the first business data, and each index in the target database is used to store business data of only one business attribute; A first writing unit, configured to write the first service data into the first target index; Wherein, determining the first target index matching the target business attribute comprises: determining a write alias matching the target business attribute to obtain a target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes matching the write alias; determining an index in a writable state in at least one first index associated with the target write alias as the first target index; After writing the first business data into the first target index, the method further includes: associating the target write alias with a second target index, wherein the second target index is an index created after writing the first business data into the first target index; configuring the write state of the first target index to a non-writable state, and configuring the write state of the second target index to a writable state, wherein only one index among the indexes associated with the target write alias is allowed to be in a writable state at the same time; Before associating the target write alias with the second target index, it also includes: obtaining the data volume of the business data stored in the first target index by calling the target application interface, wherein the target application interface is used to trigger the creation of the index according to the trigger condition, and the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to the data volume threshold; when the data volume of the business data stored in the first target index is greater than or equal to the data volume threshold, creating the second target index.

7. A business data processing device, characterized in that: include: A receiving unit, configured to receive a target query instruction sent by a target client, wherein the target query instruction is used to query service data within a target time range; a determination unit, configured to determine a target read alias matching the target time range according to a time attribute field included in each read alias, wherein the read alias is used to associate the time attribute of the business data stored in the target database with an index matching the read alias, each index in the target database is only used to store business data of one business attribute, and the time attribute field is used to describe the time attribute of the business data stored in the index associated with the read alias; an acquisition unit, configured to acquire target service data within the target time range from at least one target index associated with the target read alias; A sending unit, configured to respond to the target query instruction and send the target service data to the target client; Before receiving the target query instruction sent by the target client, the method further includes: Determine a write alias that matches a target business attribute to obtain a target write alias, wherein at least one index associated with the write alias is used to store business data having business attributes that match the write alias; determine an index that is in a writable state among at least one first index associated with the target write alias as a first target index; Associating the target write alias with a second target index, wherein the second target index is an index created after the business data is written into the first target index; configuring the write state of the first target index to be a non-writable state, and configuring the write state of the second target index to be a writable state, wherein only one index among the indexes associated with the target write alias is allowed to be in a writable state at the same time; Before associating the target write alias with the second target index, it also includes: obtaining the data volume of the business data stored in the first target index by calling the target application interface, wherein the target application interface is used to trigger the creation of the index according to the trigger condition, and the trigger condition includes that the data volume of the business data stored in the index is greater than or equal to the data volume threshold; when the data volume of the business data stored in the first target index is greater than or equal to the data volume threshold, creating the second target index.

8. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the steps of the method according to any one of claims 1 to 5 by running the computer program stored in the memory.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the steps of the method described in any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Index establishing and using method and device

    CN110019200A