WO2014176954A1 - 分布式存储系统的数据的处理方法、装置及系统 - Google Patents

分布式存储系统的数据的处理方法、装置及系统 Download PDF

Info

Publication number
WO2014176954A1
WO2014176954A1 PCT/CN2014/074556 CN2014074556W WO2014176954A1 WO 2014176954 A1 WO2014176954 A1 WO 2014176954A1 CN 2014074556 W CN2014074556 W CN 2014074556W WO 2014176954 A1 WO2014176954 A1 WO 2014176954A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
mode
mode structure
distributed storage
identification number
Prior art date
Application number
PCT/CN2014/074556
Other languages
English (en)
French (fr)
Inventor
郭斌
陈正华
韩银俊
高洪
程宁
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to US15/028,545 priority Critical patent/US10402391B2/en
Priority to EP14792021.9A priority patent/EP3046307B1/en
Publication of WO2014176954A1 publication Critical patent/WO2014176954A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • G06F11/1451Management of the data involved in backup or backup restore by selection of backup contents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Definitions

  • the present invention relates to the field of communications, and in particular to a method, device, and system for processing data in a distributed storage system.
  • BACKGROUND Cloud Computing is Grid Computing Distributed Computing, Parallel Computing, Utility Computing, Network Storage Technologies Virtualization Load balancing (Load Balance) and other traditional computer technology and network technology development products. It aims to integrate multiple relatively low-cost computing entities into a system with powerful computing power through the network.
  • Distributed storage is an area in the field of cloud computing. Its role is to provide distributed storage services for massive data and high-speed read and write access.
  • Data is schema-structured. In a relational database, the schema structure of the data is maintained by the database, but in a non-relational data storage system, the schema structure of the data is usually not perceived.
  • the data when storing data, the data is converted into a binary data stream according to the mode structure, and then stored in the distributed storage system; when reading the data, the binary data stream is taken out from the distributed storage system, and is restored according to certain rules.
  • Data that can be used. Above, the conversion and reduction of data is also commonly referred to as the serialization and deserialization process of data.
  • the writer of the data and the reader of the data may not be the same program. If the data pattern structure is never changed, the reader can restore the writer's data correctly according to his own local data schema structure. But usually with the upgrade of the program, the schema structure of the data is usually changed. Distributed storage is often massive data, and it is difficult to read and modify the pattern structure of data in a short period of time.
  • Solution 2 The traditional Tag-Length-Value (TIN) method records the identifier (Tag), length (Length), and binary data stream (Value) of each field of the data pattern structure in turn, and the disadvantage is that No complicated data structures, especially nested structures.
  • Scheme 3 self-describing representation, such as JAVA Script Object Notation (JSON), has the advantage of representing an arbitrarily complex data schema structure.
  • JSON JAVA Script Object Notation
  • the disadvantage is that it is an interpreted data description method with poor efficiency. .
  • an effective solution has not been proposed yet.
  • Embodiments of the present invention provide a method, an apparatus, and a system for processing data of a distributed storage system to solve at least the above problems.
  • a method for processing data of a distributed storage system including: acquiring a first mode structure of target data and a second mode structure of source data; and according to the first mode structure and The second mode structure processes the source data into structured data of the first mode structure.
  • the first mode structure is a textual description of a mode structure of each element in the target data
  • the second mode structure is a textual description of a mode structure of each element in the source data .
  • the text description of the first mode structure includes at least one of: a name of each element in the target data, a type of each element in the target data, in the target data a legal value range of each element, a nested relationship of each of the elements in the target data, an order of each of the elements in the target data; and/or the second mode
  • the textual description of the structure includes at least one of: a name of each element in the source data, a type of each element in the source data, a legal take of each of the elements in the source data a range of values, a nested relationship of each of the elements in the source data, an order of each of the elements in the source data.
  • processing the source data into the structured data of the first mode structure according to the first mode structure and the second mode structure comprises: determining the first mode structure and the second Whether the mode structure is consistent; when the determination result is consistent, the source data is processed into the structured data according to the first mode structure or the second mode structure; when the determination result is inconsistent, determining the first a difference between a structural mode and the second structural mode, and processing the source data into the structured data according to the first mode structure, the second mode structure, and the difference.
  • determining whether the first mode structure and the second mode structure are consistent comprises: comparing a first identification number of the first mode structure with a second identification number of the second mode structure; If the identifier number is consistent with the second identifier number, the first mode structure is consistent with the second mode structure; if the first identifier number is different from the second identifier number, the first mode is The structure is inconsistent with the second mode structure; wherein the first identification number and the second identification number are uniformly allocated by the distributed storage mode management server.
  • the target data when data is written to the storage space, the target data is data supported by the storage space, the source data is data to be written; and/or when data is read from the storage space, The target data is data to be read, and the source data is data stored in the storage space.
  • a method for processing data of a distributed storage system including: acquiring a mode structure of source data and an identifier of the mode structure, where the source data is to be written Data; writing the source data to the storage space according to the mode structure, and writing the identifier to the storage space.
  • the pattern structure is a textual description of a pattern structure of each element in the source data.
  • the text description includes at least one of the following: a name of each element, a type of each element, a legal value range of each element, a nesting relationship of each element, The order of each of these elements.
  • acquiring the mode structure of the source data and the identifier of the mode structure comprises: generating the mode structure; sending the mode structure to a distributed storage mode management server; receiving the distributed storage mode management server according to the The identifier returned by the mode structure, where the identifier is the matched existing one in a case where the distributed storage mode management server matches the mode structure in a local existing mode structure The identifier of the schema structure, otherwise the identifier is the newly assigned identifier.
  • a data processing apparatus for a distributed storage system including: an obtaining module, configured to acquire a first mode structure of target data and a second mode structure of source data; And configured to process the source data into structured data of the first mode structure according to the first mode structure and the second mode structure.
  • the restoration module is further configured to determine whether the first mode structure and the second mode structure are consistent, and when the determination result is consistent, according to the first mode structure or the second mode structure.
  • the source data is processed into the structured data, and when the determination result is inconsistent, the difference between the first structural mode and the second structural mode is determined, and according to the first mode structure, the second mode structure And the difference, the source data is processed into the structured data.
  • the restoring module is further configured to compare the first identification number of the first mode structure with the second identification number of the second mode structure, if the first identification number is consistent with the second identification number And the first mode structure is consistent with the second mode structure, and if the first identifier number is inconsistent with the second identifier number, the first mode structure is inconsistent with the second mode structure, where The first identification number and the second identification number are uniformly allocated by the distributed storage mode management server.
  • a data processing apparatus for a distributed storage system including: a mode obtaining module, configured to acquire a mode structure of source data, and an identifier of the mode structure, where The source data is data to be written; the write module writes the source data into the storage space according to the mode structure, and writes the identifier into the storage space.
  • the mode obtaining module is further configured to generate the mode structure, send the mode structure to a distributed storage mode management server, and receive the identifier returned by the distributed storage mode management server according to the mode structure, wherein, in a case that the distributed storage mode management server matches the mode structure in a local existing mode structure, the identifier is an identifier of the matched existing mode structure, otherwise the identifier A new assigned identifier.
  • a data processing system for a distributed storage system including: a distributed storage data storage server configured to store data; a distributed storage mode management server, configured to manage the The mode structure of the data; the device according to the fourteenth or fifteenth aspect, wherein the device is configured to write data to the distributed storage mode management server according to the mode structure; A device as set forth, configured to read data from the distributed storage mode management server in accordance with the mode structure.
  • the following technical solutions are adopted: acquiring a first mode structure of target data and a second mode structure of source data, and processing the source data according to the first mode structure and the second mode structure
  • the structured data of the first mode structure solves the problem that the data mode structure description in the distributed storage system in the related art is not flexible, and has the beneficial effects of improving the flexibility of the data mode structure description and improving the data processing efficiency.
  • FIG. 1 is a flowchart of a method 1 for processing data of a distributed storage system according to an embodiment of the present invention
  • 2 is a flowchart of a method 2 for processing data of a distributed storage system according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a processing device 1 for data of a distributed storage system according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of a data processing system of a distributed storage system according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a data processing system of a distributed storage system according to an embodiment of the present invention
  • FIG. 7 is a flowchart of a data processing method 1 of a distributed storage system according to a preferred embodiment of the present invention
  • FIG. 8 is a distributed storage system according to a preferred embodiment of the present invention.
  • FIG. 9 is a flowchart of a data processing method 3 of a distributed storage system according to a preferred embodiment of the present invention
  • FIG. 10 is a data processing of a distributed storage system according to a preferred embodiment of the present invention.
  • the flow chart of method four is a schematic structural diagram of a data processing system of a distributed storage system according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a data processing system of a distributed storage system according to an embodiment of the present invention
  • FIG. 7 is a flowchart of
  • FIG. 1 is a flowchart of a method for processing data of a distributed storage system according to an embodiment of the present invention. As shown in FIG. 1, the process includes The following steps: Step S102: Acquire a first mode structure of the target data and a second mode structure of the source data. Step S104, processing the source data into structured data of the first mode structure according to the first mode structure and the second mode structure.
  • the first mode structure is a text description of a mode structure of each element in the target data
  • the second mode structure is in the source data.
  • the text description of the first mode structure includes at least one of: a name of each element in the target data, a type of each element in the target data, the target a legal range of values for each of the elements in the data, a nested relationship of each of the elements in the target data, an order of each of the elements in the target data; and/or
  • the textual description of the second schema structure includes at least one of: a name of each element in the source data, a type of each of the source data, each of the elements in the source data The legal value range, the nested relationship of each element in the source data, and the order of each of the elements in the source data.
  • processing the source data into the structured data of the first mode structure according to the first mode structure and the second mode structure may include: determining Whether the first mode structure and the second mode structure are consistent; when the determination result is consistent, the source data is processed into the structured data according to the first mode structure or the second mode structure; Determining a difference between the first structural mode and the second structural mode when the determination result is inconsistent, and processing the source data according to the first mode structure, the second mode structure, and the difference Into the structured data.
  • determining whether the first mode structure and the second mode structure are consistent may include: comparing a first identification number and a second mode of the first mode structure a second identification number of the structure; if the first identification number is consistent with the second identification number, the first mode structure is consistent with the second mode structure; if the first identification number and the first If the two identifiers are inconsistent, the first mode structure is inconsistent with the second mode structure.
  • the first identifier number and the second identifier number are uniformly allocated by the distributed storage mode management server.
  • the target data when data is written to the storage space, the target data is data supported by the storage space, the source data is data to be written; and/or when When data is read from the storage space, the target data is data to be read, and the source data is data stored in the storage space.
  • the embodiment of the present invention further provides a method for processing data of a distributed storage system, and FIG. 2 is a flowchart of a method for processing data of a distributed storage system according to an embodiment of the present invention. As shown in FIG.
  • the process includes the following steps: Step S202, acquiring a mode structure of the source data and an identifier of the mode structure, where the source data is data to be written; Step S204, writing the source data according to the mode structure Storage space, and write the identification to the storage space.
  • the pattern structure is a textual description of a pattern structure of each element in the source data.
  • the text description includes at least one of the following: a name of each element, a type of each element, a legal value range of each element, a nesting relationship of each element, The order of each of these elements.
  • acquiring the mode structure of the source data and the identifier of the mode structure comprises: generating the mode structure; sending the mode structure to a distributed storage mode management server; receiving the distributed storage mode management server according to the The identifier returned by the mode structure, where the identifier is the matched existing one in a case where the distributed storage mode management server matches the mode structure in a local existing mode structure
  • the identifier of the schema structure, otherwise the identifier is the newly assigned identifier.
  • FIG. 3 is a schematic structural diagram of a data processing device 1 for a distributed storage system according to an embodiment of the present invention.
  • the method includes: an obtaining module 302, configured to acquire a first mode structure of the target data and a second mode structure of the source data; and a restoration module 304 configured to set the source data according to the first mode structure and the second mode structure Processing is structured data of the first mode structure.
  • the restoring module 304 is further configured to determine whether the first mode structure and the second mode structure are consistent. When the determination result is consistent, according to the first mode structure or the second mode structure The source data is processed into the structured data, and when the determination result is inconsistent, determining a difference between the first structural mode and the second structural mode, and according to the first mode structure, the second mode The structure and the difference are processed into the structured data.
  • the restoration module 304 is further configured to compare the first identification number of the first mode structure with the second identification number of the second mode structure, if the first identification number and the second identification number Consistently, the first mode structure is consistent with the second mode structure, and if the first identification number is inconsistent with the second identification number, the first mode structure is inconsistent with the second mode structure.
  • the first identification number and the second identification number are uniformly allocated by the distributed storage mode management server.
  • the embodiment of the present invention further provides a data processing device for a distributed storage system, and FIG. 4 is a schematic structural diagram of a data processing device 2 for a distributed storage system according to an embodiment of the present invention. As shown in FIG.
  • the mode obtaining module 402 is configured to obtain a mode structure of the source data and an identifier of the mode structure, where the source data is data to be written, and the writing module 404 is configured to The source data is written to the storage space, and the identifier is written into the storage space.
  • the mode obtaining module 402 is further configured to generate the mode structure, send the mode structure to a distributed storage mode management server, and receive the identifier returned by the distributed storage mode management server according to the mode structure.
  • the distributed storage mode management server matches the mode structure in a local existing mode structure
  • the identifier is an identifier of the matched existing mode structure, otherwise Identifies the newly assigned ID.
  • the embodiment of the present invention further provides a data processing system for a distributed storage system.
  • FIG. 5 is a schematic structural diagram of a data processing system for a distributed storage system according to an embodiment of the present invention.
  • the system includes a distributed storage data storage server 508, configured to store data; a distributed storage mode management server 506, configured to manage a mode structure of the data; a data writer 502, corresponding to the distributed storage system provided by the above embodiments
  • the data processing device 2 is configured to write data to the distributed storage mode management server 508 according to the mode structure; the data reader 504, the processing device corresponding to the data of the distributed storage system provided in the above embodiment And being configured to read data from the distributed storage mode management server according to the mode structure.
  • 6 is a schematic structural diagram of a data processing system of a distributed storage system according to a preferred embodiment of the present invention.
  • FIG. 6 the system includes: a data writer 502, a data reader 504, and a distributed storage API 606. a distributed storage mode management server 506, a distributed storage data storage server 508, wherein the data writer 502 and the data reader 504 communicate with the distributed storage data storage server 508 and the distributed storage mode via the distributed storage API 606
  • the management server 506 interacts.
  • FIG. 7 is a flowchart of a data processing method 1 of a distributed storage system according to a preferred embodiment of the present invention.
  • the data processing system of the distributed storage system of FIG. 6 is used as an architecture, and is written by a data writer.
  • the process includes the following steps: Step S702: Generate a mode structure.
  • the data writer 502 defines the mode structure of the data to be written, that is, the mode structure of each element to be written in the data according to a certain syntax, that is, the mode structure of the data to be written, the mode structure description At least one of the following: the name, type, legal range of values of each element, and the order in which elements appear, nested relationships, and so on.
  • Step S704 requesting to acquire an identification number of the mode structure.
  • the data writer 502 submits the schema structure of the data to be written to the distributed storage mode management server 506 through the distributed storage API 606, requesting acquisition of the identification number of the schema structure. Step S706, compared with the local mode structure.
  • the distributed storage mode management server 506 matches the received mode structure of the data to be written with all the mode structures maintained locally. If the same mode structure is not matched locally, the mode structure is saved and a new identifier is assigned. Number; if the same pattern structure is matched, find the identification number assigned before the pattern structure. Step S708, returning the identification number.
  • the distributed storage mode management server 506 returns the identification number to the data writer 502 via the distributed storage API 606.
  • the above step S702 708 is an initialization phase.
  • Step S710 converting the structured data into a binary data stream.
  • the data writer 502 invokes the distributed storage API 606 to convert the structured data to be written into a binary data stream according to certain rules.
  • Step S712 requesting data writing.
  • the data writer 502 sends a data write request to the distributed storage data storage server 508 via the distributed storage API 606, and submits the converted binary data stream to the distributed storage data storage server 508.
  • the data write request carries the identification number of the mode structure on which the binary data stream is stored.
  • Step S714 writing data.
  • the distributed storage data storage server 508 maintains the binary data stream and its identification number, and notifies the data writer 502 that the data write was successful through the distributed storage API 606 after the storage is completed.
  • Step S802 Generate a first mode structure.
  • the data reader 504 defines the pattern structure of each element of the data to be used, that is, the target data, in a textual form according to a certain syntax, that is, the first mode structure, and of course, in other embodiments, the mode Definitions can also be described in other forms in accordance with other rules.
  • Step S804 requesting to acquire an identification number of the first mode structure.
  • the data reader 504 submits the first mode structure to the distributed storage mode management server 506 through the distributed storage API 606; step S806, compared to the local existing mode structure.
  • the distributed storage mode management server 506 matches the received first mode structure with the locally maintained existing mode structure. If the local does not match the same mode structure, the distributed storage mode management server 506 newly assigns an identification number to The data reader 504; if locally matched to the same pattern structure, finds the identification number previously assigned to the pattern structure and assigns the identification number to the data reader 504. Step S808, returning the identification number.
  • the distributed storage mode management server 506 returns the identification number to the data reader via the distributed storage API 606.
  • the above steps S802 to S808 are initialization stages. Step S810, a data read request.
  • the data reader 504 sends a data read request to the distributed storage mode management server 506 via the distributed storage API 606.
  • the data is successfully read.
  • the distributed storage data storage server 508 returns the binary data stream and the identification number of the corresponding schema structure to the distributed storage API 606.
  • Step S814 searching for the returned identification number locally.
  • the distributed storage API 606 looks up the returned identification number in the locally saved identification number.
  • the locally saved identification number is the identification number acquired in step S808. If the returned identification number is found locally, step S816 is performed, otherwise step S818 is performed.
  • the distributed storage API 606 restores the read binary data stream to structured data according to the determined mode structure corresponding to the identification number, and returns it to the data reader 504.
  • Step S818, requesting acquisition of a mode structure.
  • the distributed storage API 606 sends a request for acquiring a mode structure to the distributed storage mode management server 506, where the request carries the identification number acquired in step S812.
  • Step S820 searching for a mode structure.
  • the distributed storage mode management server 506 After receiving the request for acquiring the mode structure, the distributed storage mode management server 506 searches for the mode structure corresponding to the identification number according to the identification number carried in the request. Step S822, returning to the mode structure.
  • the distributed storage mode management server 506 returns the found pattern structure to the distributed storage
  • the found pattern structure corresponds to the second mode structure, that is, the mode structure used by the data writer to write the corresponding source data.
  • Step S824 restoring the binary data stream to structured data.
  • the distributed storage API 606 restores the read binary data stream to structured data according to the schema structure returned by the distributed storage mode management server 506 and returns it to the data reader 504.
  • step S816 and step S824 of the embodiment if the identification number corresponding to the binary data stream is consistent with an identification number obtained by the initialization stage from the distributed storage mode management server 506, the local original mode structure, that is, the first mode structure is illustrated.
  • the pattern structure of the writer of the binary data stream is exactly the same as the second data pattern structure, and the binary data stream can be restored to the structured data according to the first pattern structure.
  • the specific method may be to sequentially read the number of bytes from the binary data stream in the order of the local elements, and the binary data of the corresponding length, and map to the elements of the local structured data to complete the restoration. If there is a nested relationship between elements, restore it recursively. If the identification number corresponding to the binary data stream in step S816 and step S824 is inconsistent with the identification number obtained from the distributed storage mode management server 506 in the initialization phase, the distributed storage API 606 needs to have the local original mode structure, that is, the first mode structure and the binary.
  • the mode definition corresponding to the data stream is compared with the second mode structure, comparing whether the elements are added or deleted, whether the order of the elements is consistent, and the like, and then restoring the binary data stream according to the mode structure of the writer, that is, the mode structure of the second data. And each element is mapped to the same name and type of elements of the local structured data, and the restoration is finally completed. If there is no local need in the second mode structure Fields can be automatically ignored when distributed storage API 606 is processed; conversely, fields that are not required locally but in the second schema structure, the Distributed Storage API 606 automatically fills in the default values.
  • the schema structure of the user profile data consists of name, phone, and address, and has stored a batch of data; A field is added to the version, and the pattern structure of the user data consists of name, age, phone number, and address. Because the schema structure (Schema) has changed, the first version and the second version cannot correctly identify each other's data without compatibility processing. After the technical solution of the embodiment is used, when the first version reads the data generated by the second version, the newly added field is automatically ignored; and when the second version reads the data generated by the first version, the automatic version automatically The new fields are populated with default values to achieve a Schema-free effect.
  • Step S902 Generate The schema structure of the data to be written.
  • the pattern structure of each element in the used data is described as text, which is referred to herein as a pattern definition, that is, a pattern structure of data to be written, and the pattern structure mainly includes each element in the data pattern structure. Name, type, legal range of values, and nesting relationships.
  • Step S904 obtaining an identification number.
  • FIG. 10 is a flowchart of a data processing method 4 of a distributed storage system according to a preferred embodiment of the present invention. In this embodiment, a data reader is taken as an example. As shown in FIG.
  • Step S1002 Generate The pattern structure of the data to be read.
  • the data structure of each element of the target data that is, the pattern structure of the target data is described as a pattern definition of the text, that is, the first pattern structure.
  • the specific mode definition is the same as above, and will not be described here.
  • Step S1004 obtaining an identification number.
  • the first mode structure is submitted to the distributed storage system mode management module, and the unique identification number assigned by the distributed storage system mode management module to the first mode structure is obtained, and the same mode structure returns the same identification number.
  • Step S1006 reading data.
  • the binary data stream is read from the distributed storage system, and the unique identification number of the schema structure corresponding to the binary data stream.
  • the identification number is written simultaneously with the binary data stream when the data is written. Step S1008, restoring the read data according to the identification number. If the obtained unique identification number is the same as the identification number of a local mode structure, the read binary data stream is restored to the structured data by using the data recovery mode of the local mode structure. If the obtained unique identification number is different from the identification number of the local mode structure, the mode structure corresponding to the identification number, that is, the second mode structure is obtained from the distributed storage system mode management module, and is performed with the first mode structure. Compare and combine the two schema structures to restore the read binary data stream.
  • the embodiments of the present invention achieve the following technical effects:
  • the embodiments of the present invention adopt centralized management of mode structure and comparison of mode structure analysis and the like.
  • the feature solves the limitations of the related technologies in terms of operational efficiency, data representation, and the freedom of mode of the data, so that different versions of structured data can be compatible even if the mode structure is different, which can well satisfy the distributed application system.
  • Embodiments of the present invention are suitable for implementing mode free characteristics of data in a distributed storage system.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention.
  • a data processing method, apparatus, and system for a distributed storage system provided by an embodiment of the present invention have the following beneficial effects:
  • centralized management is adopted by adopting a mode structure.
  • technical features such as comparison of pattern structure analysis, which solves the limitations of the related technologies in terms of operational efficiency, data representation, and the freedom of mode of the data, so that different versions of structured data can be compatible even if the mode structure is different. It can meet the needs of scenarios such as online upgrade of distributed application systems.
  • Embodiments of the present invention are suitable for implementing mode free characteristics of data in a distributed storage system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明提供了一种分布式存储系统的数据的处理方法、装置及系统,该方法包括:获取目标数据的第一模式结构和源数据的第二模式结构;根据上述第一模式结构和上述第二模式结构将上述源数据处理为上述第一模式结构的结构化数据。本发明解决了相关技术中分布式存储系统中数据模式结构描述不灵活的问题,具有提高数据模式结构描述灵活性从而提高数据处理效率的有益效果。

Description

分布式存储系统的数据的处理方法、 装置及系统 技术领域 本发明涉及通信领域, 具体而言, 涉及一种分布式存储系统的数据的处理方法、 装置及系统。 背景技术 云计算(Cloud Computing)是网格计算(Grid Computing ) 分布式计算(Distributed Computing )、 并行计算 (Parallel Computing )、 效用计算 (Utility Computing )、 网络存 储 (Network Storage Technologies ) 虚拟化 ( Virtualization) 负载均衡 (Load Balance) 等传统计算机技术和网络技术发展融合的产物。 它旨在通过网络把多个成本相对较低 的计算实体整合成一个具有强大计算能力的系统。 分布式存储是云计算范畴中的一个 领域, 其作用是提供海量数据的分布式存储服务以及高速读写访问的能力。 数据是有模式结构的, 在关系型数据库中, 数据的模式结构是数据库来维护的, 但是在非关系型的数据存储系统中, 通常不感知数据的模式结构。 于是, 在存储数据 时, 要根据模式结构将数据转换为二进制数据流, 然后存入分布式存储系统中; 读取 数据时, 从分布式存储系统中取出二进制数据流, 要根据一定规则还原为可以使用的 数据。 以上, 数据的转换和还原, 通常也称之为数据的序列化和反序列化过程。 在分布式的应用中, 数据的写入者和数据的读取者可能不是同一个程序。 如果数 据模式结构永远不变, 读取者随时都可以根据自己本地的数据模式结构正确的还原出 写入者的数据。 但通常随着程序的升级, 数据的模式结构通常是要发生变化的。 而分 布式存储中往往是海量数据, 难以短时间内全部读出并修改数据的模式结构; 此外在 某些场景中, 在升级过程中需要保持业务不中断, 也会同时出现不同版本的写入者和 读取者。 此时, 数据的读取者如何还原出任意写入者的数据, 是比较难以解决的关键 问题。 而能够还原任意写入者的数据的特性, 通常称为模式自由 (Schema-free 在相关技术方案中, 实现模式自由通常有以下几种方法: 方案一、 数据的模式结构内部固定一个字段表示数据的版本, 缺点是新版本的新 增内容只能添在旧版本的尾部, 读取者中要实现已知所有版本模式结构的还原方法; 方案二、 传统的标签长度值(Tag-Length-Value, 简称 TIN)法, 依次记录数据模 式结构各字段的标识符 (Tag), 长度 (Length), 二进制数据流 (Value), 其缺点是表 示不了复杂的数据结构, 尤其是嵌套结构。 方案三, 自描述型表示方式, 如 JAVA 脚本对象表示法 (JAVA Script Object Notation, 简称 JSON), 优点是可以表示任意复杂的数据模式结构, 缺点是它是解释 型的数据描述方式, 效率较差。 针对相关技术中相关技术中分布式存储系统中数据模式结构描述不灵活的问题, 目前尚未提出有效的解决方案。 发明内容 本发明实施例提供了一种分布式存储系统的数据的处理方法、 装置及系统, 以至 少解决上述问题。 根据本发明实施例的一个方面, 提供了一种分布式存储系统的数据的处理方法, 包括: 获取目标数据的第一模式结构和源数据的第二模式结构;根据所述第一模式结 构和所述第二模式结构将所述源数据处理为所述第一模式结构的结构化数据。 优选地, 所述第一模式结构是对所述目标数据中的每个元素的模式结构的文本描 述, 所述第二模式结构是对所述源数据中的每个元素的模式结构的文本描述。 优选地, 所述第一模式结构的文本描述包括以下至少之一: 所述目标数据中的每 个元素的名称, 所述目标数据中的所述每个元素的类型, 所述目标数据中的所述每个 元素的合法取值范围, 所述目标数据中的所述每个元素的嵌套关系, 所述目标数据中 的各个所述每个元素的顺序; 和 /或所述第二模式结构的文本描述包括以下至少之一: 所述源数据中的每个元素的名称, 所述源数据中的所述每个元素的类型, 所述源数据 中的所述每个元素的合法取值范围, 所述源数据中的所述每个元素的嵌套关系, 所述 源数据中的各个所述每个元素的顺序。 优选地, 根据所述第一模式结构和所述第二模式结构将所述源数据处理为所述第 一模式结构的所述结构化数据包括: 判断所述第一模式结构和所述第二模式结构是否 一致; 当判断结果为一致时, 按照所述第一模式结构或所述第二模式结构将所述源数 据处理成所述结构化数据; 当判断结果为不一致时, 确定所述第一结构模式与所述第 二结构模式的差异, 并根据所述第一模式结构、 所述第二模式结构和所述差异, 将所 述源数据处理成所述结构化数据。 优选地, 判断所述第一模式结构和所述第二模式结构是否一致包括: 比较所述第 一模式结构的第一标识号和所述第二模式结构的第二标识号; 如果所述第一标识号与 所述第二标识号一致, 则所述第一模式结构与所述第二模式结构一致; 如果所述第一 标识号与所述第二标识号不一致, 则所述第一模式结构与所述第二模式结构不一致; 其中, 所述第一标识号和所述第二标识号由分布式存储模式管理服务器统一分配。 优选地, 当向存储空间写入数据时, 所述目标数据为所述存储空间支持的数据, 所述源数据为待写入的数据; 和 /或当从所述存储空间读取数据时, 所述目标数据为读 取所要得到的数据, 所述源数据为所述存储空间中存储的数据。 根据本发明实施例的另一方面, 提供了一种分布式存储系统的数据的处理方法, 包括: 获取源数据的模式结构和所述模式结构的标识, 其中, 所述源数据为待写入的 数据; 根据所述模式结构将所述源数据写入存储空间, 并将所述标识写入所述存储空 间。 优选地, 所述模式结构是对所述源数据中的每个元素的模式结构的文本描述。 优选地, 所述文本描述包括以下至少之一: 所述每个元素的名称, 所述每个元素 的类型, 所述每个元素的合法取值范围, 所述每个元素的嵌套关系, 各个所述每个元 素的顺序。 优选地, 获取所述源数据的模式结构和所述模式结构的标识包括: 生成所述模式 结构; 向分布式存储模式管理服务器发送所述模式结构; 接收所述分布式存储模式管 理服务器根据所述模式结构返回的所述标识, 其中, 在所述分布式存储模式管理服务 器在本地的现有模式结构中匹配到所述模式结构的情况下, 所述标识为所匹配到的所 述现有模式结构的标识, 否则所述标识为新分配的标识。 根据本发明实施例的又一方面, 提供了一种分布式存储系统的数据的处理装置, 包括: 获取模块, 设置为获取目标数据的第一模式结构和源数据的第二模式结构; 还 原模块, 设置为根据所述第一模式结构和所述第二模式结构将所述源数据处理为所述 第一模式结构的结构化数据。 优选地, 所述还原模块还设置为判断所述第一模式结构和所述第二模式结构是否 一致, 当判断结果为一致时, 按照所述第一模式结构或所述第二模式结构将所述源数 据处理成所述结构化数据, 当判断结果为不一致时, 确定所述第一结构模式与所述第 二结构模式的差异, 并根据所述第一模式结构、 所述第二模式结构和所述差异, 将所 述源数据处理成所述结构化数据。 优选地, 所述还原模块还设置为比较所述第一模式结构的第一标识号和所述第二 模式结构的第二标识号, 如果所述第一标识号与所述第二标识号一致, 则所述第一模 式结构与所述第二模式结构一致, 如果所述第一标识号与所述第二标识号不一致, 则 所述第一模式结构与所述第二模式结构不一致, 其中, 所述第一标识号和所述第二标 识号由分布式存储模式管理服务器统一分配。 根据本发明实施例的又一方面, 提供了一种分布式存储系统的数据的处理装置, 包括: 模式获取模块, 设置为获取源数据的模式结构和所述模式结构的标识, 其中, 所述源数据为待写入的数据; 写入模块, 根据所述模式结构将所述源数据写入存储空 间, 并将所述标识写入所述存储空间。 优选地, 所述模式获取模块还设置为生成所述模式结构, 向分布式存储模式管理 服务器发送所述模式结构, 接收所述分布式存储模式管理服务器根据所述模式结构返 回的所述标识, 其中, 在所述分布式存储模式管理服务器在本地的现有模式结构中匹 配到所述模式结构的情况下, 所述标识为所匹配到的所述现有模式结构的标识, 否则 所述标识为新分配的标识。 根据本发明实施例的又一方面, 提供了一种分布式存储系统的数据的处理系统, 包括: 分布式存储数据存储服务器, 设置为存储数据; 分布式存储模式管理服务器, 设置为管理所述数据的模式结构; 上述第十四或十五项方案所述的装置, 设置为根据 所述模式结构向所述分布式存储模式管理服务器写入数据; 上述第十一至十三项方案 中任一项所述的装置, 设置为根据所述模式结构从所述分布式存储模式管理服务器读 取数据。 通过本发明实施例, 采用以下技术方案: 获取目标数据的第一模式结构和源数据 的第二模式结构, 根据所述第一模式结构和所述第二模式结构将所述源数据处理为所 述第一模式结构的结构化数据, 解决了相关技术中分布式存储系统中数据模式结构描 述不灵活的问题, 具有提高数据模式结构描述灵活性从而提高数据处理效率的有益效 果。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的分布式存储系统的数据的处理方法一的流程图; 图 2是根据本发明实施例的分布式存储系统的数据的处理方法二的流程图; 图 3是根据本发明实施例的分布式存储系统的数据的处理装置一的结构示意图; 图 4是根据本发明实施例的分布式存储系统的数据的处理装置二的结构示意图; 图 5是根据本发明实施例的分布式存储系统的数据的处理系统的结构示意图; 图 6是根据本发明优选实施例的分布式存储系统的数据处理系统的结构示意图; 图 7是根据本发明优选实施例的分布式存储系统的数据处理方法一的流程图; 图 8是根据本发明优选实施例的分布式存储系统的数据处理方法二的流程图; 图 9是根据本发明优选实施例的分布式存储系统的数据处理方法三的流程图; 以 及 图 10是根据本发明优选实施例的分布式存储系统的数据处理方法四的流程图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 本发明实施例提供了一种分布式存储系统的数据的处理方法, 图 1是根据本发明 实施例的分布式存储系统的数据的处理方法一的流程图, 如图 1所示, 该流程包括以 下步骤: 步骤 S102, 获取目标数据的第一模式结构和源数据的第二模式结构。 步骤 S104,根据所述第一模式结构和所述第二模式结构将所述源数据处理为所述 第一模式结构的结构化数据。 通过上述步骤, 解决了相关技术中分布式存储系统中数据模式结构描述不灵活的 问题, 具有提高数据模式结构描述灵活性从而提高数据处理效率的有益效果。 在本发明实施例的一个优选实施方式中, 所述第一模式结构是对所述目标数据中 的每个元素的模式结构的文本描述, 所述第二模式结构是对所述源数据中的每个元素 的模式结构的文本描述。 其中, 所述第一模式结构的文本描述包括以下至少之一: 所 述目标数据中的每个元素的名称, 所述目标数据中的所述每个元素的类型, 所述目标 数据中的所述每个元素的合法取值范围,所述目标数据中的所述每个元素的嵌套关系, 所述目标数据中的各个所述每个元素的顺序; 和 /或所述第二模式结构的文本描述包括 以下至少之一: 所述源数据中的每个元素的名称, 所述源数据中的所述每个元素的类 型, 所述源数据中的所述每个元素的合法取值范围, 所述源数据中的所述每个元素的 嵌套关系, 所述源数据中的各个所述每个元素的顺序。 通过上述步骤, 可以预先定义 目标数据的模式结构, 以实现数据模式自由。 在本发明实施例的另一个优选实施方式中, 根据所述第一模式结构和所述第二模 式结构将所述源数据处理为所述第一模式结构的所述结构化数据可以包括: 判断所述 第一模式结构和所述第二模式结构是否一致; 当判断结果为一致时, 按照所述第一模 式结构或所述第二模式结构将所述源数据处理成所述结构化数据; 当判断结果为不一 致时,确定所述第一结构模式与所述第二结构模式的差异, 并根据所述第一模式结构、 所述第二模式结构和所述差异,将所述源数据处理成所述结构化数据。通过上述步骤, 不仅数据的模式结构描述更灵活, 而且数据的读取效率也更高。 在本发明实施例的另一个优选实施方式中, 判断所述第一模式结构和所述第二模 式结构是否一致可以包括: 比较所述第一模式结构的第一标识号和所述第二模式结构 的第二标识号; 如果所述第一标识号与所述第二标识号一致, 则所述第一模式结构与 所述第二模式结构一致; 如果所述第一标识号与所述第二标识号不一致, 则所述第一 模式结构与所述第二模式结构不一致; 其中, 所述第一标识号和所述第二标识号由分 布式存储模式管理服务器统一分配。 通过上述步骤, 可以集中管理数据的模式结构, 提高数据的处理效率。 在本发明实施例的另一个优选实施方式中, 当向存储空间写入数据时, 所述目标 数据为所述存储空间支持的数据, 所述源数据为待写入的数据; 和 /或当从所述存储空 间读取数据时, 所述目标数据为读取所要得到的数据, 所述源数据为所述存储空间中 存储的数据。 本发明实施例还提供了一种分布式存储系统的数据的处理方法, 图 2是根据本发 明实施例的分布式存储系统的数据的处理方法二的流程图, 如图 2,所示, 该流程包括 以下步骤: 步骤 S202, 获取源数据的模式结构和所述模式结构的标识, 其中, 所述源数据为 待写入的数据; 步骤 S204, 根据所述模式结构将所述源数据写入存储空间, 并将所述标识写入所 述存储空间。 优选地, 所述模式结构是对所述源数据中的每个元素的模式结构的文本描述。 优选地, 所述文本描述包括以下至少之一: 所述每个元素的名称, 所述每个元素 的类型, 所述每个元素的合法取值范围, 所述每个元素的嵌套关系, 各个所述每个元 素的顺序。 优选地, 获取所述源数据的模式结构和所述模式结构的标识包括: 生成所述模式 结构; 向分布式存储模式管理服务器发送所述模式结构; 接收所述分布式存储模式管 理服务器根据所述模式结构返回的所述标识, 其中, 在所述分布式存储模式管理服务 器在本地的现有模式结构中匹配到所述模式结构的情况下, 所述标识为所匹配到的所 述现有模式结构的标识, 否则所述标识为新分配的标识。 本发明实施例还提供了一种分布式存储系统的数据的处理装置, 图 3是根据本发 明实施例的分布式存储系统的数据的处理装置一的结构示意图, 如图 3所示, 该装置 包括: 获取模块 302, 设置为获取目标数据的第一模式结构和源数据的第二模式结构; 还原模块 304, 设置为根据所述第一模式结构和所述第二模式结构将所述源数据处理 为所述第一模式结构的结构化数据。 优选地, 所述还原模块 304还设置为判断所述第一模式结构和所述第二模式结构 是否一致, 当判断结果为一致时, 按照所述第一模式结构或所述第二模式结构将所述 源数据处理成所述结构化数据, 当判断结果为不一致时, 确定所述第一结构模式与所 述第二结构模式的差异, 并根据所述第一模式结构、 所述第二模式结构和所述差异, 将所述源数据处理成所述结构化数据。 优选地, 所述还原模块 304还设置为比较所述第一模式结构的第一标识号和所述 第二模式结构的第二标识号, 如果所述第一标识号与所述第二标识号一致, 则所述第 一模式结构与所述第二模式结构一致,如果所述第一标识号与所述第二标识号不一致, 则所述第一模式结构与所述第二模式结构不一致, 其中, 所述第一标识号和所述第二 标识号由分布式存储模式管理服务器统一分配。 本发明实施例还提供了一种分布式存储系统的数据的处理装置, 图 4是根据本发 明实施例的分布式存储系统的数据的处理装置二的结构示意图, 如图 4所示, 该装置 包括: 模式获取模块 402, 设置为获取源数据的模式结构和所述模式结构的标识, 其 中, 所述源数据为待写入的数据; 写入模块 404, 设置为根据所述模式结构将所述源 数据写入存储空间, 并将所述标识写入所述存储空间。 优选地, 所述模式获取模块 402还设置为生成所述模式结构, 向分布式存储模式 管理服务器发送所述模式结构, 接收所述分布式存储模式管理服务器根据所述模式结 构返回的所述标识, 其中, 在所述分布式存储模式管理服务器在本地的现有模式结构 中匹配到所述模式结构的情况下, 所述标识为所匹配到的所述现有模式结构的标识, 否则所述标识为新分配的标识。 本发明实施例还提供了一种分布式存储系统的数据的处理系统, 图 5是根据本发 明实施例的分布式存储系统的数据的处理系统的结构示意图, 如图 5所示, 该系统包 括: 分布式存储数据存储服务器 508, 设置为存储数据; 分布式存储模式管理服务器 506, 设置为管理所述数据的模式结构; 数据写入者 502, 相当于上述实施例提供的分 布式存储系统的数据的处理装置二, 设置为根据所述模式结构向所述分布式存储模式 管理服务器 508写入数据; 数据读取者 504, 相当于上述实施例提供的分布式存储系 统的数据的处理装置一, 设置为根据所述模式结构从所述分布式存储模式管理服务器 读取数据。 图 6是根据本发明优选实施例的分布式存储系统的数据处理系统的结构示意图, 如图 6所示,该系统包括:数据写入者 502、数据读取者 504,以及分布式存储的 API606、 分布式存储模式管理服务器 506、分布式存储数据存储服务器 508, 其中, 数据写入者 502和数据读取者 504通过分布式存储的 API606, 与分布式存储数据存储服务器 508 和分布式存储模式管理服务器 506进行交互。 图 7是根据本发明优选实施例的分布式存储系统的数据处理方法一的流程图, 本 实施例以图 6所述的分布式存储系统的数据处理系统为架构, 以数据写入者写入数据 为例, 如图 6、 7所示, 该流程包括以下步骤: 步骤 S702, 生成模式结构。 在初始化阶段, 数据写入者 502将需要使用的数据即待写入数据中的每个元素的 模式结构按照一定语法描述为文本形式的模式定义即待写入数据的模式结构, 该模式 结构描述了以下至少之一: 每个元素的名称、 类型、 合法的取值范围, 以及元素的出 现顺序、 嵌套关系等。 步骤 S704, 请求获取模式结构的标识号。 数据写入者 502通过分布式存储的 API606将待写入数据的模式结构提交给分布 式存储模式管理服务器 506, 请求获取模式结构的标识号。 步骤 S706, 与本地模式结构相比较。 分布式存储模式管理服务器 506将接收到的待写入数据的模式结构与本地维护的 所有模式结构进行匹配, 如果在本地没有匹配到相同的模式结构,则保存该模式结构, 并新分配一个标识号; 如果匹配到的相同的模式结构, 则找出该模式结构之前分配的 标识号。 步骤 S708, 返回标识号。 分布式存储模式管理服务器 506将标识号通过分布式存储的 API606返回给数据 写入者 502。 以上步骤 S702 708为初始化阶段。 步骤 S710, 将结构化数据转换为二进制数据流。 数据写入者 502调用分布式存储的 API606将待写入的结构化数据按照一定规则 转换为二进制数据流。 其中, 所述规则中, 按照模式结构的元素顺序, 依次写入每个 元素占用的字节数, 以及元素的二进制表示形式。 如果元素间有嵌套关系, 以递归的 方式进行转换。 步骤 S712, 请求数据写入。 数据写入者 502通过分布式存储的 API606向分布式存储数据存储服务器 508发 送数据写入请求, 将转换好的二进制数据流提交给分布式存储数据存储服务器 508。 其中, 数据写入请求中, 携带二进制数据流存储所依据的模式结构的标识号。 步骤 S714, 写入数据。 分布式存储数据存储服务器 508保存二进制数据流和其标识号, 并在完成存储后 通过分布式存储的 API606通知数据写入者 502数据写入成功。 图 8是根据本发明优选实施例的分布式存储系统的数据处理方法二的流程图, 本 实施例以图 6所述的分布式存储系统的数据处理系统为架构, 以数据读取者读取数据 为例, 如图 6、 8所示, 该流程包括以下步骤: 步骤 S802, 生成第一模式结构。 在初始化阶段, 数据读取者 504将需要使用的数据即目标数据的每一个元素的模 式结构按照一定语法描述为文本形式的模式定义, 即第一模式结构, 当然在其他的实 施例中, 模式定义也可以按照其他规则描述为其他形式。 步骤 S804, 请求获取第一模式结构的标识号。 数据读取者 504通过分布式存储的 API606将第一模式结构提交给分布式存储模 式管理服务器 506; 步骤 S806, 与本地的现有模式结构相比较。 分布式存储模式管理服务器 506将接收到的第一模式结构与本地维护的现有模式 结构进行匹配, 如果本地没有匹配到相同的模式结构, 则分布式存储模式管理服务器 506新分配一个标识号给数据读取者 504; 如果本地匹配到相同的模式结构,则找出之 前为该模式结构分配的标识号, 并将该标识号分配给数据读取者 504。 步骤 S808, 返回标识号。 分布式存储模式管理服务器 506将标识号通过分布式存储的 API606返回给数据 读取者。 以上步骤 S802 S808为初始化阶段。 步骤 S810, 数据读取请求。 数据读取者 504通过分布式存储的 API606向分布式存储模式管理服务器 506发 送数据读取请求。 步骤 S812, 数据读取成功。 分布式存储数据存储服务器 508返回二进制数据流及相应的模式结构的标识号给 分布式存储的 API606。 步骤 S814, 在本地查找返回的标识号。 分布式存储的 API606 在本地保存的标识号中查找返回的标识号。 其中, 本地保 存的标识号是在步骤 S808中获取的标识号。如果在本地查找到了返回的标识号,则执 行步骤 S816, 否则执行步骤 S818。 步骤 S816, 将二进制数据流还原为结构化数据。 分布式存储的 API606 根据所确定的标识号对应的模式结构, 将所读取的二进制 数据流还原为结构化数据, 返回给数据读取者 504。 步骤 S818, 请求获取模式结构。 分布式存储的 API606 向分布式存储模式管理服务器 506发送获取模式结构的请 求, 该请求中携带步骤 S812中获取的标识号。 步骤 S820, 查找模式结构。 分布式存储模式管理服务器 506接收到获取模式结构的请求后, 根据该请求中携 带的标识号, 查找该标识号对应的模式结构。 步骤 S822, 返回模式结构。 分布式存储模式管理服务器 506 将查找到的模式结构返回给分布式存储的
API606。 其中, 查找到的模式结构对应的是第二模式结构, 即数据写入者写入相应的 源数据时所采用的模式结构。 步骤 S824, 将二进制数据流还原为结构化数据。 分布式存储的 API606根据分布式存储模式管理服务器 506返回的模式结构, 将 所读取的二进制数据流还原为结构化数据, 并返回给数据读取者 504。 本实施例的步骤 S816和步骤 S824中, 如果二进制数据流对应的标识号与初始化 阶段从分布式存储模式管理服务器 506获得的某个标识号一致, 则说明本地原始的模 式结构即第一模式结构与二进制数据流的写入者的模式结构即第二数据模式结构完全 一致, 此时可以按照第一模式结构将二进制数据流还原为结构化数据。 具体方法可以 是直接按照本地的元素顺序依次从二进制数据流中读取字节数, 以及相应长度的二进 制数据, 映射到本地结构化数据的元素上, 完成还原。 如果元素间有嵌套关系, 以递 归的方式进行还原。 如果步骤 S816和步骤 S824中二进制数据流对应的标识号与初始化阶段从分布式 存储模式管理服务器 506获得的标识号不一致, 分布式存储的 API606需要将本地原 始的模式结构即第一模式结构与二进制数据流对应的模式定义即第二模式结构相比 较, 比较是否有元素的增加或缺失, 元素的顺序是否一致等, 然后按写入者的模式结 构即第二数据的模式结构还原二进制数据流, 并将其每个元素映射到本地的结构化数 据的相同名称和类型的元素上, 最终完成还原。 如果第二模式结构中有本地不需要的 字段可在分布式存储的 API606 处理时自动将其忽略; 反之, 第二模式结构中没有但 本地需要的字段, 分布式存储的 API606会自动填补默认值。 比如, 以一个典型的场景举例, 在一个处理用户资料的程序的第一个版本中, 用 户资料数据的模式结构由姓名、 电话、 住址构成, 并已经存储了一批数据; 而在第二 个版本中加了字段, 用户数据的模式结构由姓名、 年龄、 电话、 住址构成。 因为模式 结构 (Schema) 发生了变化, 如果不做兼容性处理, 第一个版本和第二个版本无法正 确识别对方的数据。 而采用本实施例的技术方案后, 第一个版本读取第二个版本生成 的数据时, 自动忽略新增的字段; 而第二个版本读到第一个版本生成的数据时, 自动 将新增的字段用默认值填充, 从而达到模式自由 (Schema-free) 的效果。 图 9是根据本发明优选实施例的分布式存储系统的数据处理方法三的流程图, 本 实施例以数据写入者为例, 如图 9所示, 该流程包括以下步骤: 步骤 S902, 生成待写入数据的模式结构。 根据一定的语法, 将用到的数据中的每个元素的模式结构描述为文本, 在这里称 为模式定义即待写入数据的模式结构, 该模式结构主要包括数据模式结构中每个元素 的名称, 类型, 合法的取值范围, 以及嵌套关系等。 步骤 S904, 获取标识号。 将待写入数据的模式结构提交给分布式存储系统的模式管理模块, 得到分布式存 储系统的模式管理模块分配给该模式结构的唯一标识号, 相同的模式结构会返回相同 的标识号。 步骤 S906, 根据模式结构将待写入的数据转换为二进制流数据。 根据待写入数据的模式结构, 将待写入的数据转换为二进制数据流。 步骤 S908, 写入数据。 将待写入数据及其模式结构对应的唯一标识号存入分布式存储系统。 图 10是根据本发明优选实施例的分布式存储系统的数据处理方法四的流程图,本 实施例以数据读取者为例, 如图 10所示, 该流程包括以下步骤: 步骤 S1002, 生成待读取数据的模式结构。 根据一定的语法, 将用到的数据即目标数据的每个元素的模式结构描述为文本的 模式定义, 即第一模式结构。 具体的模式定义同上所述, 此处不再赘述。 步骤 S 1004, 获取标识号。 将第一模式结构提交给分布式存储系统模式管理模块, 得到分布式存储系统模式 管理模块分配给该第一模式结构的唯一标识号,相同的模式结构会返回相同的标识号。 步骤 S 1006, 读取数据。 从分布式存储系统读取二进制数据流, 以及该二进制数据流所对应的模式结构的 唯一标识号。 该标识号是数据写入时与二进制数据流同时写入的。 步骤 S1008, 根据标识号还原所读取的数据。 如果获取到的唯一标识号与本地的某个模式结构的标识号相同, 则使用本地模式 结构的数据还原方式, 将读取的二进制数据流还原为结构化数据。 如果获取到的唯一 标识号与本地的模式结构的标识号都不相同, 则从分布式存储系统模式管理模块获取 这个标识号对应的模式结构即第二模式结构, 将其与第一模式结构进行比较, 并结合 两个模式结构, 对读取到的二进制数据流进行还原。 从以上的描述中, 可以看出, 本发明实施例实现了如下技术效果: 本发明实施例 在非关系型的分布式存储系统中, 通过采用模式结构集中管理, 以及模式结构解析时 比较等技术特征, 解决了相关技术中在运行效率、 数据表示等方面的局限性以及数据 的模式自由问题, 使得不同版本的结构化数据, 即使模式结构不同也可以兼容, 可以 很好的满足分布式应用系统的在线升级等场景的需要。 本发明实施例适合在分布式存 储系统中实现数据的模式自由特性。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 工业实用性 如上所述, 本发明实施例提供的一种分布式存储系统的数据的处理方法、 装 置及系统具有以下有益效果: 在非关系型的分布式存储系统中, 通过采用模式结构 集中管理, 以及模式结构解析时比较等技术特征, 解决了相关技术中在运行效率、 数据表示等方面的局限性以及数据的模式自由问题, 使得不同版本的结构化数据, 即使模式结构不同也可以兼容, 可以很好的满足分布式应用系统的在线升级等场景 的需要。 本发明实施例适合在分布式存储系统中实现数据的模式自由特性。

Claims

权 利 要 求 书
1. 一种分布式存储系统的数据的处理方法, 包括:
获取目标数据的第一模式结构和源数据的第二模式结构;
根据所述第一模式结构和所述第二模式结构将所述源数据处理为所述第一 模式结构的结构化数据。
2. 根据权利要求 1所述的方法, 其中, 所述第一模式结构是对所述目标数据中的 每个元素的模式结构的文本描述, 所述第二模式结构是对所述源数据中的每个 元素的模式结构的文本描述。
3. 根据权利要求 2所述的方法, 其中, 所述第一模式结构的文本描述包括以下至少之一: 所述目标数据中的每个 元素的名称, 所述目标数据中的所述每个元素的类型, 所述目标数据中的所述 每个元素的合法取值范围, 所述目标数据中的所述每个元素的嵌套关系, 所述 目标数据中的各个所述每个元素的顺序; 和 /或
所述第二模式结构的文本描述包括以下至少之一: 所述源数据中的每个元 素的名称, 所述源数据中的所述每个元素的类型, 所述源数据中的所述每个元 素的合法取值范围, 所述源数据中的所述每个元素的嵌套关系, 所述源数据中 的各个所述每个元素的顺序。
4. 根据权利要求 1至 3中任一项所述的方法, 其中, 根据所述第一模式结构和所 述第二模式结构将所述源数据处理为所述第一模式结构的所述结构化数据包 括:
判断所述第一模式结构和所述第二模式结构是否一致;
当判断结果为一致时, 按照所述第一模式结构或所述第二模式结构将所述 源数据处理成所述结构化数据;
当判断结果为不一致时, 确定所述第一结构模式与所述第二结构模式的差 异, 并根据所述第一模式结构、 所述第二模式结构和所述差异, 将所述源数据 处理成所述结构化数据。
5. 根据权利要求 4所述的方法, 其中, 判断所述第一模式结构和所述第二模式结 构是否一致包括: 比较所述第一模式结构的第一标识号和所述第二模式结构的第二标识号; 如果所述第一标识号与所述第二标识号一致, 则所述第一模式结构与所述 第二模式结构一致;
如果所述第一标识号与所述第二标识号不一致, 则所述第一模式结构与所 述第二模式结构不一致;
其中, 所述第一标识号和所述第二标识号由分布式存储模式管理服务器统 一分配。 根据权利要求 1所述的方法, 其中,
当向所述分布式存储系统的存储空间写入数据时, 所述目标数据为所述存 储空间支持的数据, 所述源数据为待写入的数据; 和 /或
当从所述存储空间读取数据时, 所述目标数据为读取所要得到的数据, 所 述源数据为所述存储空间中存储的数据。 一种分布式存储系统的数据的处理方法, 包括: 获取源数据的模式结构和所述模式结构的标识,其中,所述源数据为待写入的数据; 根据所述模式结构将所述源数据写入存储空间, 并将所述标识写入所述存储空间。 根据权利要求 7所述的方法, 其中, 所述模式结构是对所述源数据中的每个元 素的模式结构的文本描述。 根据权利要求 8所述的方法, 其中, 所述文本描述包括以下至少之一: 所述每 个元素的名称, 所述每个元素的类型, 所述每个元素的合法取值范围, 所述每 个元素的嵌套关系, 各个所述每个元素的顺序。 根据权利要求 7至 9中任一项所述的方法, 其中, 获取所述源数据的模式结构 和所述模式结构的标识包括:
生成所述模式结构;
向分布式存储模式管理服务器发送所述模式结构;
接收所述分布式存储模式管理服务器根据所述模式结构返回的所述标识, 其中, 在所述分布式存储模式管理服务器在本地的现有模式结构中匹配到所述 模式结构的情况下, 所述标识为所匹配到的所述现有模式结构的标识, 否则所 述标识为新分配的标识。
11. 一种分布式存储系统的数据的处理装置, 包括:
获取模块,设置为获取目标数据的第一模式结构和源数据的第二模式结构; 还原模块, 设置为根据所述第一模式结构和所述第二模式结构将所述源数 据处理为所述第一模式结构的结构化数据。
12. 根据权利要求 11所述的装置,其中,所述还原模块还设置为判断所述第一模式 结构和所述第二模式结构是否一致, 当判断结果为一致时, 按照所述第一模式 结构或所述第二模式结构将所述源数据处理成所述结构化数据, 当判断结果为 不一致时, 确定所述第一结构模式与所述第二结构模式的差异, 并根据所述第 一模式结构、 所述第二模式结构和所述差异, 将所述源数据处理成所述结构化 数据。
13. 根据权利要求 12所述的装置,其中,所述还原模块还设置为比较所述第一模式 结构的第一标识号和所述第二模式结构的第二标识号, 如果所述第一标识号与 所述第二标识号一致, 则所述第一模式结构与所述第二模式结构一致, 如果所 述第一标识号与所述第二标识号不一致, 则所述第一模式结构与所述第二模式 结构不一致, 其中, 所述第一标识号和所述第二标识号由分布式存储模式管理 服务器统一分配。
14. 一种分布式存储系统的数据的处理装置, 包括:
模式获取模块, 设置为获取源数据的模式结构和所述模式结构的标识, 其 中, 所述源数据为待写入的数据;
写入模块, 设置为根据所述模式结构将所述源数据写入存储空间, 并将所 述标识写入所述存储空间。
15. 根据权利要求 14所述的装置,其中,所述模式获取模块还设置为生成所述模式 结构, 向分布式存储模式管理服务器发送所述模式结构, 接收所述分布式存储 模式管理服务器根据所述模式结构返回的所述标识, 其中, 在所述分布式存储 模式管理服务器在本地的现有模式结构中匹配到所述模式结构的情况下, 所述 标识为所匹配到的所述现有模式结构的标识, 否则所述标识为新分配的标识。
16. 一种分布式存储系统的数据的处理系统, 包括: 分布式存储数据存储服务器, 设置为存储数据;
分布式存储模式管理服务器, 设置为管理所述数据的模式结构; 权利要求 14或 15所述的装置, 设置为根据所述模式结构向所述分布式存 储模式管理服务器写入数据;
权利要求 11至 13中任一项所述的装置, 设置为根据所述模式结构从所述 分布式存储模式管理服务器读取数据。
PCT/CN2014/074556 2013-10-11 2014-04-01 分布式存储系统的数据的处理方法、装置及系统 WO2014176954A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US15/028,545 US10402391B2 (en) 2013-10-11 2014-04-01 Processing method, device and system for data of distributed storage system
EP14792021.9A EP3046307B1 (en) 2013-10-11 2014-04-01 Processing method, device and system for data of distributed storage system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310474020.8 2013-10-11
CN201310474020.8A CN104572649B (zh) 2013-10-11 2013-10-11 分布式存储系统的数据的处理方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2014176954A1 true WO2014176954A1 (zh) 2014-11-06

Family

ID=51843098

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/074556 WO2014176954A1 (zh) 2013-10-11 2014-04-01 分布式存储系统的数据的处理方法、装置及系统

Country Status (4)

Country Link
US (1) US10402391B2 (zh)
EP (1) EP3046307B1 (zh)
CN (1) CN104572649B (zh)
WO (1) WO2014176954A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649333B (zh) * 2015-10-29 2021-12-10 阿里巴巴集团控股有限公司 字段顺序一致性检测方法和装置
CN107704585A (zh) * 2017-10-09 2018-02-16 郑州云海信息技术有限公司 一种查询hdfs数据方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101488104A (zh) * 2009-02-26 2009-07-22 北京世纪互联宽带数据中心有限公司 一种实现高效安全存储的系统和方法
EP2434729A2 (en) * 2010-09-28 2012-03-28 Metaswitch Networks Ltd Method for providing access to data items from a distributed storage system
CN102694828A (zh) * 2011-03-23 2012-09-26 中兴通讯股份有限公司 一种分布式缓存系统数据存取的方法及装置
CN103064635A (zh) * 2012-12-19 2013-04-24 华为技术有限公司 分布式存储方法和分布式存储装置

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028028B1 (en) * 2001-05-17 2006-04-11 Enosys Markets,Inc. System for querying markup language data stored in a relational database according to markup language schema
GB0306463D0 (en) * 2003-03-20 2003-04-23 Steelhead Systems Ltd Improvements relating to communications data management
US7308458B2 (en) * 2003-06-11 2007-12-11 Wtviii, Inc. System for normalizing and archiving schemas
US8307012B2 (en) * 2006-02-28 2012-11-06 Sap Ag Schema mapping and data transformation on the basis of a conceptual model
EP1990740A1 (en) * 2007-05-08 2008-11-12 Sap Ag Schema matching for data migration
US7720873B2 (en) * 2007-06-21 2010-05-18 International Business Machines Corporation Dynamic data discovery of a source data schema and mapping to a target data schema
US20100274821A1 (en) * 2009-04-22 2010-10-28 Microsoft Corporation Schema Matching Using Clicklogs
US8386493B2 (en) * 2010-09-23 2013-02-26 Infosys Technologies Limited System and method for schema matching
CN103095758B (zh) * 2011-11-01 2016-09-21 北大方正集团有限公司 一种分布式文件系统及该系统中处理文件数据的方法
EP2795487A4 (en) * 2011-12-23 2015-07-29 Amazon Tech Inc SCALABLE ANALYSIS PLATFORM FOR SEMI-STRUCTURED DATA

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101488104A (zh) * 2009-02-26 2009-07-22 北京世纪互联宽带数据中心有限公司 一种实现高效安全存储的系统和方法
EP2434729A2 (en) * 2010-09-28 2012-03-28 Metaswitch Networks Ltd Method for providing access to data items from a distributed storage system
CN102694828A (zh) * 2011-03-23 2012-09-26 中兴通讯股份有限公司 一种分布式缓存系统数据存取的方法及装置
CN103064635A (zh) * 2012-12-19 2013-04-24 华为技术有限公司 分布式存储方法和分布式存储装置

Also Published As

Publication number Publication date
EP3046307B1 (en) 2020-09-16
CN104572649A (zh) 2015-04-29
US20160299820A1 (en) 2016-10-13
EP3046307A1 (en) 2016-07-20
US10402391B2 (en) 2019-09-03
CN104572649B (zh) 2019-10-25
EP3046307A4 (en) 2017-04-19

Similar Documents

Publication Publication Date Title
US20180246923A1 (en) Non-blocking processing of federated transactions for distributed data partitions
CN111767143B (zh) 交易数据处理方法、装置、设备及系统
US10338958B1 (en) Stream adapter for batch-oriented processing frameworks
US9639444B2 (en) Architecture for end-to-end testing of long-running, multi-stage asynchronous data processing services
CN101009516A (zh) 一种进行数据同步的方法及系统
CN111258978B (zh) 一种数据存储的方法
CN110413845B (zh) 基于物联网操作系统的资源存储方法及装置
CN104468274A (zh) 一种集群监控管理方法及系统
CN113900810A (zh) 分布式图处理方法、系统及存储介质
CN112035466B (zh) 一种区块链查询外置索引开发框架
WO2014176954A1 (zh) 分布式存储系统的数据的处理方法、装置及系统
CN107968798B (zh) 一种网管资源标签获取方法、缓存同步方法、装置及系统
CN111814020A (zh) 一种数据的获取方法和装置
CN111124542A (zh) 一种配置信息管理系统
CN113610527B (zh) 联盟链的交易方法、装置、系统、终端设备及存储介质
US10114864B1 (en) List element query support and processing
CN115082038A (zh) 系统集成方法、装置及电子设备
CN112948593A (zh) 知识图谱的生成方法、装置、设备和介质
CN108805741B (zh) 一种电能质量数据的融合方法、装置及系统
CN112052341A (zh) 知识图谱剪枝方法及装置
CN117082106B (zh) 面向政务云环境的多级数据组网方法、系统、装置和设备
CN115694841B (zh) 基于区块链和ipfs网络的元数据流通方法、装置及存储介质
US11671507B2 (en) Service profile discovery and connection management method for interworking with IoT device
CN116739397B (zh) 一种新能源指标的动态管理方法
CN118092982B (zh) 一种云原生应用的多集群运维方法、设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14792021

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2014792021

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 15028545

Country of ref document: US

Ref document number: 2014792021

Country of ref document: EP