WO2017084563A1 - Distributed system-based file reading method and device - Google Patents

Distributed system-based file reading method and device Download PDF

Info

Publication number
WO2017084563A1
WO2017084563A1 PCT/CN2016/105957 CN2016105957W WO2017084563A1 WO 2017084563 A1 WO2017084563 A1 WO 2017084563A1 CN 2016105957 W CN2016105957 W CN 2016105957W WO 2017084563 A1 WO2017084563 A1 WO 2017084563A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
data block
stripe
version number
file
Prior art date
Application number
PCT/CN2016/105957
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Publication of WO2017084563A1 publication Critical patent/WO2017084563A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a file reading method and apparatus based on a distributed system.
  • the distributed system may include a file interface server, a storage server, and a lock server for implementing a file interface service, a storage service, and a lock service, wherein the file interface server is configured to process a network file protocol, complete metadata processing and file read and write operations, and store The server is used to complete the storage of files and metadata; the lock server is used to complete the management of distributed locks.
  • the file data is stored in N+M protection mode, in which the file data is divided into at least N data blocks and passed through EC (Erasure). Code, data check erasure code) algorithm obtains M check data blocks.
  • N+M storage servers form an N+M data protection group through the network, and then N data blocks and M check data.
  • the block is stored in the data protection group.
  • a file may include at least one data stripe, and a data stripe may include at least one data block and at least one check data block, the data striping is written by the Quorum transaction mechanism to ensure consistency, and each data in the storage server Blocks have a version number. Under normal circumstances, the version numbers of N+M data blocks in a data strip are the same.
  • the file interface server After receiving the file read request sent by the client, the file interface server reads the data block from at least N storage servers, and the storage server returns the data block and the version number to the file interface server, and the file interface server according to the Quorum transaction
  • the mechanism is configured to determine whether the version numbers of the at least N data blocks are the same. When the version numbers of the at least N data blocks are the same, determine that the data stripe is valid, and then cache the read N data blocks, and cache the N data blocks.
  • the data block required by the client is sent to the client in the data block.
  • the limited cache capacity causes the data block cached by the file interface server to be deleted quickly.
  • the storage server needs to read at least N data blocks and their version numbers through the storage server, and the storage server reads the data pressure. Increased, resulting in client response delay, system performance is low.
  • the present invention provides a file reading method and device based on a distributed system.
  • a data block that a client needs to read is part of data in a data stripe
  • the file system can be prevented from reading the entire data stripe and effectively improving. System performance.
  • the first aspect provides a file reading method based on a distributed system, the method is applied to a file interface server, and the file interface server communicates with a client, a lock server, and a storage server, and the method includes:
  • the bar includes at least one data block
  • each target data block is sent to the client.
  • the lock server can cache the data stripe version number of each data stripe. If the client needs to read part of the data in the target data stripe, the file interface server can obtain the target data strip by using the lock server. The data striping version number, the file interface server can also determine the target data block required by the client, obtain the target data block and the data block version number corresponding to the target data block through the storage server storing the target data block, when the target data block corresponds When the data block version number and the data stripe version number are the same, the file interface server can determine that the target data block is valid and send the target data block to the client.
  • the file interface server needs to acquire all the data blocks in the target data strip by the storage server storing the data block in the target data stripe, regardless of whether the client requests part of the data or all the data of the target data stripe. And the data block version number corresponding to each data block.
  • the file interface server may determine that each data block is valid, and send the data block required by the client in the data block to the client.
  • Client in this application When the data block is part of the data in the target data strip, the file interface server obtains the target data block and the data block version number corresponding to the target data block through the storage server, and the data block version number and the data stripe version corresponding to the target data block.
  • the file interface server can determine that the target data block is valid, and it is not necessary to read all the data blocks in the target data stripe, which can effectively improve system performance.
  • the file interface server determines the data to which the data block 1-1 belongs.
  • the stripe is data strip 1
  • the data strip 1 includes a data block 1-1, a data block 1-2, and a data block 1-3
  • the file interface server sends a data block acquisition request to the storage server 1 storing the data block 1-1. And receiving the data block 1-1 fed back by the storage server 1 and the data block version number corresponding to the data block 1-1.
  • the file interface server sends a data block acquisition request to the storage server 2 storing the data block 1-2, and Receiving the data block 1-2 and the data block version number corresponding to the data block 1-2 fed back by the storage server 2, the file interface server sends a data block acquisition request to the storage server 3 storing the data block 1-3, and receives the feedback from the storage server 3.
  • Data block 1-3 and the data block version number corresponding to the data block 1-3 when the data block version number corresponding to the data block 1-1, the data block version number corresponding to the data block 1-2, and the data block 1-3 correspond to When the data block version numbers are the same, 1-1 transmits the data block to the client.
  • the file interface server may send a data stripe version number acquisition request for the data stripe 1 to the lock server, and receive the data stripe fed back by the lock server.
  • the data stripping version number of the data interface server may also send a data block acquisition request to the storage server 1 storing the data block 1-1, and receive the data block 1-1 and the data block 1-1 corresponding to the storage server 1
  • the data block version number is sent to the client when the data stripe version number of the data strip 1 and the data block version number corresponding to the data block 1-1 are the same.
  • the file interface server does not need to read all the data blocks in the data stripe, which can effectively improve system performance.
  • the offset address is an offset from the first address (ie, the start address of the file) in the file.
  • the at least one target data block is part of the data in the target data stripe, that is, the data quantity of the at least one target data block is smaller than the data quantity of the target data stripe, and the protection map of the file storage shown in FIG. 2 is taken as an example, at least When one target data block is data block 1-1, data block 1-1 is partial data in data strip 1; when at least one target data block is data block 1-1 and data block 1-2, data block 1 1 and data block 1-2 are partial data in data strip 1; at least one target data block is data block 1-1, In the case of the data block 1-2 and the data block 1-3, the data block 1-1, the data block 1-2, and the data block 1-3 are all data in the data stripe 1.
  • all the data blocks in the target data stripe can be read by a conventional file reading method.
  • the file interface server receives the target data block and the corresponding data block version number fed back by each storage server in response to the data block acquisition request, if the data stripe version number corresponds to each target data block, The data block version numbers are not identical, and all data blocks in the file can be read by the conventional file reading method.
  • the file interface server may receive a file write request sent by the client, and the file write request carries a file handle, an offset address, a write data, and a write data amount; and the file handle is obtained by using the version number allocator.
  • the data striping version number of the file determining the data block to which the write data belongs and the data strip to which the data block belongs according to the offset address and the amount of write data; and sending the write data to a storage server storing the data block to which the write data belongs;
  • the data stripe version number is sent to the lock server to notify the lock server to update the data stripe version number of the data stripe.
  • the version number allocator can maintain the data stripe version number of each data stripe in the file interface server.
  • the user can initiate a file write request to the file interface server through the client, and the file write request can carry the file handle, the offset address, the write data, and the write data amount, and the file interface server obtains the file corresponding to the file handle in the local cache through the file handle.
  • File attributes can include: the total file size of the file, the data EC protection level, and the storage path of each data block.
  • the file interface server can obtain the data block to which the write data belongs by using the total data amount, the offset address, and the write data amount, and send the write data to the storage server storing the data block according to the storage path of the data block to which the write data belongs. After the storage server receives the write data, the data block is updated. After the file interface server determines that the write data is successfully sent, the data stripe version number of the data strip obtained by the version number allocator may be sent to the lock server. The lock server may update the data stripe version number of the data stripe to ensure that the data stripe version number of the lock server cache is the latest data stripe version number, so that the file interface server receives the file read request sent by the client.
  • the interface server determines the accuracy of whether the target data block is valid.
  • the file interface server can determine that each data block is valid, and then the data block version number corresponding to the data block is used as the data stripe version number of the data strip to which each data block belongs, and the file interface server can send the data stripe version number to the lock server, and the lock The server can update the data stripe version number of the data stripe to ensure that the data striping version number of the lock server cache is the latest data stripe version number, which can improve the accuracy of the file interface server for determining whether the data block is valid.
  • the file interface server sends a read lock acquisition request to the lock server, the read lock acquisition request carries the data stripe identifier of the target data stripe, and the file interface server can receive the lock server response to the read lock acquisition request.
  • the read read authorization response message corresponding to the target data stripe corresponding to the data stripe identifier, wherein the read grant response message may carry the data stripe version number of the target data stripe.
  • the file interface server before the file interface server reads the file through the storage server, it needs to send a read lock acquisition request to the lock server, and if the lock server determines that the data barrier is corresponding to the data stripe, the read lock or the write lock is not used by other file interface servers. If it is held, the read authorization response message of the data stripe is fed back, and the file interface server can send a data block acquisition request to the storage server.
  • the file interface server needs to obtain the data stripe version number of the data stripe through the lock server, and divide the data stripe version number with the data block of the target data block. The version numbers are compared to determine if the target data block is valid.
  • the lock server may carry the data packet in the read authorization response message fed back in response to the read lock acquisition request.
  • the data striping version number is the number of bits that are stored in the lock server.
  • the file interface server sends a lock release request to the lock server, and the lock release request may carry the data stripe identifier and the data stripe version number to notify the lock server to update the data score corresponding to the data stripe identifier.
  • the read lock or the write lock may be actively released, that is, the file interface server may send a lock release request to the lock server, and the lock server responds to the lock release request, and Send a lock release response to the file interface server Message.
  • the data stripe version number of the data stripe can be sent to the lock server to ensure the data stripe version of the lock server cache. No. is the latest data striping version number.
  • the latest data stripe version number may be sent to the lock release request carrying the data stripe version number. Lock the server.
  • the file interface server may receive a lock recall request sent by the lock server, the lock recall request carries a data stripe identifier, and the file interface server may send a lock recall response message to the lock server in response to the lock recall request, the lock The recall response message carries the data stripe version number of the data stripe corresponding to the data stripe identifier, to notify the lock server to update the data stripe version number of the data stripe corresponding to the data stripe identifier.
  • the file interface server holds a read lock or a write lock on the data stripe. If another file interface server sends a lock acquisition request to the lock server, the lock server may send a lock recall request to the file interface server, and the file interface server After reading the file or writing the file, the lock recall response message may be sent to the lock server in response to the lock recall request, so that the lock server authorizes the lock of the data strip to the other file interface server.
  • the data stripe version number of the data stripe can be sent to the lock server to ensure the data stripe version of the lock server cache. No. is the latest data striping version number.
  • the file interface server may carry the data stripe version number in the lock recall response message fed back in response to the lock recall request. In order to send the latest data stripe version number to the lock server.
  • the file read request may further carry a file handle
  • the file interface server locally obtains the file attribute of the corresponding file according to the file handle
  • the file attribute includes a storage path of each data block in the file, according to each target data.
  • the storage path of the block determines a storage server of each storage target data block, and sends a data block acquisition request to each determined storage server.
  • the file handle is used to identify the file, and the different file handles correspond to different files, and the file interface server can locally obtain the file attribute of the corresponding file according to the file handle.
  • the file attribute can include the total amount of data of the file, the data EC protection level (ie, the data block in each data stripe) The number N and the number of check data blocks M) or the storage path of the data block, and the like.
  • the file interface server may determine a storage server of each storage target data block according to a storage path of the target data block, and then send a data block acquisition request to each determined storage server.
  • the file interface server may pre-establish a correspondence between the data block and the storage server.
  • the file interface server may establish the data block 1 - 1 Correspondence relationship with the storage server 1.
  • the file interface server may determine the storage server corresponding to the target data block according to the correspondence between the pre-established data block and the storage server, and send the storage server to the determined storage server. The data block gets the request.
  • a second aspect provides a file reading apparatus based on a distributed system, where the apparatus may include a request receiving unit, a data block determining unit, a request sending unit, a version number obtaining unit, a data block receiving unit, and a data block sending unit,
  • the device may be used to implement some or all of the steps in connection with the first aspect.
  • the third aspect provides a server, including a processor and a memory, which may be used to implement some or all of the steps in conjunction with the first aspect.
  • FIG. 1 is a schematic diagram of a framework of a distributed system provided in an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of protection of file storage provided in an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention
  • FIG. 4 is a schematic flowchart diagram of a file reading method based on a distributed system according to another embodiment of the present invention.
  • FIG. 5 is a schematic flowchart diagram of a file reading method based on a distributed system according to another embodiment of the present invention.
  • FIG. 6 is a file reading method based on a distributed system according to another embodiment of the present invention. Schematic diagram of the process
  • FIG. 7 is a schematic structural diagram of a file interface server according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a file reading apparatus based on a distributed system according to an embodiment of the present invention.
  • FIG. 1 is a schematic diagram of a framework of a distributed system according to an embodiment of the present invention.
  • the distributed system in the embodiment of the present invention may include at least a client, a file interface server, a storage server, and Lock the server.
  • the client can establish a communication connection with the file interface server through the network, and the file interface server establishes a communication connection with the lock server and the storage server respectively.
  • At least two storage servers can form a cluster of storage servers over the network.
  • the client is configured to send a file read request to the file interface server, and the file read request carries the offset address and the amount of read data.
  • a file interface server configured to determine, according to the offset address and the amount of read data, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs, wherein one file includes at least one data stripe Each data strip includes at least one data block; when the at least one target data block is part of the target data stripe, the data stripe version number acquisition request for the target data stripe is sent to the lock server.
  • the lock server is configured to send a data stripe version number to the file interface server in response to the data stripe version number acquisition request.
  • the file interface server is further configured to: when the at least one target data block is part of the data in the target data stripe, send a data block acquisition request to each storage server storing the target data block.
  • a storage server configured to send the target data block and the data block version number corresponding to the target data block to the file interface server in response to the data block acquisition request.
  • the file interface server is further configured to send each target data block to the client when the data stripe version number sent by the lock server is the same as the data block version number corresponding to the target data block sent by each storage server.
  • the storage server is saved at the same time.
  • the file storage adopts the N+M protection mode, that is, the N+M storage servers form an N+M data protection group through the network, and the file is divided into at least N data blocks, and the EC algorithm is used.
  • the data block is processed to obtain M check data blocks, and N data blocks and M check data blocks are stored in N+M storage servers.
  • the N+M data blocks of a file are called a data stripe.
  • each data block corresponds to one data block. Version number.
  • the check data block is used by the file interface server to determine that the data stripe is invalid, and the check data block is processed by the EC algorithm to generate a data block.
  • the file system includes five storage servers, where N is 3 and M is 2. If a file is divided into 6 data blocks, the file may include 2 data.
  • the data block identifier of each data block may be a stripe number-data block number, for example, the data block identifiers of the above data blocks are 1-1, 1-2, 1-3, 2-1, 2-2, and 2-3, processing the data blocks 1-1, 1-2, and 1-3 by the EC algorithm to obtain the check data block 1 and the check data block 2, wherein the data blocks 1-1, 1-2, and 1-3
  • the check data block 1 and the check data block 2 form a data stripe 1, and the data block 1-1 and its corresponding data block version number can be stored in the storage server 1, and the data block 1-2 and its corresponding
  • the data block version number is stored in the storage server 2, and the data block 1-3 and its corresponding data block version number are stored in the storage server 3, and the check data block 1 and its corresponding data block version number
  • the check data block 2 and its corresponding data block version number are stored in the storage server 5.
  • the data blocks 2-1, 2-2, and 2-3 are processed by the EC algorithm to obtain a check data block 3 and a check data block 4, where the data blocks 2-1, 2-2, and 2-3,
  • the check data block 3 and the check data block 4 form a data stripe 2, and the data block 2-1 and its corresponding data block version number can be stored in the storage server 1, and the data block 2-2 and its corresponding data can be stored.
  • the block version number is stored in the storage server 2
  • the check data block 1 and its corresponding data block version number are stored in the storage server 3
  • the check data block 2 and its corresponding data block version number are stored in the storage server 4.
  • the data block 2-3 and its corresponding data block version number are stored in the storage server 5.
  • the file interface server is further configured to send a data block acquisition request to the storage server of each storage target data block when the at least one target data block is all data in the target data strip.
  • the storage server is further configured to send the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
  • the file interface server is further configured to send each target data block to the client when the data block version numbers corresponding to the respective target data blocks are the same.
  • the file interface server is further configured to send a check data block acquisition request to each storage server that stores the check data block when the data block version numbers corresponding to the target data blocks are not completely the same.
  • the storage server is further configured to send the check data block and the corresponding data block version number to the file interface server in response to the check data block acquisition request.
  • the file interface server is further configured to process each check data block by using a data check erasure code EC algorithm when the data block version numbers corresponding to the check data blocks are the same, and obtain all the data blocks in the target data stripe.
  • the target data block is determined in all the generated data blocks, and each target data block is sent to the client.
  • the file interface server is further configured to: when the data block version numbers corresponding to the target data blocks are the same, the data block version number corresponding to the target data block is used as the data stripe version number of the target data stripe. Send the data stripe version number to the lock server.
  • the lock server is further configured to update the data stripe version number of the target data stripe.
  • the file interface server is further configured to: when the data stripe version number and the data block version number corresponding to each target data block are not completely the same, send to the storage server of the data block in each storage target data stripe The data block gets the request.
  • the storage server is further configured to send the data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
  • the file interface server is further configured to: when the data block version numbers corresponding to the respective data blocks are the same, determine each target data block in the received data block, and send each target data block to the client.
  • the file interface server is further configured to receive a file write request sent by the client, where the file write request carries a file handle, an offset address, a write data, and a write data amount; and the file handle is obtained by using a version number allocator.
  • the data striping version number of the file determining the data block to which the write data belongs and the data strip to which the data block belongs according to the offset address and the amount of write data; and transmitting the write data to a storage server storing the data block to which the write data belongs.
  • the storage server is also used to update the data block to which the write data belongs.
  • the file interface server is further configured to send the data stripe version number to the lock server when the write data is successfully sent.
  • the lock server is also used to update the data stripe version number of the data stripe.
  • the file interface server is configured to send a lock release request to the lock server, where the lock release request carries the data stripe identifier and the data stripe version number.
  • the lock server is further configured to update the data stripe version number of the data stripe corresponding to the data stripe identifier, and send a lock release response message to the file interface server in response to the lock release request.
  • the lock server is further configured to send a lock recall request to the file interface server, where the lock recall request carries the data stripe identifier.
  • the file interface server is further configured to send a lock recall response message to the lock server in response to the lock recall request, and the lock recall response message carries the data stripe version number of the data stripe corresponding to the data stripe identifier.
  • the lock server is further configured to update the data stripe version number of the data stripe corresponding to the data stripe identifier.
  • the file interface server is configured to send a read lock acquisition request to the lock server, where the read lock acquisition request carries the data stripe identifier of the target data strip.
  • the lock server is further configured to send a read authorization response message to the file interface server to the target data stripe corresponding to the data stripe identifier in response to the read lock acquisition request, where the read authorization response message carries the data stripe version number of the target data stripe.
  • the file read request may further carry a file handle
  • the file interface server sends a data block acquisition request to the storage server storing each target data block, where the file attribute is locally obtained according to the file handle, and the file attribute is used.
  • the storage path of each data block in the file is included; the storage server storing each target data block is determined according to the storage path of each target data block; and the data block acquisition request is sent to each determined storage server.
  • the client sends a file read request to the file interface server
  • the file read request carries the offset address and the read data amount
  • the file interface server determines the client according to the offset address and the read data amount.
  • the file interface server sends the target data to the lock server.
  • Striped data stripe version number obtained The request is received, and the lock server responds to the data stripe version number to obtain the data stripe version number fed back by the request, and the file interface server sends a data block acquisition request to each storage server storing the target data block, and receives each storage server response data block. Obtaining the target data block and the corresponding data block version number that are requested by the request, when the data stripe version number and the data block version number corresponding to each target data block are the same, the file interface server sends each target data block to the client. When the data block that the client needs to read is part of the data stripe, the file system can be prevented from reading the entire data stripe internally, thereby effectively improving system performance.
  • FIG. 3 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention, where the file reading method based on the distributed system in the embodiment of the present invention is at least Can include:
  • the client sends a file read request to the file interface server, where the file read request carries an offset address and a read data amount.
  • the file interface server determines, according to the offset address and the read data quantity, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs.
  • the file interface server may obtain the file attribute of the file in the local cache, and the file attributes may include: a total file amount of the file, a data EC protection level, and a storage path of each data block in the file.
  • the file interface server can determine at least one target data block that the client needs to read according to the offset address, the amount of read data, the total amount of data of the file, and the data EC protection level.
  • the data block identifier of each data block may be: a strip number - a data block number, such as a target
  • the data block identifiers for the data blocks are 4-2 and 4-3.
  • the file interface server may obtain the data stripe identifier of the target data strip to which the at least one target data block belongs according to the offset address, the read data amount, and the stripe data amount of the data stripe.
  • one file may include at least one data stripe, and each data stripe may include at least one data block.
  • the file includes data stripe 1 and data stripe 2
  • data stripe 1 includes data blocks 1-1, 1-2, and 1-3
  • data stripe 2 Includes data blocks 2-1, 2-2, and 2-3.
  • the format of the data stripe identifier may be: file identifier-strip number, the file identifier may be the file ID of the file, and the stripe number may be Where X is the offset address and Y is the stripe data amount of the data stripe.
  • the file interface server can determine that the target data stripe is the data stripe 1 in the file.
  • the method for obtaining the strip number includes but is not limited to the foregoing manner, for example, the strip number may be Where X is the offset address and Y is the stripe data amount of the data stripe.
  • the offset address is 1MB
  • the data volume of the data stripe is 1536 KB
  • the file interface server can determine that the target data stripe is the data stripe 0 in the file. It is not specifically limited by the embodiments of the present invention.
  • the file interface server may send a read lock acquisition request to the lock server, where the read lock acquisition request carries the data stripe identifier, and the lock server may determine whether the other file interface server holds the data stripe corresponding to the data stripe identifier.
  • the read lock or the write lock when the other file interface server does not hold the read lock and the write lock of the data stripe corresponding to the data stripe identifier, the lock server may send the data score corresponding to the data stripe identifier to the file interface server.
  • the strip reads the authorization response message so that the file interface server obtains the target data block through the storage server.
  • the file interface server sends a data stripe version number acquisition request for the target data stripe to the lock server.
  • the file interface server may send a data stripe version number acquisition request for the target data stripe to the lock server, and the data stripe version number
  • the acquisition request can carry the data stripe identifier.
  • the file interface server divides the file into six data blocks by using the file attribute, and the file includes two data strips, and the data block identifiers of the data block are 1-1, 1-2, 1-3, 2-1, respectively.
  • the target data block that the client needs to read is the data block 1-1 and the data block 1-2
  • the file interface server can determine that the target data block is part of the data in the data stripe 1, and further
  • the file interface server sends a data stripe version number acquisition request for the data strip 1 to the lock server.
  • the file interface server divides the file into six data blocks by using the file attribute, and the file includes two data strips, and the data block identifiers of the data block are 1-1, 1-2, 1-3, and 2-1, respectively.
  • the target data block that the client needs to read is data blocks 1-2, 1-3, 2-1, 2-2, and 2-3
  • the file interface server can determine the data block 1-2 and the data block.
  • 1-3 is part of the data in the data stripe 1
  • the file interface server sends a data stripe version number acquisition request for the data stripe 1 to the lock server.
  • Data blocks 2-1, 2-2, and 2-3 are all data in data stripe 2
  • the file interface server can obtain data blocks 2-1, 2-2, and 2-3 through a conventional file reading method. The obtained data blocks 2-1, 2-2, and 2-3 are sent to the client.
  • the lock server sends a data stripe version number to the file interface server in response to the data stripe version number acquisition request.
  • the lock server may cache the data stripe version number of each data stripe, and update the data stripe version number of the data stripe when the file interface server writes the data or reads the entire data stripe, and the lock server receives the data.
  • the data stripe version number of the target data stripe corresponding to the data stripe identifier may be searched, and the data stripe version number is sent to the file interface server.
  • the lock server fails, the data stripe version number in the cache may be lost, and the lock server cannot find the data stripe version number of the target data stripe corresponding to the data stripe identifier. Or when the lock server is eliminated, the file interface server cannot obtain the data stripe version number of the target data strip through the lock server. Or the lock server is currently running for the first time, and the data stripe version number of each data stripe is not stored in the cache. In the above case, the file interface server cannot obtain the data stripe version number through the lock server, and the file interface server can read the data required by the client through the traditional file reading method.
  • the lock server may carry the data stripe version number in the read authorization response message fed back by the read lock acquisition request sent by the response file interface server, so the file interface server does not need to send data to the lock server.
  • the method of obtaining the request by the stripe version number obtains the version number of the data stripe, which improves the data transmission efficiency.
  • the file interface server may send a read lock acquisition request to the lock server, the read lock acquisition request carries the data stripe identifier, and the lock server responds to the read lock acquisition request, and may send the data stripe identifier corresponding to the file interface server.
  • the read authorization response message of the file, and the read authorization response message carries the data stripe version number of the file.
  • the file interface server sends a data block acquisition request to a storage server that stores the target data block.
  • the file interface server may send a data block fetch request to the storage server storing the target data block. For example, if the file interface server determines that the target data block is the data block 1-2 and the data block 1-3, the file interface server may send a data block acquisition request to the storage server storing the data block 1-2, and the data block obtains the request carrying data. The data block identifier of block 1-2. The file interface server may also send a data block acquisition request to the storage server storing the data blocks 1-3, the data block acquisition request carrying the data block identifier of the data blocks 1-3.
  • the storage server storing the target data block may be determined according to the storage path of the target data block, and then the data block acquisition request is sent to the storage server. For example, the file interface server may determine that the data block 1-1 is stored in the storage server 1 according to the storage path of each data block, the data block 1-2 is stored in the storage server 2, and the data block 1-3 is stored in the storage server 3, When the target data block is the data block 1-2 and the data block 1-3, the file interface server may transmit a data block acquisition request to the storage server 2 and send a data block acquisition request to the storage server 3.
  • the storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
  • the storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
  • the file interface server sends a data block acquisition request to the storage server 2, the storage server 2 feeds back the data block 1-2 and the data block version number corresponding to the data block 1-2, and the file interface server can also send the data block acquisition to the storage server 3.
  • the request, the storage server 3 feeds back the data block 1-3 and the data block version number corresponding to the data block 1-3.
  • the file interface server sends each target data block to the client.
  • the file interface server may determine that each target data block is valid, and then Each target data block is sent to the client. For example, if the data stripe version number is the same as the data block version number corresponding to the data block 1-2, and the data stripe version number is the same as the data block version number corresponding to the data block 1-3, the file interface server may determine the data block. 1-2 and data blocks 1-3 are valid, and data blocks 1-2 and data blocks 1-3 are sent to the client.
  • the file interface server sends a data stripe version number acquisition request for the target data stripe to the lock server, and the lock server responds to the data stripe version number to obtain the request to the file interface server.
  • the file interface server may further send a data block acquisition request to the storage server of each storage target data block, and the storage server sends the target data block and the corresponding data block version number to the file interface server according to the data block acquisition request.
  • the file interface server sends each target data block to the client, and the data block that the client needs to read is part of the data stripe.
  • the entire data stripe can be prevented from being read internally by the file system, thereby effectively improving system performance.
  • FIG. 4 is a schematic flowchart of a method for reading a file according to an embodiment of the present invention.
  • the method for reading a file in the embodiment of the present invention may include at least:
  • the client sends a file read request to the file interface server, where the file read request carries an offset address and a read data amount.
  • the file interface server determines, according to the offset address and the read data quantity, the at least one target data block that the client needs to read and the target data strip to which the at least one target data block belongs.
  • the file interface server sends a data block acquisition request to the storage server storing the target data block.
  • the file interface server may send a data block acquisition request to the storage server storing the target data block.
  • all the data blocks in the target data strip are data block 1-1, data block 1-2, and data block 1-3
  • the file interface server determines that the target data block is data block 1-1, data block 1-2.
  • the file interface server may send a data block acquisition request to the storage server storing the data block 1-1, the data block acquisition request carrying the data block identifier of the data block 1-1.
  • the file interface server may also send a data block acquisition request to the storage server storing the data block 1-2, the data block acquisition request carrying the data block identifier of the data block 1-2.
  • the file interface server may also send a data block acquisition request to the storage server storing the data blocks 1-3, the data block acquisition request carrying the data block identifier of the data blocks 1-3.
  • the storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
  • the file interface server may determine whether the data block version numbers of the respective target data blocks are the same. When the data block version numbers corresponding to the respective target data blocks are the same, the file interface server may determine the same. Each data block in the target data strip is valid, and then each target data block is cached, and each target data block is sent to the client.
  • the file interface server may determine that the data blocks in the target data stripe are invalid, and then check according to the target data stripe.
  • the storage path of the data block sends a check data block acquisition request to the storage server storing the check data block, and the storage server sends the check data block and the data block corresponding to the check data block to the file interface server in response to the check data block acquisition request.
  • the version number, the file interface server can compare whether the data block version numbers corresponding to the respective check data blocks are the same.
  • the check data blocks are processed by the EC algorithm to obtain Each data block in the target data stripe, and then each data block is sent to the client.
  • the file interface server may use the data block version number corresponding to the target data block as the data stripe version number of the target data stripe, and The data striping version number is sent to the lock server.
  • the lock server may cache the data stripe version number and the data stripe identifier corresponding to the target data stripe;
  • the lock server may update the data stripe version number of the target data stripe.
  • the file interface server may actively release the read lock of the target data stripe, and the file interface server may strip the version number of the data in the process of releasing the read lock.
  • the file interface server may send a lock release request to the lock server, the lock release request carries the data stripe identifier and the data stripe version number, and the lock server may identify the data stripe version number of the target data stripe corresponding to the data stripe identifier.
  • the update is made and a lock release response message is sent to the file interface server in response to the lock release request.
  • the file interface server when receiving the lock recall request sent by the lock server, may carry the data stripe version number in the lock recall response message fed back in response to the lock recall request, thereby improving the file interface server and the lock server.
  • the lock server can be essay
  • the interface server sends a lock recall request, and the lock recall request carries the data stripe identifier.
  • the file interface server can send a lock recall response message to the lock server in response to the lock recall request, and the lock recall response message carries the data stripe version number, and the lock server can The data stripe version number of the target data stripe corresponding to the data stripe identifier is updated.
  • the file interface server stores the storage unit of the target data block.
  • the storage server responds to the data block acquisition request to send the target data block and the corresponding data block version number to the file interface server, and when the data block version numbers corresponding to the respective target data blocks are the same, the file interface server sets each target The data block is sent to the client.
  • FIG. 5 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention, where the file reading method based on the distributed system in the embodiment of the present invention is at least Can include:
  • the client sends a file read request to the file interface server, where the file read request carries an offset address and a read data amount.
  • the file interface server determines, according to the offset address and the amount of read data, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs.
  • the file interface server sends a data stripe version number acquisition request for the target data stripe to the lock server.
  • the lock server sends a data stripe version number to the file interface server in response to the data stripe version number acquisition request.
  • the file interface server sends a data block acquisition request to a storage server that stores the target data block.
  • the storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
  • the storage server sends a data block to the file interface server in response to the data block acquisition request.
  • the corresponding data block version number The storage server sends a data block to the file interface server in response to the data block acquisition request.
  • the file interface server may use the data block version number corresponding to the data block as the data stripe version number of the target data stripe, and divide the data into The strip version number is sent to the lock server.
  • the lock server may cache the data stripe version number and the data stripe identifier corresponding to the target data stripe; when the lock server When the data stripe version number of the target data stripe has been stored, the lock server can update the data stripe version number of the target data stripe.
  • the file interface server sends each target data block to the client.
  • the file interface server branches into each storage target data.
  • the storage server of the data block sends a data block acquisition request, and the storage server sends a data block and a corresponding data block version number to the file interface server according to the data block acquisition request.
  • the file interface server Each target data block is determined in the received data block, and each target data block is sent to the client.
  • FIG. 6 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention, where the file reading method based on the distributed system in the embodiment of the present invention is at least Can include:
  • the client sends a file write request to the file interface server, where the file write request carries a file handle, an offset address, a write data, and a write data amount.
  • the file interface server obtains a data stripe version number of the file corresponding to the file handle by using a version number allocator.
  • the file interface server may obtain the data stripe version number of the file corresponding to the file handle by using the version number allocator.
  • the current data stripe version number of the file maintained by the version number allocator is 10, and the preset monotonically increasing index is 2, and the file interface server allocates the file after the file interface server receives the file write request.
  • the data striping version number is 12. It should be noted that the monotonically increasing index includes but is not limited to 2, for example, monotonically increasing The number may be 1 or 3, etc., and is not specifically limited by the embodiment of the present invention.
  • the file interface server determines, according to the offset address and the amount of write data, a data block to which the write data belongs and a data strip to which the data block belongs.
  • the file interface server may obtain the file attribute of the file corresponding to the file handle in the local cache according to the file handle, and the file attribute may include: total file data amount, data EC protection level, and storage path of each data block in the file.
  • the file interface server can determine the data block to which the write data belongs according to the offset address, the amount of write data, the total amount of data of the file, and the level of data EC protection.
  • the number of data blocks to which the write data belongs may be at least one.
  • the file interface server determines that the total file size of the file is 30 MB, and the data EC protection level is 3+2. If the data volume of each data block is 512 KB, the offset address is 5 MB, and the write data volume is 512 KB, the file interface server It can be determined that the data block to which the write data belongs is 4-2.
  • the file interface server may obtain the data stripe identifier of the data strip to which the data block belongs according to the offset address and the stripe data amount of the data stripe, where the format of the data stripe identifier may be: file identifier Strip number, file ID can be the file ID of the file, and the strip number can be Where X is the offset address and Y is the stripe data amount of the data stripe.
  • the file interface server may send a write lock acquisition request to the lock server, and the write lock acquisition request carries the data stripe identifier, and the lock server may determine whether the other file interface server holds the data stripe corresponding to the data stripe identifier.
  • the read lock or the write lock when the other file interface server does not hold the read lock and the write lock of the data stripe corresponding to the data stripe identifier, the lock server may send the data score corresponding to the data stripe identifier to the file interface server.
  • the write authorization message of the strip so that the file interface server sends the write data to the storage server.
  • the file interface server sends the write data to a storage server that stores the data block to which the write data belongs.
  • the write data may be sent to the storage server storing the data block to which the write data belongs according to the storage path of the data block.
  • the data block to which the write data belongs is 4-2, and the file interface server determines that the data block 4-2 is stored in the storage server 1 according to the storage path of the data block 4-2, and the file interface server can send the write data to the storage server 1 .
  • the file interface server may process the write data by using an EC algorithm to obtain a check data block, and send the write data, the check data block, and the obtained data stripe version number to The storage server can update the data block to which the write data belongs, and update the check data block, and then update the data block version number corresponding to each data block in the data stripe to the data stripe version. number.
  • the file interface server may send the obtained data stripe version number to the lock server. Further, the file interface server may further send the data stripe identifier of the data strip to which the data block belongs to the lock server. For example, after the file interface server determines that the write data sent to the storage server is sent, the obtained data stripe version number may be sent to the lock server to notify the lock server to update the data stripe version number of the data stripe. For another example, after the file interface server sends the write data to the storage server, the storage server sends the write data to the file interface server to successfully receive the message, and the file interface server can successfully receive the message according to the write data to determine that the write data is successfully sent, and then the acquired data. The stripe version number is sent to the lock server.
  • the lock server updates the data stripe version number of the data stripe.
  • the client sends a file write request to the file interface server, and the file write request carries the file handle, the offset address, the write data, and the write data amount, and the file interface server passes The version number allocator obtains the data stripe version number of the file corresponding to the file handle, and the file interface server determines, according to the offset address and the amount of write data, the data block to which the write data belongs and the data strip to which the data block belongs, and the file interface server writes The data is sent to the storage server storing the data block to which the write data belongs.
  • the file interface server sends the data stripe version number to the lock server, and the lock server updates the data stripe version number of the data strip to which the data block belongs. It ensures the validity of the data stripe version number stored by the lock server.
  • FIG. 7 is a schematic structural diagram of a file interface server according to an embodiment of the present invention.
  • the file interface server may include a processor 701, a memory 702, a first network interface 703, a second network interface 704, and a third network interface 705.
  • the processor 701 is connected to the memory 702, the first network interface 703, the second network interface 704, and the third network interface 705.
  • the processor 701 can be connected to the memory 702, the first network interface 703, the second network interface 704, and the Third network interface 705.
  • the processor 701 may be a central processing unit (CPU), a network processor (NP), or the like.
  • the memory 702 can be specifically configured to store a data block, a data block version number corresponding to the data block, and the like.
  • the memory 702 may include a volatile memory such as a random-access memory (RAM); the memory may also include a non-volatile memory such as a read-only memory (read- Only memory, ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory may also include a combination of the above types of memory.
  • RAM random-access memory
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid-state drive
  • the first network interface 703 is configured to communicate with the client, for example, to receive a file read request sent by the client.
  • the first network interface 703 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
  • the second network interface 704 is configured to communicate with the lock server, for example, send a data stripe version number acquisition request for the target data stripe to the lock server.
  • the second network interface 704 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
  • the third network interface 705 is configured to communicate with the storage server, for example, send a data block acquisition request to the storage server.
  • the third network interface 705 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
  • the file interface server introduced in the embodiment of the present invention may be used to implement some or all of the processes in the embodiment of the distributed system-based file reading method introduced in conjunction with FIG. 3 to FIG.
  • FIG. 8 is a schematic structural diagram of a file reading apparatus based on a distributed system according to an embodiment of the present invention, wherein the file reading apparatus based on the distributed system provided by the embodiment of the present invention can be combined with FIG.
  • the processor 701 in the embodiment of the present invention may include at least a request receiving unit 801, a data block determining unit 802, a request sending unit 803, a version number obtaining unit 804, A data block receiving unit 805 and a data block transmitting unit 806, wherein:
  • the request receiving unit 801 is configured to receive a file read request sent by the client, where the file read request carries an offset address and a read data amount.
  • a data block determining unit 802 configured to determine, according to the offset address and the amount of read data, the client needs At least one target data block to be read and a target data strip to which the at least one target data block belongs, one file includes at least one data stripe, and each data strip includes at least one data block.
  • the request sending unit 803 is configured to send, when the at least one target data block is part of the data in the target data stripe, a data stripe version number acquisition request for the target data stripe to the lock server.
  • the version number obtaining unit 804 is configured to receive a data stripe version number fed back by the lock server in response to the data stripe version number obtaining request.
  • the request sending unit 803 is further configured to send a data block acquisition request to each storage server storing the target data block.
  • the data block receiving unit 805 is configured to receive the target data block and the corresponding data block version number fed back by the respective storage server in response to the data block acquisition request.
  • the data block sending unit 806 is configured to send each target data block to the client when the data stripe version number and the data block version number corresponding to each target data block are the same.
  • the request sending unit 803 is further configured to: when the at least one target data block is all the data in the target data stripe, send the data block obtaining request to the storage server of each storage target data block.
  • the data block receiving unit 805 is further configured to receive each target data block and each corresponding data block version number that are fed back by the respective storage server in response to the data block acquisition request.
  • the data block sending unit 806 is further configured to send each target data block to the client when the data block version numbers corresponding to the respective target data blocks are the same.
  • the request sending unit 803 is further configured to: when the data stripe version number and the data block version number corresponding to each target data block are not completely the same, store the data block in each storage target data stripe. Send a data block get request.
  • the data block receiving unit 805 is further configured to receive each data block and each corresponding data block version number fed back by the respective storage server in response to the data block acquisition request.
  • the data block determining unit 802 is further configured to determine each target data block in the received data block when the data block version numbers corresponding to the respective data blocks are the same.
  • the data block sending unit 806 is further configured to send each target data block to the client.
  • the request receiving unit 801 is further configured to receive a file write request sent by the client, where the file write request carries a file handle, an offset address, a write data, and a write data amount.
  • the version number obtaining unit 804 is further configured to obtain a data stripe version number of the file corresponding to the file handle by using the version number allocator.
  • the data block determining unit 802 is further configured to determine, according to the offset address and the amount of write data, a data block to which the write data belongs and a data strip to which the data block belongs.
  • the file reading apparatus based on the distributed system in the embodiment of the present invention may further include:
  • the data transmitting unit 807 is configured to send the write data to a storage server that stores the data block to which the write data belongs.
  • the version number sending unit 808 is configured to send the data stripe version number to the lock server when the write data is successfully sent, to notify the lock server to update the data stripe version number of the data stripe.
  • the reading device of the file in the embodiment of the present invention may further include:
  • the version number sending unit 808 is configured to use the data block version number corresponding to the target data block as the data stripe version number of the target data strip when the data block version numbers corresponding to the target data blocks are the same, and the data stripe version The number is sent to the lock server to notify the lock server to update the data stripe version number of the target data strip.
  • version number sending unit 808 is specifically configured to:
  • the lock release server responds to the lock release response message fed back by the lock release request.
  • version number sending unit 808 is specifically configured to:
  • the request sending unit 803 sends a data stripe version number acquisition request for the target data striping to the lock server, specifically for:
  • a read lock acquisition request is sent to the lock server, and the read lock acquisition request carries the data stripe identifier of the target data strip.
  • the read authorization response message carries the data stripe version number of the target data stripe.
  • the file read request may further carry a file handle
  • the request sending unit 803 sends a data block acquisition request to the storage server storing each target data block, specifically for:
  • the file attribute of the file is obtained locally according to the file handle, and the file attribute includes the storage path of each data block in the file.
  • a storage server that stores each target data block is determined according to a storage path of each target data block.
  • a data block acquisition request is sent to each of the determined storage servers.
  • the request sending unit 803 is further configured to: when the data block version numbers corresponding to the respective target data blocks are not completely the same, send the check data block to the storage server of the check data block in each storage target data stripe. request.
  • the data block receiving unit 805 is further configured to receive the check data block and the corresponding data block version number fed back by the respective storage server in response to the check data block acquisition request.
  • the file reading apparatus based on the distributed system in the embodiment of the present invention may further include:
  • the data block generating unit 809 is configured to process each check data block by an EC algorithm when the data block version numbers corresponding to the respective check data blocks are the same, to obtain each data block in the target data strip.
  • the data block sending unit 806 is further configured to send each target data block in the data block to the client.
  • the distributed system-based file reading apparatus introduced in the embodiment of the present invention may be used to implement some or all of the processes in the distributed system-based file reading method embodiment introduced by the present invention in conjunction with FIG. 3 to FIG. .
  • first and second are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated.
  • features defining “first” or “second” may include at least one of the features, either explicitly or implicitly.
  • the meaning of "a plurality” is at least two, such as two, three, etc., unless specifically defined otherwise.
  • a "computer-readable medium” can be any apparatus that can include, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with such an instruction execution system, apparatus, or device.
  • computer readable media include the following: electrical connections (electronic devices) having one or more wires, portable computer disk cartridges (magnetic devices), random access memory, read only memory , erasable editable read-only memory, fiber optic devices, and portable optical disk read-only memory.
  • the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
  • portions of the invention may be implemented in hardware, software, firmware or a combination thereof.
  • multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays, field programmable gate arrays, and the like.
  • modules in the various embodiments of the present invention may be implemented in the form of hardware or in the form of software functional modules.
  • An integrated module can also be stored in a computer readable storage medium if it is implemented as a software functional module and sold or used as a standalone product.

Landscapes

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

Abstract

A distributed system-based file reading method and device. The method comprises: determining, according to an offset address and a reading data quantity carried in a file reading request sent by a client side, at least one target data block the client side needs to read and a target data stripe to which the target data block belongs; when the at least one target data block is partial data in the target data stripe, sending to a lock server a data stripe version number acquisition request in respect of the target data stripe; sending a data block acquisition request to each storage server for storing the target data block; and when a data stripe version number fed back by the lock server is identical to a data block version number corresponding to the target data block fed back by each storage server, sending the target data block to the client side. By adopting the method, when a data block a client side needs to read is partial data in a data stripe, the whole data stripe is prevented from being read in a file system, and system performance is effectively increased.

Description

一种基于分布式系统的文件读取方法及装置File reading method and device based on distributed system 技术领域Technical field
本发明涉及通信技术领域,尤其涉及一种基于分布式系统的文件读取方法及装置。The present invention relates to the field of communications technologies, and in particular, to a file reading method and apparatus based on a distributed system.
背景技术Background technique
分布式系统可以包括文件接口服务器、存储服务器以及锁服务器,用于实现文件接口服务、存储服务以及锁服务,其中文件接口服务器用于处理网络文件协议,完成元数据处理及文件读写操作;存储服务器用于完成文件和元数据的存储;锁服务器用于完成分布式锁的管理。在分布式系统中,为了提升文件数据的可靠性,同时提高存储空间的利用率,文件数据的存储采用N+M保护方式,其中文件数据切分为至少N个数据块,并通过EC(Erasure Code,数据校验擦除码)算法得到M个校验数据块,已知N+M个存储服务器通过网络组成一个N+M的数据保护组,进而将N个数据块和M个校验数据块存储到该数据保护组中。一个文件可以包括至少一个数据分条,一个数据分条可以包括至少一个数据块和至少一个校验数据块,数据分条写入时通过Quorum事务机制保证一致性,并且在存储服务器中每个数据块都有一个版本号,正常情况下,一个数据分条中的N+M个数据块的版本号都是相同的。The distributed system may include a file interface server, a storage server, and a lock server for implementing a file interface service, a storage service, and a lock service, wherein the file interface server is configured to process a network file protocol, complete metadata processing and file read and write operations, and store The server is used to complete the storage of files and metadata; the lock server is used to complete the management of distributed locks. In a distributed system, in order to improve the reliability of file data and improve the utilization of storage space, the file data is stored in N+M protection mode, in which the file data is divided into at least N data blocks and passed through EC (Erasure). Code, data check erasure code) algorithm obtains M check data blocks. It is known that N+M storage servers form an N+M data protection group through the network, and then N data blocks and M check data. The block is stored in the data protection group. A file may include at least one data stripe, and a data stripe may include at least one data block and at least one check data block, the data striping is written by the Quorum transaction mechanism to ensure consistency, and each data in the storage server Blocks have a version number. Under normal circumstances, the version numbers of N+M data blocks in a data strip are the same.
传统的,文件接口服务器接收到客户端发送的文件读取请求之后,从至少N个存储服务器中读取数据块,存储服务器向文件接口服务器返回数据块和版本号,文件接口服务器会根据Quorum事务机制,判断至少N个数据块的版本号是否相同,当至少N个数据块的版本号相同时,确定该数据分条有效,进而缓存读取到的N个数据块,并在缓存的N个数据块中将客户端需要的数据块发送给客户端。缓存容量有限导致文件接口服务器缓存的数据块很快被删除,客户端每发送一个文件读取请求,存储服务器就需要通过存储服务器读取至少N个数据块及其版本号,存储服务器读数据压力增加,导致客户端响应延时,系统性能较低。Traditionally, after receiving the file read request sent by the client, the file interface server reads the data block from at least N storage servers, and the storage server returns the data block and the version number to the file interface server, and the file interface server according to the Quorum transaction The mechanism is configured to determine whether the version numbers of the at least N data blocks are the same. When the version numbers of the at least N data blocks are the same, determine that the data stripe is valid, and then cache the read N data blocks, and cache the N data blocks. The data block required by the client is sent to the client in the data block. The limited cache capacity causes the data block cached by the file interface server to be deleted quickly. Each time the client sends a file read request, the storage server needs to read at least N data blocks and their version numbers through the storage server, and the storage server reads the data pressure. Increased, resulting in client response delay, system performance is low.
发明内容 Summary of the invention
本申请提供一种基于分布式系统的文件读取方法及装置,当客户端需要读取的数据块是数据分条中的部分数据时,可避免文件系统内部读取整个数据分条,有效提升系统性能。The present invention provides a file reading method and device based on a distributed system. When a data block that a client needs to read is part of data in a data stripe, the file system can be prevented from reading the entire data stripe and effectively improving. System performance.
第一方面提供了一种基于分布式系统的文件读取方法,所述方法应用于文件接口服务器,文件接口服务器和客户端、锁服务器以及存储服务器通信,所述方法包括:The first aspect provides a file reading method based on a distributed system, the method is applied to a file interface server, and the file interface server communicates with a client, a lock server, and a storage server, and the method includes:
接收客户端发送的文件读请求,文件读请求携带偏移地址以及读取数据量;Receiving a file read request sent by the client, and the file read request carries an offset address and a read data amount;
根据偏移地址以及读取数据量,确定客户端需要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条,文件句柄对应的文件包括至少一个数据分条,各个数据分条包括至少一个数据块;Determining, according to the offset address and the amount of read data, at least one target data block that the client needs to read and at least one target data segment to which the target data block belongs, and the file corresponding to the file handle includes at least one data stripe, each data segment The bar includes at least one data block;
当至少一个目标数据块为目标数据分条中的部分数据时,向锁服务器发送针对目标数据分条的数据分条版本号获取请求,并接收锁服务器响应数据分条版本号获取请求所反馈的数据分条版本号;When at least one target data block is part of the data in the target data stripe, sending a data stripe version number acquisition request for the target data stripe to the lock server, and receiving the lock server response data stripe version number obtaining request feedback Data striping version number;
向各个存储目标数据块的存储服务器发送数据块获取请求,并接收各个存储服务器响应数据块获取请求所反馈的目标数据块及其对应的数据块版本号;Sending a data block acquisition request to each storage server storing the target data block, and receiving the target data block and the corresponding data block version number fed back by each storage server in response to the data block acquisition request;
当数据分条版本号和各个目标数据块对应的数据块版本号相同时,将各个目标数据块发送给客户端。When the data stripe version number is the same as the data block version number corresponding to each target data block, each target data block is sent to the client.
在该技术方案中,锁服务器可以缓存各个数据分条的数据分条版本号,如果客户端需要读取目标数据分条中的部分数据,则文件接口服务器可以通过锁服务器获取该目标数据分条的数据分条版本号,文件接口服务器还可以确定客户端所需的目标数据块,通过存储目标数据块的存储服务器获取目标数据块以及目标数据块对应的数据块版本号,当目标数据块对应的数据块版本号和数据分条版本号相同时,文件接口服务器可以确定目标数据块有效,并将目标数据块发送给客户端。传统的文件读取方法中,无论客户端请求的是目标数据分条的部分数据或者所有数据,文件接口服务器需要通过存储目标数据分条中数据块的存储服务器获取目标数据分条中所有数据块以及各个数据块对应的数据块版本号,当各个数据块版本号相同时,文件接口服务器可以确定各个数据块有效,并将上述数据块中客户端所需数据块发送给客户端。本申请中客户端所 需数据块为目标数据分条中的部分数据时,文件接口服务器通过存储服务器获取目标数据块以及目标数据块对应的数据块版本号,当目标数据块对应的数据块版本号和数据分条版本号相同时,文件接口服务器可以确定目标数据块有效,无需读取目标数据分条中的所有数据块,可有效提升系统性能。In the technical solution, the lock server can cache the data stripe version number of each data stripe. If the client needs to read part of the data in the target data stripe, the file interface server can obtain the target data strip by using the lock server. The data striping version number, the file interface server can also determine the target data block required by the client, obtain the target data block and the data block version number corresponding to the target data block through the storage server storing the target data block, when the target data block corresponds When the data block version number and the data stripe version number are the same, the file interface server can determine that the target data block is valid and send the target data block to the client. In the conventional file reading method, the file interface server needs to acquire all the data blocks in the target data strip by the storage server storing the data block in the target data stripe, regardless of whether the client requests part of the data or all the data of the target data stripe. And the data block version number corresponding to each data block. When each data block version number is the same, the file interface server may determine that each data block is valid, and send the data block required by the client in the data block to the client. Client in this application When the data block is part of the data in the target data strip, the file interface server obtains the target data block and the data block version number corresponding to the target data block through the storage server, and the data block version number and the data stripe version corresponding to the target data block. When the number is the same, the file interface server can determine that the target data block is valid, and it is not necessary to read all the data blocks in the target data stripe, which can effectively improve system performance.
以图2所示的文件存储的保护示意图为例,传统的文件读取方法中,当客户端需要读取的数据为数据块1-1时,文件接口服务器确定数据块1-1所属的数据分条为数据分条1,数据分条1包括数据块1-1、数据块1-2以及数据块1-3,文件接口服务器向存储数据块1-1的存储服务器1发送数据块获取请求,并接收存储服务器1反馈的数据块1-1以及数据块1-1对应的数据块版本号,同理,文件接口服务器向存储数据块1-2的存储服务器2发送数据块获取请求,并接收存储服务器2反馈的数据块1-2以及数据块1-2对应的数据块版本号,文件接口服务器向存储数据块1-3的存储服务器3发送数据块获取请求,并接收存储服务器3反馈的数据块1-3以及数据块1-3对应的数据块版本号,当数据块1-1对应的数据块版本号、数据块1-2对应的数据块版本号以及数据块1-3对应的数据块版本号都相同时,将数据块1-1发送给客户端。Taking the protection diagram of the file storage shown in FIG. 2 as an example, in the conventional file reading method, when the data that the client needs to read is the data block 1-1, the file interface server determines the data to which the data block 1-1 belongs. The stripe is data strip 1, the data strip 1 includes a data block 1-1, a data block 1-2, and a data block 1-3, and the file interface server sends a data block acquisition request to the storage server 1 storing the data block 1-1. And receiving the data block 1-1 fed back by the storage server 1 and the data block version number corresponding to the data block 1-1. Similarly, the file interface server sends a data block acquisition request to the storage server 2 storing the data block 1-2, and Receiving the data block 1-2 and the data block version number corresponding to the data block 1-2 fed back by the storage server 2, the file interface server sends a data block acquisition request to the storage server 3 storing the data block 1-3, and receives the feedback from the storage server 3. Data block 1-3 and the data block version number corresponding to the data block 1-3, when the data block version number corresponding to the data block 1-1, the data block version number corresponding to the data block 1-2, and the data block 1-3 correspond to When the data block version numbers are the same, 1-1 transmits the data block to the client.
而本申请中,当客户端需要读取的数据为1-1时,文件接口服务器可以向锁服务器发送针对数据分条1的数据分条版本号获取请求,并接收锁服务器反馈的数据分条1的数据分条版本号,文件接口服务器还可以向存储数据块1-1的存储服务器1发送数据块获取请求,并接收存储服务器1反馈的数据块1-1以及数据块1-1对应的数据块版本号,当数据分条1的数据分条版本号和数据块1-1对应的数据块版本号相同时,将数据块1-1发送给客户端。相对传统的文件读取方法,当客户端需要读取的数据块是数据分条中的部分数据时,文件接口服务器无需读取数据分条中的所有数据块,可有效提升系统性能。In the present application, when the data that the client needs to read is 1-1, the file interface server may send a data stripe version number acquisition request for the data stripe 1 to the lock server, and receive the data stripe fed back by the lock server. The data stripping version number of the data interface server may also send a data block acquisition request to the storage server 1 storing the data block 1-1, and receive the data block 1-1 and the data block 1-1 corresponding to the storage server 1 The data block version number is sent to the client when the data stripe version number of the data strip 1 and the data block version number corresponding to the data block 1-1 are the same. Compared with the traditional file reading method, when the data block that the client needs to read is part of the data stripe, the file interface server does not need to read all the data blocks in the data stripe, which can effectively improve system performance.
其中,偏移地址为在文件中相对于首地址(即文件的起始地址)的偏移量。Wherein, the offset address is an offset from the first address (ie, the start address of the file) in the file.
其中,至少一个目标数据块为目标数据分条中的部分数据,即至少一个目标数据块的数据量小于目标数据分条的数据量,以图2所示的文件存储的保护示意图为例,至少一个目标数据块为数据块1-1时,数据块1-1为数据分条1中的部分数据;至少一个目标数据块为数据块1-1和数据块1-2时,数据块1-1和数据块1-2为数据分条1中的部分数据;至少一个目标数据块为数据块1-1、 数据块1-2以及数据块1-3时,数据块1-1、数据块1-2以及数据块1-3为数据分条1中的所有数据。The at least one target data block is part of the data in the target data stripe, that is, the data quantity of the at least one target data block is smaller than the data quantity of the target data stripe, and the protection map of the file storage shown in FIG. 2 is taken as an example, at least When one target data block is data block 1-1, data block 1-1 is partial data in data strip 1; when at least one target data block is data block 1-1 and data block 1-2, data block 1 1 and data block 1-2 are partial data in data strip 1; at least one target data block is data block 1-1, In the case of the data block 1-2 and the data block 1-3, the data block 1-1, the data block 1-2, and the data block 1-3 are all data in the data stripe 1.
在上述技术方案中,可选的,如果客户端需要读取目标数据分条中的所有数据,则可以通过传统的文件读取方法读取目标数据分条中的所有数据块。In the above technical solution, optionally, if the client needs to read all the data in the target data stripe, all the data blocks in the target data stripe can be read by a conventional file reading method.
在上述技术方案中,可选的,文件接口服务器接收各个存储服务器响应数据块获取请求所反馈的目标数据块及其对应的数据块版本号之后,如果数据分条版本号和各个目标数据块对应的数据块版本号不完全相同,则可以通过传统的文件读取方法读取文件中的所有数据块。In the above technical solution, optionally, after the file interface server receives the target data block and the corresponding data block version number fed back by each storage server in response to the data block acquisition request, if the data stripe version number corresponds to each target data block, The data block version numbers are not identical, and all data blocks in the file can be read by the conventional file reading method.
在上述技术方案中,可选的,文件接口服务器可以接收客户端发送的文件写请求,文件写请求携带文件句柄、偏移地址、写数据以及写数据量;通过版本号分配器获取文件句柄对应的文件的数据分条版本号;根据偏移地址以及写数据量,确定写数据所属的数据块以及数据块所属的数据分条;将写数据发送给存储写数据所属数据块的存储服务器;当写数据成功发送时,将数据分条版本号发送给锁服务器,以通知锁服务器更新数据分条的数据分条版本号。In the above technical solution, optionally, the file interface server may receive a file write request sent by the client, and the file write request carries a file handle, an offset address, a write data, and a write data amount; and the file handle is obtained by using the version number allocator. The data striping version number of the file; determining the data block to which the write data belongs and the data strip to which the data block belongs according to the offset address and the amount of write data; and sending the write data to a storage server storing the data block to which the write data belongs; When the write data is successfully sent, the data stripe version number is sent to the lock server to notify the lock server to update the data stripe version number of the data stripe.
具体实现中,版本号分配器可以维护文件接口服务器中各个数据分条的数据分条版本号。用户可以通过客户端向文件接口服务器发起文件写请求,文件写请求可以携带文件句柄、偏移地址、写数据以及写数据量,文件接口服务器通过文件句柄在本地缓存中得到文件句柄对应的文件的文件属性,其中文件属性可以包括:文件的文件总数据量、数据EC保护级别以及各个数据块的存储路径。文件接口服务器可以通过文件总数据量、偏移地址以及写数据量,得到写数据所属的数据块,并根据写数据所属数据块的存储路径,向存储该数据块的存储服务器发送写数据。存储服务器接收到该写数据之后对数据块进行更新,文件接口服务器确定该写数据成功发送之后,可以将通过版本号分配器得到的该数据分条的数据分条版本号发送给锁服务器。锁服务器可以对该数据分条的数据分条版本号进行更新,确保锁服务器缓存的数据分条版本号为最新的数据分条版本号,以便文件接口服务器接收到客户端发送的文件读请求时,通过比较锁服务器缓存的数据分条版本号和目标数据块对应的数据块版本号是否相同的方式确定目标数据块是否有效,数据分条版本号为最新的数据分条版本号,可提升文件接口服务器判断目标数据块是否有效的精确度。 In a specific implementation, the version number allocator can maintain the data stripe version number of each data stripe in the file interface server. The user can initiate a file write request to the file interface server through the client, and the file write request can carry the file handle, the offset address, the write data, and the write data amount, and the file interface server obtains the file corresponding to the file handle in the local cache through the file handle. File attributes, where file attributes can include: the total file size of the file, the data EC protection level, and the storage path of each data block. The file interface server can obtain the data block to which the write data belongs by using the total data amount, the offset address, and the write data amount, and send the write data to the storage server storing the data block according to the storage path of the data block to which the write data belongs. After the storage server receives the write data, the data block is updated. After the file interface server determines that the write data is successfully sent, the data stripe version number of the data strip obtained by the version number allocator may be sent to the lock server. The lock server may update the data stripe version number of the data stripe to ensure that the data stripe version number of the lock server cache is the latest data stripe version number, so that the file interface server receives the file read request sent by the client. Determine whether the target data block is valid by comparing whether the data stripe version number of the lock server cache is the same as the data block version number corresponding to the target data block, and the data stripe version number is the latest data stripe version number, and the file can be upgraded. The interface server determines the accuracy of whether the target data block is valid.
在上述技术方案中,可选的,文件接口服务器通过传统的文件读取方法读取文件中的所有数据块之后,当通过存储服务器获取到的各个数据块对应的数据块版本号相同时,文件接口服务器可以确定各个数据块有效,进而将数据块对应的数据块版本号作为各个数据块所属数据分条的数据分条版本号,文件接口服务器可以将数据分条版本号发送给锁服务器,锁服务器可以对该数据分条的数据分条版本号进行更新,确保锁服务器缓存的数据分条版本号为最新的数据分条版本号,可提升文件接口服务器判断数据块是否有效的精确度。In the above technical solution, optionally, after the file interface server reads all the data blocks in the file by using the traditional file reading method, when the data block version numbers corresponding to the respective data blocks obtained by the storage server are the same, the file The interface server can determine that each data block is valid, and then the data block version number corresponding to the data block is used as the data stripe version number of the data strip to which each data block belongs, and the file interface server can send the data stripe version number to the lock server, and the lock The server can update the data stripe version number of the data stripe to ensure that the data striping version number of the lock server cache is the latest data stripe version number, which can improve the accuracy of the file interface server for determining whether the data block is valid.
在上述技术方案中,可选的,文件接口服务器向锁服务器发送读锁获取请求,读锁获取请求携带目标数据分条的数据分条标识,文件接口服务器可以接收锁服务器响应读锁获取请求所反馈的对数据分条标识对应的目标数据分条的读授权响应消息,其中读授权响应消息可以携带目标数据分条的数据分条版本号。In the above technical solution, optionally, the file interface server sends a read lock acquisition request to the lock server, the read lock acquisition request carries the data stripe identifier of the target data stripe, and the file interface server can receive the lock server response to the read lock acquisition request. The read read authorization response message corresponding to the target data stripe corresponding to the data stripe identifier, wherein the read grant response message may carry the data stripe version number of the target data stripe.
具体实现中,文件接口服务器通过存储服务器读取文件之前,需要向锁服务器发送读锁获取请求,如果锁服务器确定数据分条标识对应的数据分条的读锁或者写锁未被其他文件接口服务器所持有,则反馈该数据分条的读授权响应消息,进而该文件接口服务器可以向存储服务器发送数据块获取请求。另外,当客户端所需数据为数据分条中的部分数据时,文件接口服务器需要通过锁服务器获取该数据分条的数据分条版本号,将数据分条版本号与目标数据块的数据块版本号进行比较,以确定目标数据块是否有效。为了提升文件接口服务器与锁服务器之间的数据传输效率,文件接口服务器向锁服务器发送读锁获取请求时,锁服务器可以在响应读锁获取请求所反馈的读授权响应消息中携带该数据分条的数据分条版本号。In a specific implementation, before the file interface server reads the file through the storage server, it needs to send a read lock acquisition request to the lock server, and if the lock server determines that the data barrier is corresponding to the data stripe, the read lock or the write lock is not used by other file interface servers. If it is held, the read authorization response message of the data stripe is fed back, and the file interface server can send a data block acquisition request to the storage server. In addition, when the data required by the client is part of the data stripe, the file interface server needs to obtain the data stripe version number of the data stripe through the lock server, and divide the data stripe version number with the data block of the target data block. The version numbers are compared to determine if the target data block is valid. In order to improve the data transmission efficiency between the file interface server and the lock server, when the file interface server sends a read lock acquisition request to the lock server, the lock server may carry the data packet in the read authorization response message fed back in response to the read lock acquisition request. The data striping version number.
在上述技术方案中,可选的,文件接口服务器向锁服务器发送锁释放请求,锁释放请求可以携带数据分条标识以及数据分条版本号,以通知锁服务器更新数据分条标识对应的数据分条的数据分条版本号,并接收锁服务器响应锁释放请求所反馈的锁释放响应消息。In the above technical solution, optionally, the file interface server sends a lock release request to the lock server, and the lock release request may carry the data stripe identifier and the data stripe version number to notify the lock server to update the data score corresponding to the data stripe identifier. The data striping version number of the strip, and receiving the lock release response message fed back by the lock server in response to the lock release request.
具体实现中,文件接口服务器通过存储服务器读取文件或者写入文件之后,可以主动释放读锁或者写锁,即文件接口服务器可以向锁服务器发送锁释放请求,锁服务器响应该锁释放请求,可以向文件接口服务器发送锁释放响应 消息。另外,文件接口服务器通过存储服务器写入文件或者读取数据分条中的所有数据块之后,可以向锁服务器发送该数据分条的数据分条版本号,以确保锁服务器缓存的数据分条版本号为最新的数据分条版本号。为了提升文件接口服务器与锁服务器之间的数据传输效率,文件接口服务器向锁服务器发送锁释放请求时,可以通过锁释放请求携带数据分条版本号的方式将最新的数据分条版本号发送给锁服务器。In a specific implementation, after the file interface server reads the file or writes the file through the storage server, the read lock or the write lock may be actively released, that is, the file interface server may send a lock release request to the lock server, and the lock server responds to the lock release request, and Send a lock release response to the file interface server Message. In addition, after the file interface server writes the file through the storage server or reads all the data blocks in the data stripe, the data stripe version number of the data stripe can be sent to the lock server to ensure the data stripe version of the lock server cache. No. is the latest data striping version number. In order to improve the data transmission efficiency between the file interface server and the lock server, when the file interface server sends a lock release request to the lock server, the latest data stripe version number may be sent to the lock release request carrying the data stripe version number. Lock the server.
在上述技术方案中,可选的,文件接口服务器可以接收锁服务器发送的锁召回请求,锁召回请求携带数据分条标识,文件接口服务器可以响应锁召回请求向锁服务器发送锁召回响应消息,锁召回响应消息携带数据分条标识对应的数据分条的数据分条版本号,以通知锁服务器更新数据分条标识对应的数据分条的数据分条版本号。In the above technical solution, optionally, the file interface server may receive a lock recall request sent by the lock server, the lock recall request carries a data stripe identifier, and the file interface server may send a lock recall response message to the lock server in response to the lock recall request, the lock The recall response message carries the data stripe version number of the data stripe corresponding to the data stripe identifier, to notify the lock server to update the data stripe version number of the data stripe corresponding to the data stripe identifier.
具体实现中,文件接口服务器持有对数据分条的读锁或者写锁,如果其他文件接口服务器向锁服务器发送锁获取请求时,锁服务器可以向该文件接口服务器发送锁召回请求,文件接口服务器读取文件或者写文件之后,可以响应锁召回请求向锁服务器发送锁召回响应消息,以便锁服务器将该数据分条的锁授权给其他文件接口服务器。另外,文件接口服务器通过存储服务器写入文件或者读取数据分条中的所有数据块之后,可以向锁服务器发送该数据分条的数据分条版本号,以确保锁服务器缓存的数据分条版本号为最新的数据分条版本号。为了提升文件接口服务器与锁服务器之间的数据传输效率,文件接口服务器接收到锁服务器发送的锁召回请求时,可以在响应锁召回请求所反馈的锁召回响应消息中携带数据分条版本号,以便将最新的数据分条版本号发送给锁服务器。In a specific implementation, the file interface server holds a read lock or a write lock on the data stripe. If another file interface server sends a lock acquisition request to the lock server, the lock server may send a lock recall request to the file interface server, and the file interface server After reading the file or writing the file, the lock recall response message may be sent to the lock server in response to the lock recall request, so that the lock server authorizes the lock of the data strip to the other file interface server. In addition, after the file interface server writes the file through the storage server or reads all the data blocks in the data stripe, the data stripe version number of the data stripe can be sent to the lock server to ensure the data stripe version of the lock server cache. No. is the latest data striping version number. In order to improve the data transmission efficiency between the file interface server and the lock server, when receiving the lock recall request sent by the lock server, the file interface server may carry the data stripe version number in the lock recall response message fed back in response to the lock recall request. In order to send the latest data stripe version number to the lock server.
在上述技术方案中,可选的,文件读请求还可以携带文件句柄,文件接口服务器根据文件句柄在本地获取对应文件的文件属性,文件属性包括文件中各个数据块的存储路径,根据各个目标数据块的存储路径,确定各个存储目标数据块的存储服务器,并向各个确定的存储服务器发送数据块获取请求。In the above technical solution, optionally, the file read request may further carry a file handle, and the file interface server locally obtains the file attribute of the corresponding file according to the file handle, and the file attribute includes a storage path of each data block in the file, according to each target data. The storage path of the block determines a storage server of each storage target data block, and sends a data block acquisition request to each determined storage server.
其中,文件句柄用于识别文件,不同文件句柄对应不同的文件,文件接口服务器可以根据文件句柄在本地获取对应文件的文件属性。文件属性可以包括该文件的总数据量、数据EC保护级别(即各个数据分条中数据块 的个数N和校验数据块的个数M)或者数据块的存储路径等。文件接口服务器可以根据目标数据块的存储路径,确定各个存储目标数据块的存储服务器,进而向各个确定的存储服务器发送数据块获取请求。The file handle is used to identify the file, and the different file handles correspond to different files, and the file interface server can locally obtain the file attribute of the corresponding file according to the file handle. The file attribute can include the total amount of data of the file, the data EC protection level (ie, the data block in each data stripe) The number N and the number of check data blocks M) or the storage path of the data block, and the like. The file interface server may determine a storage server of each storage target data block according to a storage path of the target data block, and then send a data block acquisition request to each determined storage server.
在上述技术方案中,可选的,文件接口服务器可以预先建立数据块和存储服务器的对应关系,例如存储数据块1-1的存储服务器为存储服务器1时,文件接口服务器可以建立数据块1-1和存储服务器1的对应关系。当至少一个目标数据块为目标数据分条中的部分数据时,文件接口服务器可以根据预先建立的数据块和存储服务器的对应关系,确定目标数据块对应的存储服务器,并向确定的存储服务器发送数据块获取请求。In the foregoing technical solution, optionally, the file interface server may pre-establish a correspondence between the data block and the storage server. For example, when the storage server storing the data block 1-1 is the storage server 1, the file interface server may establish the data block 1 - 1 Correspondence relationship with the storage server 1. When the at least one target data block is part of the data in the target data stripe, the file interface server may determine the storage server corresponding to the target data block according to the correspondence between the pre-established data block and the storage server, and send the storage server to the determined storage server. The data block gets the request.
第二方面提供了一种基于分布式系统的文件读取装置,所述装置可以包括请求接收单元、数据块确定单元、请求发送单元、版本号获取单元、数据块接收单元以及数据块发送单元,所述装置可以用于实施结合第一方面的部分或全部步骤。A second aspect provides a file reading apparatus based on a distributed system, where the apparatus may include a request receiving unit, a data block determining unit, a request sending unit, a version number obtaining unit, a data block receiving unit, and a data block sending unit, The device may be used to implement some or all of the steps in connection with the first aspect.
第三方面提供了一种服务器,包括处理器以及存储器,处理器可以用于实施结合第一方面的部分或全部步骤。The third aspect provides a server, including a processor and a memory, which may be used to implement some or all of the steps in conjunction with the first aspect.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1是本发明实施例中提供的一种分布式系统的框架示意图;1 is a schematic diagram of a framework of a distributed system provided in an embodiment of the present invention;
图2是本发明实施例中提供的一种文件存储的保护示意图;2 is a schematic diagram of protection of file storage provided in an embodiment of the present invention;
图3是本发明实施例中提供的一种基于分布式系统的文件读取方法的流程示意图;3 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention;
图4是本发明另一实施例中提供的一种基于分布式系统的文件读取方法的流程示意图;FIG. 4 is a schematic flowchart diagram of a file reading method based on a distributed system according to another embodiment of the present invention; FIG.
图5是本发明另一实施例中提供的一种基于分布式系统的文件读取方法的流程示意图;FIG. 5 is a schematic flowchart diagram of a file reading method based on a distributed system according to another embodiment of the present invention; FIG.
图6是本发明另一实施例中提供的一种基于分布式系统的文件读取方法的 流程示意图;6 is a file reading method based on a distributed system according to another embodiment of the present invention. Schematic diagram of the process;
图7是本发明实施例中提供的一种文件接口服务器的结构示意图;7 is a schematic structural diagram of a file interface server according to an embodiment of the present invention;
图8是本发明实施例中提供的一种基于分布式系统的文件读取装置的结构示意图。FIG. 8 is a schematic structural diagram of a file reading apparatus based on a distributed system according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚地描述。The technical solutions in the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention.
请参见图1,图1是本发明实施例中提供的一种分布式系统的框架示意图,如图所示本发明实施例中的分布式系统至少可以包括客户端、文件接口服务器、存储服务器以及锁服务器。其中,客户端可以通过网络与文件接口服务器建立通信连接,文件接口服务器分别与锁服务器以及存储服务器建立通信连接。至少两个存储服务器可以通过网络组成存储服务器集群。Referring to FIG. 1 , FIG. 1 is a schematic diagram of a framework of a distributed system according to an embodiment of the present invention. The distributed system in the embodiment of the present invention may include at least a client, a file interface server, a storage server, and Lock the server. The client can establish a communication connection with the file interface server through the network, and the file interface server establishes a communication connection with the lock server and the storage server respectively. At least two storage servers can form a cluster of storage servers over the network.
客户端,用于向文件接口服务器发送文件读请求,文件读请求携带偏移地址以及读取数据量。The client is configured to send a file read request to the file interface server, and the file read request carries the offset address and the amount of read data.
文件接口服务器,用于根据偏移地址以及读取数据量,确定客户端需要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条,其中一个文件包括至少一个数据分条,各个数据分条包括至少一个数据块;当至少一个目标数据块为目标数据分条中的部分数据时,向锁服务器发送针对目标数据分条的数据分条版本号获取请求。a file interface server, configured to determine, according to the offset address and the amount of read data, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs, wherein one file includes at least one data stripe Each data strip includes at least one data block; when the at least one target data block is part of the target data stripe, the data stripe version number acquisition request for the target data stripe is sent to the lock server.
锁服务器,用于响应该数据分条版本号获取请求向文件接口服务器发送数据分条版本号。The lock server is configured to send a data stripe version number to the file interface server in response to the data stripe version number acquisition request.
文件接口服务器,还用于当至少一个目标数据块为目标数据分条中的部分数据时,向各个存储目标数据块的存储服务器发送数据块获取请求。The file interface server is further configured to: when the at least one target data block is part of the data in the target data stripe, send a data block acquisition request to each storage server storing the target data block.
存储服务器,用于响应该数据块获取请求向文件接口服务器发送目标数据块以及目标数据块对应的数据块版本号。And a storage server, configured to send the target data block and the data block version number corresponding to the target data block to the file interface server in response to the data block acquisition request.
文件接口服务器,还用于当锁服务器发送的数据分条版本号和各个存储服务器发送的目标数据块对应的数据块版本号相同时,将各个目标数据块发送给客户端。The file interface server is further configured to send each target data block to the client when the data stripe version number sent by the lock server is the same as the data block version number corresponding to the target data block sent by each storage server.
具体的,分布式系统中,为了提升文件的可靠性,同时提高存储服务器存 储空间的利用率,文件的存储采用N+M的保护方式,即将N+M个存储服务器通过网络组成一个N+M的数据保护组,将文件划分为至少N个数据块,通过EC算法对数据块进行处理得到M个校验数据块,将N个数据块和M个校验数据块存储到N+M个存储服务器中。其中,一个文件的N+M个数据块称为一个数据分条,该数据分条写入存储服务器时通过Quprum事务机制保持一致性,并且在存储服务器中,每个数据块对应有一个数据块版本号,正常情况下,一个数据分条中的N+M个数据块对应的数据块版本号是相同的。其中,校验数据块用于文件接口服务器确定数据分条无效时,通过EC算法对校验数据块进行处理生成数据块。Specifically, in a distributed system, in order to improve the reliability of the file, the storage server is saved at the same time. The utilization of the storage space, the file storage adopts the N+M protection mode, that is, the N+M storage servers form an N+M data protection group through the network, and the file is divided into at least N data blocks, and the EC algorithm is used. The data block is processed to obtain M check data blocks, and N data blocks and M check data blocks are stored in N+M storage servers. The N+M data blocks of a file are called a data stripe. When the data strips are written to the storage server, the consistency is maintained by the Quprum transaction mechanism, and in the storage server, each data block corresponds to one data block. Version number. Under normal circumstances, the data block version numbers corresponding to N+M data blocks in one data stripe are the same. The check data block is used by the file interface server to determine that the data stripe is invalid, and the check data block is processed by the EC algorithm to generate a data block.
以图2所示的文件存储的保护示意图为例,文件系统包括5个存储服务器,其中N为3,M为2,如果将一个文件划分为6个数据块,则该文件可以包括2个数据分条,各个数据块的数据块标识可以为分条编号-数据块编号,例如上述数据块的数据块标识分别为1-1、1-2、1-3、2-1、2-2以及2-3,通过EC算法对数据块1-1、1-2以及1-3进行处理得到校验数据块1和校验数据块2,其中数据块1-1、1-2以及1-3、校验数据块1以及校验数据块2组成数据分条1,可以将数据块1-1及其对应的数据块版本号存储到存储服务器1中,将数据块1-2及其对应的数据块版本号存储到存储服务器2中,将数据块1-3及其对应的数据块版本号存储到存储服务器3中,将校验数据块1及其对应的数据块版本号存储到存储服务器4中,将校验数据块2及其对应的数据块版本号存储到存储服务器5中。同理,通过EC算法对数据块2-1、2-2以及2-3进行处理得到校验数据块3和校验数据块4,其中数据块2-1、2-2以及2-3、校验数据块3以及校验数据块4组成数据分条2,可以将数据块2-1及其对应的数据块版本号存储到存储服务器1中,将数据块2-2及其对应的数据块版本号存储到存储服务器2中,将校验数据块1及其对应的数据块版本号存储到存储服务器3中,将校验数据块2及其对应的数据块版本号存储到存储服务器4中,将数据块2-3及其对应的数据块版本号存储到存储服务器5中。Taking the protection diagram of the file storage shown in FIG. 2 as an example, the file system includes five storage servers, where N is 3 and M is 2. If a file is divided into 6 data blocks, the file may include 2 data. For the stripe, the data block identifier of each data block may be a stripe number-data block number, for example, the data block identifiers of the above data blocks are 1-1, 1-2, 1-3, 2-1, 2-2, and 2-3, processing the data blocks 1-1, 1-2, and 1-3 by the EC algorithm to obtain the check data block 1 and the check data block 2, wherein the data blocks 1-1, 1-2, and 1-3 The check data block 1 and the check data block 2 form a data stripe 1, and the data block 1-1 and its corresponding data block version number can be stored in the storage server 1, and the data block 1-2 and its corresponding The data block version number is stored in the storage server 2, and the data block 1-3 and its corresponding data block version number are stored in the storage server 3, and the check data block 1 and its corresponding data block version number are stored in the storage server. In 4, the check data block 2 and its corresponding data block version number are stored in the storage server 5. Similarly, the data blocks 2-1, 2-2, and 2-3 are processed by the EC algorithm to obtain a check data block 3 and a check data block 4, where the data blocks 2-1, 2-2, and 2-3, The check data block 3 and the check data block 4 form a data stripe 2, and the data block 2-1 and its corresponding data block version number can be stored in the storage server 1, and the data block 2-2 and its corresponding data can be stored. The block version number is stored in the storage server 2, the check data block 1 and its corresponding data block version number are stored in the storage server 3, and the check data block 2 and its corresponding data block version number are stored in the storage server 4. The data block 2-3 and its corresponding data block version number are stored in the storage server 5.
在可选实施例中,文件接口服务器,还用于当至少一个目标数据块为目标数据分条中的所有数据时,向各个存储目标数据块的存储服务器发送数据块获取请求。 In an optional embodiment, the file interface server is further configured to send a data block acquisition request to the storage server of each storage target data block when the at least one target data block is all data in the target data strip.
存储服务器,还用于响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号。The storage server is further configured to send the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
文件接口服务器,还用于当各个目标数据块对应的数据块版本号相同时,将各个目标数据块发送给客户端。The file interface server is further configured to send each target data block to the client when the data block version numbers corresponding to the respective target data blocks are the same.
进一步可选的,文件接口服务器,还用于当各个目标数据块对应的数据块版本号不完全相同时,向各个存储校验数据块的存储服务器发送校验数据块获取请求。Further, the file interface server is further configured to send a check data block acquisition request to each storage server that stores the check data block when the data block version numbers corresponding to the target data blocks are not completely the same.
存储服务器,还用于响应校验数据块获取请求向文件接口服务器发送校验数据块及其对应的数据块版本号。The storage server is further configured to send the check data block and the corresponding data block version number to the file interface server in response to the check data block acquisition request.
文件接口服务器,还用于当各个校验数据块对应的数据块版本号相同时,通过数据校验擦除码EC算法对各个校验数据块进行处理,得到目标数据分条中的所有数据块,在生成的所有数据块中确定目标数据块,并将各个目标数据块发送给客户端。The file interface server is further configured to process each check data block by using a data check erasure code EC algorithm when the data block version numbers corresponding to the check data blocks are the same, and obtain all the data blocks in the target data stripe. The target data block is determined in all the generated data blocks, and each target data block is sent to the client.
在可选实施例中,文件接口服务器,还用于当各个目标数据块对应的数据块版本号相同时,将目标数据块对应的数据块版本号作为目标数据分条的数据分条版本号,将数据分条版本号发送给锁服务器。In an optional embodiment, the file interface server is further configured to: when the data block version numbers corresponding to the target data blocks are the same, the data block version number corresponding to the target data block is used as the data stripe version number of the target data stripe. Send the data stripe version number to the lock server.
锁服务器,还用于对该目标数据分条的数据分条版本号进行更新。The lock server is further configured to update the data stripe version number of the target data stripe.
在可选实施例中,文件接口服务器,还用于当数据分条版本号和各个目标数据块对应的数据块版本号不完全相同时,向各个存储目标数据分条中数据块的存储服务器发送数据块获取请求。In an optional embodiment, the file interface server is further configured to: when the data stripe version number and the data block version number corresponding to each target data block are not completely the same, send to the storage server of the data block in each storage target data stripe The data block gets the request.
存储服务器,还用于响应数据块获取请求向文件接口服务器发送数据块及其对应的数据块版本号。The storage server is further configured to send the data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
文件接口服务器,还用于当各个数据块对应的数据块版本号相同时,在接收得到的数据块中确定各个目标数据块,并将各个目标数据块发送给客户端。The file interface server is further configured to: when the data block version numbers corresponding to the respective data blocks are the same, determine each target data block in the received data block, and send each target data block to the client.
在可选实施例中,文件接口服务器,还用于接收客户端发送的文件写请求,文件写请求携带文件句柄、偏移地址、写数据以及写数据量;通过版本号分配器获取文件句柄对应的文件的数据分条版本号;根据偏移地址以及写数据量,确定写数据所属的数据块以及数据块所属的数据分条;将写数据发送给存储写数据所属数据块的存储服务器。 In an optional embodiment, the file interface server is further configured to receive a file write request sent by the client, where the file write request carries a file handle, an offset address, a write data, and a write data amount; and the file handle is obtained by using a version number allocator. The data striping version number of the file; determining the data block to which the write data belongs and the data strip to which the data block belongs according to the offset address and the amount of write data; and transmitting the write data to a storage server storing the data block to which the write data belongs.
存储服务器,还用于对写数据所属的数据块进行更新。The storage server is also used to update the data block to which the write data belongs.
文件接口服务器,还用于当写数据成功发送时,将数据分条版本号发送给锁服务器。The file interface server is further configured to send the data stripe version number to the lock server when the write data is successfully sent.
锁服务器,还用于对该数据分条的数据分条版本号进行更新。The lock server is also used to update the data stripe version number of the data stripe.
在可选实施例中,文件接口服务器,用于向锁服务器发送锁释放请求,锁释放请求携带数据分条标识以及数据分条版本号。In an optional embodiment, the file interface server is configured to send a lock release request to the lock server, where the lock release request carries the data stripe identifier and the data stripe version number.
锁服务器,还用于对数据分条标识对应的数据分条的数据分条版本号进行更新,并响应锁释放请求向文件接口服务器发送锁释放响应消息。The lock server is further configured to update the data stripe version number of the data stripe corresponding to the data stripe identifier, and send a lock release response message to the file interface server in response to the lock release request.
在可选实施例中,锁服务器,还用于向文件接口服务器发送锁召回请求,锁召回请求携带数据分条标识。In an optional embodiment, the lock server is further configured to send a lock recall request to the file interface server, where the lock recall request carries the data stripe identifier.
文件接口服务器,还用于响应锁召回请求向锁服务器发送锁召回响应消息,锁召回响应消息携带数据分条标识对应的数据分条的数据分条版本号。The file interface server is further configured to send a lock recall response message to the lock server in response to the lock recall request, and the lock recall response message carries the data stripe version number of the data stripe corresponding to the data stripe identifier.
锁服务器,还用于对数据分条标识对应的数据分条的数据分条版本号进行更新。The lock server is further configured to update the data stripe version number of the data stripe corresponding to the data stripe identifier.
在可选实施例中,文件接口服务器,用于向锁服务器发送读锁获取请求,读锁获取请求携带目标数据分条的数据分条标识。In an optional embodiment, the file interface server is configured to send a read lock acquisition request to the lock server, where the read lock acquisition request carries the data stripe identifier of the target data strip.
锁服务器,还用于响应读锁获取请求向文件接口服务器发送对数据分条标识对应的目标数据分条的读授权响应消息,读授权响应消息携带目标数据分条的数据分条版本号。The lock server is further configured to send a read authorization response message to the file interface server to the target data stripe corresponding to the data stripe identifier in response to the read lock acquisition request, where the read authorization response message carries the data stripe version number of the target data stripe.
在可选实施例中,文件读请求还可以携带文件句柄,文件接口服务器向存储各个目标数据块的存储服务器发送数据块获取请求,具体用于根据文件句柄在本地获取文件的文件属性,文件属性包括文件中各个数据块的存储路径;根据各个目标数据块的存储路径,确定存储各个目标数据块的存储服务器;向各个确定的存储服务器发送数据块获取请求。In an optional embodiment, the file read request may further carry a file handle, and the file interface server sends a data block acquisition request to the storage server storing each target data block, where the file attribute is locally obtained according to the file handle, and the file attribute is used. The storage path of each data block in the file is included; the storage server storing each target data block is determined according to the storage path of each target data block; and the data block acquisition request is sent to each determined storage server.
在图1所示的分布式系统中,客户端向文件接口服务器发送文件读请求,文件读请求携带偏移地址以及读取数据量,文件接口服务器根据偏移地址以及读取数据量,确定客户端需要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条,当至少一个目标数据块为目标数据分条中的部分数据时,文件接口服务器向锁服务器发送针对目标数据分条的数据分条版本号获 取请求,并接收锁服务器响应数据分条版本号获取请求所反馈的数据分条版本号,文件接口服务器向各个存储目标数据块的存储服务器发送数据块获取请求,并接收各个存储服务器响应数据块获取请求所反馈的目标数据块及其对应的数据块版本号,当数据分条版本号和各个目标数据块对应的数据块版本号相同时,文件接口服务器将各个目标数据块发送给客户端。当客户端需要读取的数据块是数据分条中的部分数据时,可避免文件系统内部读取整个数据分条,有效提升系统性能。In the distributed system shown in FIG. 1, the client sends a file read request to the file interface server, the file read request carries the offset address and the read data amount, and the file interface server determines the client according to the offset address and the read data amount. At least one target data block that needs to be read by the end and a target data strip to which the at least one target data block belongs. When at least one target data block is part of the data in the target data stripe, the file interface server sends the target data to the lock server. Striped data stripe version number obtained The request is received, and the lock server responds to the data stripe version number to obtain the data stripe version number fed back by the request, and the file interface server sends a data block acquisition request to each storage server storing the target data block, and receives each storage server response data block. Obtaining the target data block and the corresponding data block version number that are requested by the request, when the data stripe version number and the data block version number corresponding to each target data block are the same, the file interface server sends each target data block to the client. When the data block that the client needs to read is part of the data stripe, the file system can be prevented from reading the entire data stripe internally, thereby effectively improving system performance.
请参见图3,图3是本发明实施例中提供的一种基于分布式系统的文件读取方法的流程示意图,如图所示本发明实施例中的基于分布式系统的文件读取方法至少可以包括:Referring to FIG. 3, FIG. 3 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention, where the file reading method based on the distributed system in the embodiment of the present invention is at least Can include:
S301,客户端向文件接口服务器发送文件读请求,文件读请求携带偏移地址以及读取数据量。S301. The client sends a file read request to the file interface server, where the file read request carries an offset address and a read data amount.
S302,文件接口服务器根据偏移地址以及读取数据量,确定客户端需要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条。S302. The file interface server determines, according to the offset address and the read data quantity, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs.
具体实现中,文件接口服务器可以在本地缓存中获取文件的文件属性,文件属性可以包括:文件的文件总数据量,数据EC保护级别以及文件中的各个数据块的存储路径。进而文件接口服务器可以根据偏移地址、读取数据量、文件总数据量以及数据EC保护级别,确定客户端需要读取的至少一个目标数据块。In a specific implementation, the file interface server may obtain the file attribute of the file in the local cache, and the file attributes may include: a total file amount of the file, a data EC protection level, and a storage path of each data block in the file. In turn, the file interface server can determine at least one target data block that the client needs to read according to the offset address, the amount of read data, the total amount of data of the file, and the data EC protection level.
例如,文件接口服务器确定文件的文件总数据量为30MB(兆字节),数据EC保护级别为3+2(即该文件的各个数据分条包括3个数据块和2个校验数据块),如果各个数据块的数据量为512KB,则该文件包括的数据分条的个数为:30*1024/(512*3)=20,当偏移地址为5MB,读取数据量为1MB,则文件接口服务器可以确定客户端需要读取的目标数据块为数据分条4中的数据块2和数据块3,各个数据块的数据块标识可以为:分条编号-数据块编号,例如目标数据块的数据块标识为4-2以及4-3。For example, the file interface server determines that the total file size of the file is 30 MB (megabytes), and the data EC protection level is 3+2 (that is, each data strip of the file includes 3 data blocks and 2 check data blocks). If the data volume of each data block is 512 KB, the number of data strips included in the file is: 30*1024/(512*3)=20, when the offset address is 5 MB, the read data amount is 1 MB, The file interface server may determine that the target data block that the client needs to read is the data block 2 and the data block 3 in the data strip 4. The data block identifier of each data block may be: a strip number - a data block number, such as a target The data block identifiers for the data blocks are 4-2 and 4-3.
在可选实施例中,文件接口服务器可以根据偏移地址、读取数据量和数据分条的分条数据量得到至少一个目标数据块所属目标数据分条的数据分条标 识。其中,一个文件可以包括至少一个数据分条,各个数据分条可以包括至少一个数据块。以图2所示的文件存储的保护示意图为例,该文件包括数据分条1和数据分条2,数据分条1包括数据块1-1、1-2以及1-3,数据分条2包括数据块2-1、2-2以及2-3。其中数据分条标识的格式可以为:文件标识-分条编号,文件标识可以为该文件的文件ID,分条编号可以为
Figure PCTCN2016105957-appb-000001
其中X为偏移地址,Y为数据分条的分条数据量。例如,偏移地址为1MB,数据分条的数据量为1536KB,则文件接口服务器可以确定目标数据分条为该文件中的数据分条1。其中,分条编号的获取方法包含但不局限于上述方式,例如分条编号可以为
Figure PCTCN2016105957-appb-000002
其中X为偏移地址,Y为数据分条的分条数据量。示例性的,偏移地址为1MB,数据分条的数据量为1536KB,则文件接口服务器可以确定目标数据分条为该文件中的数据分条0。具体不受本发明实施例的限制。
In an optional embodiment, the file interface server may obtain the data stripe identifier of the target data strip to which the at least one target data block belongs according to the offset address, the read data amount, and the stripe data amount of the data stripe. Wherein, one file may include at least one data stripe, and each data stripe may include at least one data block. Taking the protection diagram of the file storage shown in FIG. 2 as an example, the file includes data stripe 1 and data stripe 2, and data stripe 1 includes data blocks 1-1, 1-2, and 1-3, and data stripe 2 Includes data blocks 2-1, 2-2, and 2-3. The format of the data stripe identifier may be: file identifier-strip number, the file identifier may be the file ID of the file, and the stripe number may be
Figure PCTCN2016105957-appb-000001
Where X is the offset address and Y is the stripe data amount of the data stripe. For example, if the offset address is 1MB and the data volume of the data stripe is 1536 KB, the file interface server can determine that the target data stripe is the data stripe 1 in the file. The method for obtaining the strip number includes but is not limited to the foregoing manner, for example, the strip number may be
Figure PCTCN2016105957-appb-000002
Where X is the offset address and Y is the stripe data amount of the data stripe. Exemplarily, the offset address is 1MB, and the data volume of the data stripe is 1536 KB, and the file interface server can determine that the target data stripe is the data stripe 0 in the file. It is not specifically limited by the embodiments of the present invention.
进一步可选的,文件接口服务器可以向锁服务器发送读锁获取请求,读锁获取请求携带该数据分条标识,锁服务器可以判断其他文件接口服务器是否持有该数据分条标识对应的数据分条的读锁或者写锁,当其他文件接口服务器未持有该数据分条标识对应的数据分条的读锁以及写锁时,锁服务器可以向文件接口服务器发送对数据分条标识对应的数据分条的读授权响应消息,以便文件接口服务器通过存储服务器获取目标数据块。Further, the file interface server may send a read lock acquisition request to the lock server, where the read lock acquisition request carries the data stripe identifier, and the lock server may determine whether the other file interface server holds the data stripe corresponding to the data stripe identifier. The read lock or the write lock, when the other file interface server does not hold the read lock and the write lock of the data stripe corresponding to the data stripe identifier, the lock server may send the data score corresponding to the data stripe identifier to the file interface server. The strip reads the authorization response message so that the file interface server obtains the target data block through the storage server.
S303,当至少一个目标数据块为目标数据分条中的部分数据时,文件接口服务器向锁服务器发送针对目标数据分条的数据分条版本号获取请求。S303. When at least one target data block is part of data in the target data stripe, the file interface server sends a data stripe version number acquisition request for the target data stripe to the lock server.
具体的,如果客户端需要读取的目标数据块为目标数据分条中的部分数据,文件接口服务器可以向锁服务器发送针对目标数据分条的数据分条版本号获取请求,数据分条版本号获取请求可以携带数据分条标识。例如,文件接口服务器通过文件属性得到文件划分为6个数据块,该文件包括2个数据分条,数据块的数据块标识分别为1-1、1-2、1-3、2-1、2-2以及2-3,客户端需要读取的目标数据块为数据块1-1和数据块1-2,则文件接口服务器可以确定目标数据块为数据分条1中的部分数据,进而文件接口服务器向锁服务器发送针对数据分条1的数据分条版本号获取请求。Specifically, if the target data block that the client needs to read is part of the data in the target data stripe, the file interface server may send a data stripe version number acquisition request for the target data stripe to the lock server, and the data stripe version number The acquisition request can carry the data stripe identifier. For example, the file interface server divides the file into six data blocks by using the file attribute, and the file includes two data strips, and the data block identifiers of the data block are 1-1, 1-2, 1-3, 2-1, respectively. 2-2 and 2-3, the target data block that the client needs to read is the data block 1-1 and the data block 1-2, and the file interface server can determine that the target data block is part of the data in the data stripe 1, and further The file interface server sends a data stripe version number acquisition request for the data strip 1 to the lock server.
又如,文件接口服务器通过文件属性得到文件划分为6个数据块,该文件包括2个数据分条,数据块的数据块标识分别为1-1、1-2、1-3、2-1、2-2以及 2-3,客户端需要读取的目标数据块为数据块1-2、1-3、2-1、2-2以及2-3,则文件接口服务器可以确定数据块1-2和数据块1-3为数据分条1中的部分数据,进而文件接口服务器向锁服务器发送针对数据分条1的数据分条版本号获取请求。数据块2-1、2-2以及2-3为数据分条2中的所有数据,则文件接口服务器可以通过传统的文件读取方法获取数据块2-1、2-2以及2-3,并将获取到的数据块2-1、2-2以及2-3发送给客户端。For another example, the file interface server divides the file into six data blocks by using the file attribute, and the file includes two data strips, and the data block identifiers of the data block are 1-1, 1-2, 1-3, and 2-1, respectively. 2-2 and 2-3, the target data block that the client needs to read is data blocks 1-2, 1-3, 2-1, 2-2, and 2-3, and the file interface server can determine the data block 1-2 and the data block. 1-3 is part of the data in the data stripe 1, and the file interface server sends a data stripe version number acquisition request for the data stripe 1 to the lock server. Data blocks 2-1, 2-2, and 2-3 are all data in data stripe 2, and the file interface server can obtain data blocks 2-1, 2-2, and 2-3 through a conventional file reading method. The obtained data blocks 2-1, 2-2, and 2-3 are sent to the client.
S304,锁服务器响应数据分条版本号获取请求向文件接口服务器发送数据分条版本号。S304. The lock server sends a data stripe version number to the file interface server in response to the data stripe version number acquisition request.
具体实现中,锁服务器可以缓存各个数据分条的数据分条版本号,并在文件接口服务器写数据或者读取整个数据分条时更新该数据分条的数据分条版本号,则锁服务器接收到文件接口服务器发送的数据分条版本号获取请求之后,可以查找数据分条标识对应的目标数据分条的数据分条版本号,并将该数据分条版本号发送给文件接口服务器。In a specific implementation, the lock server may cache the data stripe version number of each data stripe, and update the data stripe version number of the data stripe when the file interface server writes the data or reads the entire data stripe, and the lock server receives the data. After obtaining the request for the data stripe version number sent by the file interface server, the data stripe version number of the target data stripe corresponding to the data stripe identifier may be searched, and the data stripe version number is sent to the file interface server.
需要说明的是,当该锁服务器发生故障时,缓存中的数据分条版本号可能丢失,则锁服务器无法查找到数据分条标识对应的目标数据分条的数据分条版本号。或者当该锁服务器被淘汰时,文件接口服务器无法通过锁服务器获取到目标数据分条的数据分条版本号。或者该锁服务器当前是第一次运行,缓存中还未存储各个数据分条的数据分条版本号。上述情况中,文件接口服务器无法通过锁服务器获取数据分条版本号,则文件接口服务器可以通过传统的文件读取方法读取客户端所需数据。It should be noted that, when the lock server fails, the data stripe version number in the cache may be lost, and the lock server cannot find the data stripe version number of the target data stripe corresponding to the data stripe identifier. Or when the lock server is eliminated, the file interface server cannot obtain the data stripe version number of the target data strip through the lock server. Or the lock server is currently running for the first time, and the data stripe version number of each data stripe is not stored in the cache. In the above case, the file interface server cannot obtain the data stripe version number through the lock server, and the file interface server can read the data required by the client through the traditional file reading method.
作为步骤S303以及S304的可选方式,锁服务器可以在响应文件接口服务器发送的读锁获取请求所反馈的读授权响应消息中携带数据分条版本号,则文件接口服务器无需通过向锁服务器发送数据分条版本号获取请求的方式获取数据分条版本号,可提升数据传输效率。具体实现中,文件接口服务器可以向锁服务器发送读锁获取请求,读锁获取请求携带该数据分条标识,锁服务器响应该读锁获取请求,可以向文件接口服务器发送对数据分条标识对应的文件的读授权响应消息,读授权响应消息携带文件的数据分条版本号。As an optional manner of steps S303 and S304, the lock server may carry the data stripe version number in the read authorization response message fed back by the read lock acquisition request sent by the response file interface server, so the file interface server does not need to send data to the lock server. The method of obtaining the request by the stripe version number obtains the version number of the data stripe, which improves the data transmission efficiency. In a specific implementation, the file interface server may send a read lock acquisition request to the lock server, the read lock acquisition request carries the data stripe identifier, and the lock server responds to the read lock acquisition request, and may send the data stripe identifier corresponding to the file interface server. The read authorization response message of the file, and the read authorization response message carries the data stripe version number of the file.
S305,文件接口服务器向存储目标数据块的存储服务器发送数据块获取请求。 S305. The file interface server sends a data block acquisition request to a storage server that stores the target data block.
当目标数据块为数据分条中的部分数据时,文件接口服务器可以向存储目标数据块的存储服务器发送数据块获取请求。例如,文件接口服务器确定目标数据块为数据块1-2和数据块1-3,则文件接口服务器可以向存储数据块1-2的存储服务器发送数据块获取请求,该数据块获取请求携带数据块1-2的数据块标识。文件接口服务器还可以向存储数据块1-3的存储服务器发送数据块获取请求,该数据块获取请求携带数据块1-3的数据块标识。When the target data block is part of the data stripe, the file interface server may send a data block fetch request to the storage server storing the target data block. For example, if the file interface server determines that the target data block is the data block 1-2 and the data block 1-3, the file interface server may send a data block acquisition request to the storage server storing the data block 1-2, and the data block obtains the request carrying data. The data block identifier of block 1-2. The file interface server may also send a data block acquisition request to the storage server storing the data blocks 1-3, the data block acquisition request carrying the data block identifier of the data blocks 1-3.
在可选实施例中,文件接口服务器获取各个数据块的存储路径之后,可以根据目标数据块的存储路径确定存储目标数据块的存储服务器,进而向该存储服务器发送数据块获取请求。例如,文件接口服务器可以根据各个数据块的存储路径确定数据块1-1存储在存储服务器1中,数据块1-2存储在存储服务器2中,数据块1-3存储在存储服务器3中,当目标数据块为数据块1-2和数据块1-3时,文件接口服务器可以向存储服务器2发送数据块获取请求,并向存储服务器3发送数据块获取请求。In an optional embodiment, after the file interface server obtains the storage path of each data block, the storage server storing the target data block may be determined according to the storage path of the target data block, and then the data block acquisition request is sent to the storage server. For example, the file interface server may determine that the data block 1-1 is stored in the storage server 1 according to the storage path of each data block, the data block 1-2 is stored in the storage server 2, and the data block 1-3 is stored in the storage server 3, When the target data block is the data block 1-2 and the data block 1-3, the file interface server may transmit a data block acquisition request to the storage server 2 and send a data block acquisition request to the storage server 3.
S306,存储服务器响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号。S306. The storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
存储服务器响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号。例如,文件接口服务器向存储服务器2发送数据块获取请求,存储服务器2反馈数据块1-2以及数据块1-2对应的数据块版本号,文件接口服务器还可以向存储服务器3发送数据块获取请求,存储服务器3反馈数据块1-3以及数据块1-3对应的数据块版本号。The storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request. For example, the file interface server sends a data block acquisition request to the storage server 2, the storage server 2 feeds back the data block 1-2 and the data block version number corresponding to the data block 1-2, and the file interface server can also send the data block acquisition to the storage server 3. The request, the storage server 3 feeds back the data block 1-3 and the data block version number corresponding to the data block 1-3.
S307,当数据分条版本号和各个目标数据块对应的数据块版本号相同时,文件接口服务器将各个目标数据块发送给客户端。S307. When the data stripe version number is the same as the data block version number corresponding to each target data block, the file interface server sends each target data block to the client.
当文件接口服务器通过锁服务器获取到的数据分条版本号和通过各个存储服务器获取到的目标数据块对应的数据块版本号相同时,文件接口服务器可以确定各个目标数据块是有效的,进而将各个目标数据块发送给客户端。例如,如果数据分条版本号和数据块1-2对应的数据块版本号相同,且数据分条版本号和数据块1-3对应的数据块版本号相同,则文件接口服务器可以确定数据块1-2和数据块1-3是有效的,进而将数据块1-2和数据块1-3发送给客户端。When the data stripe version number obtained by the file interface server through the lock server is the same as the data block version number corresponding to the target data block obtained by each storage server, the file interface server may determine that each target data block is valid, and then Each target data block is sent to the client. For example, if the data stripe version number is the same as the data block version number corresponding to the data block 1-2, and the data stripe version number is the same as the data block version number corresponding to the data block 1-3, the file interface server may determine the data block. 1-2 and data blocks 1-3 are valid, and data blocks 1-2 and data blocks 1-3 are sent to the client.
在图3所示的基于分布式系统的文件读取方法中,当客户端所需的至少一 个目标数据块为目标数据分条中的部分数据时,文件接口服务器向锁服务器发送针对目标数据分条的数据分条版本号获取请求,锁服务器响应数据分条版本号获取请求向文件接口服务器发送数据分条版本号,文件接口服务器还可以向各个存储目标数据块的存储服务器发送数据块获取请求,存储服务器响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号,当数据分条版本号和各个目标数据块对应的数据块版本号相同时,文件接口服务器将各个目标数据块发送给客户端,当客户端需要读取的数据块是数据分条中的部分数据时,可避免文件系统内部读取整个数据分条,有效提升系统性能。In the distributed system-based file reading method shown in FIG. 3, at least one required by the client When the target data block is part of the data in the target data strip, the file interface server sends a data stripe version number acquisition request for the target data stripe to the lock server, and the lock server responds to the data stripe version number to obtain the request to the file interface server. Sending a data stripe version number, the file interface server may further send a data block acquisition request to the storage server of each storage target data block, and the storage server sends the target data block and the corresponding data block version number to the file interface server according to the data block acquisition request. When the data stripe version number is the same as the data block version number corresponding to each target data block, the file interface server sends each target data block to the client, and the data block that the client needs to read is part of the data stripe. When the data is used, the entire data stripe can be prevented from being read internally by the file system, thereby effectively improving system performance.
请参见图4,图4是本发明实施例中提供的一种文件的读取方法的流程示意图,如图所示本发明实施例中的文件的读取方法至少可以包括:Referring to FIG. 4, FIG. 4 is a schematic flowchart of a method for reading a file according to an embodiment of the present invention. The method for reading a file in the embodiment of the present invention may include at least:
S401,客户端向文件接口服务器发送文件读请求,文件读请求携带偏移地址以及读取数据量。S401. The client sends a file read request to the file interface server, where the file read request carries an offset address and a read data amount.
S402,文件接口服务器根据偏移地址以及读取数据量,确定客户端需要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条。S402. The file interface server determines, according to the offset address and the read data quantity, the at least one target data block that the client needs to read and the target data strip to which the at least one target data block belongs.
S403,当至少一个目标数据块为目标数据分条中的所有数据时,文件接口服务器向存储目标数据块的存储服务器发送数据块获取请求。S403. When at least one target data block is all data in the target data stripe, the file interface server sends a data block acquisition request to the storage server storing the target data block.
当目标数据块为目标数据分条中的所有数据时,文件接口服务器可以向存储目标数据块的存储服务器发送数据块获取请求。例如,目标数据分条中的所有数据块分别为数据块1-1、数据块1-2以及数据块1-3,文件接口服务器确定目标数据块为数据块1-1、数据块1-2和数据块1-3,则文件接口服务器可以向存储数据块1-1的存储服务器发送数据块获取请求,该数据块获取请求携带数据块1-1的数据块标识。文件接口服务器还可以向存储数据块1-2的存储服务器发送数据块获取请求,该数据块获取请求携带数据块1-2的数据块标识。文件接口服务器还可以向存储数据块1-3的存储服务器发送数据块获取请求,该数据块获取请求携带数据块1-3的数据块标识。When the target data block is all data in the target data stripe, the file interface server may send a data block acquisition request to the storage server storing the target data block. For example, all the data blocks in the target data strip are data block 1-1, data block 1-2, and data block 1-3, and the file interface server determines that the target data block is data block 1-1, data block 1-2. And data blocks 1-3, the file interface server may send a data block acquisition request to the storage server storing the data block 1-1, the data block acquisition request carrying the data block identifier of the data block 1-1. The file interface server may also send a data block acquisition request to the storage server storing the data block 1-2, the data block acquisition request carrying the data block identifier of the data block 1-2. The file interface server may also send a data block acquisition request to the storage server storing the data blocks 1-3, the data block acquisition request carrying the data block identifier of the data blocks 1-3.
S404,存储服务器响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号。S404. The storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
S405,当各个目标数据块对应的数据块版本号相同时,文件接口服务器将 各个目标数据块发送给客户端。S405, when the data block version numbers corresponding to the respective target data blocks are the same, the file interface server will Each target data block is sent to the client.
文件接口服务器接收到各个目标数据块的数据块版本号之后,可以判断各个目标数据块的数据块版本号是否相同,当各个目标数据块对应的数据块版本号相同时,文件接口服务器可以确定该目标数据分条中的各个数据块是有效的,进而缓存各个目标数据块,并将各个目标数据块发送给客户端。After receiving the data block version number of each target data block, the file interface server may determine whether the data block version numbers of the respective target data blocks are the same. When the data block version numbers corresponding to the respective target data blocks are the same, the file interface server may determine the same. Each data block in the target data strip is valid, and then each target data block is cached, and each target data block is sent to the client.
在可选实施例中,当各个目标数据块对应的数据块版本号不完全相同时,文件接口服务器可以确定该目标数据分条中的数据块是无效的,进而根据目标数据分条中校验数据块的存储路径向存储校验数据块的存储服务器发送校验数据块获取请求,存储服务器响应该校验数据块获取请求向文件接口服务器发送校验数据块和校验数据块对应的数据块版本号,文件接口服务器可以比较各个校验数据块对应的数据块版本号是否相同,当各个校验数据块对应的数据块版本号相同时,通过EC算法对各个校验数据块进行处理,得到目标数据分条中的各个数据块,进而将各个数据块发送给客户端。In an optional embodiment, when the data block version numbers corresponding to the respective target data blocks are not completely the same, the file interface server may determine that the data blocks in the target data stripe are invalid, and then check according to the target data stripe. The storage path of the data block sends a check data block acquisition request to the storage server storing the check data block, and the storage server sends the check data block and the data block corresponding to the check data block to the file interface server in response to the check data block acquisition request. The version number, the file interface server can compare whether the data block version numbers corresponding to the respective check data blocks are the same. When the data block version numbers corresponding to the check data blocks are the same, the check data blocks are processed by the EC algorithm to obtain Each data block in the target data stripe, and then each data block is sent to the client.
在可选实施例中,当各个目标数据块对应的数据块版本号相同时,文件接口服务器可以将目标数据块对应的数据块版本号作为目标数据分条的数据分条版本号,并将该数据分条版本号发送给锁服务器,当锁服务器未存储该文件的数据分条版本号时,锁服务器可以缓存该数据分条版本号及该目标数据分条对应的数据分条标识;当锁服务器已存储该目标数据分条的数据分条版本号时,锁服务器可以对该目标数据分条的数据分条版本号进行更新。In an optional embodiment, when the data block version numbers corresponding to the target data blocks are the same, the file interface server may use the data block version number corresponding to the target data block as the data stripe version number of the target data stripe, and The data striping version number is sent to the lock server. When the lock server does not store the data stripe version number of the file, the lock server may cache the data stripe version number and the data stripe identifier corresponding to the target data stripe; When the server has stored the data stripe version number of the target data stripe, the lock server may update the data stripe version number of the target data stripe.
在可选实施例中,文件接口服务器接收到存储服务器发送的目标数据块之后,可以主动释放该目标数据分条的读锁,文件接口服务器可以在释放读锁的过程中将数据分条版本号发送给锁服务器,提高文件接口服务器与锁服务器之间的数据传输效率。例如,文件接口服务器可以向锁服务器发送锁释放请求,锁释放请求携带数据分条标识以及数据分条版本号,锁服务器可以对该数据分条标识对应的目标数据分条的数据分条版本号进行更新,并响应锁释放请求向文件接口服务器发送锁释放响应消息。In an optional embodiment, after receiving the target data block sent by the storage server, the file interface server may actively release the read lock of the target data stripe, and the file interface server may strip the version number of the data in the process of releasing the read lock. Send to the lock server to improve the data transfer efficiency between the file interface server and the lock server. For example, the file interface server may send a lock release request to the lock server, the lock release request carries the data stripe identifier and the data stripe version number, and the lock server may identify the data stripe version number of the target data stripe corresponding to the data stripe identifier. The update is made and a lock release response message is sent to the file interface server in response to the lock release request.
在可选实施例中,文件接口服务器接收到锁服务器发送的锁召回请求时,可以在响应锁召回请求所反馈的锁召回响应消息中携带数据分条版本号,可提高文件接口服务器和锁服务器之间的数据传输效率。例如,锁服务器可以向文 件接口服务器发送锁召回请求,锁召回请求携带数据分条标识,文件接口服务器可以响应锁召回请求向锁服务器发送锁召回响应消息,锁召回响应消息携带数据分条版本号,进而锁服务器可以对数据分条标识对应的目标数据分条的数据分条版本号进行更新。In an optional embodiment, when receiving the lock recall request sent by the lock server, the file interface server may carry the data stripe version number in the lock recall response message fed back in response to the lock recall request, thereby improving the file interface server and the lock server. The efficiency of data transfer between. For example, the lock server can be essay The interface server sends a lock recall request, and the lock recall request carries the data stripe identifier. The file interface server can send a lock recall response message to the lock server in response to the lock recall request, and the lock recall response message carries the data stripe version number, and the lock server can The data stripe version number of the target data stripe corresponding to the data stripe identifier is updated.
在图4所示的基于分布式系统的文件读取方法中,当客户端所需的至少一个目标数据块为目标数据分条中的所有数据时,文件接口服务器向存储目标数据块的存储服务器发送数据块获取请求,存储服务器响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号,当各个目标数据块对应的数据块版本号相同时,文件接口服务器将各个目标数据块发送给客户端。In the distributed system-based file reading method shown in FIG. 4, when at least one target data block required by the client is all data in the target data stripe, the file interface server stores the storage unit of the target data block. Sending a data block acquisition request, the storage server responds to the data block acquisition request to send the target data block and the corresponding data block version number to the file interface server, and when the data block version numbers corresponding to the respective target data blocks are the same, the file interface server sets each target The data block is sent to the client.
请参见图5,图5是本发明实施例中提供的一种基于分布式系统的文件读取方法的流程示意图,如图所示本发明实施例中的基于分布式系统的文件读取方法至少可以包括:Referring to FIG. 5, FIG. 5 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention, where the file reading method based on the distributed system in the embodiment of the present invention is at least Can include:
S501,客户端向文件接口服务器发送文件读请求,文件读请求携带偏移地址以及读取数据量。S501. The client sends a file read request to the file interface server, where the file read request carries an offset address and a read data amount.
S502,文件接口服务器根据偏移地址以及读取数据量,确定客户端需要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条。S502. The file interface server determines, according to the offset address and the amount of read data, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs.
S503,当至少一个目标数据块为目标数据分条中的部分数据时,文件接口服务器向锁服务器发送针对目标数据分条的数据分条版本号获取请求。S503. When at least one target data block is part of data in the target data stripe, the file interface server sends a data stripe version number acquisition request for the target data stripe to the lock server.
S504,锁服务器响应数据分条版本号获取请求向文件接口服务器发送数据分条版本号。S504. The lock server sends a data stripe version number to the file interface server in response to the data stripe version number acquisition request.
S505,文件接口服务器向存储目标数据块的存储服务器发送数据块获取请求。S505. The file interface server sends a data block acquisition request to a storage server that stores the target data block.
S506,存储服务器响应数据块获取请求向文件接口服务器发送目标数据块及其对应的数据块版本号。S506. The storage server sends the target data block and its corresponding data block version number to the file interface server in response to the data block acquisition request.
S507,当数据分条版本号和各个目标数据块对应的数据块版本号不完全相同时,文件接口服务器向各个存储目标数据分条中数据块的存储服务器发送数据块获取请求。S507: When the data stripe version number and the data block version number corresponding to each target data block are not completely the same, the file interface server sends a data block acquisition request to the storage server of each of the storage target data strips.
S508,存储服务器响应数据块获取请求向文件接口服务器发送数据块及其 对应的数据块版本号。S508. The storage server sends a data block to the file interface server in response to the data block acquisition request. The corresponding data block version number.
S509,当各个数据块对应的数据块版本号相同时,文件接口服务器在接收得到的数据块中确定各个目标数据块。S509: When the data block version numbers corresponding to the respective data blocks are the same, the file interface server determines each target data block in the received data block.
在可选实施例中,当各个数据块对应的数据块版本号相同时,文件接口服务器可以将数据块对应的数据块版本号作为目标数据分条的数据分条版本号,并将该数据分条版本号发送给锁服务器,当锁服务器未存储目标数据分条的数据分条版本号时,锁服务器可以缓存该数据分条版本号及目标数据分条对应的数据分条标识;当锁服务器已存储目标数据分条的数据分条版本号时,锁服务器可以对目标数据分条的数据分条版本号进行更新。In an optional embodiment, when the data block version numbers corresponding to the data blocks are the same, the file interface server may use the data block version number corresponding to the data block as the data stripe version number of the target data stripe, and divide the data into The strip version number is sent to the lock server. When the lock server does not store the data stripe version number of the target data stripe, the lock server may cache the data stripe version number and the data stripe identifier corresponding to the target data stripe; when the lock server When the data stripe version number of the target data stripe has been stored, the lock server can update the data stripe version number of the target data stripe.
S510,文件接口服务器将各个目标数据块发送给客户端。S510. The file interface server sends each target data block to the client.
在图5所示的基于分布式系统的文件读取方法中,当数据分条版本号和各个目标数据块对应的数据块版本号不完全相同时,文件接口服务器向各个存储目标数据分条中数据块的存储服务器发送数据块获取请求,存储服务器响应数据块获取请求向文件接口服务器发送数据块及其对应的数据块版本号,当各个数据块对应的数据块版本号相同时,文件接口服务器在接收到的数据块中确定各个目标数据块,并将各个目标数据块发送给客户端。In the distributed system-based file reading method shown in FIG. 5, when the data stripe version number and the data block version number corresponding to each target data block are not completely the same, the file interface server branches into each storage target data. The storage server of the data block sends a data block acquisition request, and the storage server sends a data block and a corresponding data block version number to the file interface server according to the data block acquisition request. When the data block version number corresponding to each data block is the same, the file interface server Each target data block is determined in the received data block, and each target data block is sent to the client.
请参见图6,图6是本发明实施例中提供的一种基于分布式系统的文件读取方法的流程示意图,如图所示本发明实施例中的基于分布式系统的文件读取方法至少可以包括:Referring to FIG. 6, FIG. 6 is a schematic flowchart of a file reading method based on a distributed system according to an embodiment of the present invention, where the file reading method based on the distributed system in the embodiment of the present invention is at least Can include:
S601,客户端向文件接口服务器发送文件写请求,文件写请求携带文件句柄、偏移地址、写数据以及写数据量。S601. The client sends a file write request to the file interface server, where the file write request carries a file handle, an offset address, a write data, and a write data amount.
S602,文件接口服务器通过版本号分配器获取文件句柄对应的文件的数据分条版本号。S602. The file interface server obtains a data stripe version number of the file corresponding to the file handle by using a version number allocator.
文件接口服务器接收到客户端发送的文件写请求之后,可以通过版本号分配器获取文件句柄对应的文件的数据分条版本号。例如,版本号分配器维护的该文件的当前数据分条版本号为10,预先设定的单调递增指数为2,则文件接口服务器接收到文件写请求之后,版本号分配器分配的该文件的数据分条版本号为12。需要说明的是,单调递增指数包含但不局限于2,例如,单调递增指 数可以为1或者3等,具体不受本发明实施例的限制。After receiving the file write request sent by the client, the file interface server may obtain the data stripe version number of the file corresponding to the file handle by using the version number allocator. For example, the current data stripe version number of the file maintained by the version number allocator is 10, and the preset monotonically increasing index is 2, and the file interface server allocates the file after the file interface server receives the file write request. The data striping version number is 12. It should be noted that the monotonically increasing index includes but is not limited to 2, for example, monotonically increasing The number may be 1 or 3, etc., and is not specifically limited by the embodiment of the present invention.
S603,文件接口服务器根据偏移地址以及写数据量,确定写数据所属的数据块以及数据块所属的数据分条。S603. The file interface server determines, according to the offset address and the amount of write data, a data block to which the write data belongs and a data strip to which the data block belongs.
具体实现中,文件接口服务器可以根据文件句柄在本地缓存中获取文件句柄对应的文件的文件属性,文件属性可以包括:文件总数据量,数据EC保护级别以及文件中各个数据块的存储路径。进而文件接口服务器可以根据偏移地址、写数据量、文件总数据量以及数据EC保护级别,确定写数据所属的数据块。其中,写数据所属的数据块的个数可以为至少一个。In a specific implementation, the file interface server may obtain the file attribute of the file corresponding to the file handle in the local cache according to the file handle, and the file attribute may include: total file data amount, data EC protection level, and storage path of each data block in the file. In turn, the file interface server can determine the data block to which the write data belongs according to the offset address, the amount of write data, the total amount of data of the file, and the level of data EC protection. The number of data blocks to which the write data belongs may be at least one.
例如,文件接口服务器确定文件的文件总数据量为30MB,数据EC保护级别为3+2,如果各个数据块的数据量为512KB,偏移地址为5MB,写数据量为512KB,则文件接口服务器可以确定写数据所属的数据块为4-2。For example, the file interface server determines that the total file size of the file is 30 MB, and the data EC protection level is 3+2. If the data volume of each data block is 512 KB, the offset address is 5 MB, and the write data volume is 512 KB, the file interface server It can be determined that the data block to which the write data belongs is 4-2.
在可选实施例中,文件接口服务器可以根据偏移地址和数据分条的分条数据量得到数据块所属数据分条的数据分条标识,其中数据分条标识的格式可以为:文件标识-分条编号,文件标识可以为该文件的文件ID,分条编号可以为
Figure PCTCN2016105957-appb-000003
其中X为偏移地址,Y为数据分条的分条数据量。
In an optional embodiment, the file interface server may obtain the data stripe identifier of the data strip to which the data block belongs according to the offset address and the stripe data amount of the data stripe, where the format of the data stripe identifier may be: file identifier Strip number, file ID can be the file ID of the file, and the strip number can be
Figure PCTCN2016105957-appb-000003
Where X is the offset address and Y is the stripe data amount of the data stripe.
进一步可选的,文件接口服务器可以向锁服务器发送写锁获取请求,写锁获取请求携带该数据分条标识,锁服务器可以判断其他文件接口服务器是否持有该数据分条标识对应的数据分条的读锁或者写锁,当其他文件接口服务器未持有该数据分条标识对应的数据分条的读锁以及写锁时,锁服务器可以向文件接口服务器发送对数据分条标识对应的数据分条的写授权消息,以便文件接口服务器将写数据发送给存储服务器。Further, the file interface server may send a write lock acquisition request to the lock server, and the write lock acquisition request carries the data stripe identifier, and the lock server may determine whether the other file interface server holds the data stripe corresponding to the data stripe identifier. The read lock or the write lock, when the other file interface server does not hold the read lock and the write lock of the data stripe corresponding to the data stripe identifier, the lock server may send the data score corresponding to the data stripe identifier to the file interface server. The write authorization message of the strip, so that the file interface server sends the write data to the storage server.
S604,文件接口服务器将写数据发送给存储写数据所属数据块的存储服务器。S604. The file interface server sends the write data to a storage server that stores the data block to which the write data belongs.
文件接口服务器确定写数据所属数据块之后,可以根据数据块的存储路径,将写数据发送给存储写数据所属数据块的存储服务器。例如,写数据所属数据块为4-2,文件接口服务器根据数据块4-2的存储路径确定数据块4-2存储在存储服务器1中,进而文件接口服务器可以将写数据发送给存储服务器1。After the file interface server determines the data block to which the write data belongs, the write data may be sent to the storage server storing the data block to which the write data belongs according to the storage path of the data block. For example, the data block to which the write data belongs is 4-2, and the file interface server determines that the data block 4-2 is stored in the storage server 1 according to the storage path of the data block 4-2, and the file interface server can send the write data to the storage server 1 .
在可选实施例中,文件接口服务器可以通过EC算法对写数据进行处理,得到校验数据块,将写数据、校验数据块以及获取到的数据分条版本号发送给 该存储服务器,该存储服务器可以对写数据所属的数据块进行更新,并对校验数据块进行更新,进而将该数据分条中各个数据块对应的数据块版本号更新为该数据分条版本号。In an optional embodiment, the file interface server may process the write data by using an EC algorithm to obtain a check data block, and send the write data, the check data block, and the obtained data stripe version number to The storage server can update the data block to which the write data belongs, and update the check data block, and then update the data block version number corresponding to each data block in the data stripe to the data stripe version. number.
S605,当写数据成功发送时,文件接口服务器将数据分条版本号发送给锁服务器。S605: When the write data is successfully sent, the file interface server sends the data stripe version number to the lock server.
当写数据成功发送时,文件接口服务器可以将获取到的数据分条版本号发送给锁服务器,进一步的,文件接口服务器还可以将数据块所属数据分条的数据分条标识发送给锁服务器。例如,文件接口服务器确定向存储服务器发送的写数据发送完毕之后,可以将获取到的数据分条版本号发送给锁服务器,以通知锁服务器对该数据分条的数据分条版本号进行更新。又如,文件接口服务器将写数据发送给存储服务器之后,存储服务器向文件接口服务器发送写数据成功接收消息,文件接口服务器可以根据写数据成功接收消息确定写数据成功发送,进而将获取到的数据分条版本号发送给锁服务器。When the write data is successfully sent, the file interface server may send the obtained data stripe version number to the lock server. Further, the file interface server may further send the data stripe identifier of the data strip to which the data block belongs to the lock server. For example, after the file interface server determines that the write data sent to the storage server is sent, the obtained data stripe version number may be sent to the lock server to notify the lock server to update the data stripe version number of the data stripe. For another example, after the file interface server sends the write data to the storage server, the storage server sends the write data to the file interface server to successfully receive the message, and the file interface server can successfully receive the message according to the write data to determine that the write data is successfully sent, and then the acquired data. The stripe version number is sent to the lock server.
S606,锁服务器更新数据分条的数据分条版本号。S606. The lock server updates the data stripe version number of the data stripe.
在图6所示的基于分布式系统的文件读取方法中,客户端向文件接口服务器发送文件写请求,文件写请求携带文件句柄、偏移地址、写数据以及写数据量,文件接口服务器通过版本号分配器获取文件句柄对应的文件的数据分条版本号,文件接口服务器根据偏移地址以及写数据量,确定写数据所属的数据块以及数据块所属的数据分条,文件接口服务器将写数据发送给存储写数据所属数据块的存储服务器,当写数据成功发送时,文件接口服务器将数据分条版本号发送给锁服务器,锁服务器更新数据块所属数据分条的数据分条版本号,可确保锁服务器存储的数据分条版本号的有效性。In the distributed system-based file reading method shown in FIG. 6, the client sends a file write request to the file interface server, and the file write request carries the file handle, the offset address, the write data, and the write data amount, and the file interface server passes The version number allocator obtains the data stripe version number of the file corresponding to the file handle, and the file interface server determines, according to the offset address and the amount of write data, the data block to which the write data belongs and the data strip to which the data block belongs, and the file interface server writes The data is sent to the storage server storing the data block to which the write data belongs. When the write data is successfully sent, the file interface server sends the data stripe version number to the lock server, and the lock server updates the data stripe version number of the data strip to which the data block belongs. It ensures the validity of the data stripe version number stored by the lock server.
请参见图7,图7是本发明实施例中提供的一种文件接口服务器的结构示意图。如图7所示,该文件接口服务器可以包括:处理器701、存储器702、第一网络接口703、第二网络接口704以及第三网络接口705。处理器701连接到存储器702、第一网络接口703、第二网络接口704以及第三网络接口705,例如处理器701可以通过总线连接到存储器702、第一网络接口703、第二网络接口704以及第三网络接口705。 Referring to FIG. 7, FIG. 7 is a schematic structural diagram of a file interface server according to an embodiment of the present invention. As shown in FIG. 7, the file interface server may include a processor 701, a memory 702, a first network interface 703, a second network interface 704, and a third network interface 705. The processor 701 is connected to the memory 702, the first network interface 703, the second network interface 704, and the third network interface 705. For example, the processor 701 can be connected to the memory 702, the first network interface 703, the second network interface 704, and the Third network interface 705.
其中,处理器701可以是中央处理器(central processing unit,CPU),网络处理器(network processor,NP)等。The processor 701 may be a central processing unit (CPU), a network processor (NP), or the like.
存储器702具体可以用于存储数据块以及数据块对应的数据块版本号等。存储器702可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器也可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);存储器还可以包括上述种类的存储器的组合。The memory 702 can be specifically configured to store a data block, a data block version number corresponding to the data block, and the like. The memory 702 may include a volatile memory such as a random-access memory (RAM); the memory may also include a non-volatile memory such as a read-only memory (read- Only memory, ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory may also include a combination of the above types of memory.
第一网络接口703,用于与客户端进行通信,例如接收客户端发送的文件读请求。第一网络接口703可选的可以包括标准的有线接口、无线接口(如WI-FI接口)等。The first network interface 703 is configured to communicate with the client, for example, to receive a file read request sent by the client. The first network interface 703 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
第二网络接口704,用于与锁服务器进行通信,例如向锁服务器发送针对目标数据分条的数据分条版本号获取请求。第二网络接口704可选的可以包括标准的有线接口、无线接口(如WI-FI接口)等。The second network interface 704 is configured to communicate with the lock server, for example, send a data stripe version number acquisition request for the target data stripe to the lock server. The second network interface 704 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
第三网络接口705,用于与存储服务器进行通信,例如向存储服务器发送数据块获取请求。第三网络接口705可选的可以包括标准的有线接口、无线接口(如WI-FI接口)等。The third network interface 705 is configured to communicate with the storage server, for example, send a data block acquisition request to the storage server. The third network interface 705 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
具体的,本发明实施例中介绍的文件接口服务器可以用以实施本发明结合图3~图6介绍的基于分布式系统的文件读取方法实施例中的部分或全部流程。Specifically, the file interface server introduced in the embodiment of the present invention may be used to implement some or all of the processes in the embodiment of the distributed system-based file reading method introduced in conjunction with FIG. 3 to FIG.
请参见图8,图8是本发明实施例中提供的一种基于分布式系统的文件读取装置的结构示意图,其中本发明实施例提供的基于分布式系统的文件读取装置可以结合图7中的处理器701,如图所示本发明实施例中的基于分布式系统的文件读取装置至少可以包括请求接收单元801、数据块确定单元802、请求发送单元803、版本号获取单元804、数据块接收单元805以及数据块发送单元806,其中:Referring to FIG. 8, FIG. 8 is a schematic structural diagram of a file reading apparatus based on a distributed system according to an embodiment of the present invention, wherein the file reading apparatus based on the distributed system provided by the embodiment of the present invention can be combined with FIG. The processor 701 in the embodiment of the present invention, as shown in the figure, may include at least a request receiving unit 801, a data block determining unit 802, a request sending unit 803, a version number obtaining unit 804, A data block receiving unit 805 and a data block transmitting unit 806, wherein:
请求接收单元801,用于接收客户端发送的文件读请求,文件读请求携带偏移地址以及读取数据量。The request receiving unit 801 is configured to receive a file read request sent by the client, where the file read request carries an offset address and a read data amount.
数据块确定单元802,用于根据偏移地址以及读取数据量,确定客户端需 要读取的至少一个目标数据块以及至少一个目标数据块所属的目标数据分条,一个文件包括至少一个数据分条,各个数据分条包括至少一个数据块。a data block determining unit 802, configured to determine, according to the offset address and the amount of read data, the client needs At least one target data block to be read and a target data strip to which the at least one target data block belongs, one file includes at least one data stripe, and each data strip includes at least one data block.
请求发送单元803,用于当至少一个目标数据块为目标数据分条中的部分数据时,向锁服务器发送对目标数据分条的数据分条版本号获取请求。The request sending unit 803 is configured to send, when the at least one target data block is part of the data in the target data stripe, a data stripe version number acquisition request for the target data stripe to the lock server.
版本号获取单元804,用于接收锁服务器响应数据分条版本号获取请求所反馈的数据分条版本号。The version number obtaining unit 804 is configured to receive a data stripe version number fed back by the lock server in response to the data stripe version number obtaining request.
请求发送单元803,还用于向各个存储目标数据块的存储服务器发送数据块获取请求。The request sending unit 803 is further configured to send a data block acquisition request to each storage server storing the target data block.
数据块接收单元805,用于接收各个存储服务器响应数据块获取请求所反馈的目标数据块及其对应的数据块版本号。The data block receiving unit 805 is configured to receive the target data block and the corresponding data block version number fed back by the respective storage server in response to the data block acquisition request.
数据块发送单元806,用于当数据分条版本号和各个目标数据块对应的数据块版本号相同时,将各个目标数据块发送给客户端。The data block sending unit 806 is configured to send each target data block to the client when the data stripe version number and the data block version number corresponding to each target data block are the same.
在可选实施例中,请求发送单元803,还用于当至少一个目标数据块为目标数据分条中的所有数据时,向各个存储目标数据块的存储服务器发送数据块获取请求。In an optional embodiment, the request sending unit 803 is further configured to: when the at least one target data block is all the data in the target data stripe, send the data block obtaining request to the storage server of each storage target data block.
数据块接收单元805,还用于接收各个存储服务器响应数据块获取请求所反馈的各个目标数据块及其对应的数据块版本号。The data block receiving unit 805 is further configured to receive each target data block and each corresponding data block version number that are fed back by the respective storage server in response to the data block acquisition request.
数据块发送单元806,还用于当各个目标数据块对应的数据块版本号相同时,将各个目标数据块发送给客户端。The data block sending unit 806 is further configured to send each target data block to the client when the data block version numbers corresponding to the respective target data blocks are the same.
在可选实施例中,请求发送单元803,还用于当数据分条版本号和各个目标数据块对应的数据块版本号不完全相同时,向各个存储目标数据分条中数据块的存储服务器发送数据块获取请求。In an optional embodiment, the request sending unit 803 is further configured to: when the data stripe version number and the data block version number corresponding to each target data block are not completely the same, store the data block in each storage target data stripe. Send a data block get request.
数据块接收单元805,还用于接收各个存储服务器响应数据块获取请求所反馈的各个数据块及其对应的数据块版本号。The data block receiving unit 805 is further configured to receive each data block and each corresponding data block version number fed back by the respective storage server in response to the data block acquisition request.
数据块确定单元802,还用于当各个数据块对应的数据块版本号相同时,在接收得到的数据块中确定各个目标数据块。The data block determining unit 802 is further configured to determine each target data block in the received data block when the data block version numbers corresponding to the respective data blocks are the same.
数据块发送单元806,还用于将各个目标数据块发送给客户端。The data block sending unit 806 is further configured to send each target data block to the client.
在可选实施例中,请求接收单元801,还用于接收客户端发送的文件写请求,文件写请求携带文件句柄、偏移地址、写数据以及写数据量。 In an optional embodiment, the request receiving unit 801 is further configured to receive a file write request sent by the client, where the file write request carries a file handle, an offset address, a write data, and a write data amount.
版本号获取单元804,还用于通过版本号分配器获取文件句柄对应的文件的数据分条版本号。The version number obtaining unit 804 is further configured to obtain a data stripe version number of the file corresponding to the file handle by using the version number allocator.
数据块确定单元802,还用于根据偏移地址以及写数据量,确定写数据所属的数据块以及数据块所属的数据分条。The data block determining unit 802 is further configured to determine, according to the offset address and the amount of write data, a data block to which the write data belongs and a data strip to which the data block belongs.
进一步的,本发明实施例中基于分布式系统的文件读取装置还可以包括:Further, the file reading apparatus based on the distributed system in the embodiment of the present invention may further include:
数据发送单元807,用于将写数据发送给存储写数据所属数据块的存储服务器。The data transmitting unit 807 is configured to send the write data to a storage server that stores the data block to which the write data belongs.
版本号发送单元808,用于当写数据成功发送时,将数据分条版本号发送给锁服务器,以通知锁服务器更新该数据分条的数据分条版本号。The version number sending unit 808 is configured to send the data stripe version number to the lock server when the write data is successfully sent, to notify the lock server to update the data stripe version number of the data stripe.
在可选实施例中,本发明实施例中的文件的读取装置还可以包括:In an alternative embodiment, the reading device of the file in the embodiment of the present invention may further include:
版本号发送单元808,用于当各个目标数据块对应的数据块版本号相同时,将目标数据块对应的数据块版本号作为目标数据分条的数据分条版本号,并将数据分条版本号发送给锁服务器,以通知锁服务器更新目标数据分条的数据分条版本号。The version number sending unit 808 is configured to use the data block version number corresponding to the target data block as the data stripe version number of the target data strip when the data block version numbers corresponding to the target data blocks are the same, and the data stripe version The number is sent to the lock server to notify the lock server to update the data stripe version number of the target data strip.
进一步可选的,版本号发送单元808,具体用于:Further, the version number sending unit 808 is specifically configured to:
向锁服务器发送锁释放请求,锁释放请求携带数据分条标识以及数据分条版本号,以通知锁服务器更新数据分条标识对应的数据分条的数据分条版本号。Sending a lock release request to the lock server, the lock release request carrying the data stripe identifier and the data stripe version number, to notify the lock server to update the data stripe version number of the data stripe corresponding to the data stripe identifier.
接收锁服务器响应锁释放请求所反馈的锁释放响应消息。The lock release server responds to the lock release response message fed back by the lock release request.
进一步可选的,版本号发送单元808,具体用于:Further, the version number sending unit 808 is specifically configured to:
接收锁服务器发送的锁召回请求,锁召回请求携带数据分条标识。Receiving a lock recall request sent by the lock server, and the lock recall request carries a data stripe identifier.
响应锁召回请求向锁服务器发送锁召回响应消息,锁召回响应消息携带数据分条标识对应的数据分条的数据分条版本号,以通知锁服务器更新数据分条标识对应的数据分条的数据分条版本号。Responding to the lock recall request, sending a lock recall response message to the lock server, the lock recall response message carrying the data stripe version number of the data stripe corresponding to the data stripe identifier, to notify the lock server to update the data stripe data corresponding to the data stripe identifier Striped version number.
在可选实施例中,请求发送单元803向锁服务器发送针对目标数据分条的数据分条版本号获取请求,具体用于:In an optional embodiment, the request sending unit 803 sends a data stripe version number acquisition request for the target data striping to the lock server, specifically for:
向锁服务器发送读锁获取请求,读锁获取请求携带目标数据分条的数据分条标识。A read lock acquisition request is sent to the lock server, and the read lock acquisition request carries the data stripe identifier of the target data strip.
接收锁服务器响应读锁获取请求所反馈的对数据分条标识对应的目标数 据分条的读授权响应消息,读授权响应消息携带目标数据分条的数据分条版本号。The number of targets corresponding to the data stripe identifier fed back by the receiving lock server in response to the read lock acquisition request According to the striped read authorization response message, the read authorization response message carries the data stripe version number of the target data stripe.
在可选实施例中,文件读请求还可以携带文件句柄,请求发送单元803向存储各个目标数据块的存储服务器发送数据块获取请求,具体用于:In an optional embodiment, the file read request may further carry a file handle, and the request sending unit 803 sends a data block acquisition request to the storage server storing each target data block, specifically for:
根据文件句柄在本地获取文件的文件属性,文件属性包括文件中各个数据块的存储路径。The file attribute of the file is obtained locally according to the file handle, and the file attribute includes the storage path of each data block in the file.
根据各个目标数据块的存储路径,确定存储各个目标数据块的存储服务器。A storage server that stores each target data block is determined according to a storage path of each target data block.
向各个确定的存储服务器发送数据块获取请求。A data block acquisition request is sent to each of the determined storage servers.
进一步可选的,请求发送单元803,还用于当各个目标数据块对应的数据块版本号不完全相同时,向各个存储目标数据分条中校验数据块的存储服务器发送校验数据块获取请求。Further, the request sending unit 803 is further configured to: when the data block version numbers corresponding to the respective target data blocks are not completely the same, send the check data block to the storage server of the check data block in each storage target data stripe. request.
数据块接收单元805,还用于接收各个存储服务器响应校验数据块获取请求所反馈的校验数据块及其对应的数据块版本号。The data block receiving unit 805 is further configured to receive the check data block and the corresponding data block version number fed back by the respective storage server in response to the check data block acquisition request.
进一步的,本发明实施例中的基于分布式系统的文件读取装置还可以包括:Further, the file reading apparatus based on the distributed system in the embodiment of the present invention may further include:
数据块生成单元809,用于当各个校验数据块对应的数据块版本号相同时,通过EC算法对各个校验数据块进行处理,得到目标数据分条中的各个数据块。The data block generating unit 809 is configured to process each check data block by an EC algorithm when the data block version numbers corresponding to the respective check data blocks are the same, to obtain each data block in the target data strip.
数据块发送单元806,还用于将数据块中的各个目标数据块发送给客户端。The data block sending unit 806 is further configured to send each target data block in the data block to the client.
具体的,本发明实施例中介绍的基于分布式系统的文件读取装置可以用以实施本发明结合图3~图6介绍的基于分布式系统的文件读取方法实施例中的部分或全部流程。Specifically, the distributed system-based file reading apparatus introduced in the embodiment of the present invention may be used to implement some or all of the processes in the distributed system-based file reading method embodiment introduced by the present invention in conjunction with FIG. 3 to FIG. .
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包括于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不是必须针对相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。 In the description of the present specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means a specific feature described in connection with the embodiment or example. A structure, material or feature is included in at least one embodiment or example of the invention. In the present specification, the schematic representation of the above terms is not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. In addition, various embodiments or examples described in the specification, as well as features of various embodiments or examples, may be combined and combined.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本发明的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。Moreover, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, features defining "first" or "second" may include at least one of the features, either explicitly or implicitly. In the description of the present invention, the meaning of "a plurality" is at least two, such as two, three, etc., unless specifically defined otherwise.
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的程序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包括、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器,只读存储器,可擦除可编辑只读存储器,光纤装置,以及便携式光盘只读存储器。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。The logic and/or steps represented in the flowchart or otherwise described herein, for example, a list of programs that can be considered as executable instructions for implementing logical functions, can be embodied in any computer readable medium, Used by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions and execute instructions from an instruction execution system, apparatus, or device) Used for equipment. For the purposes of this specification, a "computer-readable medium" can be any apparatus that can include, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with such an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer readable media include the following: electrical connections (electronic devices) having one or more wires, portable computer disk cartridges (magnetic devices), random access memory, read only memory , erasable editable read-only memory, fiber optic devices, and portable optical disk read-only memory. In addition, the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列,现场可编程门阵列等。It should be understood that portions of the invention may be implemented in hardware, software, firmware or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays, field programmable gate arrays, and the like.
此外,在本发明各个实施例中的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, the modules in the various embodiments of the present invention may be implemented in the form of hardware or in the form of software functional modules. An integrated module can also be stored in a computer readable storage medium if it is implemented as a software functional module and sold or used as a standalone product.
尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。 Although the embodiments of the present invention have been shown and described, it is understood that the above-described embodiments are illustrative and are not to be construed as limiting the scope of the invention. The embodiments are subject to variations, modifications, substitutions and variations.

Claims (20)

  1. 一种基于分布式系统的文件读取方法,所述方法应用于文件接口服务器,所述文件接口服务器和客户端、锁服务器以及存储服务器通信,其特征在于,包括:A file reading method based on a distributed system, the method is applied to a file interface server, and the file interface server communicates with a client, a lock server, and a storage server, and the method includes:
    接收所述客户端发送的文件读请求,所述文件读请求携带偏移地址以及读取数据量;Receiving a file read request sent by the client, where the file read request carries an offset address and a read data amount;
    根据所述偏移地址以及所述读取数据量,确定所述客户端需要读取的至少一个目标数据块以及所述至少一个目标数据块所属的目标数据分条,一个文件包括至少一个数据分条,各个所述数据分条包括至少一个数据块;Determining, according to the offset address and the read data amount, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs, and one file includes at least one data segment a strip, each of the data strips including at least one data block;
    当所述至少一个目标数据块为所述目标数据分条中的部分数据时,向所述锁服务器发送针对所述目标数据分条的数据分条版本号获取请求,并接收所述锁服务器响应所述数据分条版本号获取请求所反馈的数据分条版本号;And when the at least one target data block is part of the target data stripe, sending a data stripe version number acquisition request for the target data stripe to the lock server, and receiving the lock server response The data stripe version number obtains a data stripe version number that is requested by the request;
    向各个存储所述目标数据块的所述存储服务器发送数据块获取请求,并接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号;And sending, to the storage server that stores the target data block, a data block acquisition request, and receiving, by the storage server, the target data block and the corresponding data block version number that are fed back in response to the data block acquisition request;
    当所述数据分条版本号和各个所述目标数据块对应的数据块版本号相同时,将各个所述目标数据块发送给所述客户端。And when the data stripe version number is the same as the data block version number corresponding to each of the target data blocks, each of the target data blocks is sent to the client.
  2. 如权利要求1所述的方法,其特征在于,所述根据所述偏移地址以及所述读取数据量,确定所述客户端需要读取的至少一个目标数据块以及所述至少一个目标数据块所属的目标数据分条之后,还包括:The method according to claim 1, wherein said determining at least one target data block and said at least one target data that said client needs to read according to said offset address and said amount of read data After the target data strip to which the block belongs, it also includes:
    当所述至少一个目标数据块为所述目标数据分条中的所有数据时,向各个存储所述目标数据块的存储服务器发送所述数据块获取请求;And when the at least one target data block is all the data in the target data stripe, sending the data block acquisition request to each storage server storing the target data block;
    接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号;Receiving, by the respective storage server, the target data block and the corresponding data block version number that are fed back in response to the data block acquisition request;
    当各个所述目标数据块对应的数据块版本号相同时,将各个所述目标数据块发送给所述客户端。 When each of the target data blocks corresponds to a data block version number, each of the target data blocks is sent to the client.
  3. 如权利要求1所述的方法,其特征在于,所述接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号之后,还包括:The method of claim 1, wherein after receiving the target data block and the corresponding data block version number that are fed back by the respective storage server in response to the data block acquisition request, the method further includes:
    当所述数据分条版本号和各个所述目标数据块对应的数据块版本号不完全相同时,向各个存储所述目标数据分条中数据块的存储服务器发送所述数据块获取请求;And when the data stripe version number and the data block version number corresponding to each of the target data blocks are not completely the same, the data block obtaining request is sent to each storage server that stores the data block in the target data stripe;
    接收各个所述存储服务器响应所述数据块获取请求所反馈的各个所述数据块及其对应的数据块版本号;Receiving, by each of the storage servers, each of the data blocks and corresponding data block version numbers that are fed back in response to the data block acquisition request;
    当各个所述数据块对应的数据块版本号相同时,在所述接收得到的数据块中确定各个所述目标数据块;Determining each of the target data blocks in the received data block when the data block version numbers corresponding to the data blocks are the same;
    将各个所述目标数据块发送给所述客户端。Each of the target data blocks is sent to the client.
  4. 如权利要求1~3任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further comprises:
    接收所述客户端发送的文件写请求,所述文件写请求携带文件句柄、偏移地址、写数据以及写数据量;Receiving a file write request sent by the client, where the file write request carries a file handle, an offset address, a write data, and a write data amount;
    通过版本号分配器获取所述文件句柄对应的文件的数据分条版本号;Obtaining, by using a version number allocator, a data stripe version number of the file corresponding to the file handle;
    根据所述偏移地址以及所述写数据量,确定所述写数据所属的数据块以及所述数据块所属的数据分条;Determining, according to the offset address and the amount of write data, a data block to which the write data belongs and a data strip to which the data block belongs;
    将所述写数据发送给存储所述写数据所属数据块的存储服务器;Transmitting the write data to a storage server storing a data block to which the write data belongs;
    当所述写数据成功发送时,将所述数据分条版本号发送给所述锁服务器,以通知所述锁服务器更新所述数据分条的数据分条版本号。When the write data is successfully sent, the data stripe version number is sent to the lock server to notify the lock server to update the data stripe version number of the data stripe.
  5. 如权利要求2所述的方法,其特征在于,所述接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号之后,还包括:The method according to claim 2, wherein after receiving the target data block and the corresponding data block version number that are fed back by the respective storage server in response to the data block acquisition request, the method further includes:
    当各个所述目标数据块对应的数据块版本号相同时,将所述目标数据块对应的数据块版本号作为所述目标数据分条的数据分条版本号;When the data block version numbers corresponding to the target data blocks are the same, the data block version number corresponding to the target data block is used as the data stripe version number of the target data stripe;
    将所述数据分条版本号发送给所述锁服务器,以通知所述锁服务器更新所述目标数据分条的数据分条版本号。 Sending the data stripe version number to the lock server to notify the lock server to update the data stripe version number of the target data stripe.
  6. 如权利要求5所述的方法,其特征在于,所述将所述数据分条版本号发送给所述锁服务器,包括:The method of claim 5, wherein the sending the data stripe version number to the lock server comprises:
    向所述锁服务器发送锁释放请求,所述锁释放请求携带数据分条标识以及数据分条版本号,以通知所述锁服务器更新所述数据分条标识对应的数据分条的数据分条版本号;Sending a lock release request to the lock server, where the lock release request carries a data stripe identifier and a data stripe version number, to notify the lock server to update a data stripe version of the data stripe corresponding to the data stripe identifier number;
    接收所述锁服务器响应所述锁释放请求所反馈的锁释放响应消息。Receiving a lock release response message fed back by the lock server in response to the lock release request.
  7. 如权利要求5所述的方法,其特征在于,所述将所述数据分条版本号发送给所述锁服务器,包括:The method of claim 5, wherein the sending the data stripe version number to the lock server comprises:
    接收所述锁服务器发送的锁召回请求,所述锁召回请求携带数据分条标识;Receiving a lock recall request sent by the lock server, where the lock recall request carries a data stripe identifier;
    响应所述锁召回请求向所述锁服务器发送锁召回响应消息,所述锁召回响应消息携带所述数据分条标识对应的数据分条的数据分条版本号,以通知所述锁服务器更新所述数据分条标识对应的数据分条的数据分条版本号。Sending a lock recall response message to the lock server in response to the lock recall request, the lock recall response message carrying a data stripe version number of the data stripe corresponding to the data stripe identifier to notify the lock server to update the location The data stripe version number of the data stripe corresponding to the data stripe identifier.
  8. 如权利要求1~7任一项所述的方法,其特征在于,所述向锁服务器发送针对所述目标数据分条的数据分条版本号获取请求,包括:The method according to any one of claims 1 to 7, wherein the sending a data stripe version number acquisition request for the target data stripe to the lock server comprises:
    向所述锁服务器发送读锁获取请求,所述读锁获取请求携带所述目标数据分条的数据分条标识;Sending a read lock acquisition request to the lock server, where the read lock acquisition request carries a data stripe identifier of the target data stripe;
    接收所述锁服务器响应所述读锁获取请求所反馈的对所述数据分条标识对应的目标数据分条的读授权响应消息,所述读授权响应消息携带所述目标数据分条的数据分条版本号。Receiving a read authorization response message of the target data stripe corresponding to the data stripe identifier fed back by the lock server in response to the read lock acquisition request, where the read grant response message carries the data score of the target data stripe Strip version number.
  9. 如权利要求2所述的方法,其特征在于,所述接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号之后,还包括:The method according to claim 2, wherein after receiving the target data block and the corresponding data block version number that are fed back by the respective storage server in response to the data block acquisition request, the method further includes:
    当各个所述目标数据块对应的数据块版本号不完全相同时,向各个存 储所述目标数据分条中校验数据块的存储服务器发送校验数据块获取请求;When the version numbers of the data blocks corresponding to the target data blocks are not completely the same, And storing, by the storage server storing the check data block in the target data stripe, a check data block acquisition request;
    接收各个所述存储服务器响应所述校验数据块获取请求所反馈的校验数据块及其对应的数据块版本号;Receiving, by the respective storage server, the check data block and the corresponding data block version number fed back by the check data block obtaining request;
    当各个所述校验数据块对应的数据块版本号相同时,通过数据校验擦除码EC算法对各个所述校验数据块进行处理,得到各个所述目标数据块;When the data block version numbers corresponding to the respective check data blocks are the same, each of the check data blocks is processed by a data check erase code EC algorithm to obtain each of the target data blocks;
    将各个所述目标数据块发送给所述客户端。Each of the target data blocks is sent to the client.
  10. 如权利要求1~9任一项所述的方法,其特征在于,所述文件读请求还携带文件句柄;The method according to any one of claims 1 to 9, wherein the file read request further carries a file handle;
    所述向各个存储所述目标数据块的所述存储服务器发送数据块获取请求,包括:And sending the data block acquisition request to each storage server that stores the target data block, including:
    根据所述文件句柄在本地获取所述文件的文件属性,所述文件属性包括所述文件中各个数据块的存储路径;Obtaining, according to the file handle, a file attribute of the file locally, where the file attribute includes a storage path of each data block in the file;
    根据各个所述目标数据块的存储路径,确定各个存储所述目标数据块的存储服务器;Determining, according to a storage path of each of the target data blocks, a storage server that stores the target data block;
    向各个确定的存储服务器发送所述数据块获取请求。The data block acquisition request is sent to each of the determined storage servers.
  11. 一种基于分布式系统的文件读取装置,其特征在于,包括:A file reading device based on a distributed system, comprising:
    请求接收单元,用于接收客户端发送的文件读请求,所述文件读请求携带偏移地址以及读取数据量;a request receiving unit, configured to receive a file read request sent by the client, where the file read request carries an offset address and a read data amount;
    数据块确定单元,用于根据所述偏移地址以及所述读取数据量,确定所述客户端需要读取的至少一个目标数据块以及所述至少一个目标数据块所属的目标数据分条,一个文件包括至少一个数据分条,各个所述数据分条包括至少一个数据块;a data block determining unit, configured to determine, according to the offset address and the read data amount, at least one target data block that the client needs to read and a target data strip to which the at least one target data block belongs, A file includes at least one data stripe, each of the data strips including at least one data block;
    请求发送单元,用于当所述至少一个目标数据块为所述目标数据分条中的部分数据时,向锁服务器发送针对所述目标数据分条的数据分条版本号获取请求;a request sending unit, configured to: when the at least one target data block is part of the target data stripe, send a data stripe version number acquisition request for the target data stripe to the lock server;
    版本号获取单元,用于接收所述锁服务器响应所述数据分条版本号获 取请求所反馈的数据分条版本号;a version number obtaining unit, configured to receive, by the lock server, a version number of the data stripe Take the data stripe version number that the request feeds back;
    所述请求发送单元,还用于向各个存储所述目标数据块的存储服务器发送数据块获取请求;The request sending unit is further configured to send a data block acquisition request to each storage server that stores the target data block;
    数据块接收单元,用于接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号;a data block receiving unit, configured to receive, by the respective storage server, the target data block and the corresponding data block version number that are fed back in response to the data block acquisition request;
    数据块发送单元,用于当所述数据分条版本号和各个所述目标数据块对应的数据块版本号相同时,将各个所述目标数据块发送给所述客户端。And a data block sending unit, configured to send each of the target data blocks to the client when the data stripe version number and the data block version number corresponding to each of the target data blocks are the same.
  12. 如权利要求11所述的装置,其特征在于,The device of claim 11 wherein:
    所述请求发送单元,还用于当所述至少一个目标数据块为所述目标数据分条中的所有数据时,向各个存储所述目标数据块的存储服务器发送所述数据块获取请求;The request sending unit is further configured to: when the at least one target data block is all the data in the target data stripe, send the data block obtaining request to each storage server that stores the target data block;
    所述数据块接收单元,还用于接收各个所述存储服务器响应所述数据块获取请求所反馈的所述目标数据块及其对应的数据块版本号;The data block receiving unit is further configured to receive, by the respective storage server, the target data block and the corresponding data block version number that are fed back in response to the data block acquisition request;
    所述数据块发送单元,还用于当各个所述目标数据块对应的数据块版本号相同时,将各个所述目标数据块发送给所述客户端。The data block sending unit is further configured to send each of the target data blocks to the client when the data block version numbers corresponding to the target data blocks are the same.
  13. 如权利要求11所述的装置,其特征在于,The device of claim 11 wherein:
    所述请求发送单元,还用于当所述数据分条版本号和各个所述目标数据块对应的数据块版本号不完全相同时,向各个存储所述目标数据分条中数据块的存储服务器发送所述数据块获取请求;The request sending unit is further configured to: when the data stripe version number and the data block version number corresponding to each of the target data blocks are not completely the same, to each storage server that stores the data block in the target data stripe Sending the data block acquisition request;
    所述数据块接收单元,还用于接收各个所述存储服务器响应所述数据块获取请求所反馈的各个所述数据块及其对应的数据块版本号;The data block receiving unit is further configured to receive each of the data blocks and corresponding data block version numbers that are fed back by each of the storage servers in response to the data block acquisition request;
    所述数据块确定单元,还用于当各个所述数据块对应的数据块版本号相同时,在所述接收得到的数据块中确定各个所述目标数据块;The data block determining unit is further configured to: when each of the data blocks corresponds to a data block version number, determine each of the target data blocks in the received data block;
    所述数据块发送单元,还用于将各个所述目标数据块发送给所述客户端。The data block sending unit is further configured to send each of the target data blocks to the client.
  14. 如权利要求11~13任一项所述的装置,其特征在于, Apparatus according to any one of claims 11 to 13 wherein:
    所述请求接收单元,还用于接收所述客户端发送的文件写请求,所述文件写请求携带文件句柄、偏移地址、写数据以及写数据量;The request receiving unit is further configured to receive a file write request sent by the client, where the file write request carries a file handle, an offset address, a write data, and a write data amount;
    所述版本号获取单元,还用于通过版本号分配器获取所述文件句柄对应的文件的数据分条版本号;The version number obtaining unit is further configured to obtain, by using a version number allocator, a data stripe version number of the file corresponding to the file handle;
    所述数据块确定单元,还用于根据所述偏移地址以及所述写数据量,确定所述写数据所属的数据块以及所述数据块所属的数据分条;The data block determining unit is further configured to determine, according to the offset address and the amount of write data, a data block to which the write data belongs and a data strip to which the data block belongs;
    所述装置还包括:The device also includes:
    数据发送单元,用于将所述写数据发送给存储所述写数据所属数据块的存储服务器;a data sending unit, configured to send the write data to a storage server that stores a data block to which the write data belongs;
    版本号发送单元,用于当所述写数据成功发送时,将所述数据分条版本号发送给所述锁服务器,以通知所述锁服务器更新所述数据分条的数据分条版本号。The version number sending unit is configured to send the data stripe version number to the lock server when the write data is successfully sent, to notify the lock server to update the data stripe version number of the data stripe.
  15. 如权利要求12所述的装置,其特征在于,所述装置还包括:The device of claim 12, wherein the device further comprises:
    版本号发送单元,用于当各个所述目标数据块对应的数据块版本号相同时,将所述目标数据块对应的数据块版本号作为所述目标数据分条的数据分条版本号,并将所述数据分条版本号发送给所述锁服务器,以通知所述锁服务器更新所述目标数据分条的数据分条版本号。a version number sending unit, configured to: when a data block version number corresponding to each of the target data blocks is the same, use a data block version number corresponding to the target data block as a data stripe version number of the target data stripe, and Sending the data stripe version number to the lock server to notify the lock server to update the data stripe version number of the target data stripe.
  16. 如权利要求15所述的装置,其特征在于,所述版本号发送单元,具体用于:The device according to claim 15, wherein the version number sending unit is specifically configured to:
    向所述锁服务器发送锁释放请求,所述锁释放请求携带数据分条标识以及数据分条版本号,以通知所述锁服务器更新所述数据分条标识对应的数据分条的数据分条版本号;Sending a lock release request to the lock server, where the lock release request carries a data stripe identifier and a data stripe version number, to notify the lock server to update a data stripe version of the data stripe corresponding to the data stripe identifier number;
    接收所述锁服务器响应所述锁释放请求所反馈的锁释放响应消息。Receiving a lock release response message fed back by the lock server in response to the lock release request.
  17. 如权利要求15所述的装置,其特征在于,所述版本号发送单元,具体用于:The device according to claim 15, wherein the version number sending unit is specifically configured to:
    接收所述锁服务器发送的锁召回请求,所述锁召回请求携带数据分条 标识;Receiving a lock recall request sent by the lock server, where the lock recall request carries data strips Identification
    响应所述锁召回请求向所述锁服务器发送锁召回响应消息,所述锁召回响应消息携带所述数据分条标识对应的数据分条的数据分条版本号,以通知所述锁服务器更新所述数据分条标识对应的数据分条的数据分条版本号。Sending a lock recall response message to the lock server in response to the lock recall request, the lock recall response message carrying a data stripe version number of the data stripe corresponding to the data stripe identifier to notify the lock server to update the location The data stripe version number of the data stripe corresponding to the data stripe identifier.
  18. 如权利要求11~17任一项所述的装置,其特征在于,所述请求发送单元向所述锁服务器发送针对所述目标数据分条的数据分条版本号获取请求,具体用于:The device according to any one of claims 11 to 17, wherein the request sending unit sends a data stripe version number acquisition request for the target data stripe to the lock server, specifically for:
    向所述锁服务器发送读锁获取请求,所述读锁获取请求携带所述目标数据分条的数据分条标识;Sending a read lock acquisition request to the lock server, where the read lock acquisition request carries a data stripe identifier of the target data stripe;
    接收所述锁服务器响应所述读锁获取请求所反馈的对所述数据分条标识对应的目标数据分条的读授权响应消息,所述读授权响应消息携带所述目标数据分条的数据分条版本号。Receiving a read authorization response message of the target data stripe corresponding to the data stripe identifier fed back by the lock server in response to the read lock acquisition request, where the read grant response message carries the data score of the target data stripe Strip version number.
  19. 如权利要求12所述的装置,其特征在于,The device of claim 12 wherein:
    所述请求发送单元,还用于当各个所述目标数据块对应的数据块版本号不完全相同时,向各个存储所述目标数据分条中校验数据块的存储服务器发送校验数据块获取请求;The request sending unit is further configured to: when each of the target data blocks corresponds to a data block version number that is not completely the same, send a check data block to each storage server that stores the check data block in the target data stripe. request;
    所述数据块接收单元,还用于接收各个所述存储服务器响应所述校验数据块获取请求所反馈的校验数据块及其对应的数据块版本号;The data block receiving unit is further configured to receive a check data block that is fed back by each of the storage servers in response to the check data block acquisition request and a corresponding data block version number thereof;
    所述装置还包括:The device also includes:
    数据块生成单元,用于当各个所述校验数据块对应的数据块版本号相同时,通过EC算法对各个所述校验数据块进行处理,得到各个所述目标数据块;a data block generating unit, configured to process each of the check data blocks by an EC algorithm to obtain each of the target data blocks when the data block version numbers corresponding to the check data blocks are the same;
    所述数据块发送单元,还用于将各个所述目标数据块发送给所述客户端。The data block sending unit is further configured to send each of the target data blocks to the client.
  20. 如权利要求11~19任一项所述的装置,其特征在于,所述文件读 请求还携带文件句柄;Apparatus according to any one of claims 11 to 19, wherein said file is read The request also carries a file handle;
    所述请求发送单元向各个存储所述目标数据块的所述存储服务器发送所述数据块获取请求,具体用于:The request sending unit sends the data block obtaining request to each storage server that stores the target data block, specifically for:
    根据所述文件句柄在本地获取所述文件的文件属性,所述文件属性包括所述文件中各个数据块的存储路径;Obtaining, according to the file handle, a file attribute of the file locally, where the file attribute includes a storage path of each data block in the file;
    根据各个所述目标数据块的存储路径,确定各个存储所述目标数据块的存储服务器;Determining, according to a storage path of each of the target data blocks, a storage server that stores the target data block;
    向各个确定的存储服务器发送所述数据块获取请求。 The data block acquisition request is sent to each of the determined storage servers.
