|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.util.CompoundClosableAllocation net.sf.farrago.util.FarragoCompoundAllocation net.sf.farrago.db.FarragoDbSingleton net.sf.farrago.db.FarragoDatabase
public class FarragoDatabase
FarragoDatabase is a top-level singleton representing an instance of a Farrago database engine.
NOTE jvs 14-Dec-2005: FarragoDatabase inherits from FarragoDbSingleton for backwards compatibility. This tie may eventually be severed so that multiple instances of FarragoDatabase can be created in the same JVM.
Nested Class Summary | |
---|---|
private class |
FarragoDatabase.CheckpointTask
|
private class |
FarragoDatabase.ReposSwitcher
|
private class |
FarragoDatabase.WatchdogTask
1 Hz task for background activities. |
Field Summary | |
---|---|
private boolean |
authenticateLocalConnections
|
private Configuration |
authenticationConfig
|
private FarragoObjectCache |
codeCache
Cache of all sorts of stuff; see the design docs. |
private FarragoDdlLockManager |
ddlLockManager
|
private FennelDbHandle |
fennelDbHandle
|
private List<FarragoSessionModelExtension> |
modelExtensions
|
private OJRexImplementorTable |
ojRexImplementorTable
|
private boolean |
partialRestore
Set to true if the system has only been partially restored, in which case, no tables can be accessed and no objects can be created. |
private FarragoPluginClassLoader |
pluginClassLoader
|
protected FarragoSessionFactory |
sessionFactory
|
private FarragoRepos |
systemRepos
|
private File |
traceConfigFile
File containing trace configuration. |
private FarragoSessionTxnMgr |
txnMgr
|
private AtomicLong |
uniqueId
Provides unique identifiers for sessions and statements. |
private FarragoRepos |
userRepos
|
Fields inherited from class net.sf.farrago.db.FarragoDbSingleton |
---|
instance, tracer |
Fields inherited from class org.eigenbase.util.CompoundClosableAllocation |
---|
allocations |
Constructor Summary | |
---|---|
FarragoDatabase(FarragoSessionFactory sessionFactory,
boolean init)
Creates a FarragoDatabase . |
Method Summary | |
---|---|
private void |
assertNoFennelHandles()
|
void |
cleanupBackupData(boolean backupSucceeded,
boolean setEndTimestamp)
Cleans up the system backup catalog by either removing pending backup data if the last backup failed, or by updating the pending data to completed, if the last backup succeeded. |
void |
close(boolean suppressExcns)
|
void |
deallocateOld()
|
private void |
dumpTraceConfig()
|
private void |
executeFennelSetParam(String paramName,
SqlLiteral paramValue)
|
private void |
filterMapNullValues(Map<String,Object> configMap)
|
FarragoSessionExecutingStmtInfo |
findExecutingStmtInfo(long id)
Looks up executing statement info by statement id. |
FarragoSessionInfo |
findSessionInfo(long id)
look up session info by session id. |
void |
flushCodeCache()
Flushes unpinned entries from the cache cache for this database. |
Configuration |
getAuthenticationConfig()
|
private File |
getBootUrlFile()
|
FarragoObjectCache |
getCodeCache()
|
private long |
getCodeCacheMaxBytes(FemFarragoConfig config)
|
FarragoObjectCache |
getDataWrapperCache()
|
FarragoDdlLockManager |
getDdlLockManager()
|
FennelDbHandle |
getFennelDbHandle()
|
List<FarragoSessionModelExtension> |
getModelExtensions()
|
OJRexImplementorTable |
getOJRexImplementorTable()
|
FarragoPluginClassLoader |
getPluginClassLoader()
|
FarragoRepos |
getSystemRepos()
|
FarragoSessionTxnMgr |
getTxnMgr()
|
long |
getUniqueId()
Gets a unique identifier: never 0. |
FarragoRepos |
getUserRepos()
|
FarragoSessionExecutableStmt |
implementStmt(FarragoSessionPreparingStmt prep,
RelNode rootRel,
SqlKind sqlKind,
boolean logical,
FarragoAllocationOwner owner)
Implements a logical or physical query plan but does not execute it. |
boolean |
isAuthenticateLocalConnections()
|
boolean |
isAuthenticationEnabled()
|
private boolean |
isExecutableStmtStale(FarragoRepos repos,
FarragoSessionExecutableStmt stmt)
|
boolean |
isPartiallyRestored()
Determines if the database is in a state where a partial restore has been done, which indicates that the catalog data is not in sync with table data. |
private void |
kill(FarragoSessionExecutingStmtInfo info,
boolean cancelOnly)
|
void |
killExecutingStmt(long id,
boolean cancelOnly)
Kill an executing statement: cancel it and deallocate it. |
int |
killExecutingStmtMatching(String match,
String nomatch,
boolean cancelOnly)
Kills all statements that are executing SQL that matches a given pattern, but does not match a second pattern. |
void |
killSession(long id,
boolean cancelOnly)
Kills a session. |
private void |
loadBootUrls()
|
private boolean |
loadFennel(FarragoCompoundAllocation startOfWorldAllocation,
FennelCmdExecutor cmdExecutor,
boolean init)
|
private void |
loadModelPlugins()
|
static void |
main(String[] args)
Main entry point which creates a new Farrago database. |
static FarragoSessionFactory |
newSessionFactory()
|
FarragoSessionExecutableStmt |
prepareStmt(FarragoSessionStmtContext stmtContext,
FarragoSessionStmtValidator stmtValidator,
SqlNode sqlNode,
FarragoAllocationOwner owner,
FarragoSessionAnalyzedSql analyzedSql)
Prepares an SQL expression; uses a cached implementation if available, otherwise caches the one generated here. |
private FarragoSessionExecutableStmt |
prepareStmtImpl(FarragoSessionPreparingStmt stmt,
SqlNode sqlNode,
FarragoAllocationOwner owner,
FarragoSessionAnalyzedSql analyzedSql)
|
void |
requestCheckpoint(boolean fuzzy,
boolean async)
|
(package private) void |
saveBootUrl(String url)
|
void |
setAuthenticateLocalConnections(boolean authenticateLocalConnections)
Turns on/off authentication for in-process jdbc sessions. |
void |
setFennelDbHandle(FennelDbHandle handle)
Sets the fennel DB handle used by the database. |
void |
setTxnMgr(FarragoSessionTxnMgr txnMgr)
Sets the transaction manager for this database. |
void |
simulateCatalogRecovery()
Simulates the catalog recovery which would occur on startup after a crash. |
private void |
updateCatalog(boolean recoveryRequired)
Updates the catalog on startup, taking care of any cleanup or recovery. |
void |
updateSystemParameter(DdlSetSystemParamStmt ddlStmt)
|
private void |
warnOnClose(Throwable ex,
boolean suppressExcns)
|
Methods inherited from class net.sf.farrago.db.FarragoDbSingleton |
---|
addSession, disconnectSession, getSessions, getSessions, isReferenced, pinReference, pinReference, setBackupFlag, shutdown, shutdownConditional |
Methods inherited from class org.eigenbase.util.CompoundClosableAllocation |
---|
addAllocation, closeAllocation, 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 |
Methods inherited from interface org.eigenbase.util.ClosableAllocation |
---|
closeAllocation |
Methods inherited from interface org.eigenbase.util.ClosableAllocation |
---|
closeAllocation |
Field Detail |
---|
private FarragoRepos systemRepos
private FarragoRepos userRepos
private FennelDbHandle fennelDbHandle
private OJRexImplementorTable ojRexImplementorTable
protected FarragoSessionFactory sessionFactory
private FarragoPluginClassLoader pluginClassLoader
private List<FarragoSessionModelExtension> modelExtensions
private FarragoDdlLockManager ddlLockManager
private FarragoSessionTxnMgr txnMgr
private Configuration authenticationConfig
private boolean authenticateLocalConnections
private boolean partialRestore
private FarragoObjectCache codeCache
private File traceConfigFile
private AtomicLong uniqueId
Constructor Detail |
---|
public FarragoDatabase(FarragoSessionFactory sessionFactory, boolean init)
FarragoDatabase
.
sessionFactory
- factory for various database-level objectsinit
- whether to initialize the system catalog (the first time the
database is started)Method Detail |
---|
public FarragoObjectCache getCodeCache()
public void flushCodeCache()
public FarragoObjectCache getDataWrapperCache()
public FarragoPluginClassLoader getPluginClassLoader()
public List<FarragoSessionModelExtension> getModelExtensions()
FarragoSessionModelExtension
instancespublic FarragoSessionTxnMgr getTxnMgr()
public void setTxnMgr(FarragoSessionTxnMgr txnMgr)
txnMgr
- new transaction managerprivate File getBootUrlFile()
private void loadBootUrls()
void saveBootUrl(String url)
private void loadModelPlugins()
public void close(boolean suppressExcns)
private void warnOnClose(Throwable ex, boolean suppressExcns)
private void dumpTraceConfig()
private void assertNoFennelHandles()
private boolean loadFennel(FarragoCompoundAllocation startOfWorldAllocation, FennelCmdExecutor cmdExecutor, boolean init) throws Exception
Exception
private void updateCatalog(boolean recoveryRequired) throws Exception
recoveryRequired
- true if starting up after a crash
Exception
public void simulateCatalogRecovery() throws Exception
Exception
public void cleanupBackupData(boolean backupSucceeded, boolean setEndTimestamp) throws Exception
backupSucceeded
- whether the last backup was successfulsetEndTimestamp
- if true, record the current timestamp as the
ending timestamp when updating pending data to completed
Exception
public boolean isPartiallyRestored()
private void filterMapNullValues(Map<String,Object> configMap)
public OJRexImplementorTable getOJRexImplementorTable()
public FarragoRepos getSystemRepos()
public FarragoRepos getUserRepos()
public boolean isAuthenticationEnabled()
public Configuration getAuthenticationConfig()
public FennelDbHandle getFennelDbHandle()
public void setFennelDbHandle(FennelDbHandle handle)
public FarragoDdlLockManager getDdlLockManager()
public long getUniqueId()
public FarragoSessionInfo findSessionInfo(long id)
id
-
public FarragoSessionExecutingStmtInfo findExecutingStmtInfo(long id)
id
-
public void killSession(long id, boolean cancelOnly) throws Throwable
id
- session identifiercancelOnly
- if true, just cancel current execution; if false,
destroy session
Throwable
private void kill(FarragoSessionExecutingStmtInfo info, boolean cancelOnly) throws Throwable
Throwable
public void killExecutingStmt(long id, boolean cancelOnly) throws Throwable
id
- statement idcancelOnly
- if true, just cancel current execution; if false,
destroy statement
Throwable
public int killExecutingStmtMatching(String match, String nomatch, boolean cancelOnly) throws Throwable
match
- pattern to match. Null string matches nothing, to be safe.nomatch
- pattern not to matchcancelOnly
- if true, just cancel current execution; if false,
destroy statement
Throwable
public FarragoSessionExecutableStmt prepareStmt(FarragoSessionStmtContext stmtContext, FarragoSessionStmtValidator stmtValidator, SqlNode sqlNode, FarragoAllocationOwner owner, FarragoSessionAnalyzedSql analyzedSql)
stmtContext
- embracing stmt contextstmtValidator
- generic stmt validatorsqlNode
- the parsed form of the statementowner
- the FarragoAllocationOwner which will be responsible for the
returned stmtanalyzedSql
- receives information about a prepared expression
public FarragoSessionExecutableStmt implementStmt(FarragoSessionPreparingStmt prep, RelNode rootRel, SqlKind sqlKind, boolean logical, FarragoAllocationOwner owner)
prep
- the FarragoSessionPreparingStmt that is managing the query.rootRel
- root of query plan (relational expression)sqlKind
- SqlKind for the relational expression: only
SqlKind.Explain and SqlKind.Dml are special cases.logical
- true for a logical query plan (still needs to be
optimized), false for a physical plan.owner
- the FarragoAllocationOwner which will be responsible for the
returned stmt
private FarragoSessionExecutableStmt prepareStmtImpl(FarragoSessionPreparingStmt stmt, SqlNode sqlNode, FarragoAllocationOwner owner, FarragoSessionAnalyzedSql analyzedSql)
private boolean isExecutableStmtStale(FarragoRepos repos, FarragoSessionExecutableStmt stmt)
public void updateSystemParameter(DdlSetSystemParamStmt ddlStmt)
private long getCodeCacheMaxBytes(FemFarragoConfig config)
private void executeFennelSetParam(String paramName, SqlLiteral paramValue)
public void requestCheckpoint(boolean fuzzy, boolean async)
public void deallocateOld()
public static FarragoSessionFactory newSessionFactory()
public static void main(String[] args)
args
- ignoredpublic boolean isAuthenticateLocalConnections()
public void setAuthenticateLocalConnections(boolean authenticateLocalConnections)
authenticateLocalConnections
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |