org.apache.blur.thrift
Class BlurControllerServer

java.lang.Object
  extended by org.apache.blur.thrift.TableAdmin
      extended by org.apache.blur.thrift.BlurControllerServer
All Implemented Interfaces:
Blur.Iface

public class BlurControllerServer
extends TableAdmin
implements Blur.Iface


Nested Class Summary
static class BlurControllerServer.BlurClient
           
static class BlurControllerServer.BlurClientRemote
           
 
Constructor Summary
BlurControllerServer()
           
 
Method Summary
 void cancelQuery(String table, String uuid)
          Cancels a query that is executing against the given table with the given uuid.
 void close()
           
 BlurResults convertToBlurResults(BlurResultIterable hitsIterable, BlurQuery query, java.util.concurrent.atomic.AtomicLongArray facetCounts, java.util.concurrent.ExecutorService executor, Selector selector, String table)
           
 void createSnapshot(String table, String name)
          Creates a snapshot for the table with the given name
 void enqueueMutate(RowMutation mutation)
          Enqueue a RowMutation.
 void enqueueMutateBatch(List<RowMutation> mutations)
          Enqueue a batch of RowMutations.
 FetchResult fetchRow(String table, Selector selector)
          Fetches a Row or a Record in the given table with the given Selector.
 List<FetchResult> fetchRowBatch(String table, List<Selector> selectors)
          Fetches a batch of Rows or Records in the given table with the given Selector list.
 BlurControllerServer.BlurClient getClient()
           
 int getRemoteFetchCount()
           
 void init()
           
 Map<String,List<String>> listSnapshots(String table)
          Returns a map where the key is the shard, and the list is the snapshots within that shard
static Schema merge(Schema result, Schema schema)
           
 void mutate(RowMutation mutation)
          Mutates a Row given the RowMutation that is provided.
 void mutateBatch(List<RowMutation> mutations)
          Mutates a group of Rows given the list of RowMutations that are provided.
 void optimize(String table, int numberOfSegmentsPerShard)
          Will perform a forced optimize on the index in the given table.
 String parseQuery(String table, Query simpleQuery)
          Parses the given query and returns the string that represents the query.
 BlurResults query(String table, BlurQuery blurQuery)
          Executes a query against a the given table and returns the results.
 BlurQueryStatus queryStatusById(String table, String uuid)
          Returns the query status for the given table and query uuid.
 List<String> queryStatusIdList(String table)
          Returns a list of the query ids of queries that have recently been executed for the given table.
 long recordFrequency(String table, String columnFamily, String columnName, String value)
          Gets the record frequency for the provided table, family, column and value.
 void removeSnapshot(String table, String name)
          Removes a previous snapshot(identified by name) of the table
 void setClient(BlurControllerServer.BlurClient client)
           
 void setDefaultDelay(long defaultDelay)
           
 void setFetchDelay(long fetchDelay)
           
 void setMaxDefaultDelay(long maxDefaultDelay)
           
 void setMaxDefaultRetries(int maxDefaultRetries)
           
 void setMaxFetchDelay(long maxFetchDelay)
           
 void setMaxFetchRetries(int maxFetchRetries)
           
 void setMaxMutateDelay(long maxMutateDelay)
           
 void setMaxMutateRetries(int maxMutateRetries)
           
 void setMutateDelay(long mutateDelay)
           
 void setNodeName(String nodeName)
           
 void setQueryChecker(BlurQueryChecker queryChecker)
           
 void setRemoteFetchCount(int remoteFetchCount)
           
 void setThreadCount(int threadCount)
           
 void setUser(User user)
          Sets the User for the current session.
 Map<String,String> shardServerLayout(String table)
          Returns a map of the layout of the given table, where the key is the shard name and the value is the shard server.

This method will return the "correct" layout for the given shard, or the "correct" layout of cluster if called on a controller.

The meaning of correct:
Given the current state of the shard cluster with failures taken into account, the correct layout is what the layout should be given the current state.
 Map<String,Map<String,ShardState>> shardServerLayoutState(String table)
          Returns a map of the layout of the given table, where the key is the shard name and the value is the shard server.

