Phat

From CS 260r 2014
Jump to: navigation, search

Client API

  • getroot() -> handle
  • open(handle, subpath) -> handle
  • mkfile(handle, subpath, initialdata) -> handle
  • mkdir(handle, subpath) -> handle
  • getcontents(handle) -> data
  • putcontents(handle, data)
  • readdir(handle) -> path*
  • stat(handle) -> metadata
  • flock(handle, locktype) -> sequencer
  • funlock(handle) -> sequencer
  • remove(handle) (or delete): delete the file (or empty directory) defined by the handle

Omitted or unnecessary features

  • Disk recovery
  • Multiple cells (we assume clients are booted with the address of at least one valid Chubby server)
  • Access control
  • Multithread safety (in initial version)

Included features

  • View changes and master failover
  • Recovery via state transfer
  • Client caching

Implementation choices

  • Sessions and keepalives?
  • Consistent client caching?
  • close() and poison()? (E.g., should flock(handle, locktype) return a new handle?)

Proposed Test Documents

In an effort to standardize our tests, we should have a common way to compare implementations for correctness and speed. The test document should be unambiguous, easy to parse by a program, and be able to test both correctness and performance.

Example Test

This test will start 100 Phat nodes, cycle through the primary node and perform 15 concurrent file creations to the Phat nodes, 10 times:

   startnodes 100
   starttimer total
   repeat 100
       stopnode primary
       repeat 10
           do createfile 15
       endrepeat
       revivenode
   endrepeat
   stoptimer total

Commands

Operation Arguments Description
startnodes [number] Starts [number] new Phat nodes and they all are aware of each other in the group. Instruction blocks until all nodes have started.
starttimer [name] Starts a timer named [name].
stoptimer [name] Stops a timer named [name] and prints the total duration the timer was running.
repeat [number] Repeats the commands following it in order until its matching endrepeat instruction is encountered, [number] times.
endrepeat none Returns to its matching repeat instruction. See repeat.
stopnode [primary,backup,any] Stops a random node that matches the node's type (i.e. primary, backup, or any node).
revivenode none Brings a node that was stopped back to running. Instruction does not block.
do [taskname] [num_clients] Initiates task [taskname] to the nodes, running concurrently [num_clients] times. See Tasks table below. Instruction blocks until all tasks have completed.
wait [ms] Blocks for [ms] milliseconds

Tasks

Task Name Description
createfile Each client creates a uniquely named file in the root with unique contents then fetches its contents and asserts they match.