Database data processing method and device based on distributed file storage

By generating and storing index files in a distributed file storage database and using distributed computing to provide vector search services, it solves the problem of low search efficiency in unstructured document management systems and achieves efficient retrieval of massive data.

CN118626464APending Publication Date: 2024-09-10GUANGDONG POWER GRID CO LTD +1
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410821724.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In large enterprises, in unstructured document management systems, simple keyword searches cannot effectively handle semantic similarities, resulting in one-sided and omitted search results, and existing technologies fail to effectively improve data search efficiency, especially under massive amounts of data. .

Method used

By obtaining incremental document data in the distributed file storage database, using message queues and index synchronization processes to generate index files, and writing them to the distributed file storage system, distributed computing methods are used to provide vector search services and achieve Efficient retrieval of unstructured data.

Benefits of technology

It improves the search efficiency of unstructured data, avoids the additional computing resources required for vector library search under massive data, and enables fast and accurate search of enterprise unstructured documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626464A
    Figure CN118626464A
Patent Text Reader

Abstract

The invention discloses a data processing method and device of a database based on distributed file storage. Relates to the technical field of data search. The method comprises the steps that incremental document data are obtained from a file storage system of a target database, the type of the target database comprises a database for distributed file storage, and the data type of the incremental document data comprises unstructured data; writing the incremental document data into a first message queue, and writing the incremental document data in the first message queue into a target buffer area; and generating an index file based on the incremental document data in the target buffer area, and writing the index file into a file storage system of the target database to provide a distributed vector search service which is used for searching data by adopting a distributed calculation mode based on a vector search engine. The technical problem of low data search efficiency caused by poor data storage effect of unstructured data in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data search, and in particular to a data processing method and device for a database based on distributed file storage. Background Art

[0002] In large enterprises, there are a large number of unstructured documents, and they contain a large number of industry terms, synonyms, abbreviations, and synonyms with a variety of semantic expressions. In an enterprise's unstructured document management system, simple keyword search often cannot meet the needs of the enterprise's actual usage scenarios. Because of the neglect of semantic similarity, the search results are one-sided and omissions, and the search effect needs to be improved urgently. In recent years, many companies have introduced semantic search into their internal unstructured document search functions to assist and improve traditional search results, such as introducing vector libraries and other solutions to perform semantic similarity calculations in vector space. However, with massive unstructured documents in large enterprises, vector library searches often require additional computing hardware resources.

[0003] In the related technologies, in the face of massive unstructured documents in enterprises, the distributed storage solutions have not fully considered the distributed computing requirements at the service call level, nor have they been combined with other unstructured and semi-structured database storage solutions. The latter still exist in large quantities in some enterprises' unstructured document management systems, and data storage cannot be expanded horizontally. In addition, in the distributed file storage solutions in the related technologies, vector library searches often require additional computing hardware resources under massive unstructured documents, resulting in low data search efficiency.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide a data processing method and device for a database based on distributed file storage, so as to at least solve the technical problem in the related art that the data storage effect of unstructured data is poor, resulting in low data search efficiency.

[0006] According to one aspect of an embodiment of the present invention, a data processing method for a database based on distributed file storage is provided, comprising: acquiring incremental document data from a file storage system of a target database, wherein the type of the target database comprises: a database with distributed file storage, the incremental document data comprises: document data of a changed document, and the data type of the incremental document data comprises: unstructured data; writing the incremental document data into a first message queue, and writing the incremental document data in the first message queue into a target buffer; generating an index file based on the incremental document data in the target buffer, and writing the index file into the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine.

[0007] Furthermore, based on the incremental document data in the target buffer, an index file is generated, and the index file is written into the file storage system of the target database, including: based on the incremental document data in the target buffer, refreshing the index in the index space using an index synchronization process, wherein the index synchronization process uses a coroutine mechanism to refresh the index in the index space, and the index space is used to record the index of the document; based on the refreshed index space, determining the index file, and writing the index file into the file storage system of the target database, wherein the index file is used to retrieve the changed document.

[0008] Furthermore, writing the index file into the file storage system of the target database includes: adding the index file to a second message queue, wherein the subject of the second message queue is different from the subject of the first message queue; and writing the index file in the second message queue into the file storage system of the target database.

