mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 12:17:35 +03:00
added proper version computation to gb
This commit is contained in:
parent
a989822414
commit
9d69c1362d
6
Hostdb.h
6
Hostdb.h
@ -53,7 +53,8 @@ enum {
|
||||
#define PFLAG_RECOVERYMODE 0x80
|
||||
|
||||
// added slow disk reads to it, 4 bytes (was 52)
|
||||
#define MAX_PING_SIZE (44+4+4)
|
||||
// 24 bytes for the gbversion
|
||||
#define MAX_PING_SIZE (44+4+4+24)
|
||||
|
||||
#define HT_GRUNT 0x01
|
||||
#define HT_SPARE 0x02
|
||||
@ -274,6 +275,9 @@ class Host {
|
||||
// . set in Process.cpp
|
||||
short m_hdtemps[4];
|
||||
|
||||
// 24 bytes including ending \0
|
||||
char m_gbVersionStrBuf[24];
|
||||
|
||||
// Syncdb.cpp uses these
|
||||
char m_inSync ;
|
||||
char m_isPermanentOutOfSync ;
|
||||
|
5
Makefile
5
Makefile
@ -127,6 +127,11 @@ g8: gb
|
||||
utils: addtest blaster2 dump hashtest makeclusterdb makespiderdb membustest monitor seektest urlinfo treetest dnstest dmozparse gbtitletest
|
||||
|
||||
gb: $(OBJS) main.o $(LIBFILES)
|
||||
echo -n "#define GBVERSION \"" > vvv
|
||||
#date --utc >> vvv
|
||||
date +%Y.%M.%d-%T-%Z >> vvv
|
||||
head -c -1 vvv > Version.h
|
||||
echo "\"" >> Version.h
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ main.o $(OBJS) $(LIBS)
|
||||
|
||||
cygwin:
|
||||
|
@ -195,7 +195,8 @@ skipReplaceHost:
|
||||
// this is now fairly obsolete
|
||||
//"<td><b>ide channel</td>"
|
||||
|
||||
"<td><b>HD temps (C)</b></td>"
|
||||
//"<td><b>HD temps (C)</b></td>"
|
||||
"<td><b>GB version</b></td>"
|
||||
|
||||
//"<td><b>resends sent</td>"
|
||||
//"<td><b>errors recvd</td>"
|
||||
@ -366,6 +367,7 @@ skipReplaceHost:
|
||||
strcpy(ipbuf1,iptoa(h->m_ip));
|
||||
strcpy(ipbuf2,iptoa(h->m_ipShotgun));
|
||||
|
||||
/*
|
||||
char hdbuf[128];
|
||||
char *hp = hdbuf;
|
||||
for ( long k = 0 ; k < 4 ; k++ ) {
|
||||
@ -379,6 +381,9 @@ skipReplaceHost:
|
||||
if ( k < 3 ) *hp++ = '/';
|
||||
*hp = '\0';
|
||||
}
|
||||
*/
|
||||
char *vbuf = h->m_gbVersionStrBuf;
|
||||
|
||||
|
||||
//long switchGroup = 0;
|
||||
//if ( g_hostdb.m_indexSplits > 1 )
|
||||
@ -531,7 +536,8 @@ skipReplaceHost:
|
||||
sb.safePrintf("\t\t<dnsPort>%li</dnsPort>\n",
|
||||
(long)h->m_dnsClientPort);
|
||||
|
||||
sb.safePrintf("\t\t<hdTemp>%s</hdTemp>\n",hdbuf);
|
||||
//sb.safePrintf("\t\t<hdTemp>%s</hdTemp>\n",hdbuf);
|
||||
sb.safePrintf("\t\t<gbVersion>%s</gbVersion>\n",vbuf);
|
||||
|
||||
sb.safePrintf("\t\t<resends>%li</resends>\n",
|
||||
h->m_totalResends);
|
||||
@ -619,7 +625,8 @@ skipReplaceHost:
|
||||
sb.safePrintf("\t\t\"dnsPort\":%li,\n",
|
||||
(long)h->m_dnsClientPort);
|
||||
|
||||
sb.safePrintf("\t\t\"hdTemp\":\"%s\",\n",hdbuf);
|
||||
//sb.safePrintf("\t\t\"hdTemp\":\"%s\",\n",hdbuf);
|
||||
sb.safePrintf("\t\t\"gbVersion\":\"%s\",\n",vbuf);
|
||||
|
||||
sb.safePrintf("\t\t\"resends\":%li,\n",
|
||||
h->m_totalResends);
|
||||
@ -770,7 +777,7 @@ skipReplaceHost:
|
||||
//switchGroup ,
|
||||
//tmpN,
|
||||
//h->m_ideChannel,
|
||||
hdbuf,
|
||||
vbuf,//hdbuf,
|
||||
h->m_totalResends,
|
||||
h->m_errorReplies,
|
||||
h->m_etryagains,
|
||||
|
@ -22,6 +22,7 @@ long klogctl( int, char *,int ) { return 0; }
|
||||
#include "Spider.h"
|
||||
#include "Test.h"
|
||||
#include "Rebalance.h"
|
||||
#include "Version.h"
|
||||
|
||||
#define PAGER_BUF_SIZE (10*1024)
|
||||
|
||||
@ -467,10 +468,20 @@ void PingServer::pingHost ( Host *h , uint32_t ip , uint16_t port ) {
|
||||
memcpy ( p , me->m_hdtemps , 4 * 2 );
|
||||
p += 4 * 2;
|
||||
|
||||
// store the gbVersionStrBuf now, just a date with a \0 included
|
||||
memcpy ( p , GBVERSION , 24 );
|
||||
p += 24;
|
||||
|
||||
|
||||
long requestSize = p - request;
|
||||
|
||||
// sanity check
|
||||
if ( requestSize != MAX_PING_SIZE ) { char *xx = NULL; *xx = 0; }
|
||||
if ( requestSize != MAX_PING_SIZE ) {
|
||||
log("ping: "
|
||||
"YOU ARE MIXING MULTIPLE GB VERSIONS IN YOUR CLUSTER. "
|
||||
"MAKE SURE THEY ARE ALL THE SAME GB BINARY");
|
||||
char *xx = NULL; *xx = 0; }
|
||||
|
||||
|
||||
// debug msg
|
||||
//logf(LOG_DEBUG,"net: Sending ping request to hid=%li ip=%s.",
|
||||
@ -922,6 +933,10 @@ void handleRequest11 ( UdpSlot *slot , long niceness ) {
|
||||
memcpy ( h->m_hdtemps , p , 4 * 2 );
|
||||
p += 4 * 2;
|
||||
|
||||
// at the end the gbverstionstrbuf
|
||||
memcpy ( h->m_gbVersionStrBuf , p , 24 );
|
||||
p += 24;
|
||||
|
||||
// if any one of them is overheating, then turn off
|
||||
// spiders on ourselves (and thus the full cluster)
|
||||
for ( long k = 0 ; k < 4 ; k++ )
|
||||
|
10
main.cpp
10
main.cpp
@ -10,7 +10,7 @@
|
||||
// maybe we should put this in a common header file so we don't have
|
||||
// certain files compiled with the platform default, and some not -partap
|
||||
|
||||
//#include "GBVersion.h"
|
||||
#include "Version.h"
|
||||
#include "Mem.h"
|
||||
#include "Conf.h"
|
||||
#include "Threads.h"
|
||||
@ -992,7 +992,7 @@ int main2 ( int argc , char *argv[] ) {
|
||||
if ( strcmp ( cmd , "-h" ) == 0 ) goto printHelp;
|
||||
// version
|
||||
if ( strcmp ( cmd , "-v" ) == 0 ) {
|
||||
fprintf(stdout,"Gigablast March-2014\n");
|
||||
fprintf(stdout,"Gigablast Version: %s\n",GBVERSION);
|
||||
// fprintf(stderr,"Gigablast %s\nMD5KEY: %s\n"
|
||||
// "TAG: %s\nPATH: %s\n",
|
||||
// GBVersion, GBCommitID, GBTag, GBBuildPath);
|
||||
@ -1534,9 +1534,6 @@ int main2 ( int argc , char *argv[] ) {
|
||||
*/
|
||||
|
||||
|
||||
// log the version
|
||||
//log(LOG_INIT,"conf: Gigablast Server %s",GBVersion);
|
||||
|
||||
//Put this here so that now we can log messages
|
||||
if ( strcmp ( cmd , "proxy" ) == 0 ) {
|
||||
if (argc < 3){
|
||||
@ -2997,6 +2994,9 @@ int main2 ( int argc , char *argv[] ) {
|
||||
|
||||
g_log.m_logTimestamps = true;
|
||||
|
||||
// log the version
|
||||
log(LOG_INIT,"conf: Gigablast Version: %s",GBVERSION);
|
||||
|
||||
// show current working dir
|
||||
log("host: Working directory is %s",workingDir);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user