Data modification method and device for distributed storage system and electronic equipment

CN118733557APending Publication Date: 2024-10-01INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410902060.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

[0005]本发明实施例提供了一种用于分布式存储系统的数据修改方法及其装置、电子设备,以至少解决相关技术中分布式文件存储系统内不支持修改存储文件,造成文件修改效率低的技术问题

Benefits of technology

[0026] In this disclosure, in the distributed storage system, in response to the data modification operation, the current page of the data to be modified in the file fragment to which it belongs is located. Each time a data modification operation is performed, only the data of the current page is supported, and modification is not supported. For data on other pages, query the offset when data is modified in the current page. According to the operation type and offset of the data modification operation, data is modified in the current page in the file fragment to which it belongs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733557A_ABST
    Figure CN118733557A_ABST
Patent Text Reader

Abstract

The invention discloses a data modification method and device for a distributed storage system and electronic equipment, and relates to the field of big data, the field of financial science and technology or other related technical fields, and the method comprises the steps: responding to a data modification operation, positioning a current page of to-be-modified data in a file fragment to which the to-be-modified data belongs, and storing the to-be-modified data in the file fragment to which the to-be-modified data belongs; and when the data modification operation is executed every time, only data of the current page is supported to be modified, data of other pages is not supported to be modified, the offset when data modification is carried out in the current page is inquired, and data modification is carried out in the current page in the file fragment according to the operation type and the offset of the data modification operation. According to the method and the device, the technical problem of low file modification efficiency caused by the fact that a distributed file storage system does not support storage file modification in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data, financial technology or other related fields, and in particular to a data modification method and device and electronic device for a distributed storage system. Background Art

[0002] The current industry standard in the field of big data is Hadoop. Hadoop is an ecosystem that includes HDFS (Hadoop distributed file storage system), MapReduce (component for distributed computing of data stored in HDFS), Hbase (distributed database), and many other components based on the Hadoop ecosystem. For HDFS, a large-capacity client is required (at least larger than the file to be uploaded). The client can upload large files to HDFS composed of multiple nodes using Hadoop-specific instructions to complete distributed storage. If you want to add data later, you can append the data to HDFS on the client. The number of nodes (number of servers) of the distributed file storage system can be continuously increased to cope with more and more data.

[0003] In the related art, although the distributed file storage system HDFS supports appending data, it adopts a write-once, read-many strategy. It does not support modification of files stored in the distributed file storage system. If you want to modify them, you must first modify them on the client and then re-upload them. The distributed file storage system cannot modify files. If you keep appending data, the files on the system will become larger and larger. At this time, if you find that the data in the files on the system is wrong, on the one hand, you cannot modify them directly, and on the other hand, even the client may not be able to put this huge file, let alone re-upload it, which will result in low file modification 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 modification method and device and an electronic device for a distributed storage system, so as to at least solve the technical problem in the related art that the distributed file storage system does not support the modification of stored files, resulting in low file modification efficiency.

[0006] According to one aspect of an embodiment of the present invention, there is provided a data modification method for a distributed storage system, which is applied to an editor in the distributed storage system, wherein the distributed storage system comprises: a client, a master server, N slave servers and the editor, wherein the client is used to upload a target file, the master server is used to record slave server information storing the target file, and the slave server is used to store M file fragments, wherein the M file fragments are obtained by dividing the target file, and the data modification method for the distributed storage system comprises: responding to a data modification operation, locating a current page of data to be modified in the corresponding file fragment, wherein each time the data modification operation is performed, only the modification of data on the current page is supported, and the modification of data on other pages is not supported; querying an offset when performing data modification in the current page; and performing data modification in the current page in the corresponding file fragment according to the operation type of the data modification operation and the offset.

[0007] Optionally, according to the operation type of the data modification operation and the offset, the step of performing data modification in the current page in the file segment to which it belongs includes: when the operation type of the data modification operation is a deletion operation, according to the numerical value of the offset, adding spaces of corresponding size at the position of the deleted data in the current page, wherein the number of newly added spaces is consistent with the number indicated by the numerical value of the offset; when the deletion operation is completed and the first save operation is received, saving all data in the current page, and appending header data of the next file segment after the file segment to which it belongs with the same numerical value as the offset to the tail of the file segment to which it belongs, and iterating the data in other file segments in sequence; for the Mth file segment, when the data in the Mth file segment is less than the numerical value of the offset, appending the data in the Mth file segment to the tail of the M-1th file segment, and deleting the Mth file segment.

[0008] Optionally, according to the operation type of the data modification operation and the offset, the step of performing data modification in the current page in the file fragment to which it belongs includes: when the operation type of the data modification operation is a new addition operation, according to the numerical value of the offset, saving the newly added data at the position involved in the new addition operation in the current page, and temporarily storing the tail data in the current page in the cache space, wherein the number of temporarily stored tail data is consistent with the number indicated by the numerical value of the offset; adding the tail data temporarily stored in the cache space to the header of the next file fragment after the file fragment to which it belongs, and iterating the data in other file fragments in turn, and for the Mth file fragment, when the total amount of data in the Mth file fragment is greater than the total amount of fragments threshold, adding a file fragment in the slave server to which it belongs to obtain the M+1th file fragment.

[0009] Optionally, according to the operation type of the data modification operation and the offset, the step of performing data modification in the current page in the file fragment to which it belongs includes: when the operation type of the data modification operation is a modification operation, executing a data modification strategy corresponding to a deletion operation or a new addition operation according to the size of the offset, wherein when the offset is a positive value, the data modification strategy corresponding to the new addition operation is executed, and when the offset is a negative value, the data modification strategy corresponding to the deletion operation is executed; when the size of the offset is 0, modifying the data corresponding to the position in the current page according to the position of the modification operation, and not modifying the data of other pages.

[0010] Optionally, the data modification method for a distributed storage system also includes: responding to a data query operation, parsing a keyword to be searched; locating the current page of the data to be searched in the corresponding file fragment; searching the current page according to the keyword query; when the keyword cannot be found in the current page, determining whether the next page after the current page exceeds the corresponding file fragment; when the next page exceeds the corresponding file fragment, searching for a slave server that stores the next file fragment of the target file in the corresponding file fragment, and searching for the keyword in the slave server associated with the next file fragment; when the keyword cannot be found in the Mth file fragment, checking whether the keyword exists starting from the first file fragment; when the keyword cannot be found in all file fragments, outputting a notification that the keyword does not exist; or, when the keyword is found, locating the position of the file fragment where the keyword is located, and displaying the page to which the keyword belongs.

[0011] Optionally, the data modification method for a distributed storage system also includes: responding to a file storage command, cutting the received target file into M parts of the same size to obtain M file fragments, wherein the sizes of the first M-1 file fragments are the same and the size of the Mth file fragment can be adjusted; obtaining the names of all slave servers, and using a modulo algorithm to calculate the slave server where each file fragment is to be stored; recording the file name, file size, and name of the slave server to which each file fragment is distributed of the target file to obtain record information, and sending the record information to the master server.

[0012] Optionally, the data modification method for a distributed storage system also includes: responding to a file read command, querying file metadata in the master server based on the file identifier; determining the name of the slave server where the file to be read is distributed based on the file metadata; locating the file fragments in each of the slave servers, and reading all of the file fragments in each of the slave servers.

[0013] Optionally, the data modification method for a distributed storage system also includes: responding to a file display command, inputting the specified jump page number into a first predetermined formula to obtain the file fragment number and the slave server to which it belongs; inputting the specified jump page number and the file fragment number into a second predetermined formula to obtain the byte size of the jump page; based on the byte size of the jump page and the preset display page size, reading the data of the specified byte segment, and displaying the read data as the current page on the target interface.

[0014] According to another aspect of an embodiment of the present invention, a distributed storage system is also provided, including: a client, used to upload a target file; a master server, used to record slave server information storing the target file; N slave servers, each of which is used to store M file fragments, and the M file fragments are obtained by dividing the target file; an editor, which executes any one of the above-mentioned data modification methods for a distributed storage system.

[0015] According to another aspect of an embodiment of the present invention, there is also provided a data modification device for a distributed storage system, which is applied to an editor in the distributed storage system. The distributed storage system includes: a client, a master server, N slave servers and the editor, wherein the client is used to upload a target file, the master server is used to record slave server information storing the target file, and the slave server is used to store M file fragments, wherein the M file fragments are obtained by dividing the target file. The data modification device for the distributed storage system includes: an operation response unit, which is used to respond to a data modification operation and locate the current page of the data to be modified in the corresponding file fragment, wherein each time the data modification operation is performed, only the modification of the data of the current page is supported, and the modification of the data of other pages is not supported; an offset query unit, which is used to query the offset when performing data modification in the current page; and a data modification unit, which is used to modify the data in the current page in the corresponding file fragment according to the operation type of the data modification operation and the offset.

[0016] Optionally, the data modification unit includes: a space adding module, which is used to add spaces of corresponding size at the position of the deleted data in the current page according to the numerical value of the offset when the operation type of the data modification operation is a deletion operation, wherein the number of newly added spaces is consistent with the number indicated by the numerical value of the offset; a first data saving module, which is used to save all data in the current page when the deletion operation is completed and the first saving operation is received, and append the header data of the next file fragment after the file fragment to which it belongs that is the same as the numerical value of the offset to the tail of the file fragment to which it belongs, and iterate the data in other file fragments in sequence; a data appending module, which is used to append the data in the Mth file fragment to the tail of the M-1th file fragment for the Mth file fragment when the data in the Mth file fragment is less than the numerical value of the offset, and delete the Mth file fragment.

[0017] Optionally, the data modification unit includes: a second data saving module, which is used to save the newly added data at the position involved in the new operation in the current page according to the numerical value of the offset when the operation type of the data modification operation is a new operation, and temporarily store the tail data in the current page in the cache space, wherein the number of temporarily stored tail data is consistent with the number indicated by the numerical value of the offset; a data adding module, which is used to add the tail data temporarily stored in the cache space to the header of the next file fragment after the file fragment to which it belongs, and iterate the data in other file fragments in turn. For the Mth file fragment, when the total amount of data in the Mth file fragment is greater than the total amount of fragments threshold, a file fragment is added to the corresponding slave server to obtain the M+1th file fragment.

[0018] Optionally, the data modification unit includes: an operation execution module, which is used to, when the operation type of the data modification operation is a modification operation, execute a data modification strategy corresponding to a deletion operation or a new addition operation according to the size of the offset, wherein when the offset is a positive value, the data modification strategy corresponding to the new addition operation is executed, and when the offset is a negative value, the data modification strategy corresponding to the deletion operation is executed; and a data page modification module, which is used to, when the size of the offset is 0, modify the data corresponding to the position in the current page according to the position of the modification operation, without modifying the data of other pages.

[0019] Optionally, the data modification device for a distributed storage system further includes: a query operation response unit, for responding to a data query operation and parsing a keyword to be searched; a page positioning unit, for positioning the current page of the data to be searched in the corresponding file fragment; a first keyword search unit, for searching in the current page according to the keyword query; a page judgment unit, for judging whether the next page after the current page exceeds the corresponding file fragment if the keyword cannot be found in the current page; a fragment search unit, for searching a slave server storing the next file fragment of the target file in the corresponding file fragment if the next page exceeds the corresponding file fragment, and searching whether the keyword exists in the next file fragment associated with the slave server; a second keyword search unit, for checking whether the keyword exists from the first file fragment if the keyword cannot be found in the Mth file fragment; a notification output unit, for outputting a notification that the keyword does not exist if the keyword cannot be found in all file fragments; or a keyword display unit, for locating the position of the file fragment where the keyword is located and displaying the page to which the keyword belongs if the keyword is found.

[0020] Optionally, the data modification device for a distributed storage system also includes: a storage command response unit, used to respond to a file storage command, cut the received target file into M parts of the same size, and obtain M file fragments, wherein the sizes of the first M-1 file fragments are the same, and the size of the Mth file fragment can be adjusted; a name acquisition unit, used to obtain the names of all slave servers, and use a modulo algorithm to calculate the slave server where each file fragment is to be stored; an information recording unit, used to record the file name, file size, and name of the slave server where each file fragment is distributed of the target file, obtain record information, and send the record information to the master server.

[0021] Optionally, the data modification device for a distributed storage system also includes: a read command response unit, used to respond to a file read command and query file metadata in the master server based on the file identifier; a name determination unit, used to determine the name of the slave server where the file to be read is distributed based on the file metadata; and a file fragment positioning unit, used to locate the file fragments in each of the slave servers and read all of the file fragments in each of the slave servers.

[0022] Optionally, the data modification device for a distributed storage system also includes: a display command response unit, used to respond to a file display command, input the specified jump page number into a first predetermined formula, and obtain the file fragment number and the slave server to which it belongs; a formula calculation unit, used to input the specified jump page number and the file fragment number into a second predetermined formula, and obtain the byte size of the jump page; a data interface display unit, used to read the data of the specified byte segment based on the byte size of the jump page and the preset display page size, and display the read data as the current page on the target interface.

