edu.yale.cs.hadoopdb.catalog
Class SimpleRandomReplicationFactorTwo
java.lang.Object
edu.yale.cs.hadoopdb.catalog.SimpleCatalogGenerator
edu.yale.cs.hadoopdb.catalog.SimpleRandomReplicationFactorTwo
public class SimpleRandomReplicationFactorTwo
- extends SimpleCatalogGenerator
This class randomly replicates chunked and unchunked databases across a cluster.
Since ensuring random replication is equivalent to a perfect matching problem, we don't
implement a nice algorithm that guarantees you always get a perfect random matching.
This algorithm is greedy. It will stall infinitely if it can't find a replicate. At that
point, you might get lucky in another try.
The class will generate shell scripts for POSTGRES databases only. Copying the
scripts to the appropriate nodes and executing them in parallel is not handled by
this code. Instead use the example python scripts to move scripts and execute scripts in parallel.
Fields inherited from class edu.yale.cs.hadoopdb.catalog.SimpleCatalogGenerator |
CATALOG_FILE, CHUNKED_DB_PREFIX, CHUNKS_PER_NODE, DRIVER, nodes, NODES_FILE, PASSWORD, PORT, properties, relations_chunked, RELATIONS_CHUNKED, relations_unchunked, RELATIONS_UNCHUNKED, UNCHUNKED_DB_PREFIX, URL_PREFIX, USERNAME |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buckets
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> buckets
chunks_per_node
private int chunks_per_node
dump
private boolean dump
DUMP_FILE_C_PREFIX
private static final java.lang.String DUMP_FILE_C_PREFIX
- See Also:
- Constant Field Values
DUMP_FILE_U_PREFIX
private static final java.lang.String DUMP_FILE_U_PREFIX
- See Also:
- Constant Field Values
DUMP_SCRIPT_PREFIX
private static final java.lang.String DUMP_SCRIPT_PREFIX
- See Also:
- Constant Field Values
gen
private java.util.Random gen
REPLICATION_SCRIPT_PREFIX
private static final java.lang.String REPLICATION_SCRIPT_PREFIX
- See Also:
- Constant Field Values
SSH_KEY
private static final java.lang.String SSH_KEY
- See Also:
- Constant Field Values
SimpleRandomReplicationFactorTwo
public SimpleRandomReplicationFactorTwo()
generateBuckets
private void generateBuckets()
generatePostgresDumpScrips
private void generatePostgresDumpScrips()
throws java.io.IOException
- Throws:
java.io.IOException
getNumber
private int getNumber(int avoid_bucket,
boolean last_node)
main
public static void main(java.lang.String[] args)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
parseArguments
protected void parseArguments(java.lang.String[] args)
throws java.io.FileNotFoundException,
java.io.IOException
- Overrides:
parseArguments
in class SimpleCatalogGenerator
- Throws:
java.io.FileNotFoundException
java.io.IOException
replicate
public void replicate()
throws javax.xml.bind.JAXBException,
javax.xml.bind.PropertyException,
java.io.FileNotFoundException,
java.io.IOException
- Throws:
javax.xml.bind.JAXBException
javax.xml.bind.PropertyException
java.io.FileNotFoundException
java.io.IOException