The variable can be changed on the fly. Thus we need the sector cache object to
exist in case someone changes the value.
Kevin Lewis wrote:
> Kelly, so why allocate the sector cache when it will not be used?
>
>> -----Original Message-----
>> From: Kelly Long [mailto:klong@stripped]
>> Sent: Wednesday, July 09, 2008 7:37 AM
>> To: commits@stripped
>> Subject: bzr commit into mysql-6.0-falcon branch (klong:2727)
>>
>> #At file:///FC/MYSQL/wa-2008-BZR/lcl/mysql-6.0-falcon-cmdline-on-off/
>>
>> 2727 Kelly Long 2008-07-09
>> Second patch for comamnd line options to enable/disable super noodes
>> and sector cache. The default is Enabled for both.
>> modified:
>> mysql-test/suite/falcon/r/falcon_options.result
>> mysql-test/suite/falcon/r/falcon_options2.result
>> storage/falcon/Cache.cpp
>> storage/falcon/IndexPage.cpp
>> storage/falcon/StorageParameters.h
>>
>> === modified file 'mysql-test/suite/falcon/r/falcon_options.result'
>> --- a/mysql-test/suite/falcon/r/falcon_options.result 2008-07-03
>> 11:24:12 +0000
>> +++ b/mysql-test/suite/falcon/r/falcon_options.result 2008-07-09
>> 12:35:48 +0000
>> @@ -26,6 +26,8 @@ falcon_serial_log_file_size 10485760
>> falcon_serial_log_priority 1
>> falcon_support_xa OFF
>> falcon_use_deferred_index_hash OFF
>> +falcon_use_sectorcache ON
>> +falcon_use_supernodes ON
>> SELECT @@GLOBAL.falcon_debug_server;
>> @@GLOBAL.falcon_debug_server
>> 0
>> @@ -106,6 +108,8 @@ FALCON_SERIAL_LOG_FILE_SIZE 10485760
>> FALCON_SERIAL_LOG_PRIORITY 1
>> FALCON_SUPPORT_XA OFF
>> FALCON_USE_DEFERRED_INDEX_HASH OFF
>> +FALCON_USE_SECTORCACHE ON
>> +FALCON_USE_SUPERNODES ON
>> SET GLOBAL falcon_debug_mask = @previous_falcon_debug_mask;
>> SET GLOBAL falcon_record_memory_max = @previous_falcon_record_memory_max;
>> SET GLOBAL falcon_index_chill_threshold =
>> @previous_falcon_index_chill_threshold;
>>
>> === modified file 'mysql-test/suite/falcon/r/falcon_options2.result'
>> --- a/mysql-test/suite/falcon/r/falcon_options2.result 2008-07-03
>> 11:24:12 +0000
>> +++ b/mysql-test/suite/falcon/r/falcon_options2.result 2008-07-09
>> 12:35:48 +0000
>> @@ -27,6 +27,8 @@ FALCON_SERIAL_LOG_FILE_SIZE 10485760
>> FALCON_SERIAL_LOG_PRIORITY 1
>> FALCON_SUPPORT_XA OFF
>> FALCON_USE_DEFERRED_INDEX_HASH OFF
>> +FALCON_USE_SECTORCACHE ON
>> +FALCON_USE_SUPERNODES ON
>> SELECT @@falcon_checkpoint_schedule;
>> @@falcon_checkpoint_schedule
>> 7 * * * * *
>> @@ -99,3 +101,9 @@ SELECT @@falcon_serial_log_priority;
>> SELECT @@falcon_use_deferred_index_hash;
>> @@falcon_use_deferred_index_hash
>> 0
>> +SELECT @@falcon_use_sectorcache;
>> +@@falcon_use_sectorcache
>> +1
>> +SELECT @@falcon_use_supernodes;
>> +@@falcon_use_supernodes
>> +1
>>
>> === modified file 'storage/falcon/Cache.cpp'
>> --- a/storage/falcon/Cache.cpp 2008-07-07 14:40:27 +0000
>> +++ b/storage/falcon/Cache.cpp 2008-07-09 12:35:48 +0000
>> @@ -40,6 +40,13 @@
>> #include "Priority.h"
>> #include "SectorCache.h"
>>
>> +#define PARAMETER_UINT(_name, _text, _min, _default, _max, _flags,
>> _update_function) \
>> + extern uint falcon_##_name;
>> +#define PARAMETER_BOOL(_name, _text, _default, _flags, _update_function) \
>> + extern char falcon_##_name;
>> +#include "StorageParameters.h"
>> +#undef PARAMETER_UINT
>> +#undef PARAMETER_BOOL
>> extern uint falcon_io_threads;
>>
>> //#define STOP_PAGE 55
>> @@ -75,10 +82,7 @@ Cache::Cache(Database *db, int pageSz, i
>> pageWriter = NULL;
>> hashTable = new Bdb* [hashSz];
>> memset (hashTable, 0, sizeof (Bdb*) * hashSize);
>> - if(falcon_use_sectorcache)
>> - sectorCache = new SectorCache(sectorCacheSize /
>> SECTOR_BUFFER_SIZE, pageSize);
>> - else
>> - sectorCache = NULL;
>> + sectorCache = new SectorCache(sectorCacheSize / SECTOR_BUFFER_SIZE,
>> pageSize);
>>
>> uint64 n = ((uint64) pageSize * numberBuffers + cacheHunkSize - 1) /
>> cacheHunkSize;
>> numberHunks = (int) n;
>> @@ -146,8 +150,7 @@ Cache::~Cache()
>> delete [] bdbs;
>> delete [] ioThreads;
>> delete flushBitmap;
>> - if(falcon_use_sectorcache)
>> - delete sectorCache;
>> + delete sectorCache;
>>
>> if (bufferHunks)
>> {
>> @@ -264,7 +267,7 @@ Bdb* Cache::fetchPage(Dbb *dbb, int32 pa
>>
>> Priority priority(database->ioScheduler);
>> priority.schedule(PRIORITY_MEDIUM);
>> - if(falcon_use_sectorcache)
>> + if (falcon_use_sectorcache)
>> sectorCache->readPage(bdb);
>> else
>> dbb->readPage(bdb);
>> @@ -531,7 +534,7 @@ void Cache::writePage(Bdb *bdb, int type
>>
>> try
>> {
>> - if(falcon_use_sectorcache)
>> + if (falcon_use_sectorcache)
>> sectorCache->writePage(bdb);
>> dbb->writePage(bdb, type);
>> }
>> @@ -803,7 +806,7 @@ void Cache::ioThread(void)
>>
> bdb->incrementUseCount(ADD_HISTORY);
>> sync.unlock();
>> bdb->addRef(Shared
>> COMMA_ADD_HISTORY);
>> - if(falcon_use_sectorcache)
>> + if (falcon_use_sectorcache)
>>
> sectorCache->writePage(bdb);
>> bdb->syncWrite.lock(NULL,
> Exclusive);
>> === modified file 'storage/falcon/IndexPage.cpp'
>> --- a/storage/falcon/IndexPage.cpp 2008-07-07 14:40:27 +0000
>> +++ b/storage/falcon/IndexPage.cpp 2008-07-09 12:35:48 +0000
>> @@ -1436,7 +1436,7 @@ bool IndexPage::checkAddSuperNode(int pa
>> if (makeNextSuper)
>> *makeNextSuper = false;
>>
>> - if(!falcon_use_supernodes)
>> + if (!falcon_use_supernodes)
>> return false;
>>
>> if (insertionPoint == nodes)
>>
>> === modified file 'storage/falcon/StorageParameters.h'
>> --- a/storage/falcon/StorageParameters.h 2008-07-07 14:40:27 +0000
>> +++ b/storage/falcon/StorageParameters.h 2008-07-09 12:35:48 +0000
>> @@ -30,7 +30,5 @@ PARAMETER_UINT(serial_log_buffers, "The
>> PARAMETER_UINT(serial_log_priority, "Whether or not serial log has write
>> priority over other writes.", 0, 1, 1, 0, NULL)
>> PARAMETER_BOOL(use_deferred_index_hash, "Use Deferred Index hash lookup",
>> 0, 0, NULL)
>> PARAMETER_BOOL(support_xa, "Enable XA two phase commit", 0, 0x0200, NULL)
>> -PARAMETER_BOOL(use_supernodes, "Use supernodes in Falcon index", 1,
> 0x0200,
>> NULL)
>> -PARAMETER_BOOL(use_sectorcache, "Use sector cache", 1, 0x0200, NULL)
>> -
>> -// #define PARAMETER_BOOL(name, text, default, flags, update_function)
>> +PARAMETER_BOOL(use_supernodes, "Use supernodes in Falcon index", 1,
> 0x0000,
>> NULL)
>> +PARAMETER_BOOL(use_sectorcache, "Use sector cache (on=disk reads are 64KB,
>> off=disk reads are page size)", 1, 0x0000, NULL)
>>
>>
>> --
>> MySQL Code Commits Mailing List
>> For list archives: http://lists.mysql.com/commits
>> To unsubscribe: http://lists.mysql.com/commits?unsub=1
>
>
--
Kelly Long, Senior Software Engineer/Performance Architect
MySQL Inc, www.mysql.com
Office: Denver CO USA
Are you MySQL certified? www.mysql.com/certification
This message including any attachments is confidential information of Sun
Microsystems, Inc. Disclosure, copying or distribution is prohibited without
permission of Sun. If you are not the intended recipient, please reply to the
sender and then delete this message.