added comments

This commit is contained in:
QA Hoang 2021-08-09 21:11:10 -07:00
parent 0454c769d5
commit 749bd1d3e8
1 changed files with 6 additions and 7 deletions

View File

@ -1285,16 +1285,15 @@ int worker_process_main(mako_args_t* args, int worker_id, mako_shmhdr_t* shm, pi
fdb_future_destroy(f);
#else /* >= 610 */
if (worker_id == 0) {
if (worker_id == 0 || args->num_fdb_clusters <= 1) {
// maintains original mako behavior in that
// first process does work to one database in the first cluster
fdb_create_database(args->cluster_files[0], &process.databases[0]);
} else {
// added support for multiple databases in multiple clusters
// the rest of the databases are divided equally to each cluster
for (size_t i = 1; i < args->num_databases; i++) {
if (args->num_fdb_clusters <= 1) { // if only default fdb.cluster is used
fdb_create_database(args->cluster_files[0], &process.databases[i]);
} else {
fdb_create_database(args->cluster_files[worker_id % args->num_fdb_clusters], &process.databases[i]);
}
fdb_create_database(args->cluster_files[worker_id % args->num_fdb_clusters], &process.databases[i]);
}
}
#endif
@ -1315,7 +1314,7 @@ int worker_process_main(mako_args_t* args, int worker_id, mako_shmhdr_t* shm, pi
for (i = 0; i < args->num_threads; i++) {
thread_args[i].thread_id = i;
if (worker_id == 0) {
if (worker_id == 0 || args->num_databases == 1) {
thread_args[i].database_index = 0;
} else {
thread_args[i].database_index = i % (args->num_databases-1) + 1;