[0009] Furthermore, based on the incremental document data in the target buffer, an index in the index space is refreshed using an index synchronization process, and based on the refreshed index space, an index file is determined, including: when the incremental document data represents that the change method for changing the document is to add data or modify data, based on the incremental document data and word embedding method, an index synchronization process is used to update the index in the index space; when the incremental document data represents that the change method for changing the document is to delete data, based on the incremental document data, an index synchronization process is used to delete a target index associated with the document in the index space, wherein the target index includes: an index of the data deleted in the document.

[0010] Further, in a case where the incremental document data represents that the change method for changing the document is to add data or to modify data, based on the incremental document data and the word embedding method, the index in the index space is updated using an index synchronization process, including: in a case where the incremental document data represents that the change method for changing the document is to add data, based on the incremental document data and the word embedding method, an index of the newly added data of the document is added to the index space using an index synchronization process, wherein the index of the newly added data of the document at least records the data identifier of the newly added data in the target database; in a case where the incremental document data represents that the change method for changing the document is to modify data, based on the incremental document data and the word embedding method, the index of the document in the index space is modified using an index synchronization process.

[0011] Furthermore, the incremental document data is written into a first message queue, and the incremental document data in the first message queue is written into a target buffer, including: creating a stream processing task, wherein the stream processing task refers to a stored procedure of the target database; executing the stream processing task, and writing the incremental document data into the first message queue; and upon detecting that the incremental document data exists in the first message queue, writing the incremental document data in the first message queue into the target buffer.

[0012] Furthermore, after writing the index file into the file storage system of the target database, it also includes: receiving a data search task for performing a data search on designated data, and distributing the data search task to multiple service nodes of the vector search engine; using the multiple service nodes, loading the index file from the file storage system of the target database, and searching the designated data based on the index file to obtain search results.

[0013] According to another aspect of an embodiment of the present invention, a data processing device for a database based on distributed file storage is also provided, including: an acquisition unit, used to acquire incremental document data from a file storage system of a target database, wherein the type of the target database includes: a database with distributed file storage, the incremental document data includes: document data of a changed document, and the data type of the incremental document data includes: unstructured data; a first processing unit, used to write the incremental document data into a first message queue, and write the incremental document data in the first message queue into a target buffer; a second processing unit, used to generate an index file based on the incremental document data in the target buffer, and write the index file into the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine.

[0014] Furthermore, the second processing unit includes: a refresh subunit, used to refresh the index in the index space based on the incremental document data in the target buffer using an index synchronization process, wherein the index synchronization process uses a coroutine mechanism to refresh the index in the index space, and the index space is used to record the index of the document; a processing subunit, used to determine an index file based on the refreshed index space, and write the index file into the file storage system of the target database, wherein the index file is used to retrieve the changed document.

[0015] Furthermore, the processing subunit includes: an adding module, used to add the index file to a second message queue, wherein the subject of the second message queue is different from the subject of the first message queue; and a writing module, used to write the index file in the second message queue into the file storage system of the target database.

[0016] Furthermore, the refresh sub-unit includes: an update module, which is used to update the index in the index space by using an index synchronization process based on the incremental document data and a word embedding method, when the incremental document data represents a change in a manner of adding data or modifying data; and a deletion module, which is used to delete a target index associated with the document in the index space by using an index synchronization process based on the incremental document data, when the incremental document data represents a change in a manner of deleting data, wherein the target index includes: an index of the data deleted in the document.

[0017] Furthermore, the update module includes: an adding submodule for adding an index of the newly added data of the document in the index space using an index synchronization process based on the incremental document data and the word embedding method, when the incremental document data represents a change in a manner that changes the document as adding new data; wherein the index of the newly added data of the document at least records a data identifier of the newly added data in the target database; and a modifying submodule for modifying the index of the document in the index space using an index synchronization process based on the incremental document data and the word embedding method, when the incremental document data represents a change in a manner that changes the document as modifying data.

[0018] Furthermore, the first processing unit includes: a creation module, used to create a stream processing task, wherein the stream processing task refers to a stored procedure of the target database; an execution module, used to execute the stream processing task and write the incremental document data into the first message queue; and a writing module, used to write the incremental document data in the first message queue into the target buffer when it is monitored that the incremental document data exists in the first message queue.

[0019] Furthermore, the data processing device of the database based on distributed file storage also includes: a third processing unit, which is used to receive a data search task for performing data search on designated data after writing the index file into the file storage system of the target database, and distribute the data search task to multiple service nodes of the vector search engine; a fourth processing unit, which is used to load the index file from the file storage system of the target database using the multiple service nodes, and search for the designated data based on the index file to obtain search results.

