org.apache.cassandra.db
Class SystemTable

java.lang.Object
  extended by org.apache.cassandra.db.SystemTable

public class SystemTable
extends java.lang.Object


Field Summary
static java.lang.String INDEX_CF
           
static java.lang.String NODE_ID_CF
           
static java.lang.String STATUS_CF
           
 
Constructor Summary
SystemTable()
           
 
Method Summary
static void checkHealth()
          One of three things will happen if you try to read the system table: 1.
static NodeId getCurrentLocalNodeId()
          Read the current local node id from the system table or null if no such node id is recorded.
static java.util.List<NodeId.NodeIdRecord> getOldLocalNodeIds()
           
static Token getSavedToken()
           
static int incrementAndGetGeneration()
           
static boolean isBootstrapped()
           
static boolean isIndexBuilt(java.lang.String table, java.lang.String indexName)
           
static java.util.HashMap<Token,java.net.InetAddress> loadTokens()
          Return a map of stored tokens to IP addresses
static void purgeIncompatibleHints()
           
static void removeToken(Token token)
          Remove stored token being used by another node
static void setBootstrapped(boolean isBootstrapped)
           
static void setIndexBuilt(java.lang.String table, java.lang.String indexName)
           
static void setIndexRemoved(java.lang.String table, java.lang.String indexName)
           
static void updateToken(java.net.InetAddress ep, Token token)
          Record token being used by another node
static void updateToken(Token token)
          This method is used to update the System Table with the new token for this node
static void writeCurrentLocalNodeId(NodeId oldNodeId, NodeId newNodeId, long now)
          Write a new current local node id to the system table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_CF

public static final java.lang.String STATUS_CF
See Also:
Constant Field Values

INDEX_CF

public static final java.lang.String INDEX_CF
See Also:
Constant Field Values

NODE_ID_CF

public static final java.lang.String NODE_ID_CF
See Also:
Constant Field Values
Constructor Detail

SystemTable

public SystemTable()
Method Detail

purgeIncompatibleHints

public static void purgeIncompatibleHints()
                                   throws java.io.IOException
Throws:
java.io.IOException

updateToken

public static void updateToken(java.net.InetAddress ep,
                               Token token)
Record token being used by another node


removeToken

public static void removeToken(Token token)
Remove stored token being used by another node


updateToken

public static void updateToken(Token token)
This method is used to update the System Table with the new token for this node


loadTokens

public static java.util.HashMap<Token,java.net.InetAddress> loadTokens()
Return a map of stored tokens to IP addresses


checkHealth

public static void checkHealth()
                        throws ConfigurationException,
                               java.io.IOException
One of three things will happen if you try to read the system table: 1. files are present and you can read them: great 2. no files are there: great (new node is assumed) 3. files are present but you can't read them: bad (suspect that the partitioner was changed).

Throws:
ConfigurationException
java.io.IOException

getSavedToken

public static Token getSavedToken()

incrementAndGetGeneration

public static int incrementAndGetGeneration()
                                     throws java.io.IOException
Throws:
java.io.IOException

isBootstrapped

public static boolean isBootstrapped()

setBootstrapped

public static void setBootstrapped(boolean isBootstrapped)

isIndexBuilt

public static boolean isIndexBuilt(java.lang.String table,
                                   java.lang.String indexName)

setIndexBuilt

public static void setIndexBuilt(java.lang.String table,
                                 java.lang.String indexName)

setIndexRemoved

public static void setIndexRemoved(java.lang.String table,
                                   java.lang.String indexName)

getCurrentLocalNodeId

public static NodeId getCurrentLocalNodeId()
Read the current local node id from the system table or null if no such node id is recorded.


writeCurrentLocalNodeId

public static void writeCurrentLocalNodeId(NodeId oldNodeId,
                                           NodeId newNodeId,
                                           long now)
Write a new current local node id to the system table.

Parameters:
oldNodeId - the previous local node id (that newNodeId replace) or null if no such node id exists (new node or removed system table)
newNodeId - the new current local node id to record

getOldLocalNodeIds

public static java.util.List<NodeId.NodeIdRecord> getOldLocalNodeIds()


Copyright © 2011 The Apache Software Foundation