Search in sources :

Example 1 with CacheFactory

use of org.apache.derby.iapi.services.cache.CacheFactory in project derby by apache.

the class DataDictionaryImpl method getPermissionsCache.

private CacheManager getPermissionsCache() throws StandardException {
    if (permissionsCache == null) {
        CacheFactory cf = (CacheFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.CacheFactory);
        LanguageConnectionContext lcc = getLCC();
        TransactionController tc = lcc.getTransactionExecute();
        permissionsCacheSize = PropertyUtil.getServiceInt(tc, Property.LANG_PERMISSIONS_CACHE_SIZE, 40, /* min value */
        Integer.MAX_VALUE, permissionsCacheSize);
        permissionsCache = cf.newCacheManager(this, "PermissionsCache", permissionsCacheSize, permissionsCacheSize);
    }
    return permissionsCache;
}
Also used : LanguageConnectionContext(org.apache.derby.iapi.sql.conn.LanguageConnectionContext) CacheFactory(org.apache.derby.iapi.services.cache.CacheFactory) TransactionController(org.apache.derby.iapi.store.access.TransactionController)

Example 2 with CacheFactory

use of org.apache.derby.iapi.services.cache.CacheFactory in project derby by apache.

the class DataDictionaryImpl method boot.

/**
 * Start-up method for this instance of the data dictionary.
 *
 * @param startParams	The start-up parameters
 *
 *	@exception StandardException	Thrown if the module fails to start
 */
public void boot(boolean create, Properties startParams) throws StandardException {
    softwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_15);
    startupParameters = startParams;
    uuidFactory = getMonitor().getUUIDFactory();
    engineType = Monitor.getEngineType(startParams);
    // Set the collation type of system schemas before we start loading
    // built-in schemas's SchemaDescriptor(s). This is because
    // SchemaDescriptor will look to DataDictionary to get the correct
    // collation type for themselves. We can't load SD for SESSION schema
    // just yet because we do not know the collation type for user schemas
    // yet. We will know the right collation for user schema little later
    // in this boot method.
    collationTypeOfSystemSchemas = StringDataValue.COLLATION_TYPE_UCS_BASIC;
    getBuiltinSystemSchemas();
    // REMIND: actually, we're supposed to get the DataValueFactory
    // out of the connection context...this is a bit of a shortcut.
    // We get the DataValueFactory early in order to help bootstrap the system catalogs.
    LanguageConnectionFactory langConnFactory = (LanguageConnectionFactory) bootServiceModule(create, this, LanguageConnectionFactory.MODULE, startParams);
    dvf = langConnFactory.getDataValueFactory();
    exFactory = (ExecutionFactory) bootServiceModule(create, this, ExecutionFactory.MODULE, startParams);
    // initailze the arrays of core and noncore tables
    initializeCatalogInfo();
    // indicate that we are in the process of booting
    booting = true;
    // set only if child class hasn't overriden this already
    if (dataDescriptorGenerator == null) {
        dataDescriptorGenerator = new DataDescriptorGenerator(this);
    }
    if (!create) {
        // SYSTABLES
        coreInfo[SYSTABLES_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSTABLES_ID, true));
        coreInfo[SYSTABLES_CORE_NUM].setIndexConglomerate(SYSTABLESRowFactory.SYSTABLES_INDEX1_ID, getBootParameter(startParams, CFG_SYSTABLES_INDEX1_ID, true));
        coreInfo[SYSTABLES_CORE_NUM].setIndexConglomerate(SYSTABLESRowFactory.SYSTABLES_INDEX2_ID, getBootParameter(startParams, CFG_SYSTABLES_INDEX2_ID, true));
        // SYSCOLUMNS
        coreInfo[SYSCOLUMNS_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSCOLUMNS_ID, true));
        coreInfo[SYSCOLUMNS_CORE_NUM].setIndexConglomerate(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX1_ID, getBootParameter(startParams, CFG_SYSCOLUMNS_INDEX1_ID, true));
        // 2nd syscolumns index added in Xena, hence may not be there
        coreInfo[SYSCOLUMNS_CORE_NUM].setIndexConglomerate(SYSCOLUMNSRowFactory.SYSCOLUMNS_INDEX2_ID, getBootParameter(startParams, CFG_SYSCOLUMNS_INDEX2_ID, false));
        // SYSCONGLOMERATES
        coreInfo[SYSCONGLOMERATES_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSCONGLOMERATES_ID, true));
        coreInfo[SYSCONGLOMERATES_CORE_NUM].setIndexConglomerate(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX1_ID, getBootParameter(startParams, CFG_SYSCONGLOMERATES_INDEX1_ID, true));
        coreInfo[SYSCONGLOMERATES_CORE_NUM].setIndexConglomerate(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX2_ID, getBootParameter(startParams, CFG_SYSCONGLOMERATES_INDEX2_ID, true));
        coreInfo[SYSCONGLOMERATES_CORE_NUM].setIndexConglomerate(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX3_ID, getBootParameter(startParams, CFG_SYSCONGLOMERATES_INDEX3_ID, true));
        // SYSSCHEMAS
        coreInfo[SYSSCHEMAS_CORE_NUM].setHeapConglomerate(getBootParameter(startParams, CFG_SYSSCHEMAS_ID, true));
        coreInfo[SYSSCHEMAS_CORE_NUM].setIndexConglomerate(SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX1_ID, getBootParameter(startParams, CFG_SYSSCHEMAS_INDEX1_ID, true));
        coreInfo[SYSSCHEMAS_CORE_NUM].setIndexConglomerate(SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX2_ID, getBootParameter(startParams, CFG_SYSSCHEMAS_INDEX2_ID, true));
    }
    String value = startParams.getProperty(Property.LANG_TD_CACHE_SIZE);
    tdCacheSize = PropertyUtil.intPropertyValue(Property.LANG_TD_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_TD_CACHE_SIZE_DEFAULT);
    value = startParams.getProperty(Property.LANG_SPS_CACHE_SIZE);
    stmtCacheSize = PropertyUtil.intPropertyValue(Property.LANG_SPS_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_SPS_CACHE_SIZE_DEFAULT);
    value = startParams.getProperty(Property.LANG_SEQGEN_CACHE_SIZE);
    seqgenCacheSize = PropertyUtil.intPropertyValue(Property.LANG_SEQGEN_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_SEQGEN_CACHE_SIZE_DEFAULT);
    value = startParams.getProperty(Property.LANG_PERMISSIONS_CACHE_SIZE);
    permissionsCacheSize = PropertyUtil.intPropertyValue(Property.LANG_PERMISSIONS_CACHE_SIZE, value, 0, Integer.MAX_VALUE, Property.LANG_PERMISSIONS_CACHE_SIZE_DEFAULT);
    // See if automatic index statistics update is disabled through a
    // system wide property. May be overridden by a database specific
    // property later on.
    // The default is that automatic index statistics update is enabled.
    indexStatsUpdateDisabled = !PropertyUtil.getSystemBoolean(Property.STORAGE_AUTO_INDEX_STATS, true);
    // See if we should enable logging of index stats activities.
    indexStatsUpdateLogging = PropertyUtil.getSystemBoolean(Property.STORAGE_AUTO_INDEX_STATS_LOGGING);
    // See if we should enable tracing of index stats activities.
    indexStatsUpdateTracing = PropertyUtil.getSystemProperty(Property.STORAGE_AUTO_INDEX_STATS_TRACING, "off");
    /*
		 * data dictionary contexts are only associated with connections.
		 * we have to look for the basic data dictionary, as there is
		 * no connection, and thus no context stack yet.
		 */
    /*
		 * Get the table descriptor cache.
		 */
    CacheFactory cf = (CacheFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.CacheFactory);
    OIDTdCache = cf.newCacheManager(this, "TableDescriptorOIDCache", tdCacheSize, tdCacheSize);
    nameTdCache = cf.newCacheManager(this, "TableDescriptorNameCache", tdCacheSize, tdCacheSize);
    if (stmtCacheSize > 0) {
        spsNameCache = cf.newCacheManager(this, "SPSNameDescriptorCache", stmtCacheSize, stmtCacheSize);
        spsIdHash = new Hashtable<UUID, SPSDescriptor>(stmtCacheSize);
    // spsTextHash = new Hashtable(stmtCacheSize);
    }
    sequenceGeneratorCache = cf.newCacheManager(this, "SequenceGeneratorCache", seqgenCacheSize, seqgenCacheSize);
    sequenceIDs = new HashMap<String, HashMap<String, String>>();
    /* Get the object to coordinate cache transitions */
    cacheCoordinator = new ShExLockable();
    /* Get AccessFactory in order to transaction stuff */
    af = (AccessFactory) findServiceModule(this, AccessFactory.MODULE);
    /* Get the lock factory */
    lockFactory = af.getLockFactory();
    /*
		 * now we need to setup a context stack for the database creation work.
		 * We assume the System boot process has created a context
		 * manager already, but not that contexts we need are there.
		 */
    ContextService csf = getContextService();
    ContextManager cm = csf.getCurrentContextManager();
    if (SanityManager.DEBUG)
        SanityManager.ASSERT((cm != null), "Failed to get current ContextManager");
    // RESOLVE other non-StandardException errors.
    bootingTC = null;
    try {
        // Get a transaction controller. This has the side effect of
        // creating a transaction context if there isn't one already.
        bootingTC = af.getTransaction(cm);
        /*
				We need an execution context so that we can generate rows
				REMIND: maybe only for create case?
			 */
        exFactory.newExecutionContext(cm);
        DataDescriptorGenerator ddg = getDataDescriptorGenerator();
        // We should set the user schema collation type here now because
        // later on, we are going to create user schema APP. By the time any
        // user schema gets created, we should have the correct collation
        // type set for such schemas to use. For this reason, don't remove
        // the following if else statement and don't move it later in this
        // method.
        String userDefinedCollation;
        if (create) {
            // Get the collation attribute from the JDBC url. It can only
            // have one of 2 possible values - UCS_BASIC or TERRITORY_BASED
            // This attribute can only be specified at database create time.
            // The attribute value has already been verified in DVF.boot and
            // hence we can be assured that the attribute value if provided
            // is either UCS_BASIC or TERRITORY_BASED. If none provided,
            // then we will take it to be the default which is UCS_BASIC.
            userDefinedCollation = startParams.getProperty(Attribute.COLLATION, Property.UCS_BASIC_COLLATION);
            bootingTC.setProperty(Property.COLLATION, userDefinedCollation, true);
        } else {
            userDefinedCollation = startParams.getProperty(Property.COLLATION, Property.UCS_BASIC_COLLATION);
        }
        // Initialize the collation type of user schemas by looking at
        // collation property/attribute.
        collationTypeOfUserSchemas = DataTypeDescriptor.getCollationType(userDefinedCollation);
        if (SanityManager.DEBUG)
            SanityManager.ASSERT((collationTypeOfUserSchemas != -1), "Invalid collation type: " + userDefinedCollation);
        // Now is also a good time to create schema descriptor for global
        // temporary tables. Since this is a user schema, it should use the
        // collation type associated with user schemas. Since we just
        // finished setting up the collation type of user schema, it is
        // safe to create user SchemaDescriptor(s) now.
        declaredGlobalTemporaryTablesSchemaDesc = newDeclaredGlobalTemporaryTablesSchemaDesc(SchemaDescriptor.STD_DECLARED_GLOBAL_TEMPORARY_TABLES_SCHEMA_NAME);
        boolean nativeAuthenticationEnabled = PropertyUtil.nativeAuthenticationEnabled(startParams);
        if (create) {
            String userName = IdUtil.getUserNameFromURLProps(startParams);
            authorizationDatabaseOwner = IdUtil.getUserAuthorizationId(userName);
            HashSet<String> newlyCreatedRoutines = new HashSet<String>();
            // log the current dictionary version. Moving this statement to top as SYSCOLUMNSRowFactory
            // queries the version info. SEE Derby-6904
            dictionaryVersion = softwareVersion;
            // create any required tables.
            createDictionaryTables(startParams, bootingTC, ddg);
            // create procedures for network server metadata
            create_SYSIBM_procedures(bootingTC, newlyCreatedRoutines);
            // create metadata sps statement required for network server
            createSystemSps(bootingTC);
            // create the SYSCS_UTIL system procedures)
            create_SYSCS_procedures(bootingTC, newlyCreatedRoutines);
            // now grant execute permission on some of these routines
            grantPublicAccessToSystemRoutines(newlyCreatedRoutines, bootingTC, authorizationDatabaseOwner);
            /* Set properties for current and create time 
				 * DataDictionary versions.
				 */
            bootingTC.setProperty(DataDictionary.CORE_DATA_DICTIONARY_VERSION, dictionaryVersion, true);
            bootingTC.setProperty(DataDictionary.CREATE_DATA_DICTIONARY_VERSION, dictionaryVersion, true);
            // 
            if (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY)) {
                bootingTC.setProperty(Property.SQL_AUTHORIZATION_PROPERTY, "true", true);
            }
            if (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY) || nativeAuthenticationEnabled) {
                usesSqlAuthorization = true;
            }
            // Set default hash algorithm used to protect passwords stored
            // in the database for BUILTIN and NATIVE authentication.
            bootingTC.setProperty(Property.AUTHENTICATION_BUILTIN_ALGORITHM, findDefaultBuiltinAlgorithm(), false);
        } else {
            // Get the ids for non-core tables
            loadDictionaryTables(bootingTC, startParams);
            // See if index stats update is disabled by a database prop.
            String dbIndexStatsUpdateAuto = PropertyUtil.getDatabaseProperty(bootingTC, Property.STORAGE_AUTO_INDEX_STATS);
            if (dbIndexStatsUpdateAuto != null) {
                indexStatsUpdateDisabled = !Boolean.valueOf(dbIndexStatsUpdateAuto).booleanValue();
            }
            String dbEnableIndexStatsLogging = PropertyUtil.getDatabaseProperty(bootingTC, Property.STORAGE_AUTO_INDEX_STATS_LOGGING);
            if (dbEnableIndexStatsLogging != null) {
                indexStatsUpdateLogging = Boolean.valueOf(dbEnableIndexStatsLogging).booleanValue();
            }
            String dbEnableIndexStatsTracing = PropertyUtil.getDatabaseProperty(bootingTC, Property.STORAGE_AUTO_INDEX_STATS_TRACING);
            if (dbEnableIndexStatsTracing != null) {
                if (!(dbEnableIndexStatsTracing.equalsIgnoreCase("off") || dbEnableIndexStatsTracing.equalsIgnoreCase("log") || dbEnableIndexStatsTracing.equalsIgnoreCase("stdout") || dbEnableIndexStatsTracing.equalsIgnoreCase("both"))) {
                    indexStatsUpdateTracing = "off";
                } else {
                    indexStatsUpdateTracing = dbEnableIndexStatsTracing;
                }
            }
            String sqlAuth = PropertyUtil.getDatabaseProperty(bootingTC, Property.SQL_AUTHORIZATION_PROPERTY);
            // Feature compatibility check.
            if (Boolean.valueOf(startParams.getProperty(Attribute.SOFT_UPGRADE_NO_FEATURE_CHECK)).booleanValue()) {
                // database owner check at a hard upgrade.
                if (dictionaryVersion.majorVersionNumber >= DataDictionary.DD_VERSION_DERBY_10_2) {
                    usesSqlAuthorization = Boolean.valueOf(sqlAuth).booleanValue() || nativeAuthenticationEnabled;
                }
            } else {
                if (Boolean.valueOf(sqlAuth).booleanValue() || nativeAuthenticationEnabled) {
                    // SQL authorization requires 10.2 or higher database
                    checkVersion(DataDictionary.DD_VERSION_DERBY_10_2, "sqlAuthorization");
                    usesSqlAuthorization = true;
                }
            }
        }
        if (SanityManager.DEBUG)
            SanityManager.ASSERT((authorizationDatabaseOwner != null), "Failed to get Database Owner authorization");
        /* Commit & destroy the create database */
        bootingTC.commit();
        // done with ctx
        cm.getContext(ExecutionContext.CONTEXT_ID).popMe();
    } finally {
        if (bootingTC != null) {
            // gets rid of the transaction context
            bootingTC.destroy();
            bootingTC = null;
        }
    }
    setDependencyManager();
    booting = false;
}
Also used : ContextService(org.apache.derby.iapi.services.context.ContextService) ShExLockable(org.apache.derby.iapi.services.locks.ShExLockable) HashMap(java.util.HashMap) DataDescriptorGenerator(org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator) LanguageConnectionFactory(org.apache.derby.iapi.sql.conn.LanguageConnectionFactory) ContextManager(org.apache.derby.iapi.services.context.ContextManager) CacheFactory(org.apache.derby.iapi.services.cache.CacheFactory) UUID(org.apache.derby.catalog.UUID) SPSDescriptor(org.apache.derby.iapi.sql.dictionary.SPSDescriptor) HashSet(java.util.HashSet)

