mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 12:17:35 +03:00
num-mirrors: updates
This commit is contained in:
parent
f65a2fd625
commit
fb7096dc5d
16
Hostdb.cpp
16
Hostdb.cpp
@ -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
|
||||
|
12
hosts.conf
12
hosts.conf
@ -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
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user