A dependency can be either persistent or non-persistent. Persistent dependencies are stored in the data dictionary, and non-persistent dependencies are stored within the dependency manager itself (in memory).
Synchronization
The need for synchronization is different depending
on whether the dependency is an in-memory dependency or a stored dependency.
When accessing and modifying in-memory dependencies, Java synchronization
must be used (specifically, we synchronize on this). When accessing
and modifying stored dependencies, which are stored in the data dictionary,
we expect that the locking protocols will provide the synchronization needed.
Note that stored dependencies should not be accessed while holding the
monitor of this, as this may result in deadlocks. So far the need
for synchronization across both in-memory and stored dependencies hasn't
occurred.
| Modifier and Type | Field and Description |
|---|---|
| private final DataDictionary | dd
DataDictionary for this database. |
| private final Map | dependents
Map of in-memory dependencies for Dependents. |
| private static final ProviderInfo[] | |
| private final Map | providers
Map of in-memory dependencies for Providers. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addDependency(Dependent
the dependent d, Provider the provider p, ContextManager Current ContextManager cm)Implements org. adds a dependency from the dependent on the provider. |
| private void | addDependency(Dependent
the dependent d, Provider the provider p, ContextManager context manager cm, TransactionController transaction controller, used to determine if any transactional
operations should be attempted carried out in a nested transaction.
If tc)tc is null, the user transaction is used.Adds the dependency to the data dictionary or the in-memory dependency map. |
| private boolean | Returns: boolean Whether or not the dependency get added.Add a new dependency to the specified table if it does not already exist in that table. |
| private synchronized void | addInMemoryDependency(Dependent
the dependent d, Provider the provider p, ContextManager context manager cm)Adds the dependency as an in-memory dependency. |
| private void | addStoredDependency(Dependent
the dependent d, Provider the provider p, ContextManager context manager cm, TransactionController transaction controller (may be tc)null)Adds the dependency as a stored dependency. |
| public void | clearColumnInfoInProviders(ProviderList
provider list pl)Implements org. Clear the in memory column bit map information in any table descriptor provider in a provider list. |
| public void | clearDependencies(LanguageConnectionContext
Compiler state lcc, Dependent the dependent d)Implements org. Erases all of the dependencies the dependent has, be they valid or invalid, of any dependency type. |
| public void | clearDependencies(LanguageConnectionContext
Compiler state lcc, Dependent the dependent d, TransactionController transaction controller tc)Implements org. Erases all of the dependencies the dependent has, be they valid or invalid, of any dependency type. |
| public synchronized void | clearInMemoryDependency(Dependency dy)
Implements org. Clear the specified in memory dependency. |
| private void | |
| public void | copyDependencies(Dependent
the dependent to copy from copy_From, Dependent the dependent to copy to copyTo, boolean only copy persistent dependencies persistentOnly, ContextManager Current ContextManager cm)Implements org. Copy dependencies from one dependent to another. |
| public void | copyDependencies(Dependent
the dependent to copy from copy_From, Dependent the dependent to copy to copyTo, boolean only copy persistent dependencies persistentOnly, ContextManager Current ContextManager cm, TransactionController Transaction Controller tc)Implements org. Copy dependencies from one dependent to another. |
| private void | coreInvalidateFor(Provider
the provider p, int the action causing the invalidation action, LanguageConnectionContext language connection context lcc)A version of invalidateFor that does not provide synchronization among invalidators. |
| public int | Returns: int The number of active dependencies in the system.Implements org. Count the number of active dependencies, both stored and in memory, in the system. |
| private void | dropDependency(LanguageConnectionContext lcc, Dependent
the dependent d, Provider the provider p)drops a single dependency |
| public String | Returns: String The String representationThe action action)Implements org. Returns a string representation of the SQL action, hence no need to internationalize, which is causing the invokation of the Dependency Manager. |
| private List | Returns: List The converted ListThe List of DependencyDescriptors representing
stored dependencies. storedList, Provider The provider if this list is being created
for a list of dependents. Null otherwise. providerForList)Turn a list of DependencyDescriptors into a list of Dependencies. |
| private List | Returns: A list of dependents (possibly empty).the provider p)Returns an enumeration of all dependencies that this provider is supporting for any dependent at all (even invalid ones). |
| private LanguageConnectionContext | Returns: LanguageConnectionContext The LanguageConnectionContext to use.Current ContextManager cm)Returns the LanguageConnectionContext to use. |
| public ProviderInfo[] | getPersistentProviderInfos(Dependent dependent)
Implements org. Get a new array of ProviderInfos representing all the persistent providers for the given dependent. |
| public ProviderInfo[] | getPersistentProviderInfos(ProviderList pl)
Implements org. Get a new array of ProviderInfos representing all the persistent providers from the given list of providers. |
| private List | Returns: A list of providers (possibly empty).the dependent d)Returns a list of all providers that this dependent has (even invalid ones). |
| public void | invalidateFor(Provider
the provider p, int The action causing the invalidate action, LanguageConnectionContext The LanguageConnectionContext lcc)Implements org. mark all dependencies on the named provider as invalid. |
| dd | back to summary |
|---|---|
| private final DataDictionary dd DataDictionary for this database. | |
| dependents | back to summary |
|---|---|
| private final Map<UUID, List<Dependency>> dependents Map of in-memory dependencies for Dependents. In-memory means that one or both of the Dependent or Provider are non-persistent (isPersistent() returns false). Key is the UUID of the Dependent (from getObjectID()). Value is a List containing Dependency objects, each of whihc links the same Dependent to a Provider. Dependency objects in the List are unique. | |
| EMPTY_PROVIDER_INFO | back to summary |
|---|---|
| private static final ProviderInfo[] EMPTY_PROVIDER_INFO | |
| providers | back to summary |
|---|---|
| private final Map<UUID, List<Dependency>> providers Map of in-memory dependencies for Providers. In-memory means that one or both of the Dependent or Provider are non-persistent (isPersistent() returns false). Key is the UUID of the Provider (from getObjectID()). Value is a List containing Dependency objects, each of which links the same Provider to a Dependent. Dependency objects in the List are unique. | |
| BasicDependencyManager | back to summary |
|---|---|
| public BasicDependencyManager(DataDictionary dd) | |
| addDependency | back to summary |
|---|---|
| public void addDependency(Dependent d, Provider p, ContextManager cm) throws StandardException Implements org. adds a dependency from the dependent on the provider. This will be considered to be the default type of dependency, when dependency types show up. Implementations of addDependency should be fast -- performing alot of extra actions to add a dependency would be a detriment.
| |
| addDependency | back to summary |
|---|---|
| private void addDependency(Dependent d, Provider p, ContextManager cm, TransactionController tc) throws StandardException Adds the dependency to the data dictionary or the in-memory dependency map. The action taken is detmermined by whether the dependent and/or the provider are persistent.
| |
| addDependencyToTable | back to summary |
|---|---|
| private boolean addDependencyToTable(Map<UUID, List<Dependency>> table, UUID key, Dependency dy) Add a new dependency to the specified table if it does not already exist in that table.
| |
| addInMemoryDependency | back to summary |
|---|---|
| private synchronized void addInMemoryDependency(Dependent d, Provider p, ContextManager cm) throws StandardException Adds the dependency as an in-memory dependency.
| |
| addStoredDependency | back to summary |
|---|---|
| private void addStoredDependency(Dependent d, Provider p, ContextManager cm, TransactionController tc) throws StandardException Adds the dependency as a stored dependency. We expect that transactional locking (in the data dictionary) is enough to protect us from concurrent changes when adding stored dependencies. Adding synchronization here and accessing the data dictionary (which is transactional) may cause deadlocks.
| |
| clearColumnInfoInProviders | back to summary |
|---|---|
| public void clearColumnInfoInProviders(ProviderList pl) throws StandardException Implements org. Doc from org. Clear the in memory column bit map information in any table descriptor provider in a provider list. This function needs to be called before the table descriptor is reused as provider in column dependency. For example, this happens in "create publication" statement with target-only DDL where more than one views are defined and they all reference one table.
| |
| clearDependencies | back to summary |
|---|---|
| public void clearDependencies(LanguageConnectionContext lcc, Dependent d) throws StandardException Implements org. Erases all of the dependencies the dependent has, be they valid or invalid, of any dependency type. This action is usually performed as the first step in revalidating a dependent; it first erases all the old dependencies, then revalidates itself generating a list of new dependencies, and then marks itself valid if all its new dependencies are valid. There might be a future want to clear all dependencies for a particular provider, e.g. when destroying the provider. However, at present, they are assumed to stick around and it is the responsibility of the dependent to erase them when revalidating against the new version of the provider. clearDependencies will delete dependencies if they are stored; the delete is finalized at the next commit.
| |
| clearDependencies | back to summary |
|---|---|
| public void clearDependencies(LanguageConnectionContext lcc, Dependent d, TransactionController tc) throws StandardException Implements org. Doc from org. Erases all of the dependencies the dependent has, be they valid or invalid, of any dependency type. This action is usually performed as the first step in revalidating a dependent; it first erases all the old dependencies, then revalidates itself generating a list of new dependencies, and then marks itself valid if all its new dependencies are valid. There might be a future want to clear all dependencies for a particular provider, e.g. when destroying the provider. However, at present, they are assumed to stick around and it is the responsibility of the dependent to erase them when revalidating against the new version of the provider. clearDependencies will delete dependencies if they are stored; the delete is finalized at the next commit.
| |
| clearInMemoryDependency | back to summary |
|---|---|
| public synchronized void clearInMemoryDependency(Dependency dy) Implements org. Clear the specified in memory dependency. This is useful for clean-up when an exception occurs. (We clear all in-memory dependencies added in the current StatementContext.) | |
| clearProviderDependency | back to summary |
|---|---|
| private void clearProviderDependency(UUID p, Dependency d) removes a dependency for a given provider. assumes that the dependent removal is being dealt with elsewhere. Won't assume that the dependent only appears once in the list. | |
| copyDependencies | back to summary |
|---|---|
| public void copyDependencies(Dependent copy_From, Dependent copyTo, boolean persistentOnly, ContextManager cm) throws StandardException Implements org. Copy dependencies from one dependent to another.
| |
| copyDependencies | back to summary |
|---|---|
| public void copyDependencies(Dependent copy_From, Dependent copyTo, boolean persistentOnly, ContextManager cm, TransactionController tc) throws StandardException Implements org. Doc from org. Copy dependencies from one dependent to another.
| |
| coreInvalidateFor | back to summary |
|---|---|
| private void coreInvalidateFor(Provider p, int action, LanguageConnectionContext lcc) throws StandardException A version of invalidateFor that does not provide synchronization among invalidators.
| |
| countDependencies | back to summary |
|---|---|
| public int countDependencies() throws StandardException Implements org. Count the number of active dependencies, both stored and in memory, in the system.
| |
| dropDependency | back to summary |
|---|---|
| private void dropDependency(LanguageConnectionContext lcc, Dependent d, Provider p) throws StandardException drops a single dependency
| |
| getActionString | back to summary |
|---|---|
| public String getActionString(int action) Implements org. Returns a string representation of the SQL action, hence no need to internationalize, which is causing the invokation of the Dependency Manager.
| |
| getDependencyDescriptorList | back to summary |
|---|---|
| private List Turn a list of DependencyDescriptors into a list of Dependencies.
| |
| getDependents | back to summary |
|---|---|
| private List Returns an enumeration of all dependencies that this provider is supporting for any dependent at all (even invalid ones). Includes all dependency types.
| |
| getLanguageConnectionContext | back to summary |
|---|---|
| private LanguageConnectionContext getLanguageConnectionContext(ContextManager cm) Returns the LanguageConnectionContext to use.
| |
| getPersistentProviderInfos | back to summary |
|---|---|
| public ProviderInfo[] getPersistentProviderInfos(Dependent dependent) throws StandardException Implements org. Doc from org. Get a new array of ProviderInfos representing all the persistent providers for the given dependent.
| |
| getPersistentProviderInfos | back to summary |
|---|---|
| public ProviderInfo[] getPersistentProviderInfos(ProviderList pl) throws StandardException Implements org. Doc from org. Get a new array of ProviderInfos representing all the persistent providers from the given list of providers.
| |
| getProviders | back to summary |
|---|---|
| private List Returns a list of all providers that this dependent has (even invalid ones). Includes all dependency types.
| |
| invalidateFor | back to summary |
|---|---|
| public void invalidateFor(Provider p, int action, LanguageConnectionContext lcc) throws StandardException Implements org. mark all dependencies on the named provider as invalid. When invalidation types show up, this will use the default invalidation type. The dependencies will still exist once they are marked invalid; clearDependencies should be used to remove dependencies that a dependent has or provider gives. Implementations of this can take a little time, but are not really expected to recompile things against any changes made to the provider that caused the invalidation. The dependency system makes no guarantees about the state of the provider -- implementations can call this before or after actually changing the provider to its new state. Implementations should throw StandardException if the invalidation should be disallowed.
| |