Example 3 with CacheFactory

use of org.apache.derby.iapi.services.cache.CacheFactory in project derby by apache.

the class BCJava method boot.

// 
// ModuleControl interface
// 
/**
 *		Start this module. We need a read/write version of the class utilities
 *
 *		@exception StandardException standard Derby policy
 */
public void boot(boolean create, Properties properties) throws StandardException {
    CacheFactory cf = (CacheFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.CacheFactory);
    /*
		** The initial and maximum cache sizes are based on experiments
		** that I did with some of the language tests.  I found that
		** the size quickly grew to about 40, then continued to grow
		** slowly after that.
		**
		**			-	Jeff
		*/
    vmTypeIdCache = cf.newCacheManager(this, "VMTypeIdCache", 64, 256);
}
Also used : CacheFactory(org.apache.derby.iapi.services.cache.CacheFactory)

Example 4 with CacheFactory

use of org.apache.derby.iapi.services.cache.CacheFactory in project derby by apache.

the class GenericLanguageConnectionFactory method boot.

/**
 * Start-up method for this instance of the language connection factory.
 * Note these are expected to be booted relative to a Database.
 *
 * @param startParams	The start-up parameters (ignored in this case)
 *
 * @exception StandardException	Thrown on failure to boot
 */
public void boot(boolean create, Properties startParams) throws StandardException {
    // The following call to Monitor to get DVF is going to get the already
    // booted DVF (DVF got booted by BasicDatabase's boot method.
    // BasicDatabase also set the correct Locale in the DVF. There after,
    // DVF with correct Locale is available to rest of the Derby code.
    dvf = (DataValueFactory) bootServiceModule(create, this, org.apache.derby.shared.common.reference.ClassName.DataValueFactory, startParams);
    javaFactory = (JavaFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.JavaFactory);
    uuidFactory = getMonitor().getUUIDFactory();
    classFactory = (ClassFactory) getServiceModule(this, org.apache.derby.shared.common.reference.Module.ClassFactory);
    if (classFactory == null)
        classFactory = (ClassFactory) findSystemModule(org.apache.derby.shared.common.reference.Module.ClassFactory);
    // set the property validation module needed to do propertySetCallBack
    // register and property validation
    setValidation();
    ef = (ExecutionFactory) bootServiceModule(create, this, ExecutionFactory.MODULE, startParams);
    of = (OptimizerFactory) bootServiceModule(create, this, OptimizerFactory.MODULE, startParams);
    tcf = (TypeCompilerFactory) startSystemModule(TypeCompilerFactory.MODULE);
    // If the system supports statement caching boot the CacheFactory module.
    int cacheSize = statementCacheSize(startParams);
    if (cacheSize > 0) {
        CacheFactory cacheFactory = (CacheFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.CacheFactory);
        singleStatementCache = cacheFactory.newCacheManager(this, "StatementCache", cacheSize / 4, cacheSize);
        // Start a management bean for the statement cache to allow
        // monitoring through JMX, if it is available and enabled.
        DataFactory df = (DataFactory) findServiceModule(this, DataFactory.MODULE);
        singleStatementCache.registerMBean(df.getRootDirectory());
    }
}
Also used : ClassFactory(org.apache.derby.iapi.services.loader.ClassFactory) DataFactory(org.apache.derby.iapi.store.raw.data.DataFactory) CacheFactory(org.apache.derby.iapi.services.cache.CacheFactory)