This method will return immediately with what shards are currently open in the shard server.
 void startTrace(String rootId, String requestId)
          Starts a trace with the given trace id.
 TableStats tableStats(String table)
          Gets the table stats for the given table.
 List<String> terms(String table, String columnFamily, String columnName, String startWith, short size)
          Gets the terms list from the index for the given table, family, column using the startWith value to page through the results.
 
Methods inherited from class org.apache.blur.thrift.TableAdmin
addColumnDefinition, checkForUpdates, checkForUpdates, checkTable, checkTable, configuration, controllerServerList, createTable, describe, disableTable, enableTable, getClusterStatus, getMaxRecordsPerRowFetchRequest, isInSafeMode, isTableEnabled, logging, metrics, ping, removeTable, resetLogging, schema, setClusterStatus, setConfiguration, setMaxRecordsPerRowFetchRequest, setZookeeper, shardClusterList, shardServerList, tableExists, tableList, tableListByCluster, traceList, traceRemove, traceRequestFetch, traceRequestList
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.blur.thrift.generated.Blur.Iface
addColumnDefinition, configuration, controllerServerList, createTable, describe, disableTable, enableTable, isInSafeMode, logging, metrics, ping, removeTable, resetLogging, schema, shardClusterList, shardServerList, tableList, tableListByCluster, traceList, traceRemove, traceRequestFetch, traceRequestList
 

Constructor Detail

BlurControllerServer

public BlurControllerServer()
Method Detail

init

public void init()
          throws org.apache.zookeeper.KeeperException,
                 InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

close

public void close()

query

public BlurResults query(String table,
                         BlurQuery blurQuery)
                  throws BlurException,
                         TException
Description copied from interface: Blur.Iface
Executes a query against a the given table and returns the results. If this method is executed against a controller the results will contain the aggregated results from all the shards. If this method is executed against a shard server the results will only contain aggregated results from the shards of the given table that are being served on the shard server, if any.

Specified by:
query in interface Blur.Iface
Parameters:
table - the table name.
blurQuery - the query to execute.
Returns:
the BlurResults.
Throws:
BlurException
TException

convertToBlurResults

public BlurResults convertToBlurResults(BlurResultIterable hitsIterable,
                                        BlurQuery query,
                                        java.util.concurrent.atomic.AtomicLongArray facetCounts,
                                        java.util.concurrent.ExecutorService executor,
                                        Selector selector,
                                        String table)
                                 throws InterruptedException,
                                        java.util.concurrent.ExecutionException,
                                        BlurException
Throws:
InterruptedException
java.util.concurrent.ExecutionException
BlurException

fetchRow

public FetchResult fetchRow(String table,
                            Selector selector)
                     throws BlurException,
                            TException
Description copied from interface: Blur.Iface
Fetches a Row or a Record in the given table with the given Selector.

Specified by:
fetchRow in interface Blur.Iface
Parameters:
table - the table name.
selector - the Selector to use to fetch the Row or Record.
Returns:
the FetchResult.
Throws:
BlurException
TException

fetchRowBatch

public List<FetchResult> fetchRowBatch(String table,
                                       List<Selector> selectors)
                                throws BlurException,
                                       TException
Description copied from interface: Blur.Iface
Fetches a batch of Rows or Records in the given table with the given Selector list.

Specified by:
fetchRowBatch in interface Blur.Iface
Parameters:
table - the table name.
selectors - the Selector to use to fetch the Row or Record.
Returns:
the FetchResult.
Throws:
BlurException
TException

cancelQuery

public void cancelQuery(String table,
                        String uuid)
                 throws BlurException,
                        TException
Description copied from interface: Blur.Iface
Cancels a query that is executing against the given table with the given uuid. Note, the cancel call maybe take some time for the query actually stops executing.

Specified by:
cancelQuery in interface Blur.Iface
Parameters:
table - the table name.
uuid - the uuid of the query.
Throws:
BlurException
TException

queryStatusIdList

public List<String> queryStatusIdList(String table)
                               throws BlurException,
                                      TException
Description copied from interface: Blur.Iface
Returns a list of the query ids of queries that have recently been executed for the given table.

Specified by:
queryStatusIdList in interface Blur.Iface
Parameters:
table - the table name.
Returns:
list of all the uuids of the queries uuids.
Throws:
BlurException
TException

queryStatusById

public BlurQueryStatus queryStatusById(String table,
                                       String uuid)
                                throws BlurException,
                                       TException
