void FileSystemTestSetup::start_failovercache_for_remote_node() { remote_foc_helper_ = std::make_unique<FailOverCacheTestHelper>(failovercache_dir(topdir_), local_config().failovercache_host, local_config().failovercache_port, failovercache_transport()); }
void FileSystemTestSetup::TearDown() { bpt::ptree pt; // Fill the ptree first as it requires e.g. the mdstore_test_setup_ to be // still around. make_config_(pt, topdir_, local_config().vrouter_id); stop_failovercache_for_local_node(); mdstore_test_setup_.reset(); mds_server_config_.reset(); mds_manager_.reset(); mds_test_setup_ = nullptr; try { vfs::FileSystem::destroy(pt); } CATCH_STD_ALL_LOGLEVEL_IGNORE("Failed to clean up filesystem - resources might be leaked; manual intervention required", FATAL); arakoon_test_setup_->tearDownArakoon(); uninitialize_connection_manager(); fs::remove_all(topdir_); Py_Finalize(); }
int main (int argc, const char * argv[]) { struct settings *settings = local_config(); settings->hash_power = 0; settings->prealloc = true; settings->evict_opt = EVICT_LRU; settings->maxbytes = 200 * 1024 * 1024; settings->slab_size = 1024 * 1024; settings->use_freeq = true; settings->use_lruq = true; settings->profile_last_id = 12; int i = 0, j = 0, n = 0; for (i = 1; i < 13; i++) { settings->profile[i] = 100 * i; } bool result = local_start(); if (result) printf("cache started\n"); else { printf("cache started fail\n"); return 1; } char *key = (char*)malloc(8); char *value = (char*)malloc(900); for (i = 0; i < 10000; i++) { for (j = 0; j < 10000; j++) { int *ptr = (int*)key; *ptr = i; *(ptr++) = j; n = i + j; n = (n % 9) * 100 + 50; ptr = (int*)value; *ptr = i; *(ptr + n - 4) = j; result = local_put(key, 8, 10, value, n); if (!result) { printf("cache put item fail\n"); printf("%d %d\n", i, j); return 1; } struct item *res = local_get(key, 8); if (res == NULL || res->nbyte != n) { printf("cache get item fail\n"); printf("%d %d\n", i, j); return 1; } char *data = item_data(res); if (*((int*)data) != i) { printf("cache get value fail\n"); printf("%d %d\n", i, j); return 1; } } } return 0; }
bpt::ptree& FileSystemTestSetup::make_dtl_config_(const vfs::NodeId& vrouter_id, bpt::ptree& pt) const { ip::PARAMETER_TYPE(fs_dtl_config_mode)(dtl_config_mode_).persist(pt); if (dtl_config_mode_ == vfs::FailOverCacheConfigMode::Manual) { const vfs::ClusterNodeConfig cfg(vrouter_id == local_node_id() ? local_config() : remote_config()); ip::PARAMETER_TYPE(fs_dtl_host)(cfg.failovercache_host).persist(pt); ip::PARAMETER_TYPE(fs_dtl_port)(cfg.failovercache_port).persist(pt); ip::PARAMETER_TYPE(fs_dtl_mode)(dtl_mode_).persist(pt); } return pt; }