com.bigdata.resources
Class ResourceEvents

java.lang.Object
  extended by com.bigdata.resources.ResourceEvents
Direct Known Subclasses:
StoreManager

public class ResourceEvents
extends Object

Class encapsulates reporting API for resource (index and store files) events.

Resource consumption events include

  1. mutable unisolated indices open on the journal
  2. mutable isolated indices open in writable transactions
  3. historical read-only indices open on old journals
  4. historical read-only index segments
The latter two classes of event sources exist iff Journal.overflow() is handled by creating a new Journal and evicting data from the old Journal asynchronously onto read-optimized IndexSegments.

Other resource consumption events deal directly with transactions

  1. open a transaction
  2. close a transaction
  3. a heartbeat for each write operation on a transaction is used to update the resource consumption of the store

Latency events include

  1. request latency, that is, the time that a request waits on a queue before being serviced
  2. transactions per second
FIXME Revisit and refactor - this is incomplete as it stands. This is event focused, which is fine. We also have the CounterSets which allow us to report statistics regarding classes of events.

Version:
$Id: ResourceEvents.java 3408 2010-08-04 18:53:35Z thompsonbry $
Author:
Bryan Thompson
TODO:
use MDC to put metadata into the logging context {thread, host, dataService, global index name, local index name (includes the index partition), etc}.

Field Summary
protected static org.apache.log4j.Logger log
          Logger.
 
Constructor Summary
ResourceEvents()
           
 
Method Summary
static void closeJournal(String filename)
          Report close of an IJournal resource.
static void closeTx(long tx, long revisionTime, boolean aborted)
          Report completion of a transaction.
static void closeUnisolatedBTree(String name)
          Report closing of a mutable unisolated named index on an IJournal.
static void deleteJournal(String filename)
          Report deletion of an IJournal resource.
static void dropUnisolatedBTree(String name)
          Report drop of a named unisolated index.
static void extendJournal(String filename, long nbytes)
          Report the extension of an IJournal.
static void isolateIndex(long startTime, String name)
          Report the isolation of a named index by a transaction.
static void openJournal(String filename, long nbytes, BufferMode bufferMode)
          Report the opening of an IJournal resource.
static void openTx(long startTime)
          Report the start of a new transaction.
static void openUnisolatedBTree(String name)
          Report opening of a mutable unisolated named index on an IJournal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Logger.

TODO:
change the logger configuration to write on a JMS queue or JINI discovered service in order to aggregate results from multiple hosts in a scale-out solution.
Constructor Detail

ResourceEvents

public ResourceEvents()
Method Detail

openUnisolatedBTree

public static void openUnisolatedBTree(String name)
Report opening of a mutable unisolated named index on an IJournal.

Parameters:
name - The index name.

closeUnisolatedBTree

public static void closeUnisolatedBTree(String name)
Report closing of a mutable unisolated named index on an IJournal.

Parameters:
name - The index name.
TODO:
never invoked since we do not explicitly close out indices and are not really able to differentiate the nature of the index when it is finalized (unisolated vs isolated vs index segment can be identified based on their interfaces)., add reporting for AbstractBTree.reopen().

dropUnisolatedBTree

public static void dropUnisolatedBTree(String name)
Report drop of a named unisolated index.

Parameters:
name - The index name.

openTx

public static void openTx(long startTime)
Report the start of a new transaction.

Parameters:
startTime - Both the transaction identifier and its global start time.
level - The isolation level of the transaction.

closeTx

public static void closeTx(long tx,
                           long revisionTime,
                           boolean aborted)
Report completion of a transaction.

Parameters:
tx - The transaction identifier.
revisionTime - The timestamp assigned to the revisions written by the transactions when it commits (non-zero iff this was a writable transaction that committed successfully and zero otherwise).
aborted - True iff the transaction aborted vs completing successfully.

isolateIndex

public static void isolateIndex(long startTime,
                                String name)
Report the isolation of a named index by a transaction.

Parameters:
startTime - The transaction identifier.
name - The index name.

openJournal

public static void openJournal(String filename,
                               long nbytes,
                               BufferMode bufferMode)
Report the opening of an IJournal resource.

Parameters:
filename - The filename or null iff the journal was not backed by a file.
nbytes - The total #of bytes available on the journal.
bufferMode - The buffer mode in use by the journal.

extendJournal

public static void extendJournal(String filename,
                                 long nbytes)
Report the extension of an IJournal.

Parameters:
filename - The filename or null iff the journal was not backed by a file.
nbytes - The total #of bytes available (vs written) on the journal.
TODO:
this does not differentiate between extension of a buffer backing a journal and extension of a TemporaryRawStore. This means that the resources allocated to a transaction vs the unisolated indices on a journal can not be differentiated.

closeJournal

public static void closeJournal(String filename)
Report close of an IJournal resource.

Parameters:
filename - The filename or null iff the journal was not backed by a file.

deleteJournal

public static void deleteJournal(String filename)
Report deletion of an IJournal resource.

Parameters:
filename - The filename or null iff the journal was not backed by a file.
TODO:
also report deletion of resources for journals that were already closed but not yet deleted pending client leases or updates of the metadata index (in the MasterJournal).


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.