Description copied from interface: Blur.Iface
Returns the query status for the given table and query uuid.

Specified by:
queryStatusById in interface Blur.Iface
Parameters:
table - the table name.
uuid - the uuid of the query.
Returns:
fetches the BlurQueryStatus for the given table and uuid.
Throws:
BlurException
TException

tableStats

public TableStats tableStats(String table)
                      throws BlurException,
                             TException
Description copied from interface: Blur.Iface
Gets the table stats for the given table.

Specified by:
tableStats in interface Blur.Iface
Parameters:
table - the table name.
Returns:
TableStats.
Throws:
BlurException
TException

shardServerLayout

public Map<String,String> shardServerLayout(String table)
                                     throws BlurException,
                                            TException
Description copied from interface: Blur.Iface
Returns a map of the layout of the given table, where the key is the shard name and the value is the shard server.

This method will return the "correct" layout for the given shard, or the "correct" layout of cluster if called on a controller.

The meaning of correct:
Given the current state of the shard cluster with failures taken into account, the correct layout is what the layout should be given the current state. In other words, what the shard server should be serving. The act of calling the shard server layout method with the NORMAL option will block until the layout shard server matches the correct layout. Meaning it will block until indexes that should be open are open and ready for queries. However indexes are lazily closed, so if a table is being disabled then the call will return immediately with an empty map, but the indexes may not be close yet.

Specified by:
shardServerLayout in interface Blur.Iface
Parameters:
table - the table name.
Returns:
map of shards in a table to the shard servers.
Throws:
BlurException
TException

shardServerLayoutState

public Map<String,Map<String,ShardState>> shardServerLayoutState(String table)
                                                          throws BlurException,
                                                                 TException
Description copied from interface: Blur.Iface
Returns a map of the layout of the given table, where the key is the shard name and the value is the shard server.

This method will return immediately with what shards are currently open in the shard server. So if a shard is being moved to another server and is being closed by this server it WILL be returned in the map. The shardServerLayout method would not return the shard given the same situation.

Specified by:
shardServerLayoutState in interface Blur.Iface
Parameters:
table - the table name.
Returns:
map of shards to a map of shard servers with the state of the shard.
Throws:
BlurException
TException

recordFrequency

public long recordFrequency(String table,
                            String columnFamily,
                            String columnName,
                            String value)
                     throws BlurException,
                            TException
Description copied from interface: Blur.Iface
Gets the record frequency for the provided table, family, column and value.

Specified by:
recordFrequency in interface Blur.Iface
Parameters:
table - the table name.
columnFamily - the column family. If the frequency requested is a system field like "rowid", "recordid", "family", etc then columnFamily can be null.
columnName - the column name.
value - the value.
Returns:
the count for the entire table.
Throws:
BlurException
TException

terms

public List<String> terms(String table,
                          String columnFamily,
                          String columnName,
                          String startWith,
                          short size)
                   throws BlurException,
                          TException
Description copied from interface: Blur.Iface
Gets the terms list from the index for the given table, family, column using the startWith value to page through the results. This method only makes sense to use with string and text field types.

Specified by:
terms in interface Blur.Iface
Parameters:
table - the table name.
columnFamily - the column family. If the frequency requested is a system field like "rowid", "recordid", "family", etc then columnFamily can be null.
columnName - the column name.
startWith - the term to start with assuming that you are paging through the term list.
size - the number to fetch at once.
Returns:
the list of terms for the given column.
Throws:
BlurException
TException

merge

public static Schema merge(Schema result,
                           Schema schema)

mutate

public void mutate(RowMutation mutation)
            throws BlurException,
                   TException
Description copied from interface: Blur.Iface
Mutates a Row given the RowMutation that is provided.

Specified by:
mutate in interface Blur.Iface
Parameters:
mutation - the RowMutation.
Throws:
BlurException
TException

enqueueMutate

public void enqueueMutate(RowMutation mutation)
                   throws BlurException,
                          TException
Description copied from interface: Blur.Iface
Enqueue a RowMutation. Note that the effect of the RowMutation will occur at some point in the future, volume and load will play a role in how much time will pass before the mutation goes into effect.

Specified by:
enqueueMutate in interface Blur.Iface
Parameters:
mutation - the RowMutation.
Throws:
BlurException
TException

mutateBatch

