...
/Workflow of Write Operations in GFS
Workflow of Write Operations in GFS
Learn how GFS performs write operations.
We’ve discussed how GFS carries out file operations, and we have seen the two of them (create and read files) in the previous lesson. In this lesson, we will look into what kind of write operations GFS supports and the workflow of these operations.
Writing data to the file
Data can be written at a random position in the file or appended to the file in case of sequential writes. GFS offers two operations–a random write and an append operation. In a random write operation, the client provides the offset at which the data should be written. In an append operation, the data is written at the end of the file at the GFS chosen offset.
For write operations, the GFS client needs to know which chunk they will be writing the data to. We’ve already seen that the manager keeps three replicas for each chunk by default. Among these three replicas, the manager gives one the
All write operations from the clients are carried out by the replica that has the current lease, called the primary replica. The primary replica then forwards the request to secondary replicas and replies to the client once the request has been processed. Since it is the manager who decides which replica will take the lease, therefore, replicas don't need any election algorithms to choose a primary between them.
Note: Leases are a fault-tolerance mechanism that enable the manager to provide good availability under different kinds of failures. Lease value should not ...