static int64_t numberOfRecords(stKVDatabase *database) { MySqlDb *dbImpl = database->dbImpl; MYSQL_RES *rs = queryStart(dbImpl, "select count(*) from %s", dbImpl->table); char **row = queryNextRequired(dbImpl, rs); int64_t numRecords = stSafeStrToInt64(row[0]); queryEnd(dbImpl, rs); return numRecords; }
/* Default to 175M which seems to be about where the * kyoto tycoon network error danger zone starts */ static int64_t getXMLMaxKTBulkSetSize(stHash *hash) { const char *value = stHash_search(hash, "max_bulkset_size"); if (value == NULL) { return (int64_t) 183500800; } else { return stSafeStrToInt64(value); } }
/* Default to tried-and-true value of 10000 */ static int64_t getXMLMaxKTBulkSetNumRecords(stHash *hash) { const char *value = stHash_search(hash, "max_bulkset_num_records"); if (value == NULL) { return (int64_t) 10000; } else { return stSafeStrToInt64(value); } }
/* Default to 50M. It used to be 175M but since noticing * problems in bulk *get* within cactus secondary dbs we * crank it way down. Unlike bulk set, in the get we don't * know the total size of the requested records. To prevent * big data transfers (which are problematic), we reduce max * size of individual records and hope for the best */ static int64_t getXMLMaxKTRecordSize(stHash *hash) { const char *value = stHash_search(hash, "max_record_size"); if (value == NULL) { return (int64_t) 10000000; } else { return stSafeStrToInt64(value); } }