RDFS
The Rice Comp413 2017 class' continuation on the work of the 2016 RDFS.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | List of all members
StorageMetrics Class Reference

Public Member Functions

 StorageMetrics (std::shared_ptr< ZKWrapper > zkWrapper_)
 
float usedSpaceFraction ()
 
float usedSpace ()
 
float blocksPerDataNodeSD ()
 
int replicationRecoverySpeed ()
 
float degenerateRead (std::string file, std::string destination, std::vector< std::pair< std::string, std::string >> targetDatanodes)
 

Static Public Member Functions

static void watcher_replicate (zhandle_t *zzh, int type, int state, const char *path, void *watcherCtx)
 

Constructor & Destructor Documentation

StorageMetrics::StorageMetrics ( std::shared_ptr< ZKWrapper zkWrapper_)
explicit

Constructor

Parameters
numDatanodes_the number of datanodes, known by the caller test. This can be changed to be variable size later if needed.
zkWrapper_the zkWrapper

Member Function Documentation

float StorageMetrics::blocksPerDataNodeSD ( )

Counts number of used blocks on each datanode, and takes the standard deviation of that distribution.

Returns
The standard deviation of the blocks per datanode
float StorageMetrics::degenerateRead ( std::string  file,
std::string  destination,
std::vector< std::pair< std::string, std::string >>  targetDatanodes 
)

Measures how long a read takes while a data block is being recovered.

Prints the resulting time.

Note that files under replication have no degenerate read. The degenerate case is the file being unreadable. Files under EC must have a downed data block (not parity block) for the degenerate read case. Keep that in mind when passing in target DataNodes

Logging level must be set to 9 before calling this function.

Parameters
fileThe file path to read.
destinationThe file name for writing cat output
targetDatanodesfirst: unix process name of a datanode to kill second: cliArgs for restarting that datanode.
Returns
0 on success, 1 on error
int StorageMetrics::replicationRecoverySpeed ( )

Measures the time for recovering from a DataNode failure.

This method polls the zookeeper work_queues/replication until there are none left. This should only be called from tests with a controlled number of replications.

Prints wall clock time spent in this function using easylogging++

Logging level must be set to 9 before calling this function.

Returns
0 success, -1 error
float StorageMetrics::usedSpace ( )

Returns the total space used.

Returns
totalUsedSpace
float StorageMetrics::usedSpaceFraction ( )

Returns the proportion of space used.

Returns
totalUsedSpace / totalSpace
void StorageMetrics::watcher_replicate ( zhandle_t *  zzh,
int  type,
int  state,
const char *  path,
void *  watcherCtx 
)
static

watcher function to set on /work_queues/replicate.

Parameters
zzhunused
typeunused
stateunused
pathPath to the znode to watch.
watcherCtx"this"

The documentation for this class was generated from the following files: