net.sf.farrago.db
Class FarragoDbSession

java.lang.Object
  extended by org.eigenbase.util.CompoundClosableAllocation
      extended by net.sf.farrago.util.FarragoCompoundAllocation
          extended by net.sf.farrago.db.FarragoDbSession
All Implemented Interfaces:
Cloneable, FarragoSession, FarragoAllocation, FarragoAllocationOwner, ClosableAllocation, ClosableAllocationOwner

public class FarragoDbSession
extends FarragoCompoundAllocation
implements FarragoSession, Cloneable

FarragoDbSession implements the FarragoSession interface as a connection to a FarragoDatabase instance. It manages private authorization and transaction context.

Most non-trivial public methods on this class must be synchronized, since closeAllocation may be called from a thread shutting down the database.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/db/FarragoDbSession.java#27
Author:
John V. Sichi

Nested Class Summary
private  class FarragoDbSession.DdlExecutionVisitor
           
private static class FarragoDbSession.SessionLabel
           
private static class FarragoDbSession.TxnIdRef
           
 
Field Summary
private  boolean catalogDumpRequested
           
private  FarragoSessionConnectionSource connectionSource
          The connection source for this session.
private  FarragoDatabase database
          Database accessed by this session
private  DatabaseMetaData dbMetaData
           
private  FarragoSessionPersonality defaultPersonality
          Default personality for this session.
private  FennelTxnContext fennelTxnContext
          Fennel transaction context for this session
private  boolean isAutoCommit
           
private  boolean isClone
          Was this session produced by cloning?
private  boolean isLoopback
           
static String MDR_USER_NAME
           
private  int nextSavepointId
          Generator for savepoint Id's.
private  Pattern optRuleDescExclusionFilter
           
private  FarragoSessionPersonality personality
          Current personality for this session.
private  FarragoSessionPrivilegeMap privilegeMap
           
private  FarragoRepos repos
          Repos accessed by this session
private  boolean reposSessionEnded
           
private  List<FarragoDbSavepoint> savepointList
          List of savepoints established within current transaction which have not been released or rolled back; order is from earliest to latest.
protected  FarragoSessionFactory sessionFactory
           
private  FarragoSessionIndexMap sessionIndexMap
          Map of temporary indexes created by this session.
private  FarragoDbSessionInfo sessionInfo
           
private  FarragoDbSession.SessionLabel sessionLabel
           
private  FarragoSessionVariables sessionVariables
          Qualifiers to assume for unqualified object references
private  boolean shutdownRequested
           
private  boolean shutDownRequested
           
private static Logger sqlTimingTracer
           
private static Logger tracer
           
private  Map<String,FarragoObjectCache.Entry> txnCodeCache
          Private cache of executable code pinned by the current txn.
private  FarragoDbSession.TxnIdRef txnIdRef
          Reference to current transaction ID, or null if none active.
private  String url
          URL used to connect this session.
(package private)  FarragoWarningQueue warningQueue
          Warnings accumulated on this session.
private  boolean wasKilled
           
 
Fields inherited from class org.eigenbase.util.CompoundClosableAllocation
allocations
 
Constructor Summary
FarragoDbSession(String url, Properties info, FarragoSessionFactory sessionFactory)
          Creates a new FarragoDbSession object.
 
Method Summary
private  void accessTargetTable(FarragoDbStmtContextBase stmtContext, FarragoSessionDdlStmt ddlStmt)
          Accesses the target table of a DDL statement for write to prevent concurrent DML on the same table.
 FarragoSessionAnalyzedSql analyzeSql(String sql, RelDataTypeFactory typeFactory, RelDataType paramRowType, boolean optimize)
          Analyzes an SQL expression, and returns information about it.
 void cancel()
          Cancels execution of any statements on this session (but does not kill it or them).
 FarragoSession cloneSession(FarragoSessionVariables inheritedVariables)
          Clones this session.
 void closeAllocation()
          Closes this object.
 void commit()
          Commits current transaction if any.
(package private)  void commitImpl()
           
 void disableSubqueryReduction()
          Disables subquery reduction for the current session.
 void endTransactionIfAuto(boolean commit)
          Ends the current transaction if session is in autocommit mode.
private  void executeDdl(FarragoSessionDdlValidator ddlValidator, FarragoReposTxnContext reposTxnContext, FarragoSessionDdlStmt ddlStmt)
           
 Collection<RefObject> executeLurqlQuery(String lurql, Map<String,?> argMap)
          Executes a LURQL query against the repository.
private  int findSavepoint(FarragoDbSavepoint savepoint)
           
private  int findSavepointByName(String name, boolean throwIfNotFound)
           
 FarragoSessionAnalyzedSql getAnalysisBlock(RelDataTypeFactory typeFactory)
           
 FarragoSessionConnectionSource getConnectionSource()
           
 FarragoDatabase getDatabase()
           
 DatabaseMetaData getDatabaseMetaData()
           
 FennelTxnContext getFennelTxnContext()
          Accessor for the fennel Txn Context in this session.
 List<FarragoSessionModelExtension> getModelExtensions()
           
 Pattern getOptRuleDescExclusionFilter()
           
 FarragoSessionPersonality getPersonality()
           
 FarragoPluginClassLoader getPluginClassLoader()
           
 FarragoSessionPrivilegeMap getPrivilegeMap()
           
 FarragoRepos getRepos()
           
 FarragoSessionFactory getSessionFactory()
           
 FarragoSessionIndexMap getSessionIndexMap()
           
 FarragoSessionInfo getSessionInfo()
          Returns a FarragoSessionInfo object which contains information on the runtime state of the session (e.g., active statements).
 Timestamp getSessionLabelCreationTimestamp()
          Retrieves the creation timestamp for the session's label setting, if a label setting is set.
 Long getSessionLabelCsn()
          Retrieves the commit sequence number associated with a session's label, if it's set.
 FarragoSessionVariables getSessionVariables()
           
(package private)  Map<String,FarragoObjectCache.Entry> getTxnCodeCache()
           
 FarragoSessionTxnId getTxnId(boolean createIfNeeded)
          Gets the ID of the current transaction on this session, optionally initiating a new transaction if none is currently active.
 FarragoSessionTxnMgr getTxnMgr()
           
 String getUrl()
           
 FarragoWarningQueue getWarningQueue()
          Gets the warning queue for this session.
private  void init(Properties info)
           
 boolean isAutoCommit()
           
 boolean isClone()
           
 boolean isClosed()
           
 boolean isLoopback()
          Tests whether this session is a loopback session.
 boolean isReentrantAlterTableAddColumn()
          Tests whether this is a reentrant session executing DML on behalf of ALTER TABLE ADD COLUMN.
 boolean isReentrantAlterTableRebuild()
          Tests whether this is a reentrant session executing DML on behalf of ALTER TABLE REBUILD.
private  boolean isSessionLabelEnabled()
           
 boolean isTxnInProgress()
           
 void kill()
          Kills this session.
private  void markTableInUse(FarragoDbStmtContextBase stmtContext, FarragoSessionDdlStmt ddlStmt)
          Marks the target table for a DDL statement as in-use.
 FarragoSessionPrivilegeChecker newPrivilegeChecker()
          Creates a new privilege checker for a session.
protected  FarragoSessionRuntimeParams newRuntimeContextParams()
           
 FarragoSessionSavepoint newSavepoint(String name)
          Creates a new savepoint based on the current session state.
private  FarragoSessionSavepoint newSavepointImpl(String name)
           
 FarragoSessionStmtContext newStmtContext(FarragoSessionStmtParamDefFactory paramDefFactory)
          Creates a new statement context within this session.
 FarragoSessionStmtContext newStmtContext(FarragoSessionStmtParamDefFactory paramDefFactory, FarragoSessionStmtContext rootStmtContext)
          Creates a new statement context within this session.
 FarragoSessionStmtValidator newStmtValidator()
          Creates a new SQL statement validator.
protected  void onEndOfTransaction(FarragoSessionTxnEnd eot)
           
protected  FarragoSessionExecutableStmt prepare(FarragoDbStmtContextBase stmtContext, String sql, FarragoAllocationOwner owner, boolean isExecDirect, FarragoSessionAnalyzedSql analyzedSql)
           
private  FarragoSessionExecutableStmt prepareImpl(String sql, FarragoAllocationOwner owner, boolean isExecDirect, FarragoSessionAnalyzedSql analyzedSql, FarragoDbStmtContextBase stmtContext, FarragoSessionStmtValidator stmtValidator, FarragoReposTxnContext reposTxnContext, boolean[] pRollback)
           
 void releaseSavepoint(FarragoSessionSavepoint savepoint)
          Releases an existing savepoint.
private  void releaseSavepoint(int iSavepoint)
           
 void rollback(FarragoSessionSavepoint savepoint)
          Rolls back current transaction if any.
(package private)  void rollbackImpl()
           
private  void rollbackToSavepoint(int iSavepoint)
           
 void setAutoCommit(boolean autoCommit)
          Changes the autocommit mode for this session.
 void setConnectionSource(FarragoSessionConnectionSource source)
          Initializes the connection source associated with this session.
 void setDatabaseMetaData(DatabaseMetaData dbMetaData)
          Initializes the database metadata associated with this session.
 void setLoopback()
          Flags this FarragoSession as being a loopback session.
 void setOptRuleDescExclusionFilter(Pattern exclusionFilter)
          Sets the exclusion filter to use for planners created by this session.
 void setSessionIndexMap(FarragoSessionIndexMap sessionIndexMap)
          Overrides the index map associated with this session
private  void setSessionLabel(FemLabel label)
           
 void setShutdownRequest(boolean val)
          Turns on a flag indicating whether a shutdown request has been made.
 boolean shutdownRequested()
           
private  void validateDdl(FarragoSessionDdlValidator ddlValidator, FarragoDbStmtContextBase stmtContext, FarragoReposTxnContext reposTxnContext, FarragoSessionDdlStmt ddlStmt)
           
private  int validateSavepoint(FarragoSessionSavepoint savepoint)
           
 boolean wasKilled()
           
 
Methods inherited from class org.eigenbase.util.CompoundClosableAllocation
addAllocation, forgetAllocation, hasAllocations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eigenbase.util.ClosableAllocationOwner
addAllocation
 

Field Detail

tracer

private static final Logger tracer

sqlTimingTracer

private static final Logger sqlTimingTracer

MDR_USER_NAME

public static final String MDR_USER_NAME
See Also:
Constant Field Values

defaultPersonality

private FarragoSessionPersonality defaultPersonality
Default personality for this session.


personality

private FarragoSessionPersonality personality
Current personality for this session.


fennelTxnContext

private FennelTxnContext fennelTxnContext
Fennel transaction context for this session


txnIdRef

private FarragoDbSession.TxnIdRef txnIdRef
Reference to current transaction ID, or null if none active. We do it this way so that reference is shared across all clones via shallow-copy.


sessionVariables

private FarragoSessionVariables sessionVariables
Qualifiers to assume for unqualified object references


database

private FarragoDatabase database
Database accessed by this session


repos

private FarragoRepos repos
Repos accessed by this session


url

private String url
URL used to connect this session.


warningQueue

FarragoWarningQueue warningQueue
Warnings accumulated on this session.


isClone

private boolean isClone
Was this session produced by cloning?


isAutoCommit

private boolean isAutoCommit

shutDownRequested

private boolean shutDownRequested

catalogDumpRequested

private boolean catalogDumpRequested

shutdownRequested

private boolean shutdownRequested

reposSessionEnded

private boolean reposSessionEnded

wasKilled

private boolean wasKilled

savepointList

private List<FarragoDbSavepoint> savepointList
List of savepoints established within current transaction which have not been released or rolled back; order is from earliest to latest.


nextSavepointId

private int nextSavepointId
Generator for savepoint Id's.


sessionIndexMap

private FarragoSessionIndexMap sessionIndexMap
Map of temporary indexes created by this session.


connectionSource

private FarragoSessionConnectionSource connectionSource
The connection source for this session.


txnCodeCache

private Map<String,FarragoObjectCache.Entry> txnCodeCache
Private cache of executable code pinned by the current txn.


dbMetaData

private DatabaseMetaData dbMetaData

sessionFactory

protected FarragoSessionFactory sessionFactory

privilegeMap

private FarragoSessionPrivilegeMap privilegeMap

sessionInfo

private FarragoDbSessionInfo sessionInfo

optRuleDescExclusionFilter

private Pattern optRuleDescExclusionFilter

sessionLabel

private FarragoDbSession.SessionLabel sessionLabel

isLoopback

private boolean isLoopback
Constructor Detail

FarragoDbSession

public FarragoDbSession(String url,
                        Properties info,
                        FarragoSessionFactory sessionFactory)
Creates a new FarragoDbSession object.

Parameters:
url - URL used to connect (same as JDBC)
info - properties for this session
sessionFactory - factory which created this session
Method Detail

init

private void init(Properties info)

getSessionFactory

public FarragoSessionFactory getSessionFactory()
Specified by:
getSessionFactory in interface FarragoSession
Returns:
the factory which created this session

getPersonality

public FarragoSessionPersonality getPersonality()
Specified by:
getPersonality in interface FarragoSession
Returns:
the current personality for this session

setDatabaseMetaData

public void setDatabaseMetaData(DatabaseMetaData dbMetaData)
Description copied from interface: FarragoSession
Initializes the database metadata associated with this session.

Specified by:
setDatabaseMetaData in interface FarragoSession
Parameters:
dbMetaData - metadata to set

setConnectionSource

public void setConnectionSource(FarragoSessionConnectionSource source)
Description copied from interface: FarragoSession
Initializes the connection source associated with this session.

Specified by:
setConnectionSource in interface FarragoSession
Parameters:
source - connection source to set

getDatabaseMetaData

public DatabaseMetaData getDatabaseMetaData()
Specified by:
getDatabaseMetaData in interface FarragoSession
Returns:
JDBC database metadata for this session

getConnectionSource

public FarragoSessionConnectionSource getConnectionSource()
Specified by:
getConnectionSource in interface FarragoSession
Returns:
connection source

getUrl

public String getUrl()
Specified by:
getUrl in interface FarragoSession
Returns:
JDBC URL used to establish this session

getPluginClassLoader

public FarragoPluginClassLoader getPluginClassLoader()
Specified by:
getPluginClassLoader in interface FarragoSession
Returns:
ClassLoader for loading plugins

getModelExtensions

public List<FarragoSessionModelExtension> getModelExtensions()
Specified by:
getModelExtensions in interface FarragoSession
Returns:
list of installed FarragoSessionModelExtension instances

getSessionInfo

public FarragoSessionInfo getSessionInfo()
Description copied from interface: FarragoSession
Returns a FarragoSessionInfo object which contains information on the runtime state of the session (e.g., active statements).

Specified by:
getSessionInfo in interface FarragoSession
Returns:
FarragoSessionInfo object

getWarningQueue

public FarragoWarningQueue getWarningQueue()
Description copied from interface: FarragoSession
Gets the warning queue for this session.

Specified by:
getWarningQueue in interface FarragoSession
Returns:
warning queue

newStmtContext

public FarragoSessionStmtContext newStmtContext(FarragoSessionStmtParamDefFactory paramDefFactory)
Description copied from interface: FarragoSession
Creates a new statement context within this session.

Specified by:
newStmtContext in interface FarragoSession
Parameters:
paramDefFactory - a factory for FarragoSessionStmtParamDef instances
Returns:
new statement context

newStmtContext

public FarragoSessionStmtContext newStmtContext(FarragoSessionStmtParamDefFactory paramDefFactory,
                                                FarragoSessionStmtContext rootStmtContext)
Description copied from interface: FarragoSession
Creates a new statement context within this session.

Specified by:
newStmtContext in interface FarragoSession
Parameters:
paramDefFactory - a factory for FarragoSessionStmtParamDef instances
rootStmtContext - the root statement context for an internally prepared statement; for an externally prepared statement, this will be null
Returns:
new statement context

newStmtValidator

public FarragoSessionStmtValidator newStmtValidator()
Description copied from interface: FarragoSession
Creates a new SQL statement validator.

Specified by:
newStmtValidator in interface FarragoSession
Returns:
new validator

newPrivilegeChecker

public FarragoSessionPrivilegeChecker newPrivilegeChecker()
Description copied from interface: FarragoSession
Creates a new privilege checker for a session. This checker ensures that the session user has the right privileges on the objects which it requests to operate on.

Because privilege checkers are stateful, one privilege checker should be created for each statement.

Specified by:
newPrivilegeChecker in interface FarragoSession
Returns:
new privilege checker

getPrivilegeMap

public FarragoSessionPrivilegeMap getPrivilegeMap()
Specified by:
getPrivilegeMap in interface FarragoSession
Returns:
FarragoSessionPrivilegeMap for this session

cloneSession

public FarragoSession cloneSession(FarragoSessionVariables inheritedVariables)
Description copied from interface: FarragoSession
Clones this session. TODO: document what this entails.

Specified by:
cloneSession in interface FarragoSession
Parameters:
inheritedVariables - session variables to use for context in new session, or null to inherit those of session being cloned
Returns:
cloned session.

isClone

public boolean isClone()
Specified by:
isClone in interface FarragoSession
Returns:
whether this session is an internal session cloned from another session

isClosed

public boolean isClosed()
Specified by:
isClosed in interface FarragoSession
Returns:
whether this session has already been closed

wasKilled

public boolean wasKilled()
Specified by:
wasKilled in interface FarragoSession
Returns:
whether this session was killed (which implies closed)

isTxnInProgress

public boolean isTxnInProgress()
Specified by:
isTxnInProgress in interface FarragoSession
Returns:
whether this session currently has a transaction in progress

getTxnId

public FarragoSessionTxnId getTxnId(boolean createIfNeeded)
Description copied from interface: FarragoSession
Gets the ID of the current transaction on this session, optionally initiating a new transaction if none is currently active.

Specified by:
getTxnId in interface FarragoSession
Parameters:
createIfNeeded - if true and no transaction is active, create a new one
Returns:
transaction ID, or null if no transaction active and !createIfNeeded

getTxnMgr

public FarragoSessionTxnMgr getTxnMgr()
Specified by:
getTxnMgr in interface FarragoSession
Returns:
transaction manager for this session

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Description copied from interface: FarragoSession
Changes the autocommit mode for this session.

Specified by:
setAutoCommit in interface FarragoSession
Parameters:
autoCommit - true to request autocommit; false to request manual commit

isAutoCommit

public boolean isAutoCommit()
Specified by:
isAutoCommit in interface FarragoSession
Returns:
whether this session is in autocommit mode

getSessionVariables

public FarragoSessionVariables getSessionVariables()
Specified by:
getSessionVariables in interface FarragoSession
Returns:
current connection defaults for this session

endTransactionIfAuto

public void endTransactionIfAuto(boolean commit)
Description copied from interface: FarragoSession
Ends the current transaction if session is in autocommit mode. Normally, an attempt to commit or rollback in autocommit mode will cause an exception; this method is for use by other components which need to notify the session that some event (e.g. cursor close) is triggering an autocommit boundary.

Specified by:
endTransactionIfAuto in interface FarragoSession
Parameters:
commit - true to commit; false to rollback

getRepos

public FarragoRepos getRepos()
Specified by:
getRepos in interface FarragoSession
Returns:
repos accessed by this session

kill

public void kill()
Description copied from interface: FarragoSession
Kills this session. A killed session is closed, so the implementation of this method should insure that ClosableAllocation.closeAllocation() is called. After this method is called, FarragoSession.wasKilled() and FarragoSession.isClosed() will return true.

Specified by:
kill in interface FarragoSession

cancel

public void cancel()
Description copied from interface: FarragoSession
Cancels execution of any statements on this session (but does not kill it or them).

Specified by:
cancel in interface FarragoSession

disableSubqueryReduction

public void disableSubqueryReduction()
Description copied from interface: FarragoSession
Disables subquery reduction for the current session.

Specified by:
disableSubqueryReduction in interface FarragoSession

closeAllocation

public void closeAllocation()
Description copied from interface: ClosableAllocation
Closes this object.

Specified by:
closeAllocation in interface ClosableAllocation
Overrides:
closeAllocation in class CompoundClosableAllocation

commit

public void commit()
Description copied from interface: FarragoSession
Commits current transaction if any.

Specified by:
commit in interface FarragoSession

newSavepoint

public FarragoSessionSavepoint newSavepoint(String name)
Description copied from interface: FarragoSession
Creates a new savepoint based on the current session state.

Specified by:
newSavepoint in interface FarragoSession
Parameters:
name - name to give new savepoint, or null for anonymous savepoint
Returns:
new savepoint

releaseSavepoint

public void releaseSavepoint(FarragoSessionSavepoint savepoint)
Description copied from interface: FarragoSession
Releases an existing savepoint.

Specified by:
releaseSavepoint in interface FarragoSession
Parameters:
savepoint - savepoint to release

analyzeSql

public FarragoSessionAnalyzedSql analyzeSql(String sql,
                                            RelDataTypeFactory typeFactory,
                                            RelDataType paramRowType,
                                            boolean optimize)
Description copied from interface: FarragoSession
Analyzes an SQL expression, and returns information about it. Used when an expression is not going to be executed directly, but needs to be validated as part of the definition of some containing object such as a view.

Specified by:
analyzeSql in interface FarragoSession
Parameters:
sql - text of SQL expression
typeFactory - factory for creating result and param types
paramRowType - if non-null, expression is expected to be a function body with these parameters; if null, expression is expected to be a query
optimize - if true, run optimizer as part of analysis; otherwise, skip optimization, returning less information
Returns:
FarragoSessionAnalyzedSql derived from the query

setSessionLabel

private void setSessionLabel(FemLabel label)

getSessionLabelCsn

public Long getSessionLabelCsn()
Description copied from interface: FarragoSession
Retrieves the commit sequence number associated with a session's label, if it's set.

Specified by:
getSessionLabelCsn in interface FarragoSession
Returns:
the commit sequence number of a session's label; null if the session does not have a label setting

getSessionLabelCreationTimestamp

public Timestamp getSessionLabelCreationTimestamp()
Description copied from interface: FarragoSession
Retrieves the creation timestamp for the session's label setting, if a label setting is set.

Specified by:
getSessionLabelCreationTimestamp in interface FarragoSession
Returns:
the creation timestamp; null if the session does not have a label setting

isSessionLabelEnabled

private boolean isSessionLabelEnabled()
Returns:
true if the session has a label setting and it is not temporarily disabled

getAnalysisBlock

public FarragoSessionAnalyzedSql getAnalysisBlock(RelDataTypeFactory typeFactory)

getDatabase

public FarragoDatabase getDatabase()

getSessionIndexMap

public FarragoSessionIndexMap getSessionIndexMap()
Specified by:
getSessionIndexMap in interface FarragoSession
Returns:
session index map

setSessionIndexMap

public void setSessionIndexMap(FarragoSessionIndexMap sessionIndexMap)
Description copied from interface: FarragoSession
Overrides the index map associated with this session

Specified by:
setSessionIndexMap in interface FarragoSession
Parameters:
sessionIndexMap - index map to set

getTxnCodeCache

Map<String,FarragoObjectCache.Entry> getTxnCodeCache()

getFennelTxnContext

public FennelTxnContext getFennelTxnContext()
Accessor for the fennel Txn Context in this session. If no transaction is active, this should return null

Returns:
the FennelTxnContext active in this DB session

commitImpl

void commitImpl()

rollbackImpl

void rollbackImpl()

onEndOfTransaction

protected void onEndOfTransaction(FarragoSessionTxnEnd eot)

rollback

public void rollback(FarragoSessionSavepoint savepoint)
Description copied from interface: FarragoSession
Rolls back current transaction if any.

Specified by:
rollback in interface FarragoSession
Parameters:
savepoint - savepoint to roll back to, or null to rollback entire transaction

executeLurqlQuery

public Collection<RefObject> executeLurqlQuery(String lurql,
                                               Map<String,?> argMap)
Description copied from interface: FarragoSession
Executes a LURQL query against the repository.

Specified by:
executeLurqlQuery in interface FarragoSession
Parameters:
lurql - query string
argMap - from parameter name (String) to argument value (typically String or Set)
Returns:
collection of RefObjects retrieved by query

setOptRuleDescExclusionFilter

public void setOptRuleDescExclusionFilter(Pattern exclusionFilter)
Description copied from interface: FarragoSession
Sets the exclusion filter to use for planners created by this session. See RelOptPlanner.setRuleDescExclusionFilter(java.util.regex.Pattern) for details.

Specified by:
setOptRuleDescExclusionFilter in interface FarragoSession
Parameters:
exclusionFilter - pattern to match for exclusion; null to disable filtering

getOptRuleDescExclusionFilter

public Pattern getOptRuleDescExclusionFilter()
Specified by:
getOptRuleDescExclusionFilter in interface FarragoSession
Returns:
exclusion filter in effect for planners created by this session

newRuntimeContextParams

protected FarragoSessionRuntimeParams newRuntimeContextParams()

newSavepointImpl

private FarragoSessionSavepoint newSavepointImpl(String name)

validateSavepoint

private int validateSavepoint(FarragoSessionSavepoint savepoint)

findSavepointByName

private int findSavepointByName(String name,
                                boolean throwIfNotFound)

findSavepoint

private int findSavepoint(FarragoDbSavepoint savepoint)

releaseSavepoint

private void releaseSavepoint(int iSavepoint)

rollbackToSavepoint

private void rollbackToSavepoint(int iSavepoint)

prepare

protected FarragoSessionExecutableStmt prepare(FarragoDbStmtContextBase stmtContext,
                                               String sql,
                                               FarragoAllocationOwner owner,
                                               boolean isExecDirect,
                                               FarragoSessionAnalyzedSql analyzedSql)

prepareImpl

private FarragoSessionExecutableStmt prepareImpl(String sql,
                                                 FarragoAllocationOwner owner,
                                                 boolean isExecDirect,
                                                 FarragoSessionAnalyzedSql analyzedSql,
                                                 FarragoDbStmtContextBase stmtContext,
                                                 FarragoSessionStmtValidator stmtValidator,
                                                 FarragoReposTxnContext reposTxnContext,
                                                 boolean[] pRollback)

validateDdl

private void validateDdl(FarragoSessionDdlValidator ddlValidator,
                         FarragoDbStmtContextBase stmtContext,
                         FarragoReposTxnContext reposTxnContext,
                         FarragoSessionDdlStmt ddlStmt)

markTableInUse

private void markTableInUse(FarragoDbStmtContextBase stmtContext,
                            FarragoSessionDdlStmt ddlStmt)
Marks the target table for a DDL statement as in-use. This allows us to subsequently release the MDR repository lock acquired at the start of query preparation. Marking the table as in-use prevents it from being dropped while the repository is unlocked. The lock is released in FarragoDbSession.DdlExecutionVisitor during the execution of some types of long-running DdlStmt.

Parameters:
stmtContext - context of the DDL statement
ddlStmt - the DDL statement

accessTargetTable

private void accessTargetTable(FarragoDbStmtContextBase stmtContext,
                               FarragoSessionDdlStmt ddlStmt)
Accesses the target table of a DDL statement for write to prevent concurrent DML on the same table.

Parameters:
stmtContext - context of the DDL statement
ddlStmt - the DDL statement

executeDdl

private void executeDdl(FarragoSessionDdlValidator ddlValidator,
                        FarragoReposTxnContext reposTxnContext,
                        FarragoSessionDdlStmt ddlStmt)

setShutdownRequest

public void setShutdownRequest(boolean val)
Turns on a flag indicating whether a shutdown request has been made.

Parameters:
val - whether to set the flag to true or false

shutdownRequested

public boolean shutdownRequested()
Returns:
true if a metamodel dump has been requested

setLoopback

public void setLoopback()
Description copied from interface: FarragoSession
Flags this FarragoSession as being a loopback session. Loopback sessions do not block server shutdown.

Specified by:
setLoopback in interface FarragoSession

isLoopback

public boolean isLoopback()
Description copied from interface: FarragoSession
Tests whether this session is a loopback session.

Specified by:
isLoopback in interface FarragoSession
Returns:
true if this is a loopback session, false otherwise
See Also:
FarragoSession.setLoopback()

isReentrantAlterTableRebuild

public boolean isReentrantAlterTableRebuild()
Description copied from interface: FarragoSession
Tests whether this is a reentrant session executing DML on behalf of ALTER TABLE REBUILD.

Specified by:
isReentrantAlterTableRebuild in interface FarragoSession
Returns:
true if this session is doing ALTER TABLE REBUILD, false otherwise

isReentrantAlterTableAddColumn

public boolean isReentrantAlterTableAddColumn()
Description copied from interface: FarragoSession
Tests whether this is a reentrant session executing DML on behalf of ALTER TABLE ADD COLUMN.

Specified by:
isReentrantAlterTableAddColumn in interface FarragoSession
Returns:
true if this session is doing ALTER TABLE ADD COLUMN, false otherwise