public ClientDBsAreSame ( int client_index_a, int client_index_b ) : bool | ||
client_index_a | int | |
client_index_b | int | |
리턴 | bool |
public bool ClientDBsAreSame(int client_index_a, int client_index_b)
{
bool res = true;
if (clients.Count < Math.Max(client_index_a, client_index_b) + 1) return false;
Database dba = clients[client_index_a].GetDatabase(dbname);
Database dbb = clients[client_index_b].GetDatabase(dbname);
if (!Utils.DBCompare(dba, dbb))
{
Console.WriteLine("Database on client " + client_index_b + " differs from reference db on " + client_index_a);
res = false;
}
if (!Utils.DBCompare(dbb, dba))
{
Console.WriteLine("Database on client " + client_index_a + " differs from reference db on " + client_index_b);
res = false;
}
return res;
}
//[TestMethod] public void MultiClusterTest_10_Threads() { int init_users = 10000; int threadnum = 10; Users usr = new Users(Utils.GetConfigNodes()); // TODO add another client usr.EmptyAll(); usr.InsertUsers(init_users); Thread[] threads = new Thread[threadnum]; for (int i = 0; i < threadnum; i++) { threads[i] = new Thread(new ParameterizedThreadStart(MultiClusterTestWorker)); threads[i].Start(500); } for (int i = 0; i < threadnum; i++) { threads[i].Join(); } while(usr.IterateClients()) Assert.IsTrue(usr.IsConsistent()); Assert.IsTrue(usr.ClientDBsAreSame(0, 1)); }