[0020] According to another aspect of an embodiment of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned data processing methods of a database based on distributed file storage by executing the executable instructions.

[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned data processing methods of a database based on distributed file storage.

[0022] In the present invention, incremental document data is obtained from a file storage system of a target database, wherein the type of the target database includes: a database of distributed file storage, the incremental document data includes: document data of a modified document, and the data type of the incremental document data includes: unstructured data; the incremental document data is written into a first message queue, and the incremental document data in the first message queue is written into a target buffer; an index file is generated based on the incremental document data in the target buffer, and the index file is written into the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine, thereby solving the technical problem that the data storage effect of unstructured data is poor and the data search efficiency is low in the related technology. In the present invention, an index file is generated by using a message queue and a database of distributed file storage, and is stored in a database of distributed file storage to provide a distributed vector search service, thereby avoiding the situation in the related technology that it is difficult to quickly search a large amount of unstructured data, thereby achieving the technical effect of improving the data search efficiency of unstructured data. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0024] Figure 1 is a flow chart of an optional data processing method of a database based on distributed file storage according to an embodiment of the present invention;

[0025] Figure 2 is a flowchart of another optional data processing method of a database based on distributed file storage according to an embodiment of the present invention;

[0026] Figure 3 is a schematic diagram of an optional data processing device of a database based on distributed file storage according to an embodiment of the present invention;

[0027] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

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

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

[0030] Embodiment 1

[0031] According to an embodiment of the present invention, an optional method embodiment of a data processing method for a database based on distributed file storage is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0032] Figure 1 is a flow chart of an optional data processing method of a database based on distributed file storage according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0033] Step S101, acquiring incremental document data from a file storage system of a target database, wherein the type of the target database includes: a distributed file storage database, the incremental document data includes: document data of a modified document, and the data type of the incremental document data includes: unstructured data.

[0034] The types of the above-mentioned target database include: a database for distributed file storage, for example, MongoDB (a database for distributed file storage), the above-mentioned file storage system may refer to GridFS (a storage mechanism) in MongoDB, and the above-mentioned incremental document data may record the document data of updated documents, which may include file types.

[0035] Step S102: writing incremental document data into the first message queue, and writing the incremental document data in the first message queue into the target buffer.

[0036] The above-mentioned target buffer may refer to the buffer of a distributed vector search engine (Distributed-FAISS). In this embodiment, the incremental document data may be written to a topic agreed upon by Kafka (corresponding to the first message queue), and then the incremental document data in the first message queue may be written to the target buffer by monitoring the incremental data in the first message queue.

[0037] Step S103, based on the incremental document data in the target buffer, an index file is generated, and the index file is written into the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine.

[0038] The file storage system of the target database may refer to a GridFS cluster, and the GridFS cluster may refer to a cluster composed of multiple GridFS servers. The above-mentioned vector search engine may refer to a distributed vector search engine (for example, Distributed-FAISS). In this embodiment, an index file may be generated based on the incremental document data in the target buffer, and the index file may be written to the second message queue. Then, the index file may be asynchronously written to the file storage system of the target database through the second message queue to avoid data blocking.

[0039] Through the above steps, in this embodiment, the index file is generated by using the message queue and the database of the distributed file storage, and stored in the database of the distributed file storage to provide a distributed vector search service, thereby avoiding the difficulty in quickly searching massive amounts of unstructured data in the related art, thereby achieving the technical effect of improving the data search efficiency of unstructured data. This solves the technical problem of poor data storage effect of unstructured data in the related art, resulting in low data search efficiency.

[0040] Optionally, based on the incremental document data in the target buffer, an index file is generated, and the index file is written to the file storage system of the target database, including: based on the incremental document data in the target buffer, refreshing the index in the index space using an index synchronization process, wherein the index synchronization process uses a coroutine mechanism to refresh the index in the index space, and the index space is used to record the index of the document; based on the refreshed index space, determining the index file, and writing the index file to the file storage system of the target database, wherein the index file is used to retrieve the changed document.

[0041] The above-mentioned index synchronization process can be a coroutine mechanism based on Python (a programming language), which is used to batch refresh the source data (i.e., document incremental data) to the index space without blocking and affecting the index service as much as possible. In this embodiment, adding an index can essentially be a process of parsing word embedding and training in the vector space model, which is relatively resource-intensive. Before replacing the online index, the two processes of parsing word embedding and training in the vector space model are preprocessed.