Example 5 with CacheFactory

use of org.apache.derby.iapi.services.cache.CacheFactory in project derby by apache.

the class BaseDataFileFactory method boot.

public void boot(boolean create, Properties startParams) throws StandardException {
    jbmsVersion = getMonitor().getEngineVersion();
    jvmVersion = buildJvmVersion();
    osInfo = buildOSinfo();
    jarCPath = jarClassPath(getClass());
    dataDirectory = startParams.getProperty(PersistentService.ROOT);
    UUIDFactory uf = getMonitor().getUUIDFactory();
    identifier = uf.createUUID();
    PersistentService ps = getMonitor().getServiceType(this);
    try {
        storageFactory = ps.getStorageFactoryInstance(true, dataDirectory, startParams.getProperty(Property.STORAGE_TEMP_DIRECTORY, PropertyUtil.getSystemProperty(Property.STORAGE_TEMP_DIRECTORY)), identifier.toANSIidentifier());
    } catch (IOException ioe) {
        if (create) {
            throw StandardException.newException(SQLState.SERVICE_DIRECTORY_CREATE_ERROR, ioe, dataDirectory);
        } else {
            throw StandardException.newException(SQLState.DATABASE_NOT_FOUND, ioe, dataDirectory);
        }
    }
    // you can't encrypt a database if the Lucene plugin is loaded
    if (luceneLoaded()) {
        String encryptionProp = startParams.getProperty(Attribute.DATA_ENCRYPTION);
        if ((encryptionProp != null) && "TRUE".equals(encryptionProp.toUpperCase())) {
            throw StandardException.newException(SQLState.LUCENE_ENCRYPTED_DB);
        }
    }
    if (storageFactory instanceof WritableStorageFactory)
        writableStorageFactory = (WritableStorageFactory) storageFactory;
    actionCode = BOOT_ACTION;
    try {
        AccessController.doPrivileged(this);
    } catch (PrivilegedActionException pae) {
    // BOOT_ACTION does not throw any exceptions.
    }
    String value = startParams.getProperty(Property.FORCE_DATABASE_LOCK, PropertyUtil.getSystemProperty(Property.FORCE_DATABASE_LOCK));
    throwDBlckException = Boolean.valueOf((value != null ? value.trim() : value)).booleanValue();
    if (// read only db, not interested in filelock
    !isReadOnly())
        getJBMSLockOnDB(identifier, uf, dataDirectory);
    // If the database is being restored/created from backup
    // the restore the data directory(seg*) from backup
    String restoreFrom = null;
    restoreFrom = startParams.getProperty(Attribute.CREATE_FROM);
    if (restoreFrom == null)
        restoreFrom = startParams.getProperty(Attribute.RESTORE_FROM);
    if (restoreFrom == null)
        restoreFrom = startParams.getProperty(Attribute.ROLL_FORWARD_RECOVERY_FROM);
    if (restoreFrom != null) {
        try {
            // restoreFrom and createFrom operations also need to know if database
            // is encrypted
            String dataEncryption = startParams.getProperty(Attribute.DATA_ENCRYPTION);
            databaseEncrypted = Boolean.valueOf(dataEncryption).booleanValue();
            restoreDataDirectory(restoreFrom);
        } catch (StandardException se) {
            releaseJBMSLockOnDB();
            throw se;
        }
    }
    logMsg(LINE);
    String messageID = (isReadOnly()) ? MessageId.STORE_BOOT_MSG_READ_ONLY : MessageId.STORE_BOOT_MSG;
    boolean logBootTrace = Boolean.valueOf(startParams.getProperty(Property.LOG_BOOT_TRACE, PropertyUtil.getSystemProperty(Property.LOG_BOOT_TRACE))).booleanValue();
    logMsg(new Date() + MessageService.getTextMessage(messageID, jbmsVersion, identifier, dataDirectory, // cast to Object so we get object hash code
    (Object) this.getClass().getClassLoader(), jarCPath));
    // Log the JVM version info
    logMsg(jvmVersion);
    // Log the OS info
    logMsg(osInfo);
    // Log derby.system.home It will have null value if user didn't set it
    logMsg(Property.SYSTEM_HOME_PROPERTY + "=" + PropertyUtil.getSystemProperty(Property.SYSTEM_HOME_PROPERTY));
    // Log properties related to redirection of derby.log
    String target = PropertyUtil.getSystemProperty(Property.ERRORLOG_STYLE_PROPERTY);
    if (target != null)
        logMsg(Property.ERRORLOG_STYLE_PROPERTY + "=" + target);
    target = PropertyUtil.getSystemProperty(Property.ERRORLOG_FILE_PROPERTY);
    if (target != null)
        logMsg(Property.ERRORLOG_FILE_PROPERTY + "=" + target);
    target = PropertyUtil.getSystemProperty(Property.ERRORLOG_METHOD_PROPERTY);
    if (target != null)
        logMsg(Property.ERRORLOG_METHOD_PROPERTY + "=" + target);
    target = PropertyUtil.getSystemProperty(Property.ERRORLOG_FIELD_PROPERTY);
    if (target != null)
        logMsg(Property.ERRORLOG_FIELD_PROPERTY + "=" + target);
    if (logBootTrace)
        Monitor.logThrowable(new Throwable("boot trace"));
    uf = null;
    CacheFactory cf = (CacheFactory) startSystemModule(org.apache.derby.shared.common.reference.Module.CacheFactory);
    // Initialize the page cache
    int pageCacheSize = getIntParameter(RawStoreFactory.PAGE_CACHE_SIZE_PARAMETER, null, RawStoreFactory.PAGE_CACHE_SIZE_DEFAULT, RawStoreFactory.PAGE_CACHE_SIZE_MINIMUM, RawStoreFactory.PAGE_CACHE_SIZE_MAXIMUM);
    pageCache = cf.newCacheManager(this, "PageCache", pageCacheSize / 2, pageCacheSize);
    // Initialize the container cache
    int fileCacheSize = getIntParameter(RawStoreFactory.CONTAINER_CACHE_SIZE_PARAMETER, null, RawStoreFactory.CONTAINER_CACHE_SIZE_DEFAULT, RawStoreFactory.CONTAINER_CACHE_SIZE_MINIMUM, RawStoreFactory.CONTAINER_CACHE_SIZE_MAXIMUM);
    containerCache = cf.newCacheManager(this, "ContainerCache", fileCacheSize / 2, fileCacheSize);
    // Register MBeans that allow users to monitor the page cache
    // and the container cache.
    pageCache.registerMBean(dataDirectory);
    containerCache.registerMBean(dataDirectory);
    if (create) {
        String noLog = startParams.getProperty(Property.CREATE_WITH_NO_LOG);
        inCreateNoLog = (noLog != null && Boolean.valueOf(noLog).booleanValue());
    }
    droppedTableStubInfo = new Hashtable<LogInstant, Object[]>();
    // writes during checkpoint
    if (Property.DURABILITY_TESTMODE_NO_SYNC.equalsIgnoreCase(PropertyUtil.getSystemProperty(Property.DURABILITY_PROPERTY))) {
        // - disable syncing of data during checkpoint.
        dataNotSyncedAtCheckpoint = true;
        // log message stating that derby.system.durability
        // is set to a mode, where syncs wont be forced and the
        // possible consequences of setting this mode
        Monitor.logMessage(MessageService.getTextMessage(MessageId.STORE_DURABILITY_TESTMODE_NO_SYNC, Property.DURABILITY_PROPERTY, Property.DURABILITY_TESTMODE_NO_SYNC));
    } else if (Performance.MEASURE) {
        // development build only feature, must by hand set the
        // Performance.MEASURE variable and rebuild.  Useful during
        // development to compare/contrast effect of syncing, release
        // users can use the above relaxed durability option to disable
        // all syncing.
        // debug only flag - disable syncing of data during checkpoint.
        dataNotSyncedAtCheckpoint = PropertyUtil.getSystemBoolean(Property.STORAGE_DATA_NOT_SYNCED_AT_CHECKPOINT);
        if (dataNotSyncedAtCheckpoint)
            Monitor.logMessage("Warning: " + Property.STORAGE_DATA_NOT_SYNCED_AT_CHECKPOINT + "set to true.");
    }
    fileHandler = new RFResource(this);
}
Also used : LogInstant(org.apache.derby.iapi.store.raw.log.LogInstant) PrivilegedActionException(java.security.PrivilegedActionException) UUIDFactory(org.apache.derby.iapi.services.uuid.UUIDFactory) WritableStorageFactory(org.apache.derby.io.WritableStorageFactory) IOException(java.io.IOException) Date(java.util.Date) StandardException(org.apache.derby.shared.common.error.StandardException) PersistentService(org.apache.derby.iapi.services.monitor.PersistentService) CacheFactory(org.apache.derby.iapi.services.cache.CacheFactory)

Aggregations

CacheFactory (org.apache.derby.iapi.services.cache.CacheFactory)6 IOException (java.io.IOException)1 PrivilegedActionException (java.security.PrivilegedActionException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 UUID (org.apache.derby.catalog.UUID)1 ContextManager (org.apache.derby.iapi.services.context.ContextManager)1 ContextService (org.apache.derby.iapi.services.context.ContextService)1 ClassFactory (org.apache.derby.iapi.services.loader.ClassFactory)1 ShExLockable (org.apache.derby.iapi.services.locks.ShExLockable)1 PersistentService (org.apache.derby.iapi.services.monitor.PersistentService)1 UUIDFactory (org.apache.derby.iapi.services.uuid.UUIDFactory)1 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)1 LanguageConnectionFactory (org.apache.derby.iapi.sql.conn.LanguageConnectionFactory)1 DataDescriptorGenerator (org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator)1 SPSDescriptor (org.apache.derby.iapi.sql.dictionary.SPSDescriptor)1 TransactionController (org.apache.derby.iapi.store.access.TransactionController)1 DataFactory (org.apache.derby.iapi.store.raw.data.DataFactory)1 LogInstant (org.apache.derby.iapi.store.raw.log.LogInstant)1