Skip to content

Commit

Permalink
fixed binloging in regression tests
Browse files Browse the repository at this point in the history
git-svn-id: http://sphinxsearch.googlecode.com/svn/trunk@2491 8b96e2b9-35c5-2c16-bc47-5122d61876d4
  • Loading branch information
tomat committed Sep 27, 2010
1 parent d00f21f commit 96de76c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/searchd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11222,6 +11222,7 @@ int WINAPI ServiceMain ( int argc, char **argv )

CSphString sOptListen;
bool bOptListen = false;
bool bTestMode = false;

#define OPT(_a1,_a2) else if ( !strcmp(argv[i],_a1) || !strcmp(argv[i],_a2) )
#define OPT1(_a1) else if ( !strcmp(argv[i],_a1) )
Expand Down Expand Up @@ -11253,7 +11254,7 @@ int WINAPI ServiceMain ( int argc, char **argv )
#endif
OPT1 ( "--logdebug" ) g_eLogLevel = LOG_DEBUG;
OPT1 ( "--safetrace" ) g_bSafeTrace = true;
OPT1 ( "--test" ) g_bWatchdog = false;
OPT1 ( "--test" ) { g_bWatchdog = false; bTestMode = true; }

// handle 1-arg options
else if ( (i+1)>=argc ) break;
Expand Down Expand Up @@ -11814,7 +11815,7 @@ int WINAPI ServiceMain ( int argc, char **argv )
#endif

if ( g_eWorkers==MPM_THREADS )
sphRTConfigure ( hSearchd );
sphRTConfigure ( hSearchd, bTestMode );

if ( bOptPIDFile )
{
Expand Down
10 changes: 5 additions & 5 deletions src/sphinxrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ class RtBinlog_c : public ISphBinlog
void BinlogUpdateAttributes ( const char * sIndexName, int64_t iTID, const CSphAttrUpdate & tUpd );
void NotifyIndexFlush ( const char * sIndexName, int64_t iTID, bool bShutdown );

void Configure ( const CSphConfigSection & hSearchd );
void Configure ( const CSphConfigSection & hSearchd, bool bTestMode );
void Replay ( const SmallStringHash_T<CSphIndex*> & hIndexes, ProgressCallbackSimple_t * pfnProgressCallback );

void CreateTimerThread ();
Expand Down Expand Up @@ -4369,7 +4369,7 @@ void RtBinlog_c::NotifyIndexFlush ( const char * sIndexName, int64_t iTID, bool
Verify ( m_tWriteLock.Unlock() );
}

void RtBinlog_c::Configure ( const CSphConfigSection & hSearchd )
void RtBinlog_c::Configure ( const CSphConfigSection & hSearchd, bool bTestMode )
{
MEMORY ( SPH_MEM_BINLOG );

Expand All @@ -4386,7 +4386,7 @@ void RtBinlog_c::Configure ( const CSphConfigSection & hSearchd )
#define DATADIR "."
#endif

m_sLogPath = hSearchd.GetStr ( "binlog_path", DATADIR );
m_sLogPath = hSearchd.GetStr ( "binlog_path", bTestMode ? "" : DATADIR );
m_bDisabled = m_sLogPath.IsEmpty();

m_iRestartSize = hSearchd.GetSize ( "binlog_max_log_size", m_iRestartSize );
Expand Down Expand Up @@ -5100,10 +5100,10 @@ void sphRTInit ()
sphDie ( "binlog: failed to create binlog" );
}

void sphRTConfigure ( const CSphConfigSection & hSearchd )
void sphRTConfigure ( const CSphConfigSection & hSearchd, bool bTestMode )
{
assert ( g_pBinlog );
g_pBinlog->Configure ( hSearchd );
g_pBinlog->Configure ( hSearchd, bTestMode );
}

void sphRTDone ()
Expand Down
2 changes: 1 addition & 1 deletion src/sphinxrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ISphRtIndex : public CSphIndex
/// initialize subsystem
class CSphConfigSection;
void sphRTInit ();
void sphRTConfigure ( const CSphConfigSection & hSearchd );
void sphRTConfigure ( const CSphConfigSection & hSearchd, bool bTestMode );

/// deinitialize subsystem
void sphRTDone ();
Expand Down
2 changes: 1 addition & 1 deletion src/testrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ int main ()

CSphConfigSection tRTConfig;
sphRTInit();
sphRTConfigure ( tRTConfig );
sphRTConfigure ( tRTConfig, true );
SmallStringHash_T< CSphIndex * > dTemp;
sphReplayBinlog ( dTemp );
ISphRtIndex * pIndex = sphCreateIndexRT ( tSchema, "testrt", 32*1024*1024, "data/dump" );
Expand Down
4 changes: 1 addition & 3 deletions src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,11 +1554,9 @@ static void DeleteIndexFiles ( const char * sIndex )
void TestRTInit ()
{
CSphConfigSection tRTConfig;
CSphVariant tEmpty ( "" );
tRTConfig.Add ( tEmpty, "binlog_path" ); // explicitly disable binlog

sphRTInit();
sphRTConfigure ( tRTConfig );
sphRTConfigure ( tRTConfig, true );

SmallStringHash_T<CSphIndex*> hIndexes;
sphReplayBinlog ( hIndexes );
Expand Down

0 comments on commit 96de76c

Please sign in to comment.