CN114625729A - Business data storage method and device, electronic equipment and storage medium - Google Patents

Business data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114625729A
CN114625729A CN202011472401.9A CN202011472401A CN114625729A CN 114625729 A CN114625729 A CN 114625729A CN 202011472401 A CN202011472401 A CN 202011472401A CN 114625729 A CN114625729 A CN 114625729A
Authority
CN
China
Prior art keywords
data
service
storage area
storage
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011472401.9A
Other languages
Chinese (zh)
Inventor
沈志宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011472401.9A priority Critical patent/CN114625729A/en
Publication of CN114625729A publication Critical patent/CN114625729A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method and a device for storing service data, electronic equipment and a storage medium; the method comprises the steps of obtaining service data to be stored, wherein the service data comprise service basic data and service field data, and the service field data comprise service field identification and service content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area. The embodiment of the application can store the service data based on the service field identification, and improves the storage efficiency of the service data.

Description

Business data storage method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for storing service data, an electronic device, and a storage medium.
Background
With the development of network technology, more and more services can be provided by the internet, and the amount of data generated by various services is also rapidly expanded. With the explosive growth of business data, how a data storage system stores massive business data becomes a research focus in the field of data storage in the business processing process.
The existing data storage method is to store service data through a large dedicated wide table, and although the data storage mode can meet the requirement of high storage capacity of mass data, the data storage is performed based on the wide table, so that the data storage efficiency is low.
Disclosure of Invention
The embodiment of the application provides a method and a device for storing service data, electronic equipment and a storage medium, which can improve the storage efficiency of the service data.
The embodiment of the application provides a method for storing service data, which comprises the following steps:
acquiring service data to be stored, wherein the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data;
identifying a target service field corresponding to the service data according to the service field identifier;
determining a preset storage area to which the service data need to be stored based on the service basic data;
determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field;
and storing the service data to the target sub-storage area.
Correspondingly, an embodiment of the present application provides a storage device for service data, including:
the device comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring service data to be stored, the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data;
the identification unit is used for identifying the target service field corresponding to the service data according to the service field identifier;
the first determining unit is used for determining a preset storage area to which the service data needs to be stored based on the service basic data;
a second determining unit, configured to determine, from the preset storage area, a target sub-storage area corresponding to the target service area, where the preset storage area includes: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field;
and the storage unit is used for storing the service data into the target sub-storage area.
Optionally, in some embodiments of the present application, the service domain data further includes an event identifier of a service event to which the service data belongs; the memory cell may include a verify subunit and a memory subunit, as follows:
the checking subunit is configured to check the event identifier in the service field data based on the current event identifier of the service event;
and the storage subunit is used for storing the service data into the target sub-storage area when the event identifier passes the verification.
Optionally, in some embodiments of the present application, the storage unit may further include an update subunit, as follows:
and the updating subunit is configured to update the current event identifier of the service event to the event identifier in the service field data.
Optionally, in some embodiments of the present application, the storage unit may include a writing subunit, a first storage subunit, and a second storage subunit, as follows:
the writing subunit is configured to write the storage operation information corresponding to the service data into an operation log;
the first storage subunit is used for storing the service data into the target sub-storage area;
and the second storage subunit is configured to, when the service data is not successfully stored in the target sub-storage area, restore the service data to the target sub-storage area based on the storage operation information corresponding to the service data in the operation log.
Optionally, in some embodiments of the present application, the first storage subunit may be specifically configured to store the service data in the target sub-storage area, and generate target storage operation information corresponding to the service data;
the storage unit may further include a comparison subunit and a first determination subunit, as follows:
the comparison subunit is configured to compare the target storage operation information with the storage operation information corresponding to the service data in the operation log;
and the first determining subunit is used for determining whether the service data is successfully stored in the target sub-storage area or not based on the comparison result.
Optionally, in some embodiments of the present application, the target sub-storage area includes a base data storage block and a domain data storage block, and the base data storage block and the domain data storage block have the same storage structure; the memory cell may include a third memory sub-cell and a fourth memory sub-cell, as follows:
the third storage subunit is configured to store the service basic data in the basic data storage block;
and the fourth storage subunit is used for storing the service domain data into the domain data storage block.
Optionally, in some embodiments of the present application, the preset storage area further includes: the second determining unit may include a first obtaining sub-unit and a second determining sub-unit, as follows:
the first obtaining subunit is configured to obtain, from the data index directory, a data node index corresponding to the target service field;
and the second determining subunit is used for determining a target data node based on the data node index and taking the sub-storage area corresponding to the target data node as a target sub-storage area.
Optionally, in some embodiments of the present application, the storage unit may further include a generation subunit and an addition subunit, as follows:
the generating subunit is configured to generate metadata corresponding to the service data based on a storage location of the service data in the target sub-storage area, where the metadata indicates the storage location of the service data;
and the adding subunit is used for adding the metadata to the target data node.
Optionally, in some embodiments of the present application, the storage device for service data may further include a receiving unit, a third determining unit, a fourth determining unit, and a data obtaining unit, as follows:
the receiving unit is used for receiving an acquisition request of target service data, wherein the acquisition request comprises a service field identifier and a data identifier of the target service data;
a third determining unit, configured to determine a preset storage area corresponding to the target service data;
a fourth determining unit, configured to determine, from the preset storage area, a target sub-storage area corresponding to the service domain identifier;
and the data acquisition unit is used for acquiring the target service data from the target sub-storage area according to the data identification.
Optionally, in some embodiments of the present application, the preset storage area further includes: the data index directory and the data nodes comprise metadata of the sub-storage areas, and the metadata indicate the storage positions of the service data;
the fourth determining unit may include a second obtaining subunit and a third determining subunit, as follows:
the second obtaining subunit is configured to obtain, from the data index directory, a data node index corresponding to the service domain identifier;
and the third determining subunit is used for determining a target data node based on the data node index and taking the sub-storage area corresponding to the target data node as a target sub-storage area.
The data acquisition unit may include an extraction subunit and a third acquisition subunit, as follows:
the extracting subunit is configured to extract, according to the data identifier, metadata corresponding to the target service data from the target data node;
and the third acquiring subunit is used for acquiring the target service data from the target sub storage area based on the metadata.
Optionally, in some embodiments of the present application, the preset storage area includes a plurality of data storage areas, each data storage area stores service data in a corresponding target time, and each data storage area includes a plurality of sub storage areas isolated from each other; the acquisition request further comprises time information;
the fourth determining unit may include a fourth determining subunit and a fifth determining subunit, as follows:
the fourth determining subunit is configured to determine, from the preset storage area, a target data storage area corresponding to the time information;
and the fifth determining subunit is configured to determine, from the target data storage area, a target sub-storage area corresponding to the service domain identifier.
The electronic device provided by the embodiment of the application comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the steps in the method for storing the service data provided by the embodiment of the application.
In addition, a storage medium is further provided, on which a computer program is stored, where the computer program is executed by a processor to implement the steps in the storage method of the service data provided in the embodiment of the present application.
The embodiment of the application provides a method and a device for storing business data, electronic equipment and a storage medium, which can acquire the business data to be stored, wherein the business data comprises business basic data and business field data, and the business field data comprises a business field identifier and business content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area. The embodiment of the application can store the service data based on the service field identification, and improves the storage efficiency of the service data.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a schematic view of a scenario of a service data storage method provided in an embodiment of the present application;
fig. 1b is a flowchart of a method for storing service data according to an embodiment of the present application;
fig. 1c is a schematic structural diagram of a service data storage method provided in an embodiment of the present application;
fig. 1d is a schematic model diagram of a storage method of service data according to an embodiment of the present application;
fig. 1e is another schematic structural diagram of a service data storage method provided in an embodiment of the present application;
fig. 2a is another flowchart of a method for storing service data according to an embodiment of the present application;
fig. 2b is an explanatory diagram of a storage method of service data provided in an embodiment of the present application;
fig. 2c is a schematic page diagram of a method for storing service data according to an embodiment of the present application;
fig. 2d is another schematic page diagram of a method for storing service data according to an embodiment of the present application;
fig. 3a is a schematic structural diagram of a service data storage device according to an embodiment of the present application;
fig. 3b is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3c is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3d is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3e is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3f is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3g is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3h is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3i is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3j is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3k is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 3l is another schematic structural diagram of a service data storage device provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a method and a device for storing service data, electronic equipment and a storage medium. The storage device of the service data may be specifically integrated in an electronic device, and the electronic device may be a terminal or a server.
It is understood that the method for storing service data in this embodiment may be executed on the terminal, may also be executed on the server, and may also be executed by both the terminal and the server. The above examples should not be construed as limiting the present application.
As shown in fig. 1a, a method for storing service data executed by a terminal and a server together is taken as an example. The storage system of the service data provided by the embodiment of the application comprises a terminal 10, a server 11 and the like; the terminal 10 and the server 11 are connected via a network, for example, a wired or wireless network connection, and the like, wherein the storage device of the service data can be integrated in the server.
The server 11 may be configured to: receiving service data to be stored, which is sent by a terminal 10, wherein the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area. The server 11 may be a single server, or a server cluster or a cloud server composed of a plurality of servers.
Wherein the terminal 10 may transmit the service data to be stored to the server 11. The business data may be billing data or the like. The terminal 10 may include a mobile phone, a smart television, a tablet Computer, a notebook Computer, a Personal Computer (PC), or the like. A client, which may be an application client or a browser client or the like, may also be provided on the terminal 10.
The step of storing the service data by the server 11 may be executed by the terminal 10.
The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
The embodiment will be described from the perspective of a storage device of service data, which may be specifically integrated in an electronic device, and the electronic device may be a server, a terminal, or other devices.
The method for storing the service data can be applied to various scenes of data storage. For example, the method for storing business data provided by this embodiment may be used to store the bill data, so as to improve the storage efficiency of the bill data and improve the reading speed of the bill data.
As shown in fig. 1b, a specific flow of the storage method of the service data may be as follows:
101. the method comprises the steps of obtaining service data to be stored, wherein the service data comprise service basic data and service field data, and the service field data comprise service field identification and service content data.
In this embodiment, the service data may specifically be bill data, and the bill data may be generated by an instant messaging client or a shopping client during a transaction process, which is not limited in this embodiment.
The service basic data may include a user identifier, time information, a data identifier, and the like corresponding to the service data; the data identifier may specifically be a service ticket number identifier.
The service fields refer to different service types, for example, in a payment transaction scenario, the service fields may include red envelope, transfer, recharge, withdrawal, and the like. The service domain identifier is used for uniquely identifying one service domain. The business content data may include specific business content, such as in a payment transaction scenario, the business content data may include consumption at hotel a, ticket consumption to location C, and so on.
102. And identifying the target service field corresponding to the service data according to the service field identifier.
The target business field is the business field to which the business data to be stored belongs. In the scenario of payment transaction, the business data is bill data, and the target business field may be a payment field, a red envelope field, a transfer field, a face-to-face transaction field, a refund field, an industry field, or the like.
103. And determining a preset storage area to which the service data needs to be stored based on the service basic data.
In some embodiments, the service basic data includes a user identifier corresponding to the service data, and a preset storage area to which the service data needs to be stored may be determined according to the user identifier, where the service data corresponding to the user identifier is stored in the preset storage area.
The storage architecture of the service data may be a storage area divided according to the user identifier, and different user identifiers correspond to different preset storage areas.
104. Determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: and each sub-storage area is used for storing the service data of the corresponding service field.
In this embodiment, a preset storage area is divided according to a service domain to obtain a plurality of mutually isolated sub-storage areas, and each sub-storage area stores service data of a different service domain.
Optionally, in some embodiments, the preset storage area further includes: the step of "determining a target sub-storage area corresponding to the target service area from the preset storage area" may include:
acquiring a data node index corresponding to the target service field from the data index directory;
and determining a target data node based on the data node index, and taking a sub-storage area corresponding to the target data node as a target sub-storage area.
The data index directory includes data node indexes corresponding to the service fields, and the data node indexes corresponding to the target service fields can be searched from the data index directory according to the target service fields. Optionally, the data node corresponding to the data node index may store address information of a target sub-storage area corresponding to the target service domain. The data index directory may also be viewed as a collection of data node indexes. The data index directory comprises a mapping relation between the service field and the data node index.
The data index directory can be stored in a buffer area to facilitate reading of the data index directory.
Each data node in the data structure corresponds to a storage unit. In some embodiments, the data node may store address information of a corresponding sub-storage area, and a specific storage location of each service data in the sub-storage area. The data node may further determine a remaining empty storage location in the target sub-storage area based on the storage location of the currently stored service data in the target sub-storage area, and instruct a specific storage location in the target sub-storage area for the next incoming service data to be stored. And storing the service data to the specific storage position in the target sub-storage area based on the specific storage position in the target sub-storage area indicated by the data node.
105. And storing the service data to the target sub-storage area.
In the above embodiment, the service data to be stored may be stored in a storage location adjacent to a storage location of the service data last stored in the target sub-storage area.
Optionally, in some embodiments, the service domain data further includes an event identifier of a service event to which the service data belongs; before the step of storing the service data into the target sub-storage area, the method may further include:
based on the current event identifier of the service event, verifying the event identifier in the service field data;
the storing the service data to the target sub-storage area includes:
and when the event identifier passes the verification, storing the service data into the target sub-storage area.
After the step "storing the service data in the target sub-storage area when the event identifier passes the verification", the method may further include:
and updating the current event identifier of the business event into the event identifier in the business field data.
The business event may include a plurality of links, which may generate a plurality of pieces of business data, and different pieces of business data belonging to the same business event correspond to different event identifiers. The event identifier is a Data Version (Data Version), and the Data Version is used as an optimistic lock, that is, a correct Data Version is required each time the business Data of the target child storage region is written or modified.
The optimistic lock is also called optimistic concurrency control, is a method for ensuring Data concurrency safety and preventing update loss of a database, and can be realized through Data Version.
For example, in the context of payment transactions, where the transaction data is billing data, the process of the same transaction may include the steps of initiating a transfer, accepting a transfer/returning a transfer, that is, the transaction event includes the steps of initiating a transfer and accepting a transfer/returning a transfer, and the event identifier of the transaction data generated by initiating a transfer is different from the event identifier of the transaction data generated by receiving a transfer.
And the current event identifier of the business event is the event identifier of the business data which is stored in the target sub-storage area at the latest time of the business event. The process of verifying the service event may specifically be to verify whether the current event identifier of the service event is the same as the event identifier in the service field data, and if so, the event identifier is not verified; if not, the event identifier passes the check. Specifically, for different service Data belonging to the same service event, the Data Version of the service Data written later is larger than the Data Version of the service Data written earlier, and the corresponding storage area can be successfully written.
In some embodiments, the event identifier in the service domain data is determined based on the current event identifier of the service event to which the service data belongs. For example, if the target sub-storage area does not originally store the service data under a certain service event, and the current event identifier of the service event may be 0, the event identifier in the service domain data may be set to 1.
In a specific embodiment, the user 1 initiates a transfer to the user 2, and at this time, the billing Data needs to be written into the corresponding storage area, because there is no related billing Data of the transaction (business event) in the storage area originally, and the current event identifier may be marked as 0, the event identifier of the billing Data initiating the transfer may be substituted into 1, and the billing Data written with a Data Version 1 can be successfully written, and after the successful writing, the current event identifier is updated to 1. When the state of the business event changes and a piece of business Data needs to be written again, if refund operation occurs, second write operation needs to be performed, then Data Version substituted by the second write operation needs to be different from 1 to be successfully written, and if Data Version corresponding to the refund operation can be 2.
The embodiment checks the event identifier, so that the repeated storage of the service data can be avoided. For example, when the service data is bill data, after the transfer is initiated, and when the payment is clicked, a multiple payment request is generated, at this time, an interface for storing the bill data is called three times, and three pieces of the same bill data are written, but the three pieces of the bill data should not be written into the storage area. Generally, the event identifications of the three billing data are all the same. After the three pieces of billing data are sent to the server, the current event identifier is an event identifier corresponding to the initiated transfer, and is different from the event identifiers of the three pieces of billing data, so that one piece of billing data is updated into the storage area, meanwhile, the event identifier at the moment is also updated into the event identifier corresponding to the received money, and the event identifiers of the other two pieces of redundant billing data are the same and cannot be written into the storage area.
In addition, the event identification is verified, and data intrusion can be avoided. If the program is abnormal, the business Data belonging to the business area A is stored in the target sub-storage area of the business area B, and the Data intrusion operation cannot be carried out because the Data Version is not correct.
Optionally, in some embodiments, before the step of storing the service data in the target sub-storage area, the method may further include:
writing the storage operation information corresponding to the service data into an operation log;
after storing the service data into the target sub-storage area, the method further includes:
and when the service data is not successfully stored in the target sub-storage area, the service data is stored in the target sub-storage area again based on the storage operation information corresponding to the service data in the operation log.
In some embodiments, before the service data is stored in the target sub-storage area, an operation record may be written into the operation log, that is, storage operation information corresponding to the service data is written into the operation log, and the storage operation information may include storage content (that is, the service data) and the like. For example, the content of the storage operation information may be that the user 1 initiates a transfer of 10 money to the user 2 at time a. In this embodiment, the storage operation information corresponding to the service data may be written to the operation log, the service data may be operated, and the service data may be stored in the target sub-storage area, so that the storage operation information of the service data may be backed up, so that when the data storage system does not actually write the service data, the service data in the target sub-storage area may be recovered or restored according to the storage operation information corresponding to the service data in the operation log.
In some embodiments, the step of "storing the service data in the target sub-storage area" may include:
storing the service data to the target sub-storage area, and generating target storage operation information corresponding to the service data;
when the service data is not successfully stored in the target sub-storage area, before the service data is stored in the target sub-storage area again based on the storage operation information corresponding to the service data in the operation log, the method further includes:
comparing the target storage operation information with the storage operation information corresponding to the service data in the operation log;
and determining whether the service data is successfully stored in the target sub-storage area or not based on the comparison result.
The target storage operation information records real storage operation information of the service data, namely the service data really stored in the target sub-storage area; the storage operation information in the operation log is expected storage operation information of the service data, and the service data is compared with the expected storage operation information of the service data, so that whether the service data is really stored in the target sub-storage area or not can be determined. If the two are the same, the service data is successfully stored in the target sub-storage area, and if the two are different, the service data is not successfully stored in the target sub-storage area.
Wherein, the target storage operation information and the storage operation information in the operation log can be compared through diff. Wherein diff may be used to compare the difference of two text files; diff may compare the similarities and differences of text files in a line-by-line manner.
In a specific embodiment, the storage architecture of the business data may adopt an ElasticSearch, as shown in fig. 1c, the application layer is responsible for receiving various requests from a user, for example, the application layer may receive a request for verifying whether the business data is successfully written into the target sub-storage region, the application layer forwards the storage Operation information of the business data to a Dao layer of the ElasticSearch, and the Dao layer of the ElasticSearch writes the storage Operation information into an Operation log (op log, Operation log). After the service data is stored in the target sub-storage area, whether the service data is really stored in the target sub-storage area is checked, target storage operation information corresponding to the service data is obtained through routing management, the target storage operation information is compared with the storage operation information in the operation log, if the target storage operation information is different from the storage operation information in the operation log, the service data is not successfully written, the service data is requested to be rewritten, and the service data can be rewritten in the target sub-storage area based on the storage operation information in the operation log. In this embodiment, the operation log generated by the elastic searchdao is used for reconciling the service data, so that the accuracy of the data can be guaranteed.
In fig. 1c, the operation platform may be responsible for configuration management/console/monitoring alarms etc. for the ElasticSearchDao.
The elastic search is an open source search framework, is a search server, provides a full text search engine with distributed multi-user capability, and can conveniently enable a large amount of data to have the capabilities of searching, analyzing and exploring. The Dao layer of ElasticSearch may be used to interact with the database, which may be responsible for the cut operation of the data. Wherein, cut stands for Create (Create), Update (Update), read (Retrieve), and Delete (Delete) operations.
Optionally, in some embodiments, the target sub-storage area includes a base data storage block and a domain data storage block, and the base data storage block and the domain data storage block have the same storage structure; the step of storing the service data in the target sub-storage area may include:
storing the service basic data into the basic data storage block;
and storing the service domain data into the domain data storage block.
The service data may include two parts, namely service basic data and service domain data, and the two parts may be stored in different storage blocks respectively. It should be understood that the division of the service data may be set according to actual situations, and the embodiment does not limit this.
The service basic data may include a user identifier, time information, a data identifier, and the like corresponding to the service data; the data identifier may specifically be a service ticket number identifier.
Optionally, in some embodiments, the service data may be divided into three parts, which are record basic information, order basic information, and service domain data, respectively; the record basic information may include a user identifier of the service data, the order basic information may include a time information and a data identifier of the service data, and the service domain data may include a service domain identifier, service content data, and an event identifier of a service event to which the service data belongs. When the service data is stored, the three parts can be stored in different storage blocks respectively, and the storage structures of the three storage blocks can be the same.
When new service requirements or service data structure adjustment exist, the data blocks of the sub-storage area can be correspondingly adjusted. For example, new service information is added to the service data, a new storage block can be added to the sub-storage area, and the new storage block is used for storing the new service information, so that the expansibility of the storage system can be increased, and the addition and deletion of the service data are facilitated.
The scalability can refer to an expansion capability provided by the system to cope with future demand changes, and when new demands appear, the system can support the demands without or with only a small amount of modification, and the whole system is not required to be reconstructed or rebuilt.
Optionally, in some embodiments, after the step of "storing the service data in the target sub-storage area", the method may further include:
generating metadata corresponding to the business data based on the storage position of the business data in the target sub-storage area, wherein the metadata indicates the storage position of the business data;
adding the metadata to the target data node.
Metadata (Metadata) is mainly information describing data attributes, and is used to support functions such as indicating storage locations, history data, resource searching, file recording, and the like. Metadata is an electronic directory, which is information about the organization, data fields and their relationships of data, and in short, metadata is data about data.
In this embodiment, the metadata may record a specific storage location of the service data in the target sub-storage area, and the metadata is added to the target data node, so that subsequent access to the service data may be facilitated. The target data node stores metadata, namely a specific storage position, of each service data in the target sub-storage area.
The storage architecture of the storage method for the service data provided by the embodiment can also be used in the access process of the service data, and the data access efficiency can be improved.
Optionally, the method for storing service data may further include:
receiving an acquisition request of target service data, wherein the acquisition request comprises a service field identifier and a data identifier of the target service data;
determining a preset storage area corresponding to the target service data;
determining a target sub-storage area corresponding to the service field identifier from the preset storage area;
and acquiring the target service data from the target sub-storage area according to the data identifier.
Wherein, the target service data is the service data to be read. Specifically, the acquisition request may further include a user identifier of the target service data, the preset storage region corresponding to the target service data may be determined according to the user identifier, the target sub-storage region is determined from the preset storage region based on the service field identifier, and then the specific storage location of the target service data is determined from the target sub-storage region according to the data identifier, so as to acquire the target service data.
The data identifier may be a single number identifier of the service data, and if the service data is bill data, the data identifier may be a bill number.
Optionally, in some embodiments, the preset storage area further includes: the data index directory and the data nodes comprise metadata of the sub-storage areas, and the metadata indicate the storage positions of the service data;
the step of determining the target sub-storage area corresponding to the service area identifier from the preset storage area may include:
acquiring a data node index corresponding to the service field identifier from the data index directory;
determining a target data node based on the data node index, and taking a sub-storage area corresponding to the target data node as a target sub-storage area;
the step of acquiring the target service data from the target sub-storage area according to the data identifier may include:
extracting metadata corresponding to the target service data from the target data node according to the data identifier;
and acquiring the target service data from the target sub-storage area based on the metadata.
The data index directory includes data node indexes corresponding to the service fields, and the corresponding data node indexes can be searched from the data index directory according to the service field identifiers. Optionally, the target data node corresponding to the data node index may store address information of the target sub-storage area corresponding to the service domain identifier. The directory of data indices may also be viewed as a collection of indices of data nodes. The data index directory comprises a mapping relation between the service field identification and the data node index.
The data node may store a specific storage location of each service data in the sub storage area corresponding to the data node, that is, metadata corresponding to each service data. The data node may include a mapping relationship between metadata of the service data and the data identification.
Optionally, in some embodiments, the preset storage area includes a plurality of data storage areas, each data storage area stores service data in a corresponding target time, and each data storage area includes a plurality of sub storage areas isolated from each other; the acquisition request further comprises time information;
the step of determining the target sub-storage area corresponding to the service area identifier from the preset storage area may include:
determining a target data storage area corresponding to the time information from the preset storage area;
and determining a target sub-storage area corresponding to the service field identification from the target data storage area.
The data storage areas store service data of different time periods, and the user identifications of the service data in the data storage areas belonging to the same preset storage area are the same.
Each data storage area comprises a sub storage area corresponding to each service field. The data storage area in which the target service data is stored may be determined based on the time information of the target service data, and then the target sub-storage area corresponding to the service field identifier may be determined from the data storage area based on the service field identifier.
In a specific embodiment, the preset storage area may include two data storage areas, namely a first data storage area and a second data storage area, the first data storage area may be used for storing the service data of the target user within one month, and the second data storage area may be used for storing the service data of the target user before one month. If the time information of the target service data to be accessed is within one month, a first data storage area of the preset storage area where the target service data is stored can be determined, and then a target sub-storage area corresponding to the service field identifier is determined from the first data storage area based on the service field identifier of the target service data.
In some embodiments, the service data stored in the first data storage area before one month may be transferred to the second data storage area over time, so as to ensure that the service data stored in the first data storage area is the service data of the user within one month.
In a specific embodiment, the service data is bill data, and referring to fig. 1d, the service data may be an overall architecture and a storage model of a storage method of the service data, where the bill data may include a plurality of service fields, such as a payment field, a red envelope field, a transfer field, a face-to-face field, a refund field, an industry field, and the like, and after the terminal generates the bill data in a transaction, the bill event center may send the bill data to an access layer on a remote server side through a real-time writing interface of a terminal platform, and then store the bill data in a storage layer of the remote server. In the remote server, the specific process of storing the account data may be: and determining a preset storage area based on the user identifier of the account data, determining a data node index corresponding to the service field identifier from a data index directory based on the service field identifier of the account data, finding a corresponding target data node based on the data node index, wherein a sub-storage area corresponding to the target data node is a target sub-storage area of the account data, and storing the account data in the target sub-storage area.
The data structure of the bill data may be as shown in fig. 1e, the bill data may include three parts, namely record basic information, order basic information, and business field data, where the record basic information, the order basic information, and the business field data are parallel structures, the record basic information may include a user identifier of the bill data, the order basic information may include time information (i.e., transaction time) and a single number identifier (i.e., a transaction order number) of the bill data, the business field data may include a business field identifier, business content data, and an event identifier of a business event to which the bill data belongs, and the business content data may specifically include specific contents such as a hotel and a ticket.
In particular, the traffic data may be designed as a composite structure consisting of array types. Each BusinessData (service data, that is, the service domain data in the foregoing embodiment) in the array is information of one domain, and the BusinessData may be internally composed of a BusinessType (a service type, that is, the service domain identifier in the foregoing embodiment), a DataVersion (a data version, that is, the event identifier in the foregoing embodiment), and RealData (real data, that is, the service content data in the foregoing embodiment). Wherein BusinessType represents the domain type, and for example, BusinessType 34 may represent a transfer. Real data in the field is stored in the RealData, and the RealData can also be of an array type, namely, the RealData supports recording of running water information of the field.
Optionally, in this embodiment, when a new service is required, for example, a new service field needs to be added, by using the method for storing service data provided by the present application, a sub-storage region corresponding to the new service field may be added in a preset storage region, and the service data of the new service field is stored in the sub-storage region. The method and the device can facilitate adding the field of the service field, and have strong expansibility.
When the existing bill system stores the bill data, each field of the bill is stored through a wide table in a MySql (a relational database management system) database, and the type of the bill is distinguished through a business type field in the wide table. In the prior art, the expansibility is low, and if fields need to be added or deleted, the implementation cost of MySql is high. Meanwhile, the query speed of the existing scheme is low, and data can only be scanned according to the time sequence when queried. In addition, when different organizations operate on the same wide table, data contamination is easily caused.
The method for storing the service data can reorganize the service data in a domain mode, and the introduction of the service domain data can realize the isolation of the domain from a data layer, facilitate the addition or deletion of fields, and has strong expansibility; data are isolated from each other between fields, and the problem of data pollution is also improved. Meanwhile, the ElasticSearch can be used as a data storage tool, and the data query efficiency is greatly improved.
As can be seen from the above, the electronic device of this embodiment may obtain service data to be stored, where the service data includes service basic data and service field data, and the service field data includes a service field identifier and service content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area. The embodiment of the application can store the service data based on the service field identification, and improves the storage efficiency of the service data.
The method described in the foregoing embodiment will be described in further detail below by way of example in which the storage device for the service data is specifically integrated in the server.
An embodiment of the present application provides a method for storing service data, and as shown in fig. 2a, a specific process of the method for storing service data may be as follows:
201. the server receives service data to be stored, which is sent by a terminal, wherein the service data comprises service basic data and service field data, and the service field data comprises a service field identifier, service content data and an event identifier of a service event to which the service data belongs.
The service data may be billing data. And (4) billing: the user can check information such as transaction details, expense income statistics and the like according to the transaction certificate generated by the terminal side after the user carries out transaction at the terminal.
After the user successfully pays on the terminal side, corresponding bill data can be generated and stored on the terminal payment side, and meanwhile, the bill data is written on the remote storage side.
The service basic data may include a user identifier, time information, a data identifier, and the like corresponding to the service data; the data identifier may specifically be a service ticket number identifier. The service fields refer to different service types, for example, in the scene of payment transaction, the service fields may include red envelope, transfer, recharge, withdrawal and the like.
202. And the server identifies the target service field corresponding to the service data according to the service field identifier.
203. And the server determines a preset storage area to which the service data needs to be stored based on the service basic data.
In some embodiments, the service basic data includes a user identifier corresponding to the service data, and a preset storage area to which the service data needs to be stored may be determined according to the user identifier, where the service data corresponding to the user identifier is stored in the preset storage area.
The storage architecture of the service data may be a storage area divided according to the user identifier, and different user identifiers correspond to different preset storage areas.
204. The server determines a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: and each sub-storage area is used for storing the service data of the corresponding service field.
205. And the server checks the event identifier in the service field data based on the current event identifier of the service event.
The business event may include a plurality of links, which may generate a plurality of pieces of business data, and different pieces of business data belonging to the same business event correspond to different event identifiers. The event identifier is a Data Version (Data Version), and the Data Version is used as an optimistic lock, that is, a correct Data Version is required each time the business Data of the target child storage region is written or modified.
206. And when the event identifier passes the verification, the server stores the service data into the target sub-storage area, and updates the current event identifier of the service event into the event identifier in the service field data.
Optionally, in some embodiments, before the step of "storing the service data in the target sub-storage area", the method may further include:
writing the storage operation information corresponding to the service data into an operation log;
the step of storing the service data in the target sub-storage area may include:
storing the service data to the target sub-storage area, and generating target storage operation information corresponding to the service data;
after the step of storing the service data into the target sub-storage area, the method further comprises:
comparing the target storage operation information with the storage operation information corresponding to the service data in the operation log;
determining whether the service data is successfully stored in the target sub-storage area based on the comparison result;
and when the service data is not successfully stored in the target sub-storage area, the service data is stored in the target sub-storage area again based on the storage operation information corresponding to the service data in the operation log.
The target storage operation information records real storage operation information of the service data, namely the service data really stored in the target sub-storage area; the storage operation information in the operation log is expected storage operation information of the service data, and the service data is compared with the expected storage operation information of the service data, so that whether the service data is really stored in the target sub-storage area or not can be determined. If the two are the same, the service data is successfully stored in the target sub-storage area, and if the two are different, the service data is not successfully stored in the target sub-storage area.
Wherein, the target storage operation information and the storage operation information in the operation log can be compared through diff. Wherein diff may be used to compare the difference of two text files; diff may compare the similarities and differences of text files in a line-by-line manner.
Optionally, in some embodiments, the target sub-storage area includes a base data storage block and a domain data storage block, and the base data storage block and the domain data storage block have the same storage structure; the step of storing the service data in the target sub-storage area may include:
storing the service basic data into the basic data storage block;
and storing the business field data into the field data storage block.
In an embodiment, as shown in fig. 2b, a bill 1.0 is a bill operated by the storage system of the storage method of business data provided in the present application, and a bill 2.0 is a bill operated by the storage system of the prior art, where each item of data in the horizontal axis represents an operation on bill data, and respectively represents an access to "all list", "detail page", "category entry" of the bill data, and a deletion of the bill data, "filter by merchant", "filter by affinity card", or "filter by commission deduction" of the bill data. As can be seen from fig. 2b, the method provided by the present application can greatly reduce interface consumption time, where the main interface consumption time is reduced by more than 50%, and the partial interface consumption time is reduced by more than 90%; in addition, the expansibility is greatly improved; the data pollution condition is obviously improved and is obviously superior to the prior art.
The scheme provided by the embodiment can be applied to the payment of the user bill at the terminal side, and the user bill data is stored through the scheme, so that the waiting time for the user to inquire the bill data can be reduced, and the reading efficiency of the system account data is improved.
In some embodiments, when the user completes the payment operation on the terminal side, the bill data corresponding to the payment operation may be generated on the terminal side, the bill data may include business basic data and business field data, and the business field data may include business field identification and business content data. As shown in fig. 2c, a bill generated for paying the transportation fee, wherein the business basic data of the bill may include payment time and payment user identification; the service field identifier may be secret payment exemption, traffic payment, or the like, and may be specifically set according to an actual situation, which is not limited in this embodiment; the service content data may include information such as the amount of the deduction fee, the riding time, and the riding route. Meanwhile, the terminal can send the account data to the server, so that the server can store the account data based on the service field identification of the account data. For a specific storage process, reference may be made to the description of the foregoing embodiments, which are not described herein again.
Optionally, in this embodiment, the bill page on the terminal side may be used to query the bill data, and the bill page may be as shown in fig. 2d, where each field type may be displayed in the bill page based on a trigger operation on the field selection control (i.e., an icon corresponding to "all field types" in fig. 2 d), and the bill data in the target field type may be displayed in the bill page based on a determination operation on the target field type. Through the business data storage method provided by the application, the bill data of the target field type can be rapidly accessed.
As can be seen from the above, in this embodiment, the service data to be stored, which is sent by the terminal, may be received by the server, where the service data includes service basic data and service field data, and the service field data includes a service field identifier, service content data, and an event identifier of a service event to which the service data belongs; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; based on the current event identifier of the service event, verifying the event identifier in the service field data; and when the event identifier passes the verification, the server stores the service data into the target sub-storage area, and updates the current event identifier of the service event into the event identifier in the service field data. The embodiment of the application can store the service data based on the service field identification, and improves the storage efficiency of the service data.
In order to better implement the above method, an embodiment of the present application further provides a storage device for service data, as shown in fig. 3a, the storage device for service data may include an obtaining unit 301, an identifying unit 302, a first determining unit 303, a second determining unit 304, and a storage unit 305, as follows:
(1) an acquisition unit 301;
an obtaining unit 301, configured to obtain service data to be stored, where the service data includes service basic data and service field data, and the service field data includes a service field identifier and service content data.
(2) An identification unit 302;
an identifying unit 302, configured to identify, according to the service domain identifier, a target service domain corresponding to the service data.
(3) A first determination unit 303;
a first determining unit 303, configured to determine, based on the service basic data, a preset storage area to which the service data needs to be stored.
(4) A second determination unit 304;
a second determining unit 304, configured to determine, from the preset storage area, a target sub-storage area corresponding to the target service area, where the preset storage area includes: and each sub-storage area is used for storing the service data of the corresponding service field.
Optionally, in some embodiments of the present application, the preset storage area further includes: the second determining unit 304 may include a first obtaining subunit 3041 and a second determining subunit 3042, referring to fig. 3b, as follows:
the first obtaining subunit 3041 is configured to obtain, from the data index directory, a data node index corresponding to the target service field;
a second determining subunit 3042, configured to determine a target data node based on the data node index, and use a sub storage area corresponding to the target data node as a target sub storage area.
(5) A storage unit 305;
a storage unit 305, configured to store the service data in the target sub-storage area.
Optionally, in some embodiments of the present application, the service domain data further includes an event identifier of a service event to which the service data belongs; the storage unit 305 may comprise a syndrome unit 3051 and a storage subunit 3052, see fig. 3c, as follows:
the checking subunit 3051 is configured to check, based on the current event identifier of the service event, the event identifier in the service field data;
a storage subunit 3052, configured to store the service data in the target sub-storage area when the event identifier passes the check.
Optionally, in some embodiments of the present application, the storage unit 305 may further include an updating subunit 3053, see fig. 3d, as follows:
the updating subunit 3053 is configured to update the current event identifier of the service event to the event identifier in the service domain data.
Optionally, in some embodiments of the present application, the storage unit 305 may include a writing subunit 3054, a first storage subunit 3055, and a second storage subunit 3056, see fig. 3e, as follows:
the writing subunit 3054 is configured to write the storage operation information corresponding to the service data into an operation log;
a first storage subunit 3055, configured to store the service data in the target sub-storage area;
a second storing subunit 3056, configured to, when the service data is not successfully stored in the target sub-storage area, restore the service data to the target sub-storage area based on the storage operation information corresponding to the service data in the operation log.
Optionally, in some embodiments of the present application, the first storage subunit 3055 may be specifically configured to store the service data in the target sub-storage region, and generate target storage operation information corresponding to the service data;
the storage unit 305 may further comprise a comparing subunit 3057 and a first determining subunit 3058, see fig. 3f, as follows:
the comparing subunit 3057 is configured to compare the target storage operation information with the storage operation information corresponding to the service data in the operation log;
a first determining subunit 3058, configured to determine, based on the comparison result, whether the service data is successfully stored in the target sub-storage region.
Optionally, in some embodiments of the present application, the target sub-storage area includes a base data storage block and a domain data storage block, and the base data storage block and the domain data storage block have the same storage structure; the storage unit 305 may comprise a third storage subunit 3059 and a fourth storage subunit 30510, see fig. 3g, as follows:
the third storage subunit 3059, configured to store the service basic data in the basic data storage block;
a fourth storage subunit 30510, configured to store the service domain data in the domain data storage block.
Optionally, in some embodiments of the present application, the storage unit 305 may further include a generation subunit 30511 and an addition subunit 30512, see fig. 3h, as follows:
the generating subunit 30511 is configured to generate, based on a storage location of the service data in the target sub-storage area, metadata corresponding to the service data, where the metadata indicates the storage location of the service data;
an adding sub-unit 30512, configured to add the metadata to the target data node.
Optionally, in some embodiments of the present application, the storage device for the service data may further include a receiving unit 306, a third determining unit 307, a fourth determining unit 308, and a data obtaining unit 309, see fig. 3i, as follows:
the receiving unit 306 is configured to receive an acquisition request of target service data, where the acquisition request includes a service field identifier and a data identifier of the target service data;
a third determining unit 307, configured to determine a preset storage area corresponding to the target service data;
a fourth determining unit 308, configured to determine, from the preset storage area, a target sub-storage area corresponding to the service domain identifier;
a data obtaining unit 309, configured to obtain the target service data from the target sub-storage area according to the data identifier.
Optionally, in some embodiments of the present application, the preset storage area further includes: the data index directory and the data nodes comprise metadata of the sub-storage areas, and the metadata indicate the storage positions of the service data;
the fourth determining unit 308 may comprise a second obtaining sub-unit 3081 and a third determining sub-unit 3082, see fig. 3j, as follows:
the second obtaining subunit 3081, configured to obtain, from the data index directory, a data node index corresponding to the service domain identifier;
a third determining subunit 3082, configured to determine a target data node based on the data node index, and use a sub-storage region corresponding to the target data node as a target sub-storage region.
The data acquisition unit 309 may comprise an extraction sub-unit 3091 and a third acquisition sub-unit 3092, see fig. 3k, as follows:
the extracting subunit 3091, configured to extract, according to the data identifier, metadata corresponding to the target service data from the target data node;
a third obtaining subunit 3092, configured to obtain the target service data from the target sub-storage area based on the metadata.
Optionally, in some embodiments of the present application, the preset storage area includes a plurality of data storage areas, each data storage area stores service data in a corresponding target time, and each data storage area includes a plurality of sub storage areas isolated from each other; the acquisition request further comprises time information;
the fourth determination unit 308 may comprise a fourth determination subunit 3083 and a fifth determination subunit 3084, see fig. 3l, as follows:
the fourth determining subunit 3083, configured to determine, from the preset storage area, a target data storage area corresponding to the time information;
a fifth determining subunit 3084, configured to determine, from the target data storage area, a target sub-storage area corresponding to the service domain identifier.
As can be seen from the above, in this embodiment, the obtaining unit 301 obtains service data to be stored, where the service data includes service basic data and service field data, and the service field data includes a service field identifier and service content data; identifying a target service field corresponding to the service data according to the service field identifier by an identification unit 302; determining, by the first determining unit 303, a preset storage area to which the service data needs to be stored based on the service basic data; determining, by the second determining unit 304, a target sub-storage area corresponding to the target service area from the preset storage area, where the preset storage area includes: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; the service data is stored in the target sub-storage area through the storage unit 305. The embodiment of the application can store the service data based on the service field identification, and improves the storage efficiency of the service data.
An electronic device according to an embodiment of the present application is further provided, as shown in fig. 4, and shows a schematic structural diagram of the electronic device according to the embodiment of the present application, where the electronic device may be a terminal or a server, and specifically:
the electronic device may include components such as a processor 401 of one or more processing cores, memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 4 does not constitute a limitation of the electronic device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 401 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby integrally monitoring the electronic device. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by operating the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
The electronic device further comprises a power supply 403 for supplying power to the various components, and preferably, the power supply 403 is logically connected to the processor 401 through a power management system, so that functions of managing charging, discharging, and power consumption are realized through the power management system. The power supply 403 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The electronic device may further include an input unit 404, and the input unit 404 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the electronic device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 401 in the electronic device loads the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the application program stored in the memory 402, thereby implementing various functions as follows:
acquiring service data to be stored, wherein the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
As can be seen from the above, the embodiment may obtain service data to be stored, where the service data includes service basic data and service field data, and the service field data includes a service field identifier and service content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area. The embodiment of the application can store the service data based on the service field identification, and improves the storage efficiency of the service data.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a storage medium, in which a plurality of instructions are stored, where the instructions can be loaded by a processor to execute the steps in any one of the storage methods for service data provided in the present application. For example, the instructions may perform the steps of:
acquiring service data to be stored, wherein the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data; identifying a target service field corresponding to the service data according to the service field identifier; determining a preset storage area to which the service data need to be stored based on the service basic data; determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field; and storing the service data to the target sub-storage area.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium can execute the steps in any service data storage method provided in the embodiment of the present application, beneficial effects that can be achieved by any service data storage method provided in the embodiment of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to execute the method provided in the various alternative implementations of the storage aspect of the business data.
The foregoing describes in detail a method, an apparatus, an electronic device, and a storage medium for storing business data provided in an embodiment of the present application, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the foregoing embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (14)

1. A method for storing service data, comprising:
acquiring service data to be stored, wherein the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data;
identifying a target service field corresponding to the service data according to the service field identifier;
determining a preset storage area to which the service data need to be stored based on the service basic data;
determining a target sub-storage area corresponding to the target service field from the preset storage area, wherein the preset storage area comprises: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field;
and storing the service data to the target sub-storage area.
2. The method according to claim 1, wherein the service domain data further comprises an event identifier of a service event to which the service data belongs; before storing the service data into the target sub-storage area, the method further includes:
based on the current event identifier of the service event, verifying the event identifier in the service field data;
the storing the service data to the target sub-storage area includes:
and when the event identification passes the verification, storing the service data into the target sub-storage area.
3. The method of claim 2, wherein after storing the service data in the target sub-storage area when the event identifier is verified, further comprising:
and updating the current event identifier of the business event into the event identifier in the business field data.
4. The method of claim 1, wherein before storing the service data in the target sub-storage area, further comprising:
writing the storage operation information corresponding to the service data into an operation log;
after storing the service data into the target sub-storage area, the method further includes:
and when the service data is not successfully stored in the target sub-storage area, the service data is stored in the target sub-storage area again based on the storage operation information corresponding to the service data in the operation log.
5. The method of claim 4, wherein the storing the service data in the target sub-storage area comprises:
storing the service data to the target sub-storage area, and generating target storage operation information corresponding to the service data;
when the service data is not successfully stored in the target sub-storage area, before the service data is stored in the target sub-storage area again based on the storage operation information corresponding to the service data in the operation log, the method further includes:
comparing the target storage operation information with the storage operation information corresponding to the service data in the operation log;
and determining whether the service data is successfully stored in the target sub-storage area or not based on the comparison result.
6. The method of claim 1, wherein the target sub-storage area comprises a base data storage block and a domain data storage block, the base data storage block and the domain data storage block having a same storage structure; the storing the service data to the target sub-storage area includes:
storing the service basic data into the basic data storage block;
and storing the business field data into the field data storage block.
7. The method of claim 1, wherein the presetting the storage area further comprises: the determining of the target sub-storage area corresponding to the target service field from the preset storage area comprises:
acquiring a data node index corresponding to the target service field from the data index directory;
and determining a target data node based on the data node index, and taking a sub-storage area corresponding to the target data node as a target sub-storage area.
8. The method of claim 7, wherein after storing the service data in the target sub-storage area, further comprising:
generating metadata corresponding to the business data based on the storage position of the business data in the target sub-storage area, wherein the metadata indicates the storage position of the business data;
adding the metadata to the target data node.
9. The method of claim 1, further comprising:
receiving an acquisition request of target service data, wherein the acquisition request comprises a service field identifier and a data identifier of the target service data;
determining a preset storage area corresponding to the target service data;
determining a target sub-storage area corresponding to the service field identifier from the preset storage area;
and acquiring the target service data from the target sub-storage area according to the data identifier.
10. The method of claim 9, wherein the presetting the storage area further comprises: the data index directory and the data nodes comprise metadata of the sub-storage areas, and the metadata indicate the storage positions of the service data;
the determining the target sub-storage area corresponding to the service field identifier from the preset storage area includes:
acquiring a data node index corresponding to the service field identifier from the data index directory;
determining a target data node based on the data node index, and taking a sub-storage area corresponding to the target data node as a target sub-storage area;
the acquiring the target service data from the target sub-storage area according to the data identifier includes:
extracting metadata corresponding to the target service data from the target data node according to the data identifier;
and acquiring the target service data from the target sub-storage area based on the metadata.
11. The method according to claim 9, wherein the preset storage area comprises a plurality of data storage areas, each data storage area stores service data in a corresponding target time, and each data storage area comprises a plurality of sub storage areas isolated from each other; the acquisition request further comprises time information;
the determining the target sub-storage area corresponding to the service field identifier from the preset storage area includes:
determining a target data storage area corresponding to the time information from the preset storage area;
and determining a target sub-storage area corresponding to the service field identifier from the target data storage area.
12. A device for storing service data, comprising:
the device comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring service data to be stored, the service data comprises service basic data and service field data, and the service field data comprises a service field identifier and service content data;
the identification unit is used for identifying the target service field corresponding to the service data according to the service field identifier;
the first determining unit is used for determining a preset storage area to which the service data needs to be stored based on the service basic data;
a second determining unit, configured to determine, from the preset storage area, a target sub-storage area corresponding to the target service area, where the preset storage area includes: the system comprises a plurality of mutually isolated sub-storage areas, a plurality of storage units and a plurality of storage units, wherein each sub-storage area is used for storing service data of a corresponding service field;
and the storage unit is used for storing the service data into the target sub-storage area.
13. An electronic device comprising a memory and a processor; the memory stores an application program, and the processor is configured to execute the application program in the memory to perform the steps in the method for storing business data according to any one of claims 1 to 11.
14. A storage medium, characterized in that the storage medium stores a plurality of instructions, which are suitable for being loaded by a processor to execute the steps in the method for storing service data according to any one of claims 1 to 11.
CN202011472401.9A 2020-12-14 2020-12-14 Business data storage method and device, electronic equipment and storage medium Pending CN114625729A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011472401.9A CN114625729A (en) 2020-12-14 2020-12-14 Business data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011472401.9A CN114625729A (en) 2020-12-14 2020-12-14 Business data storage method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114625729A true CN114625729A (en) 2022-06-14