[0023] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, wherein the computer-readable storage medium includes a stored 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 modification methods for a distributed storage system.

[0024] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising 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 any one of the above-mentioned data modification methods for a distributed storage system.

[0025] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned methods for modifying data in a distributed storage system are implemented.

[0026] In the present disclosure, in a distributed storage system, in response to a data modification operation, the current page of the data to be modified in the corresponding file fragment is located. Each time a data modification operation is performed, only the data of the current page is supported to be modified, and the data of other pages is not supported to be modified. The offset when the data is modified in the current page is queried, and the data is modified in the current page in the corresponding file fragment according to the operation type and offset of the data modification operation.

[0027] In the present disclosure, the files / data stored in the distributed storage system can be modified in real time. When making specific modifications, the offset when modifying the data in the current page is first queried, and then the operation type and offset are used to modify the data in the current page in the corresponding file segment. By directly modifying the files on the newly developed distributed file storage system, the defects of the original industry standard HDFS are overcome, the data modification efficiency is significantly improved, the operation of big data is made more convenient, and the technical problem in the related technology that the distributed file storage system does not support the modification of stored files, resulting in low file modification efficiency is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] 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:

[0029] Figure 1 is a flow chart of an optional data modification method for a distributed storage system according to an embodiment of the present invention;

[0030] Figure 2 is a schematic diagram of an optional distributed storage system according to an embodiment of the present invention;

[0031] Figure 3 is a schematic diagram of an optional editor interface according to an embodiment of the present invention;

[0032] Figure 4 is a schematic diagram of an optional data modification device for a distributed storage system according to an embodiment of the present invention;

[0033] Figure 5 It is a hardware structure block diagram of an electronic device (or mobile device) for a data modification method in a distributed storage system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0034] 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.

[0035] 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.

[0036] To facilitate those skilled in the art to understand the present invention, some terms or nouns involved in the embodiments of the present invention are explained below:

[0037] Distributed storage refers to the situation where a single server cannot store large files and a file system consisting of multiple nodes (servers) is needed to store the files. It is mostly used in the field of big data.

[0038] hadoop distributed file storage system, Hadoop Distributed Fi le System, referred to as hdfs.

[0039] Byte conversion, 1K=1024 bytes, 1M=1024K. Generally speaking, one English character is one byte, and one Chinese character occupies two bytes.

[0040] It should be noted that the data modification method and apparatus for a distributed storage system in the present disclosure can be used in the field of financial technology to realize the function of randomly modifying the data of a distributed storage system, and can also be used in any field other than the field of financial technology to realize the function of randomly modifying the data of a distributed storage system. The present disclosure does not limit the application field of the data modification method and apparatus for a distributed storage system.

[0041] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) collected by this disclosure are information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation portals are provided for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0042] It should be noted that in the present disclosure, when collecting and analyzing customer information, corresponding operation entrances are provided for users to choose to agree or reject the automated decision results; if the user chooses to reject, the expert decision-making process is entered.

[0043] The following embodiments of the present invention can be applied to various systems / applications / devices for data modification in distributed storage systems. The present invention can directly modify files on a newly developed distributed file system, overcome the defects of the original industry standard HDFS, and make the operation of big data more convenient.

[0044] The present invention is described in detail below in conjunction with various embodiments.

[0045] Embodiment 1

[0046] According to an embodiment of the present invention, an embodiment of a data modification method for a distributed storage system 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.

[0047] According to an embodiment of the present invention, a data modification method for a distributed storage system is provided, which is applied to an editor in the distributed storage system. The distributed storage system includes: a client, a master server, N slave servers and an editor. The client is used to upload a target file, the master server is used to record slave server information storing the target file, and the slave server is used to store M file fragments, and the M file fragments are obtained by dividing the target file.

[0048] In the embodiment of the present invention, the distributed storage system (or distributed file storage system) adopts a master-slave mode, and the architecture is a client, a master server (referred to as the host) and N slave servers (referred to as slaves). The host is defined as the Master, which is responsible for recording which slaves the super-large files are stored on. Such records are called metadata; the slave is defined as the Slave, which is responsible for storing file fragments; the client is the Client, which is responsible for uploading super-large files. At the same time, an editor is also provided in this embodiment for modifying files, storing files, etc.

[0049] Figure 1 is a flow chart of an optional data modification method for a distributed storage system according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0050] Step S101, in response to a data modification operation, locate the current page of the data to be modified in the corresponding file segment, wherein each time a data modification operation is performed, only the data of the current page is supported to be modified, and the data of other pages is not supported to be modified.

[0051] In the prior art, the scenario of data modification on the distributed storage system is not a high-frequency scenario. When data needs to be modified, it will be downloaded to the client first. After the data is modified by the client, the modified data will be uploaded to the system. However, this method of modifying data involves cross-servers, which is more complicated and inefficient. Compared with the cumbersome and inefficient data modification in the prior art, the data modification method provided in this embodiment simplifies it, stipulates that only the data of the current page can be modified each time, and does not support modifying multiple pages of data at a time, such as not supporting the modification of both the data of page 1 and the data of page 100.

[0052] Step S102, querying the offset when modifying data in the current page.

[0053] Step S103: modify the data in the current page in the corresponding file segment according to the operation type and offset of the data modification operation.

[0054] Through the above steps, the data modification operation can be responded to, the current page of the data to be modified in the file segment to which it belongs can be located, and each time the data modification operation is performed, only the data of the current page can be modified, and the data of other pages can not be modified. The offset when the data is modified in the current page is queried, and the data is modified in the current page in the file segment to which it belongs according to the operation type and offset of the data modification operation. In this embodiment, the files / data stored in the distributed storage system can be modified in real time. When modifying the data, the offset when the data is modified in the current page is first queried, and then the operation type and offset are used to modify the data in the current page in the file segment to which it belongs. By directly modifying the file on the newly developed distributed file storage system, the defects of the original industry standard HDFS are overcome, the data modification efficiency is significantly improved, the operation of big data is made more convenient, and the technical problem that the distributed file storage system does not support the modification of the stored files in the related technology, resulting in low file modification efficiency is solved.

[0055] The embodiment of the present invention is described in detail below in combination with the above steps.

[0056] Regarding step S103, when modifying data, there are three specific cases: deleting data, adding data, and modifying data. These three cases are described below respectively.

[0057] The first one is to delete the data.

