Changeset View
Changeset View
Standalone View
Standalone View
src/leveldb/db/db_impl.cc
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | Options SanitizeOptions(const std::string& dbname, | ||||
const InternalKeyComparator* icmp, | const InternalKeyComparator* icmp, | ||||
const InternalFilterPolicy* ipolicy, | const InternalFilterPolicy* ipolicy, | ||||
const Options& src) { | const Options& src) { | ||||
Options result = src; | Options result = src; | ||||
result.comparator = icmp; | result.comparator = icmp; | ||||
result.filter_policy = (src.filter_policy != NULL) ? ipolicy : NULL; | result.filter_policy = (src.filter_policy != NULL) ? ipolicy : NULL; | ||||
ClipToRange(&result.max_open_files, 64 + kNumNonTableCacheFiles, 50000); | ClipToRange(&result.max_open_files, 64 + kNumNonTableCacheFiles, 50000); | ||||
ClipToRange(&result.write_buffer_size, 64<<10, 1<<30); | ClipToRange(&result.write_buffer_size, 64<<10, 1<<30); | ||||
ClipToRange(&result.max_file_size, 1<<20, 1<<30); | |||||
ClipToRange(&result.block_size, 1<<10, 4<<20); | ClipToRange(&result.block_size, 1<<10, 4<<20); | ||||
if (result.info_log == NULL) { | if (result.info_log == NULL) { | ||||
// Open a log file in the same directory as the db | // Open a log file in the same directory as the db | ||||
src.env->CreateDir(dbname); // In case it does not exist | src.env->CreateDir(dbname); // In case it does not exist | ||||
src.env->RenameFile(InfoLogFileName(dbname), OldInfoLogFileName(dbname)); | src.env->RenameFile(InfoLogFileName(dbname), OldInfoLogFileName(dbname)); | ||||
Status s = src.env->NewLogger(InfoLogFileName(dbname), &result.info_log); | Status s = src.env->NewLogger(InfoLogFileName(dbname), &result.info_log); | ||||
if (!s.ok()) { | if (!s.ok()) { | ||||
// No place suitable for logging | // No place suitable for logging | ||||
▲ Show 20 Lines • Show All 1,461 Lines • Show Last 20 Lines |