Family

ID=81897089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011472401.9A Pending CN114625729A (en) 2020-12-14 2020-12-14 Business data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114625729A (en)

Similar Documents

Publication Publication Date Title
CN102629247B (en) Method, device and system for data processing
US7036149B2 (en) Computer system
US20090012932A1 (en) Method and System For Data Storage And Management
CN103460197A (en) Computer system, file management method and metadata server
CN110188103A (en) Data account checking method, device, equipment and storage medium
CN104584524A (en) Aggregating data in a mediation system
CN104050276A (en) Cache processing method and system of distributed database
CN110287201A (en) Data access method, device, equipment and storage medium
CN112416960A (en) Data processing method, device and equipment under multiple scenes and storage medium
CN111917834A (en) Data synchronization method and device, storage medium and computer equipment
WO2020215580A1 (en) Distributed global data deduplication method and device
US20060112083A1 (en) Object relation information management program, method, and apparatus
CN106649530B (en) Cloud detail query management system and method
CN109947730B (en) Metadata recovery method, device, distributed file system and readable storage medium
CN112800066B (en) Index management method, related equipment and storage medium
CN103503388B (en) A kind of distributed queue's message read method and equipment, system
CN106250501A (en) Report processing method and reporting system
CN112241474A (en) Information processing method, device and storage medium
CN111753141B (en) Data management method and related equipment
CN112241396A (en) Spark-based method and Spark-based system for merging small files of Delta
CN111581227A (en) Event pushing method and device, computer equipment and storage medium
CN114625729A (en) Business data storage method and device, electronic equipment and storage medium
Ronström et al. Design and Modelling of a Parallel Data Server for Telecom Applications
CN114398452A (en) Component splitting method, device, equipment and readable storage medium
CN111352985A (en) Data service platform, method and storage medium based on computer system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination