num-mirrors: updates

This commit is contained in:
Matt Wells 2013-10-24 14:59:35 -07:00
parent f65a2fd625
commit fb7096dc5d
2 changed files with 17 additions and 11 deletions

View File

@ -259,7 +259,7 @@ bool Hostdb::init ( char *filename , long hostId , char *netName ,
long indexSplits = 0;
char *wdir2 = NULL;
long wdirlen2 = 0;
long numMirrors = 0;
long numMirrors = -1;
for ( ; *p ; p++ , line++ ) {
if ( is_wspace_a (*p) ) continue;
@ -753,9 +753,13 @@ bool Hostdb::init ( char *filename , long hostId , char *netName ,
// how many shards are we configure for?
//m_numShards = maxShard + 1; // g_conf.m_numGroups;
// set it here
// # of mirrors is zero if no mirrors,
// if it is 1 then each host has ONE MIRROR host
if ( numMirrors == 0 )
indexSplits = numGrunts;
if ( numMirrors > 0 )
indexSplits = numGrunts / numMirrors;
indexSplits = numGrunts / (numMirrors+1);
if ( indexSplits == 0 ) {
g_errno = EBADENGINEER;
@ -765,9 +769,9 @@ bool Hostdb::init ( char *filename , long hostId , char *netName ,
return false;
}
numMirrors = numGrunts / indexSplits;
numMirrors = (numGrunts / indexSplits) - 1 ;
if ( numMirrors == 0 ) {
if ( numMirrors < 0 ) {
g_errno = EBADENGINEER;
log("admin: need num-mirrors: xxx or "
"index-splits: xxx directive "
@ -777,7 +781,7 @@ bool Hostdb::init ( char *filename , long hostId , char *netName ,
m_indexSplits = indexSplits;
m_numShards = numGrunts / numMirrors;
m_numShards = numGrunts / (numMirrors+1);
//
// set Host::m_shardNum

View File

@ -2,12 +2,14 @@
# Tells us what hosts are participating in the distributed search engine.
# This is how many pieces you want the index split into.
# So if you have 64 machines, and you want a unique piece of index on
# each machine, then make this 64. But if you have 64 machines and you
# want one level of redundancy then make this 32.
# How many mirrors do you want? If this is 0 then your data
# will NOT be replicated. If it is 1 then each host listed
# below will have one host that mirrors it, thereby decreasing
# total index capacity, but increasing redundancy. If this is
# 1 then the first half of hosts will be replicated by the
# second half of the hosts listed below.
num-mirrors: 1
num-mirrors: 0