Due: 11-1-2021 23:59 (UTC+8)
Please back up your lab1 solution before progressing the steps below:
In the first place, please remember to save your lab1 solution:
% cd cse-lab% git commit -a -m “solution for lab1”
Then, pull from the repository:
xxxxxxxxxx% git pullremote: Counting objects: 43, done.…[new branch] lab2 -> origin/lab2Already up-to-date
Then, switch to the lab2 branch:
xxxxxxxxxx% git checkout lab2
Merge with lab1, and solve conflicts on your own (mainly in fuse.cc and chfs_client.cc):
xxxxxxxxxx% git merge lab1Auto-merging fuse.ccCONFLICT (content): Merge conflict in chfs_client.ccAuto-merging chfs_client.ccCONFLICT (content): Merge conflict in ifs_client.ccAutomatic merge failed; fix conflicts and then commit the result......
After merging all conflicts, you should be able to compile the new project successfully:
xxxxxxxxxx% chmod -R o+w `pwd`% sudo docker run -it --rm --privileged --cap-add=ALL -v `pwd`:/home/stu/cse-lab shenjiahuan/cselab_env:1.0 /bin/bash% cd cse-lab% make
Please make sure there is no error during make.
In lab1, you have implemented a file system named ChFS on a single machine. In lab2, your objective is to extend it to a distributed file server with RPC.
Luckily, most of your jobs have been done in lab1. You now can use extent service provided by extent_server through RPC in extent_client.
You'd better test your code with the previous test suit before any progress.
rpcs listening on a port and registering various RPC handlers (see main() function in demo_server.cc).rpcc, asks for it to be connected to the demo_server's address and port, and invokes RPC calls (see demo_client.cc).stat call implementation. Note that it's for the illustration purpose only, you won't need to follow the implementation.make rpcdemo to build the RPC demo.rpc.h under rpc_const.std::string, int, and char. You should be able to complete this lab with existing marshall/unmarshall methods.std::string(char*) constructor treats '\0' as the end of the string, so if you use that constructor to hold file content or the written data, you will have trouble with this lab. Use the std::string(buf, size) constructor instead. Also, if you use C-style char[] carelessly you may run into trouble :(To grade this part of lab, a test script grade.sh is provided. Here's a successful grading.
xxxxxxxxxx% ./grade.shPassed APassed BPassed CPassed DPassed EPassed G (Consistency)Lab2 part 1 passed......
Notice that a non-RPC version may also pass the tests, but RPCs will be checked against in actual grading. So please refrain yourself from doing so :D
(Reference: MIT 6.824 Distributed Systems)
In this lab, you are asked to build a MapReduce framework.
You will implement a worker process that calls Map and Reduce functions and handles reading and writing files, and a coordinator process that hands out tasks to workers and copes with failed workers.
You can refer to the MapReduce paper for more details (Note that this lab uses "coordinator" instead of the paper's "master").
There are four files added for this part: mr_protocol.h, mr_sequential.cc, mr_coordinator.cc, mr_worker.cc.
mr_sequential.cc is a sequential mapreduce implementation, running Map and Reduce once at a time within a single process.mr_sequential.cc.mr_coordinator.cc and mr_worker.cc. There will be only one coordinator process, but one or more worker processes executing concurrently.RPC. One way to get started is to think about the RPC protocol in mr_protocol.h first.mr_protocol.h.Done() loop returns true indicating that all tasks are completely finished.After you have implement part1 & part2, run the grading script:
x% ./grade.shPassed part1 APassed part1 BPassed part1 CPassed part1 DPassed part1 EPassed part1 G (Consistency)Lab2 part 1 passedPassed part2 A (Word Count)Passed part2 B (Word Count with distributed MapReduce)Lab2 part 2 passedPassed all tests!Score: 100/100
We will test your MapReduce following the evaluation criteria above.
After all above done:
xxxxxxxxxx% make handin
That should produce a file called lab2.tgz in the directory. Change the file name to your student id:
xxxxxxxxxx% mv lab2.tgz lab2_[your student id].tgz
Then upload lab2_[your student id].tgz file to Canvas before the deadline.
You'll receive full credits if your code passes the same tests that we gave you, when we run your code on our machines.