[0042] After refreshing the index space, the index file can be obtained, and then the index file can be persistently stored in the file storage system of the target database (for example, the GridFS cluster) through the second message queue. Since the GridFS cluster has the ability to scale horizontally, the horizontal scalability of distributed file storage is improved, which is convenient for coping with massive data scenarios.

[0043] Optionally, writing the index file into the file storage system of the target database includes: adding the index file to a second message queue, wherein the subject of the second message queue is different from the subject of the first message queue; and writing the index file in the second message queue into the file storage system of the target database.

[0044] In this embodiment, a distributed search engine can be used to save the index, and saving the index can be asynchronously executed by a storage listening thread (save watcher). In this embodiment, the distributed search engine itself can be based on file storage. In the distributed search engine, the kafka client can be integrated through the save watcher, and the code that originally writes the index to the local file can be changed to write to the kafka topic "index_${nodeId}" (corresponding to the second message queue), that is, the index file can be written to the second message queue and wait for the target database (for example, MongoDB) to save it.

[0045] When writing index files to MongoDB, you can use MongoDB Connector for Kafka (a tool that synchronizes MongoDB change event streams to Kafka), configure sinker (a component used to write data from Kafka topics to MongoDB databases), subscribe to index file data from the index_${nodeId} topic in Kafka (the second message queue), and write it to the GridFS cluster associated with the index file (corresponding to the file storage system of the target database), thereby achieving the purpose of persistent storage of incremental file data.

[0046] Optionally, based on the incremental document data in the target buffer, an index in the index space is refreshed using an index synchronization process, and based on the refreshed index space, an index file is determined, including: when the incremental document data represents a change to the document in the form of adding new data or modifying data, based on the incremental document data and word embedding, an index synchronization process is used to update the index in the index space; when the incremental document data represents a change to the document in the form of deleting data, based on the incremental document data, an index synchronization process is used to delete a target index associated with the document in the index space, wherein the target index includes: an index of data deleted from the document.

[0047] In this embodiment, after accumulating a certain amount of incremental data (corresponding to incremental document data), the incremental synchronization process can be started to train the incremental data into the index (i.e., refresh the index space). The incremental data can be divided into several types according to the incremental operations of the incremental document data: addition, modification, and deletion, and the corresponding vector search engine API is called to synchronize to the index space, thereby achieving the purpose of updating the index space.

[0048] Optionally, when the incremental document data represents a change to a document in a manner of adding data or modifying data, based on the incremental document data and word embeddings, an index in the index space is updated using an index synchronization process, including: when the incremental document data represents a change to a document in a manner of adding data, based on the incremental document data and word embeddings, an index of the newly added data in the document is added to the index space using an index synchronization process, wherein the index of the newly added data in the document at least records a data identifier of the newly added data in the target database; when the incremental document data represents a change to a document in a manner of modifying data, based on the incremental document data and word embeddings, an index of the document is modified in the index space using an index synchronization process.

[0049] For the newly added data of the document represented by the incremental document data, the newly added data is directly trained into the index, and the metadata field can be added to the relevant index. The sourceId records the ID of the data source in the corresponding mongodb (i.e. MongoDB) (corresponding to the data identifier of the newly added data in the target database), the name can record the file name of the document, and the contentType can record the file format.

[0050] For the data of the existence modification operation of the document represented by the incremental document data, the index in the index space is deleted in the vector search engine, and then a new index is added.

[0051] For the data of the existence deletion operation of the document represented by the incremental document data, the corresponding document index is deleted according to the meta information field sourceId of the index space in the vector search engine.

[0052] Optionally, the incremental document data is written to the first message queue, and the incremental document data in the first message queue is written to the target buffer, including: creating a stream processing task, wherein the stream processing task refers to a stored procedure of the target database; executing the stream processing task, writing the incremental document data to the first message queue; and when it is detected that there is incremental document data in the first message queue, writing the incremental document data in the first message queue to the target buffer.

[0053] In this embodiment, MongoDB Connector for Kafka can be used to write the incremental document data in GridFS into Kafka (i.e., the first message queue). For example, after installing MongoDB Connector For Kafka, the mongosh tool (MongoDB Shell, an interactive command line tool) can be used to create a stream processing task in MongoDB (corresponding to the target database). The stream processing task may refer to a stored procedure in mongoDB, which specifies the data source as a GridFS collection and writes the incremental data to the topic agreed upon by kafka. In this embodiment, the topic of the incremental GridFS data source can be agreed upon as source_${nodeId}. NodeId is the sharding node of the MongoDB cluster, and the node used for the vector search engine corresponds to it, and is deployed nearby to improve performance.

