ExScratchFileOptions *genScratchFileOptions(Generator *generator) { Space *space = generator->getSpace(); ExScratchFileOptions *result = new(space) ExScratchFileOptions; // --------------------------------------------------------------------- // Compile the defaults table entries into internal format // --------------------------------------------------------------------- NAString sDisks; NAString xDisks; NAString pDisks; enum DefaultConstants sEnum; enum DefaultConstants xEnum; enum DefaultConstants pEnum; const char *sDefaultName; const char *xDefaultName; const char *pDefaultName; // use two different sets of defaults, dependent on the platform sEnum = SCRATCH_DRIVE_LETTERS; xEnum = SCRATCH_DRIVE_LETTERS_EXCLUDED; pEnum = SCRATCH_DRIVE_LETTERS_PREFERRED; sDefaultName = "SCRATCH_DRIVE_LETTERS"; xDefaultName = "SCRATCH_DRIVE_LETTERS_EXCLUDED"; pDefaultName = "SCRATCH_DRIVE_LETTERS_PREFERRED"; // look up defaults CmpCommon::getDefault(sEnum,sDisks,0); CmpCommon::getDefault(xEnum,xDisks,0); CmpCommon::getDefault(pEnum,pDisks,0); // convert into executor structures and give warnings for syntax errors Lng32 numEntries; ExScratchDiskDrive *l; l = genScratchDriveList( sDisks, numEntries, generator, sDefaultName); result->setSpecifiedScratchDisks(l,numEntries); l = genScratchDriveList( xDisks, numEntries, generator, xDefaultName); result->setExcludedScratchDisks(l,numEntries); l = genScratchDriveList( pDisks, numEntries, generator, pDefaultName); result->setPreferredScratchDisks(l,numEntries); NADefaults &defs = ActiveSchemaDB()->getDefaults(); result->setScratchMgmtOption((Lng32)defs.getAsULong(SCRATCH_MGMT_OPTION)); result->setScratchMaxOpensHash((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_HASH)); result->setScratchMaxOpensSort((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_SORT)); if(CmpCommon::getDefault(SCRATCH_PREALLOCATE_EXTENTS) == DF_ON) result->setScratchPreallocateExtents(TRUE); if(CmpCommon::getDefault(SCRATCH_DISK_LOGGING) == DF_ON) result->setScratchDiskLogging(TRUE); return result; }
ExScratchFileOptions *genScratchFileOptions(Generator *generator) { Space *space = generator->getSpace(); ExScratchFileOptions *result = new(space) ExScratchFileOptions; // --------------------------------------------------------------------- // Compile the defaults table entries into internal format // --------------------------------------------------------------------- NAString sDirs; enum DefaultConstants sEnum; const char *sDefaultName; sEnum = SCRATCH_DIRS; sDefaultName = "SCRATCH_DIRS"; // look up defaults CmpCommon::getDefault(sEnum,sDirs,0); // convert into executor structures and give warnings for syntax errors Lng32 numEntries; ExScratchDiskDrive *l; l = genScratchDisks(sDirs, numEntries, generator, sDefaultName); result->setSpecifiedScratchDirs(l,numEntries); NADefaults &defs = ActiveSchemaDB()->getDefaults(); result->setScratchMgmtOption((Lng32)defs.getAsULong(SCRATCH_MGMT_OPTION)); result->setScratchMaxOpensHash((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_HASH)); result->setScratchMaxOpensSort((Lng32)defs.getAsULong(SCRATCH_MAX_OPENS_SORT)); if(CmpCommon::getDefault(SCRATCH_PREALLOCATE_EXTENTS) == DF_ON) result->setScratchPreallocateExtents(TRUE); if(CmpCommon::getDefault(SCRATCH_DISK_LOGGING) == DF_ON) result->setScratchDiskLogging(TRUE); return result; }