int se_scheduler_init(sescheduler *s, so *env) { ss_mutexinit(&s->lock); s->workers_branch = 0; s->workers_backup = 0; s->workers_gc = 0; s->workers_gc_db = 0; s->rotate = 0; s->req = 0; s->i = NULL; s->count = 0; s->rr = 0; s->env = env; s->checkpoint_lsn = 0; s->checkpoint_lsn_last = 0; s->checkpoint = 0; s->age = 0; s->age_last = 0; s->backup_bsn = 0; s->backup_last = 0; s->backup_last_complete = 0; s->backup_events = 0; s->backup = 0; s->gc = 0; s->gc_last = 0; se_workerpool_init(&s->workers); return 0; }
static void mt_multi_stmt(void) { void *env = sp_env(); t( env != NULL ); t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 ); t( sp_setint(env, "scheduler.threads", 3) == 0 ); t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 ); t( sp_setint(env, "log.rotate_sync", 0) == 0 ); t( sp_setint(env, "log.sync", 0) == 0 ); t( sp_setstring(env, "db", "test", 0) == 0 ); t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 ); t( sp_setint(env, "db.test.sync", 0) == 0 ); void *db = sp_getobject(env, "db.test"); t( db != NULL ); t( sp_open(env) == 0 ); seworkerpool p; se_workerpool_init(&p); void *ptr[2] = { env, db }; t( se_workerpool_new(&p, &st_r.r, 5, multi_stmt_thread, ptr) == 0 ); t( se_workerpool_shutdown(&p, &st_r.r) == 0 ); t (sp_getint(env, "db.test.index.count") == 100000 ); t( sp_destroy(env) == 0 ); }
int se_scheduler_init(sescheduler *s, so *env) { uint64_t now = ss_utime(); ss_mutexinit(&s->lock); s->workers_branch = 0; s->workers_backup = 0; s->workers_gc = 0; s->workers_gc_db = 0; s->workers_lru = 0; s->rotate = 0; s->req = 0; s->i = NULL; s->count = 0; s->rr = 0; s->env = env; s->checkpoint_lsn = 0; s->checkpoint_lsn_last = 0; s->checkpoint = 0; s->age = 0; s->age_last = now; s->backup_bsn = 0; s->backup_bsn_last = 0; s->backup_bsn_last_complete = 0; s->backup_events = 0; s->backup = 0; s->anticache_asn = 0; s->anticache_asn_last = 0; s->anticache_last = now; s->anticache_storage = 0; s->anticache = 0; s->snapshot_ssn = 0; s->snapshot_ssn_last = 0; s->snapshot_last = now; s->snapshot = 0; s->gc = 0; s->gc_last = now; s->lru = 0; s->lru_last = now; ss_threadpool_init(&s->tp); se_workerpool_init(&s->workers); return 0; }