[0054] When incremental data is written to Kafka, the data incremental operation type can be specified, including adding, modifying, and deleting, so that the vector search engine index can make corresponding changes. In this embodiment, the source code of the distributed vector search engine can also be modified, and the FAISS Source Consumer (source data consumer) is added to the server code (the code used to create and run the server) to monitor the incremental data in Kafka to determine whether to synchronize the incremental document data buffer of the corresponding MongoDB node and then write it to the service node of the distributed vector search engine.

[0055] After confirming that the corresponding incremental document data is submitted to the buffer of the distributed vector search engine, the incremental data does not immediately trigger an index refresh, but is asynchronously written to the service node of the distributed vector search engine by the index synchronization process.

[0056] Optionally, after writing the index file to the file storage system of the target database, it also includes: receiving a data search task for performing a data search on designated data, and distributing the data search task to multiple service nodes of a vector search engine; using multiple service nodes, loading the index file from the file storage system of the target database, and searching for designated data based on the index file to obtain search results.

[0057] In this embodiment, a vector search service can be implemented based on a distributed vector search engine, and a cluster composed of service nodes of multiple vector search engines can be proxyed to implement a distributed vector search function on the cluster. In this embodiment, the distributed vector search engine can be transformed as follows and a search interface can be implemented:

[0058] (1) Modify the index server (IndexServer is a server running on the service node). Modify the code for loading indexes in the index server, integrate the MongoDB driver, and change the original implementation code that loads index files from the local system to loading index files from MongoDB's GridFS.

[0059] (2) Integrated index client (IndexClient). The vector search service is a proxy service of the FAISS service cluster. It calls the functions of each FAISS service node through the index client. At the same time, it can use the round-robin mechanism to achieve load balancing, meeting the service call layer's requirements for load balancing and distributed computing task scheduling.

[0060] (3) Vector search service can open HTTP (Hypertext Transfer Protocol) interface through FastAPI (Fast Application Programming Interface) to provide a series of search API (Application Programming Interface) services.

[0061] In this embodiment, more complete data storage and data search can be achieved from multiple aspects such as service call, distributed computing, distributed storage and automatic data synchronization. From the service call, a unified search entry can be provided, and the search task can be distributed to each FAISS node (for example, service node), and the search results can be obtained in parallel and merged and returned to the client; in terms of storage, MongoDB data sharding and other mechanisms can be used to provide guarantees for high reliability and elastic scalability; based on MongoDB connector and Kafka, the index automatic refresh mechanism of FAISS node is implemented, and the incremental synchronization mechanism of file data source is implemented in close combination with MongoDB, which provides a semantic vector search method that takes into account accuracy, high reliability, elastic scalability and high performance for massive unstructured documents of enterprises.

[0062] Embodiment 2

[0063] Embodiment 2 of the present invention provides another optional database processing method based on distributed file storage. Figure 2 is a flowchart of another optional data processing method of a database based on distributed file storage according to an embodiment of the present invention, such as Figure 2 As shown, including:

[0064] Step 1: MongoDB writes incremental document data to Kafka (corresponding to the first message queue):

[0065] Use MongoDB Connector for Kafka to write incremental document data in GridFS to Kafka.

[0066] After installing MongoDB Connector For Kafka, use the mongosh tool to create a stream processing task in MongoDB. A stream processing task is a stored procedure in mongoDB. It specifies the data source as a GridFS collection and writes incremental data to the topic agreed upon by Kafka. In this embodiment, the topic for the incremental GridFS data source is source_${nodeId}. NodeId is the shard node of the MongoDB cluster, which is used for the FAISS node to correspond to it and be deployed nearby to improve performance.

[0067] Incremental data writing requires specifying the data incremental operation type, including adding, modifying, and deleting, so that the FAISS index can make corresponding changes.

[0068] Step 2: FAISS Source Consumer loads incremental document data:

[0069] Modify the Distributed-FAISS source code and add FAISS SourceConsumer to the server (service) code to monitor the incremental data in Kafka to determine whether to synchronize the incremental data of the corresponding MongoDB node to the FAISS service node.

[0070] Step 3, submit to the Distributed-FAISS buffer:

[0071] Submit the corresponding incremental source data (incremental document data) to the Distributed-FAISS buffer. At this time, the incremental data does not immediately trigger an index refresh, but is asynchronously written to the FAISS service node by the index synchronization process.

[0072] Step 4: The index synchronization process determines whether to refresh the index:

[0073] The index synchronization process is based on the Python coroutine mechanism, which aims to batch refresh the source data to the index space without blocking or affecting the index service. Since adding an index is essentially a process of parsing word embeddings and training a vector space model, it is quite resource-intensive. Step 4: Preprocess these two tasks before replacing the online index.

[0074] Step 5: Incremental training into the index:

[0075] After accumulating a certain amount of incremental data (i.e., incremental document data), the index synchronization process starts the incremental synchronization process to train the incremental data into the index.

[0076] According to the incremental operation in step 1, you can divide the incremental data into several types: new, modified, and deleted. Call the corresponding FAISS API to synchronize it to the index.

[0077] Correspondingly, the newly added data is directly trained into the index space. In this embodiment, a meta information field may also be added to the index, where sourceId records the ID of the corresponding data source in MongoDB, name records the file name of the document, and contentType records the file format.

[0078] The modification operation can delete the index in FAISS and then add a new index.

[0079] The delete operation can delete the corresponding document index according to the sourceId meta-information field indexed in FAISS.

[0080] Step 6, save the index to Kafka:

[0081] Saving the index can be performed asynchronously by a storage watcher thread. Distributed-FAISS itself is based on file storage. In the present invention, Distributed-FAISS is modified as follows:

[0082] The save watcher integrates the Kafka client and changes the code that originally writes the index to the local file to write it to the Kafka topic "index_${nodeId}" and wait for MongoDB to save it.

[0083] Step 7, write the index file to mongodb:

[0084] Use MongoDB Connector for Kafka, configure sinker, subscribe to index file data from the index_${nodeId} topic in Kafka, and write it to the GridFS cluster of index files.

[0085] Step 8: Provide distributed vector search service:

[0086] Based on Distributed-FAISS, a vector search service is implemented, and a cluster consisting of multiple FAISS service nodes is proxyed to implement a distributed vector search function on the cluster. In the present invention, Distributed-FAISS is transformed as follows and a search interface is implemented:

[0087] (1) Modify the index server (IndexServer, which is a server running on the FAISS service node). Modify the code for loading indexes in the index server, integrate the MongoDB driver, and change the original implementation code that loads index files from the local system to loading index files from MongoDB's GridFS.

[0088] (2) Integrated Index Client. The vector search service is a proxy service of the FAISS service cluster. It calls the functions of each FAISS service node through the index client. At the same time, it uses the round-robin mechanism to achieve load balancing.

[0089] (3) The vector search service opens the HTTP interface through FastAPI and provides a series of search API services.

[0090] In this embodiment, more complete data storage and data search can be achieved from multiple aspects such as service call, distributed computing, distributed storage and automatic data synchronization. From the service call, a unified search entry can be provided, and the search task can be distributed to each FAISS node, and the search results can be obtained in parallel and merged and returned to the client; in terms of storage, mongodb data sharding and other mechanisms can be used to provide guarantees for high reliability and elastic scalability; based on mongodb connector and Kafka, the index automatic refresh mechanism of FAISS node is implemented, and the incremental synchronization mechanism of file data source is implemented in close combination with mongodb, which provides a semantic vector search solution that takes into account accuracy, high reliability, elastic scalability and high performance for massive unstructured documents of enterprises.

[0091] Embodiment 3

[0092] Embodiment 3 of the present invention provides an optional data processing device for a distributed file storage database, and each implementation unit in the data processing device corresponds to each implementation step in Embodiment 1.

[0093] Figure 3 is a schematic diagram of an optional data processing device based on a distributed file storage database according to an embodiment of the present invention, such as Figure 3 As shown, the data processing device includes: an acquisition unit 31, a first processing unit 32 and a second processing unit 33.

[0094] The acquisition unit 31 is used to acquire incremental document data from a file storage system of a target database, wherein the type of the target database includes: a distributed file storage database, the incremental document data includes: document data of a modified document, and the data type of the incremental document data includes: unstructured data;

[0095] The first processing unit 32 is used to write the incremental document data into the first message queue, and write the incremental document data in the first message queue into the target buffer;

[0096] The second processing unit 33 is used to generate an index file based on the incremental document data in the target buffer, and write the index file to the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine.