PCT/CN2016/105957 2015-11-19 2016-11-15 Distributed system-based file reading method and device WO2017084563A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510807517.6 2015-11-19
CN201510807517.6A CN105426483B (en) 2015-11-19 2015-11-19 A kind of file reading and device based on distributed system

Publications (1)

Publication Number Publication Date
WO2017084563A1 true WO2017084563A1 (en) 2017-05-26

Family

ID=55504695

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/105957 WO2017084563A1 (en) 2015-11-19 2016-11-15 Distributed system-based file reading method and device

Country Status (2)

Country Link
CN (1) CN105426483B (en)
WO (1) WO2017084563A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783866A (en) * 2021-01-29 2021-05-11 深圳追一科技有限公司 Data reading method and device, computer equipment and storage medium
CN114528258A (en) * 2022-02-18 2022-05-24 北京百度网讯科技有限公司 Asynchronous file processing method, device, server, medium, product and system

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105426483B (en) * 2015-11-19 2019-01-11 华为技术有限公司 A kind of file reading and device based on distributed system
CN106527993B (en) * 2016-11-09 2019-08-30 北京搜狐新媒体信息技术有限公司 Mass file storage method and device in a kind of distributed system
CN107025257B (en) * 2016-11-30 2020-04-28 阿里巴巴集团控股有限公司 Transaction processing method and device
CN108241548A (en) * 2016-12-23 2018-07-03 航天星图科技(北京)有限公司 A kind of file reading based on distributed system
CN109819005B (en) * 2017-11-22 2021-12-10 腾讯科技(深圳)有限公司 Information acquisition method and equipment, system, terminal and server thereof
CN110309100B (en) * 2018-03-22 2023-05-23 腾讯科技(深圳)有限公司 Snapshot object generation method and device
CN109542872B (en) * 2018-10-26 2021-01-22 金蝶软件(中国)有限公司 Data reading method and device, computer equipment and storage medium
CN109726036B (en) * 2018-11-21 2021-08-20 华为技术有限公司 Data reconstruction method and device in storage system
CN109558086B (en) * 2018-12-03 2019-10-18 浪潮电子信息产业股份有限公司 A kind of method for reading data, system and associated component
CN109634526B (en) * 2018-12-11 2022-04-22 浪潮(北京)电子信息产业有限公司 Data operation method based on object storage and related device
CN110442558B (en) * 2019-07-30 2023-12-29 深信服科技股份有限公司 Data processing method, slicing server, storage medium and device
CN112910936B (en) * 2019-11-19 2023-02-07 北京金山云网络技术有限公司 Data processing method, device and system, electronic equipment and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2330519A1 (en) * 2008-08-04 2011-06-08 ZTE Corporation Distributed file system and data block consistency managing method thereof
CN103207866A (en) * 2012-01-16 2013-07-17 中国科学院声学研究所 File storing method and system based on partitioning strategies
CN103562915A (en) * 2011-04-12 2014-02-05 阿玛得斯两合公司 Cache memory structure and method
CN103729352A (en) * 2012-10-10 2014-04-16 腾讯科技(深圳)有限公司 Distributed file system and method for processing multiple replica data in distributed file system
CN104272274A (en) * 2013-12-31 2015-01-07 华为技术有限公司 Data processing method and device in distributed file storage system
CN105426483A (en) * 2015-11-19 2016-03-23 华为技术有限公司 File reading method and device based on distributed system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7725655B2 (en) * 2006-02-16 2010-05-25 Hewlett-Packard Development Company, L.P. Method of operating distributed storage system in which data is read from replicated caches and stored as erasure-coded data
US9772787B2 (en) * 2014-03-31 2017-09-26 Amazon Technologies, Inc. File storage using variable stripe sizes
CN104932953B (en) * 2015-06-04 2017-11-21 华为技术有限公司 A kind of data distributing method, date storage method, relevant apparatus and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2330519A1 (en) * 2008-08-04 2011-06-08 ZTE Corporation Distributed file system and data block consistency managing method thereof
CN103562915A (en) * 2011-04-12 2014-02-05 阿玛得斯两合公司 Cache memory structure and method
CN103207866A (en) * 2012-01-16 2013-07-17 中国科学院声学研究所 File storing method and system based on partitioning strategies
CN103729352A (en) * 2012-10-10 2014-04-16 腾讯科技(深圳)有限公司 Distributed file system and method for processing multiple replica data in distributed file system
CN104272274A (en) * 2013-12-31 2015-01-07 华为技术有限公司 Data processing method and device in distributed file storage system
CN105426483A (en) * 2015-11-19 2016-03-23 华为技术有限公司 File reading method and device based on distributed system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783866A (en) * 2021-01-29 2021-05-11 深圳追一科技有限公司 Data reading method and device, computer equipment and storage medium
CN114528258A (en) * 2022-02-18 2022-05-24 北京百度网讯科技有限公司 Asynchronous file processing method, device, server, medium, product and system
CN114528258B (en) * 2022-02-18 2022-12-27 北京百度网讯科技有限公司 Asynchronous file processing method, device, server, medium, product and system

Also Published As

Publication number Publication date
CN105426483B (en) 2019-01-11
CN105426483A (en) 2016-03-23

Similar Documents

Publication Publication Date Title
WO2017084563A1 (en) Distributed system-based file reading method and device
US10976932B2 (en) Method for providing a client device access to a plurality of remote storage devices
US10761768B1 (en) Method to address misaligned holes and writes to end of files while performing quick reconcile operation during synchronous filesystem replication
US20090240880A1 (en) High availability and low capacity thin provisioning
WO2019127018A1 (en) Memory system access method and device
CN113485636B (en) Data access method, device and system
US20140122434A1 (en) Simplified copy offload
US10884926B2 (en) Method and system for distributed storage using client-side global persistent cache
US20140032861A1 (en) Systems and methods for efficiently storing data
WO2018040583A1 (en) Data storage method in data storage system and coordinating storage node
CN112615917B (en) Storage device management method in storage system and storage system
JP7378403B2 (en) Data processing methods, equipment, and computing devices
CN109302448B (en) Data processing method and device
US20130311514A1 (en) Information processing system and method for controlling the same
CN108540510B (en) Cloud host creation method and device and cloud service system
CN113360077B (en) Data storage method, computing node and storage system
US9176675B1 (en) Fast-zeroing in a file system
WO2019071595A1 (en) Method and device for storing data in distributed block storage system, and computer readable storage medium
WO2019127017A1 (en) Method and apparatus for managing storage device in storage system
US11068299B1 (en) Managing file system metadata using persistent cache
WO2016206070A1 (en) File updating method and storage device
WO2020037625A1 (en) Distributed storage system and data read-write method therefor, and storage terminal and storage medium
KR20220077208A (en) Storage device with data deduplication, operation method of storage device, and operation method of storage server
WO2018076954A1 (en) Data storage method, apparatus and system
US20150026126A1 (en) Method of replicating data in asymmetric file system

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: 16865740

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16865740

Country of ref document: EP

Kind code of ref document: A1