public void mutateBatch(List<RowMutation> mutations)
                 throws BlurException,
                        TException
Description copied from interface: Blur.Iface
Mutates a group of Rows given the list of RowMutations that are provided. Note: This is not an atomic operation.

Specified by:
mutateBatch in interface Blur.Iface
Parameters:
mutations - the batch of RowMutations.
Throws:
BlurException
TException

enqueueMutateBatch

public void enqueueMutateBatch(List<RowMutation> mutations)
                        throws BlurException,
                               TException
Description copied from interface: Blur.Iface
Enqueue a batch of RowMutations. Note that the effect of the RowMutation will occur at some point in the future, volume and load will play a role in how much time will pass before the mutation goes into effect.

Specified by:
enqueueMutateBatch in interface Blur.Iface
Parameters:
mutations - the batch of RowMutations.
Throws:
BlurException
TException

createSnapshot

public void createSnapshot(String table,
                           String name)
                    throws BlurException,
                           TException
Description copied from interface: Blur.Iface
Creates a snapshot for the table with the given name

Specified by:
createSnapshot in interface Blur.Iface
Throws:
BlurException
TException

removeSnapshot

public void removeSnapshot(String table,
                           String name)
                    throws BlurException,
                           TException
Description copied from interface: Blur.Iface
Removes a previous snapshot(identified by name) of the table

Specified by:
removeSnapshot in interface Blur.Iface
Throws:
BlurException
TException

listSnapshots

public Map<String,List<String>> listSnapshots(String table)
                                       throws BlurException,
                                              TException
Description copied from interface: Blur.Iface
Returns a map where the key is the shard, and the list is the snapshots within that shard

Specified by:
listSnapshots in interface Blur.Iface
Throws:
BlurException
TException

setNodeName

public void setNodeName(String nodeName)

getRemoteFetchCount

public int getRemoteFetchCount()

setRemoteFetchCount

public void setRemoteFetchCount(int remoteFetchCount)

setQueryChecker

public void setQueryChecker(BlurQueryChecker queryChecker)

setThreadCount

public void setThreadCount(int threadCount)

setMaxFetchRetries

public void setMaxFetchRetries(int maxFetchRetries)

setMaxMutateRetries

public void setMaxMutateRetries(int maxMutateRetries)

setMaxDefaultRetries

public void setMaxDefaultRetries(int maxDefaultRetries)

setFetchDelay

public void setFetchDelay(long fetchDelay)

setMutateDelay

public void setMutateDelay(long mutateDelay)

setDefaultDelay

public void setDefaultDelay(long defaultDelay)

setMaxFetchDelay

public void setMaxFetchDelay(long maxFetchDelay)

setMaxMutateDelay

public void setMaxMutateDelay(long maxMutateDelay)

setMaxDefaultDelay

public void setMaxDefaultDelay(long maxDefaultDelay)

getClient

public BlurControllerServer.BlurClient getClient()

setClient

public void setClient(BlurControllerServer.BlurClient client)

optimize

public void optimize(String table,
                     int numberOfSegmentsPerShard)
              throws BlurException,
                     TException
Description copied from interface: Blur.Iface
Will perform a forced optimize on the index in the given table.

Specified by:
optimize in interface Blur.Iface
Parameters:
table - table the name of the table.
numberOfSegmentsPerShard - the maximum of segments per shard index after the operation is completed.
Throws:
BlurException
TException

parseQuery

public String parseQuery(String table,
                         Query simpleQuery)
                  throws BlurException,
                         TException
Description copied from interface: Blur.Iface
Parses the given query and returns the string that represents the query.

Specified by:
parseQuery in interface Blur.Iface
Parameters:
table - the table name.
simpleQuery - the query to parse.
Returns:
string representation of the parsed query.
Throws:
BlurException
TException

setUser

public void setUser(User user)
             throws TException
Description copied from interface: Blur.Iface
Sets the User for the current session.

Specified by:
setUser in interface Blur.Iface
Parameters:
user - the User object.
Throws:
TException

startTrace

public void startTrace(String rootId,
                       String requestId)
                throws TException
Description copied from interface: Blur.Iface
Starts a trace with the given trace id.

Specified by:
startTrace in interface Blur.Iface
Parameters:
rootId - the trace id.
requestId - the request id, used to connected remote calls together. Client can pass null.
Throws:
TException


Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.