[0097] In the data processing device of the database based on distributed file storage provided in the third embodiment of the present invention, incremental document data can be acquired from the file storage system of the target database by the acquisition unit 31, wherein the type of the target database includes: a database of distributed file storage, the incremental document data includes: document data of the changed document, and the data type of the incremental document data includes: unstructured data, the incremental document data is written into the first message queue by the first processing unit 32, and the incremental document data in the first message queue is written into the target buffer, and the index file is generated based on the incremental document data in the target buffer by the second processing unit 33, and the index file is written into the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine. Thus, the technical problem that the data storage effect of unstructured data is poor in the related technology, resulting in low data search efficiency is solved.

[0098] In this embodiment, an index file is generated by using a message queue and a distributed file storage database, and is stored in the distributed file storage database to provide a distributed vector search service, thereby avoiding the difficulty in quickly searching massive amounts of unstructured data in related technologies, thereby achieving the technical effect of improving the data search efficiency of unstructured data.

[0099] Optionally, in the data processing device of a database based on distributed file storage provided in Example 3 of the present invention, the second processing unit includes: a refresh sub-unit, used to refresh the index in the index space based on the incremental document data in the target buffer using an index synchronization process, wherein the index synchronization process uses a coroutine mechanism to refresh the index in the index space, and the index space is used to record the index of the document; a processing sub-unit, used to determine the index file based on the refreshed index space, and write the index file into the file storage system of the target database, wherein the index file is used to retrieve the changed document.

[0100] Optionally, in the data processing device of a database based on distributed file storage provided in Example 3 of the present invention, the processing sub-unit includes: an adding module, used to add an index file to a second message queue, wherein the subject of the second message queue is different from the subject of the first message queue; and a writing module, used to write the index file in the second message queue into the file storage system of the target database.

[0101] Optionally, in the data processing device of the database based on distributed file storage provided in Example 3 of the present invention, the refresh sub-unit includes: an update module, which is used to update the index in the index space by using the index synchronization process based on the incremental document data and the word embedding method when the incremental document data represents that the change method of the change to the document is to add data or modify data; and a deletion module, which is used to delete the target index associated with the document in the index space by using the index synchronization process based on the incremental document data when the incremental document data represents that the change method of the change to the document is to delete data, wherein the target index includes: the index of the data deleted in the document.

[0102] Optionally, in the data processing device of the database based on distributed file storage provided in Example 3 of the present invention, the update module includes: an adding sub-module for adding an index of the newly added data of the document in the index space using an index synchronization process based on the incremental document data and a word embedding method when the incremental document data represents a change in a manner of changing the document as adding new data, wherein the index of the newly added data of the document at least records a data identifier of the newly added data in the target database; and a modifying sub-module for modifying the index of the document in the index space using an index synchronization process based on the incremental document data and a word embedding method when the incremental document data represents a change in a manner of changing the document as modifying the data.

[0103] Optionally, in the data processing device of a database based on distributed file storage provided in Example 3 of the present invention, the first processing unit includes: a creation module, used to create a stream processing task, wherein the stream processing task refers to a stored procedure of the target database; an execution module, used to execute the stream processing task and write the incremental document data to the first message queue; and a writing module, used to write the incremental document data in the first message queue to the target buffer when it is monitored that there is incremental document data in the first message queue.

[0104] Optionally, in the data processing device of a database based on distributed file storage provided in Embodiment 3 of the present invention, the data processing device of a database based on distributed file storage also includes: a third processing unit, used to receive a data search task for performing a data search on designated data after writing the index file into the file storage system of the target database, and distribute the data search task to multiple service nodes of the vector search engine; a fourth processing unit, used to load the index file from the file storage system of the target database using multiple service nodes, and search for designated data based on the index file to obtain search results.

[0105] The above-mentioned data processing device of the database based on distributed file storage may also include a processor and a memory. The above-mentioned acquisition unit 31, the first processing unit 32 and the second processing unit 33, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.

[0106] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters are adjusted to utilize the message queue and the distributed file storage database to generate index files, and store them in the distributed file storage database to provide distributed vector search services, thereby avoiding the difficulty in quickly searching massive amounts of unstructured data in related technologies, thereby achieving the technical effect of improving the data search efficiency of unstructured data.

[0107] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.

[0108] According to another aspect of an embodiment of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned data processing methods of a database based on distributed file storage by executing the executable instructions.