[0058] Optionally, according to the operation type and offset of the data modification operation, the step of performing data modification in the current page in the file fragment to which it belongs includes: when the operation type of the data modification operation is a deletion operation, according to the numerical value of the offset, adding spaces of corresponding size at the position of the deleted data in the current page, wherein the number of newly added spaces is consistent with the number indicated by the numerical value of the offset; when the deletion operation is completed and the first save operation is received, saving all data in the current page, and appending header data of the next file fragment after the file fragment to which it belongs with the same numerical value as the offset to the tail of the file fragment to which it belongs, and iterating the data in other file fragments in sequence; for the Mth file fragment, when the data in the Mth file fragment is less than the numerical value of the offset, appending the data in the Mth file fragment to the tail of the M-1th file fragment, and deleting the Mth file fragment.

[0059] When deleting data, you can first select the row to be deleted, and then delete the target data. At this time, the content in the editor will not directly pull up the data of the next page like the existing file deletion mode (such as word deletion mode), but leave it blank. The number of newly added spaces is equivalent to the offset. This is the principle of only modifying the data of the current page. For example: the current page is a page in aaa-1. After deleting 1k of data in the page, the data of the current page is not 64K, but 63K. The subtracted content = the number of newly added spaces, that is, the offset = negative 1K. When 1K of data is deleted from aaa-1 and the Save button is clicked, the current aaa-1 will append the head 1K data of aaa-2 in the next server server2 to the tail and save it; then the head 1K data of aaa-2 in server2 is removed, and the head 1K data of aaa-3 in server3 is appended to the tail and saved, and so on, until there is no next block.

[0060] The second method is to add new data.

[0061] Optionally, according to the operation type and offset of the data modification operation, the step of performing data modification in the current page in the corresponding file fragment includes: when the operation type of the data modification operation is a new addition operation, according to the numerical value of the offset, saving the newly added data at the position involved in the new addition operation in the current page, and temporarily storing the tail data in the current page in the cache space, wherein the number of temporarily stored tail data is consistent with the number indicated by the numerical value of the offset; adding the temporarily stored tail data in the cache space to the header of the next file fragment after the corresponding file fragment, and iterating the data in other file fragments in turn, and for the Mth file fragment, when the total amount of data in the Mth file fragment is greater than the total amount threshold of the fragments, adding a file fragment in the corresponding slave server to obtain the M+1th file fragment.

[0062] Adding data is the reverse operation of deleting data. Unlike the above-mentioned deleting data which will leave spaces on the editor, adding data will squeeze out the original tail data, and this part of the squeezed data will be temporarily stored by the system. For example, if the new data of a certain page in aaa-1 reaches 1K, that is, the amount of data squeezed out reaches 1K, then the offset is positive 1K. Similar to deleting data, while modifying the aaa-1 data, the client's scheduler will send the 1K data squeezed out of aaa-1 to server2, and let aaa-2 stored in server2 put this data at the head, and at the same time remove the 1K data at the tail of aaa-2 and send it to server3, and aaa-3 in server3 will put it at the head, and so on.

[0063] The third method is to modify the data.

[0064] Optionally, according to the operation type and offset of the data modification operation, the step of performing data modification in the current page in the corresponding file fragment includes: when the operation type of the data modification operation is a modification operation, executing a data modification strategy corresponding to a deletion operation or a new addition operation according to the size of the offset, wherein when the offset is a positive value, the data modification strategy corresponding to the new addition operation is executed, and when the offset is a negative value, the data modification strategy corresponding to the deletion operation is executed; when the size of the offset is 0, modifying the data corresponding to the position in the current page according to the position of the modification operation, and not modifying the data of other pages.

[0065] Modifying data is a combination of adding data and deleting data. In the final analysis, it depends on whether the offset is positive or negative. A positive offset is equivalent to taking the path of adding data, and a negative offset is equivalent to taking the path of deleting data. If the offset is 0, you only need to modify the data of the current block, and there is no need to modify the data on other servers.

[0066] Through the above implementation, it is possible to modify the data in the distributed storage system. Of course, the technical solution provided in this embodiment, in addition to the above modification operation, can also include query operation, storage operation, reading operation, display operation, etc.

[0067] Optionally, the data modification method for a distributed storage system also includes: responding to a data query operation, parsing a keyword to be searched; locating the current page of the data to be searched in the corresponding file fragment; searching in the current page according to the keyword query; when the keyword cannot be found in the current page, determining whether the next page after the current page exceeds the corresponding file fragment; when the next page exceeds the corresponding file fragment, searching for a slave server that stores the next file fragment of the corresponding file fragment in the target file, and searching for the keyword in the next file fragment associated with the slave server; when the keyword cannot be found in the Mth file fragment, determining whether the keyword exists starting from the first file fragment; when the keyword cannot be found in all file fragments, outputting a notification that the keyword does not exist; or, when the keyword is found, locating the position of the file fragment where the keyword is located, and displaying the page to which the keyword belongs.

[0068] This embodiment provides a keyword search function. When searching, the system will first search in the current page. If it cannot be found, it will continue to search in the next page. Each time it enters the next page, it is necessary to determine whether it has exceeded the range of the file fragment block. If it has exceeded, it is necessary to find the next sequence number block from the next server and then search again. If it is not found on the last page, it will return to block 1 of server 1 to search. If it is not found on all pages, a notification "the keyword does not exist" is issued.

[0069] Optionally, the data modification method for a distributed storage system also includes: responding to a file storage command, cutting the received target file into M parts of the same size to obtain M file fragments, wherein the sizes of the first M-1 file fragments are the same and the size of the Mth file fragment can be adjusted; obtaining the names of all slave servers, and using a modulo algorithm to calculate the slave server where each file fragment is to be stored; recording the file name, file size, and name of the slave server where each file fragment is distributed of the target file, obtaining record information, and sending the record information to the master server.

[0070] This embodiment provides a data storage function. When storing files, the files can be divided into many file segments. The sizes of the first file segments are the same (the specific file segment sizes are set according to the server data and the current data size), and only the size of the last file segment is variable. After that, the names of all current slave servers are obtained, and the modulo algorithm is used to calculate the destination of each file.

[0071] Optionally, the data modification method for a distributed storage system also includes: responding to a file read command, querying file metadata in the master server based on the file identifier; based on the file metadata, determining the name of the slave server where the file to be read is distributed; locating the file fragments in each slave server, and reading all file fragments from each slave server.

[0072] After the super large file is stored, if you want to read the contents of the target file on the file system, first read the metadata on the master server, find out which slave servers the target file is distributed on, and read all file fragments on each slave server.

[0073] Optionally, the data modification method for a distributed storage system also includes: responding to a file display command, inputting the specified jump page number into a first predetermined formula to obtain the file fragment number and the slave server to which it belongs; inputting the specified jump page number and the file fragment number into a second predetermined formula to obtain the byte size of the jump page; based on the byte size of the jump page and the preset display page size, reading the data of the specified byte segment, and displaying the read data as the current page on the target interface.

[0074] In this embodiment, the display screen of the editor is set to show only one page at a time, and each page is of a fixed size. If you want to see the data on the next or previous page, you need to slide or click the "Next Page" or "Previous Page" button at the top of the interface.

[0075] The interface in this embodiment also provides a function of jumping to a specific page. For example, if you want to jump to page 10000, the specific algorithm is:

[0076] The first predetermined formula a: (10000-1) / (128*1024 / 64)+1=5 (where * is multiplication, 128 is the size of the file segment in M, / is division but only retains the integer part, byte conversion: 1024K=1M), find the block number 5, that is, aaa-5, and use the above modulus algorithm to calculate that the block exists on server1.

[0077] The second predetermined formula b: 10000*64-128*1024*(5-1)=115712K (where 5 is the serial number of the block, and 5-1=4 is the number of blocks traversed before).

[0078] After determining the page to which the data belongs, read that section of data and display it on the interface as the current page.

[0079] Through the above-mentioned embodiments, real-time modification of data stored in the system can be realized in the new distributed storage system, thereby improving the efficiency of file modification. At the same time, the present application also realizes operations such as querying, reading, and displaying stored files through the newly created distributed storage system, thereby providing users with a more convenient distributed storage system and improving user utilization.

[0080] The present invention is described below in conjunction with another optional implementation manner.

[0081] According to another aspect of an embodiment of the present invention, a distributed storage system is also provided, including: a client, used to upload a target file; a master server, used to record slave server information storing the target file; N slave servers, each slave server is used to store M file fragments, and the M file fragments are obtained by dividing the target file; an editor, which executes any one of the above data modification methods for a distributed storage system.

[0082] Figure 2 is a schematic diagram of an optional distributed storage system according to an embodiment of the present invention, such as Figure 2 As shown, the distributed file system provided in this embodiment adopts a master-slave mode, and the architecture is a client, a master server and a slave server. The host is the Master, which is responsible for recording which slaves the super-large files are stored on. Such records are called metadata; the slave is responsible for storing file fragments; the client is responsible for uploading super-large files. This embodiment provides an editor front end for the terminal interface of the client, and an editor back end runs in the system background to respond to the operation instructions of the editor front end.

[0083] A scheduler is also deployed on the Client side, which is responsible for communicating with the Master node and each Slave node. It has two main functions: sending a "read command" to one of the Slave nodes can obtain the content of a block on the Slave; sending a "write command" to one of the Slave nodes can modify and save the content on a block on the Slave.

[0084] The first part is the implementation of storage.

[0085] Step a. Determine whether there is a file with the same name on the file system. If so, an error is reported; otherwise, continue.

[0086] Step b. Cut the file into a plurality of file segments (the file segments are defined as blocks in this implementation mode), each block is 128M, and only the size of the last block changes.

[0087] Step c. Get the names of all current Slave servers (such as Figure 1 Including from server server1, from server server2, from server server3, from server server4), use the modulus algorithm to calculate the destination of each file fragment.

[0088] For example, the size of the file aaa.txt is 888M, which can be divided into 7 blocks, 1-6 are 128M, and the last one is 120M. The 7 blocks are named aaa-1, aaa-2, aaa-3, aaa-4, aaa-5, aaa-6, aaa-7. At this time, there are 4 slave servers in the system, server1, server2, server3, and server4. Then the system will use the modulo method to calculate which slave server each block should be assigned to, and then use the program to send the block to the corresponding slave server.

[0089] aaa-1 is put on the slave server server1, and the calculation formula is: ((1-1)mod 4)+1, where mod means modulus, which means taking the remainder.

[0090] aaa-2 is put on the slave server server2, and the calculation formula is: ((2-1) mod 4) + 1.

[0091] aaa-3 is put on the slave server server3, and the calculation formula is: ((3-1) mod 4) + 1.

[0092] aaa-4 is put on the slave server server4, and the calculation formula is: ((4-1) mod 4) + 1.

[0093] aaa-5 is put on the slave server server1, and the calculation formula is: ((5-1)mod 4)+1.

[0094] Finally, the Master server will record the name, size, and distribution server of the oversized file: aaa.txt-888M-server1,2,3,4. This is to provide information for future reading.

[0095] It should be noted that the number of nodes may change in the future. For example, if a new server server5 is added, then if you want to upload another file such as bbb.txt to the file system, you must use server1-5 for distributed storage.

[0096] The second part is the implementation of reading.

[0097] After the super large file is stored, if you want to read the content of aaa.txt on the file system, first read the metadata on the Master server and find that aaa.txt is distributed on four nodes: server1, 2, 3, and 4. Through the 888M file size found in the metadata, calculate that there are a total of 7 blocks. Then you can use the modulo algorithm to locate each block in turn, that is, the first block is located on server1, the second block is located on server2...the fifth block is located on server1, and so on.

[0098] When the file content needs to be read, an editor is used that is specifically used to read and modify files on the distributed storage system. Figure 3 is a schematic diagram of an optional editor interface according to an embodiment of the present invention, such as Figure 3 As shown, keyword search, page turning (previous page button and next page button), page jump function, etc. can be realized. Before opening the editor, there will be a pop-up box to fill in the file name to be opened. This implementation takes aaa.txt as an example. After entering aaa.txt, the file interface associated with aaa.txt will be displayed, and the file name is in the upper right corner. The system will calculate the total number of pages - 14208 pages - by dividing the total size of aaa.txt, that is, 888*1024 by 64.

[0099] The editor only displays one page at a time, and each page has a fixed size of 64K content. If you want to view the data on the next or previous page, you need to click the "Next Page" or "Previous Page" button of the editor.

[0100] The editor initially displays the contents of the first page of aaa.txt, which is the first 64K content of the first block. The system will first locate the first slave server server1 through the metadata of the Master server, find the first block of aaa.txt, that is, aaa-1, on the server, and then take the first 64K content of aaa-1 and display it in the editor.

[0101] It should be noted that the editor provided in this implementation also provides a function of jumping to a specific page, such as jumping to page 10000. The specific algorithm is:

[0102] Formula a: (10000-1) / (128*1024 / 64)+1=5 (where * is multiplication, / is division but only retains the integer part, byte conversion: 1024K=1M), find the block number 5, that is, aaa-5, and use the above modulo algorithm to calculate that the block exists on server1.

[0103] Formula b: 10000*64-128*1024*(5-1)=115712K (where 5 is the block number, and 5-1=4 is the number of blocks traversed before).

[0104] The scheduler on the client side sends a "read command" to server1 to obtain the data from 115648K (115712-64=115648K) to 115712K in the block aaa-5, and displays it on the interface as the current page.

[0105] The third part is the implementation of the search function.

[0106] like Figure 3 As shown, the interface provides a keyword search function. When searching for a keyword, the system will first search in the current page, for example, from the data from 115648K to 115712K in aaa-5 on server1. If it cannot be found, it will continue to search in the next page. Each time it enters the next page, it must determine whether it has exceeded the range of the block. If it has exceeded, it is necessary to find the next block with the next serial number from the next server and then search again. If it is not found on the last page, it will return to the first 64K content of block1 on server1 for search. If it is not found on all pages, it will be notified that "the keyword does not exist."

[0107] It should be noted that in the case of aaa.txt, it is only stored in the four servers server1-4, so the next server of server1 is server2, and so on, the next server of server4 is server1.

[0108] Part 4, implementation of data modification function.

[0109] In this implementation, it is specified that only the data of the current page can be modified each time, and it does not support modifying the data of multiple pages at a time. For example, it does not support modifying the data of page 1 and the data of page 100 at the same time.

[0110] Based on the above principle, when modifying data, clicking the "Edit" button will make the "Save" button light up, so that after editing, clicking the "Save" button will restore the interface to its original state; the search function is retained, and only the data on the current page can be searched; at the same time, the "Edit", "Previous Page", "Next Page" buttons, and the jump page text box are grayed out.

[0111] The following is an explanation of the three situations of addition, deletion and modification.

[0112] a. Delete data.

[0113] When deleting data, you can first select the line you want to delete, and then click backspace to delete it. It should be noted that at this time the content in the editor will not pull up the data of the next page like Word, but will leave it blank. The number of newly added spaces is equivalent to the offset. This is the principle of only modifying the data on the current page.

[0114] For example: the current page is a page in aaa-1. After deleting 1K of data in the page, the data of the current page is not 64K, but 63K. The subtracted content = the number of newly added spaces, that is, the offset = negative 1K.

[0115] After receiving the save command, the current page is saved. All subsequent pages in the block where the page is located, as well as other blocks corresponding to all subsequent pages, must be adjusted accordingly, which will involve all servers where the subsequent blocks are located. This is a domino-like cascading process. For example, when 1K of data is deleted on aaa-1 and the Save button is clicked, the current aaa-1 will append the first 1K data of aaa-2 in the next server server2 to the tail and save it; then the first 1K data of aaa-2 in server2 is removed, and the first 1K data of aaa-3 in server3 is appended to the tail and saved, and so on, until there is no next block. It should be noted that if the last block is less than 1K, the second-to-last block will append all the contents of the last block to the tail, and the original last block will be deleted.

[0116] b. Add new data.

[0117] Adding data is the reverse operation of deleting data. Unlike deleting data which will leave a space in the editor, adding data will squeeze out the original data at the end, and this squeezed data will be temporarily stored by the system.

[0118] For example, if the newly added data of a certain page in the current aaa-1 reaches 1K, that is, the amount of data squeezed out reaches 1K, then the offset is positive 1K, similar to deleting data. After clicking the "Save" button, while modifying the aaa-1 data, the client-side scheduler will send the 1K data squeezed out from aaa-1 to server2, so that aaa-2 stored in server2 will put this data at the head, and at the same time remove the 1K data at the end of aaa-2 and send it to server3, and aaa-3 in server3 will put it at the head, and so on. It should be noted that if the amount of data in the last block exceeds 128M after adding 1K, a new block needs to be created on the next server of the server where the last block is located (for example, the next one of server1 is server2, and the next one of server4 is server1), named aaa-n, where n is the serial number of the extension, and its size is the size of the original last block + 1K-128M.

[0119] c. Modify data.

[0120] In this implementation, the data modification operation is a combination of adding data and deleting data. In the final analysis, it depends on whether the offset is positive or negative. A positive offset is equivalent to taking the path of adding data, and a negative offset is equivalent to taking the path of deleting data. If the offset is 0, you only need to modify the data of the current block, and there is no need to modify the data on other servers. For example, the current page data is:

[0121] "aaaaaaaaa

[0122] bbbbbbbb".

[0123] Modify to: "aaaaaaaaa

[0124] bbbbbcbb".

[0125] By comparison, we can see that the offset before and after the modification is 0, so we only need to modify the data of the block where the current page is located.

[0126] If the current page data is:

[0127] "aaaaaaaaa

[0128] bbbbbbbb".

[0129] Modified to:

[0130] "aaaaaaaaa

[0131] bbbbbbbbbbbbbb

[0132] ccccccccc".

[0133] The offset is a positive number, which is 6 b + 9 c = 15. For subsequent steps, refer to a. Add data strategy.

[0134] If the current page data is:

[0135] "aaaaaaaaa

[0136] bbbbbbbb".

[0137] Modified to:

[0138] "aaaaaaaaa

[0139] bbb".

[0140] The offset is a negative number, -6. For subsequent steps, refer to b. Deleting data strategy.

[0141] Through the above embodiments, data storage, reading, display and real-time modification can be achieved through a newly constructed new distributed file storage system with the function of randomly modifying data. This implementation method can directly modify files on a newly developed distributed file system, overcoming the defects of the original industry standard HDFS and making big data operations more convenient.

[0142] The following is a detailed description in conjunction with another embodiment.

[0143] Embodiment 2

[0144] A data modification device for a distributed storage system provided in this embodiment includes multiple implementation units, each implementation unit corresponds to each implementation step in the above-mentioned embodiment 1.

[0145] An embodiment of the present invention provides a data modification device for a distributed storage system, which is applied to an editor in the distributed storage system. The distributed storage system includes: a client, a master server, N slave servers and an editor. The client is used to upload a target file, the master server is used to record the slave server information storing the target file, and the slave server is used to store M file fragments, and the M file fragments are obtained by dividing the target file.

[0146] Figure 4 is a schematic diagram of an optional data modification device for a distributed storage system according to an embodiment of the present invention, such as Figure 4 As shown, the data modification device for a distributed storage system may include: an operation response unit 41, an offset query unit 42, and a data modification unit 43.

[0147] The operation response unit 41 is used to respond to the data modification operation and locate the current page of the data to be modified in the corresponding file segment. Each time the data modification operation is performed, only the data of the current page is supported to be modified, and the data of other pages is not supported to be modified.

[0148] The offset query unit 42 is used to query the offset when data is modified in the current page.

[0149] The data modification unit 43 is used to modify the data in the current page in the corresponding file segment according to the operation type and offset of the data modification operation.

[0150] The above-mentioned data modification device for distributed storage system can respond to the data modification operation through the operation response unit 41, locate the current page of the data to be modified in the file segment to which it belongs, and only support the modification of the data of the current page when performing the data modification operation each time, and do not support the modification of the data of other pages, the offset query unit 42 queries the offset when the data is modified in the current page, and the data modification unit 43 performs data modification in the current page in the file segment to which it belongs according to the operation type and offset of the data modification operation. In this embodiment, the files / data stored in the distributed storage system can be modified in real time. When modifying specifically, the offset when the data is modified in the current page is first queried, and then the operation type and offset are used to modify the data in the current page in the file segment to which it belongs. By directly modifying the file on the newly developed distributed file storage system, the defects of the original industry standard HDFS are overcome, the data modification efficiency is significantly improved, the operation of big data is made more convenient, and the technical problem of low file modification efficiency caused by the fact that the distributed file storage system does not support the modification of stored files in the related technology is solved.

[0151] Optionally, the data modification unit includes: a space adding module, which is used to add spaces of corresponding size at the position of the deleted data in the current page according to the numerical value of the offset when the operation type of the data modification operation is a deletion operation, wherein the number of newly added spaces is consistent with the number indicated by the numerical value of the offset; a first data saving module, which is used to save all data in the current page when the deletion operation is completed and the first saving operation is received, and append the header data of the next file fragment after the corresponding file fragment that is the same as the numerical value of the offset to the tail of the corresponding file fragment, and iterate the data in other file fragments in sequence; a data appending module, which is used to append the data in the Mth file fragment to the tail of the M-1th file fragment for the Mth file fragment when the data in the Mth file fragment is less than the numerical value of the offset, and delete the Mth file fragment.

[0152] Optionally, the data modification unit includes: a second data saving module, which is used to save the newly added data at the position involved in the new operation in the current page according to the numerical value of the offset when the operation type of the data modification operation is a new operation, and temporarily store the tail data in the current page in the cache space, wherein the number of temporarily stored tail data is consistent with the number indicated by the numerical value of the offset; a data adding module, which is used to add the tail data temporarily stored in the cache space to the header of the next file fragment after the corresponding file fragment, and iterate the data in other file fragments in turn, and for the Mth file fragment, when the total amount of data in the Mth file fragment is greater than the total amount of fragments threshold, add a file fragment in the corresponding slave server to obtain the M+1th file fragment.

[0153] Optionally, the data modification unit includes: an operation execution module, which is used to execute a data modification strategy corresponding to a deletion operation or a new addition operation according to the size of the offset when the operation type of the data modification operation is a modification operation, wherein when the offset is a positive value, the data modification strategy corresponding to the new addition operation is executed, and when the offset is a negative value, the data modification strategy corresponding to the deletion operation is executed; a data page modification module, which is used to modify the data corresponding to the position in the current page according to the position of the modification operation when the size of the offset is 0, without modifying the data of other pages.

[0154] Optionally, the data modification device for a distributed storage system also includes: a query operation response unit, which is used to respond to data query operations and parse keywords to be searched; a page positioning unit, which is used to locate the current page of the data to be searched in the corresponding file fragment; a first keyword search unit, which is used to search in the current page according to the keyword query; a page judgment unit, which is used to judge whether the next page after the current page exceeds the corresponding file fragment when the keyword cannot be found in the current page; a fragment search unit, which is used to search for the slave server that stores the next file fragment of the corresponding file fragment in the target file when the next page exceeds the corresponding file fragment, and find out whether the keyword exists in the next file fragment associated with the slave server; a second keyword search unit, which is used to determine whether the keyword exists from the first file fragment when the keyword cannot be found in the Mth file fragment; a notification output unit, which is used to output a notification that the keyword does not exist when the keyword cannot be found in all file fragments; or, a keyword display unit, which is used to locate the position of the file fragment where the keyword is located when the keyword is found, and display the page to which the keyword belongs.

[0155] Optionally, the data modification device for a distributed storage system also includes: a storage command response unit, used to respond to a file storage command, cut the received target file into M parts of the same size, and obtain M file fragments, wherein the sizes of the first M-1 file fragments are the same, and the size of the Mth file fragment can be adjusted; a name acquisition unit, used to obtain the names of all slave servers, and use a modulo algorithm to calculate the slave server where each file fragment is to be stored; an information recording unit, used to record the file name, file size, and name of the slave server where each file fragment is distributed of the target file, obtain record information, and send the record information to the master server.

[0156] Optionally, the data modification device for a distributed storage system also includes: a read command response unit, used to respond to a file read command and query the file metadata in the master server based on the file identifier; a name determination unit, used to determine the name of the slave server where the file to be read is distributed based on the file metadata; and a file fragment positioning unit, used to locate the file fragments in each slave server and read all file fragments from each slave server.

[0157] Optionally, the data modification device for a distributed storage system also includes: a display command response unit, used to respond to a file display command, input the specified jump page number into a first predetermined formula, and obtain the file fragment serial number and the slave server to which it belongs; a formula calculation unit, used to input the specified jump page number and the file fragment serial number into a second predetermined formula, and obtain the byte size of the jump page; a data interface display unit, used to read the data of the specified byte segment based on the byte size of the jump page and the preset display page size, and display the read data as the current page on the target interface.

[0158] The above-mentioned data modification device for a distributed storage system may also include a processor and a memory. The above-mentioned operation response unit 41, offset query unit 42, data modification unit 43, 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 corresponding functions.

[0159] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the files / data stored in the distributed storage system can be modified in real time by adjusting kernel parameters.

[0160] 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.

[0161] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored 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 data modification methods for a distributed storage system in the above-mentioned embodiment 1.

[0162] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising 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 one or more processors, the one or more processors implement the data modification method for a distributed storage system of any one of the above-mentioned embodiments one.

[0163] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of implementing the data modification method for a distributed storage system described in each embodiment of the present application include: responding to a data modification operation, locating the current page of the data to be modified in the corresponding file segment, each time a data modification operation is performed, only supporting modification of the data of the current page, and not supporting modification of the data of other pages, querying the offset when performing data modification in the current page, and modifying the data in the current page in the corresponding file segment according to the operation type and offset of the data modification operation.

[0164] The present application also provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data modification method for a distributed storage system described in each embodiment of the present application are implemented.

[0165] Figure 5 1 is a hardware structure block diagram of an electronic device (or mobile device) for a data modification method for a distributed storage system according to an embodiment of the present invention. Figure 5 As shown, the electronic device may include one or more ( Figure 5 502a, 502b, ..., 502n are used to illustrate) processor 502 (processor 502 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), memory 504 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 5 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 5 More or fewer components as shown, or with Figure 5 Different configurations shown.

[0166] 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.

[0167] 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.

[0168] 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.

[0169] 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.

[0170] 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.

[0171] 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.

[0172] 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 modification method for a distributed storage system, It is characterized in that An editor applied to a distributed storage system, the distributed storage system comprising: a client, a master server, N slave servers and the editor, the client being used to upload a target file, the master server being used to record slave server information storing the target file, the slave server being used to store M file segments, the M file segments being obtained by dividing the target file, the data modification method for the distributed storage system comprising: In response to the data modification operation, locate the current page of the data to be modified in the corresponding file segment, wherein each time the data modification operation is performed, only the data of the current page is supported to be modified, and the data of other pages is not supported to be modified; Query the offset when data is modified in the current page; According to the operation type of the data modification operation and the offset, data modification is performed in the current page in the corresponding file segment.

2. The data modification method for a distributed storage system according to claim 1, It is characterized in that The step of modifying data in the current page in the file segment according to the operation type of the data modification operation and the offset includes: In the case where the operation type of the data modification operation is a deletion operation, according to the numerical value of the offset, a space of a corresponding size is added at a position of the deleted data in the current page, wherein the number of the newly added spaces is consistent with the number indicated by the numerical value of the offset; When the deletion operation is completed and the first saving operation is received, all data in the current page are saved, and header data of the next file fragment after the file fragment having the same value as the offset is appended to the end of the file fragment, and data in other file fragments are iterated in sequence; For the Mth file segment, when the data in the Mth file segment is smaller than the numerical value of the offset, the data in the Mth file segment is appended to the end of the M-1th file segment, and the Mth file segment is deleted.

3. The data modification method for a distributed storage system according to claim 1, It is characterized in that The step of modifying data in the current page in the file segment according to the operation type of the data modification operation and the offset includes: In the case where the operation type of the data modification operation is a new addition operation, according to the numerical value of the offset, the newly added data is saved at the position involved in the new addition operation in the current page, and the tail data in the current page is temporarily stored in the cache space, wherein the amount of the temporarily stored tail data is consistent with the amount indicated by the numerical value of the offset; Add the tail data temporarily stored in the cache space to the head of the next file fragment after the corresponding file fragment, and iterate the data in other file fragments in sequence, For the Mth file fragment, when the total amount of data in the Mth file fragment is greater than the fragment total amount threshold, a file fragment is added to the corresponding slave server to obtain the M+1th file fragment.

4. The data modification method for a distributed storage system according to claim 1, It is characterized in that The step of modifying data in the current page in the file segment according to the operation type of the data modification operation and the offset includes: In the case where the operation type of the data modification operation is a modification operation, a data modification strategy corresponding to a deletion operation or a new addition operation is executed according to the size of the offset, wherein, in the case where the offset is a positive value, the data modification strategy corresponding to the new addition operation is executed, and in the case where the offset is a negative value, the data modification strategy corresponding to the deletion operation is executed; When the size of the offset is 0, the data corresponding to the position is modified in the current page according to the position of the modification operation, and the data of other pages are not modified.

5. The data modification method for a distributed storage system according to claim 1, It is characterized in that Also includes: Respond to data query operations and parse the keywords to be found; Locate the current page of the data to be searched in the corresponding file segment; Searching the current page according to the keyword query; In the case that the keyword cannot be found on the current page, determining whether the next page after the current page exceeds the corresponding file segment; In the case that the next page exceeds the corresponding file segment, searching for a slave server storing the next file segment of the target file in the corresponding file segment, and searching whether the keyword exists in the next file segment associated with the slave server; In the case that the keyword cannot be found in the Mth file segment, whether the keyword exists starting from the first file segment; If the keyword cannot be found in all file segments, a notification that the keyword does not exist is output; or, When the keyword is found, the position of the file segment where the keyword is located is located, and the page to which the keyword belongs is displayed.

6. The data modification method for a distributed storage system according to claim 1, It is characterized in that Also includes: In response to the file storage command, the received target file is cut into M parts of the same size to obtain M file fragments, wherein the sizes of the first M-1 file fragments are the same, and the size of the Mth file fragment can be adjusted; Get the names of all slave servers and use the modulo algorithm to calculate the slave server where each file fragment is to be stored; Record the file name, file size, and name of the slave server to which each file fragment is distributed of the target file, obtain record information, and send the record information to the master server.

7. The data modification method for a distributed storage system according to claim 1, It is characterized in that Also includes: In response to the file read command, query the file metadata in the master server according to the file identifier; Based on the file metadata, determine the name of the slave server where the file to be read is distributed; The file segments in each of the slave servers are located, and all of the file segments are read from each of the slave servers.

8. The data modification method for a distributed storage system according to claim 1, It is characterized in that Also includes: In response to the file display command, the specified page number is input into the first predetermined formula to obtain the file segment sequence number and the slave server to which it belongs; Input the jump designated page number and the file segment sequence number into a second predetermined formula to obtain the byte size of the jump page; Based on the byte size of the jump page and the preset display page size, data of the specified byte segment is read, and the read data is displayed on the target interface as the current page.

9. A distributed storage system, It is characterized in that include: Client, used to upload target files; The master server is used to record the slave server information where the target file is stored; N slave servers, each of which is used to store M file segments, where the M file segments are obtained by dividing the target file; An editor executes the data modification method for a distributed storage system as described in any one of claims 1 to 8.

10. A data modification device for a distributed storage system, It is characterized in that An editor applied to a distributed storage system, the distributed storage system comprising: a client, a master server, N slave servers and the editor, the client being used to upload a target file, the master server being used to record slave server information storing the target file, the slave server being used to store M file segments, the M file segments being obtained by dividing the target file, the data modification device for the distributed storage system comprising: An operation response unit, used for responding to a data modification operation, locating a current page of the data to be modified in the corresponding file segment, wherein each time the data modification operation is performed, only the data of the current page is supported to be modified, and the data of other pages is not supported to be modified; An offset query unit, used to query an offset when data is modified in the current page; The data modification unit is used to modify the data in the current page in the file segment according to the operation type of the data modification operation and the offset.

11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored 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 modification method for a distributed storage system as described in any one of claims 1 to 8.

12. An electronic device, It is 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 modification method for a distributed storage system as described in any one of claims 1 to 8.