[0109] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned data processing methods of a database based on distributed file storage.

[0110] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention, such as Figure 4 As shown, an embodiment of the present invention provides an electronic device 40, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, any one of the above-mentioned data processing methods of a database based on distributed file storage is implemented.

[0111] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0112] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

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

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

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

[0116] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

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

Claims

1. A data processing method based on a distributed file storage database, characterized in that: include: Acquire incremental document data from a file storage system of a target database, wherein the type of the target database includes: a distributed file storage database, the incremental document data includes: document data of a modified document, and the data type of the incremental document data includes: unstructured data; Writing the incremental document data into a first message queue, and writing the incremental document data in the first message queue into a target buffer; An index file is generated based on the incremental document data in the target buffer, and the index file is written to the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine.

2. The data processing method according to claim 1, characterized in that: Generating an index file based on the incremental document data in the target buffer, and writing the index file into the file storage system of the target database, including: Based on the incremental document data in the target buffer, refreshing the index in the index space by using an index synchronization process, wherein the index synchronization process uses a coroutine mechanism to refresh the index in the index space, and the index space is used to record the index of the document; Based on the refreshed index space, an index file is determined, and the index file is written into a file storage system of the target database, wherein the index file is used to retrieve the modified document.

3. The processing method according to claim 2, characterized in that: Writing the index file into the file storage system of the target database includes: Adding the index file to a second message queue, wherein the subject of the second message queue is different from the subject of the first message queue; The index file in the second message queue is written into the file storage system of the target database.

4. The data processing method according to claim 2, characterized in that: Based on the incremental document data in the target buffer, refreshing the index in the index space using the index synchronization process, and determining the index file based on the refreshed index space, including: In a case where the incremental document data represents that the change to the document is a change in the form of adding data or modifying data, updating the index in the index space by using an index synchronization process based on the incremental document data and the word embedding method; In the case where the incremental document data represents that the change to the document is made by deleting data, based on the incremental document data, an index synchronization process is used to delete a target index associated with the document in the index space, wherein the target index includes: an index of the data deleted in the document.

5. The data processing method according to claim 4, characterized in that: In a case where the incremental document data represents that the change to the document is to add data or modify data, updating the index in the index space by using an index synchronization process based on the incremental document data and the word embedding method includes: In the case where the incremental document data represents that the change mode of the change to the document is the addition of new data, based on the incremental document data and the word embedding mode, an index of the newly added data of the document is added in the index space by using an index synchronization process, wherein the index of the newly added data of the document at least records a data identifier of the newly added data in the target database; In the case where the incremental document data represents a change to the document in a manner of modifying data, the index of the document is modified in the index space using an index synchronization process based on the incremental document data and the word embedding manner.

6. The data processing method according to claim 1, characterized in that: Writing the incremental document data into a first message queue, and writing the incremental document data in the first message queue into a target buffer, comprises: Creating a stream processing task, wherein the stream processing task refers to a stored procedure of the target database; Execute the stream processing task and write the incremental document data into the first message queue; In the case where it is monitored that the incremental document data exists in the first message queue, the incremental document data in the first message queue is written into the target buffer.

7. The data processing method according to claim 1, characterized in that: After writing the index file into the file storage system of the target database, the method further includes: receiving a data search task for performing data search on designated data, and distributing the data search task to a plurality of service nodes of the vector search engine; The index file is loaded from the file storage system of the target database by using the multiple service nodes, and the designated data is searched based on the index file to obtain search results.

8. A data processing device based on a distributed file storage database, characterized in that: include: An acquisition unit is used to acquire incremental document data from a file storage system of a target database, wherein the type of the target database includes: a distributed file storage database, the incremental document data includes: document data of a modified document, and the data type of the incremental document data includes: unstructured data; A first processing unit, configured to write the incremental document data into a first message queue, and write the incremental document data in the first message queue into a target buffer; The second processing unit is used to generate an index file based on the incremental document data in the target buffer, and write the index file to the file storage system of the target database to provide a distributed vector search service, wherein the distributed vector search service is used to search data in a distributed computing manner based on a vector search engine.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the data processing method of a database based on distributed file storage as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method of a database based on distributed file storage as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Multi-modal data storage method and device, equipment, medium and product

    CN120950005A

  • Method for generating highway engineering feasibility research report based on local large model training

    CN121413576A

  • Method for generating feasibility study report of highway engineering based on local large model training

    CN121413576B