Skip to content

Commit

Permalink
Resolve the bug where the log cutting parameters are not working prop…
Browse files Browse the repository at this point in the history
…erly.
  • Loading branch information
yujiaqi committed Apr 4, 2023
1 parent 04f9fab commit 893f6ee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion QueryPropertyServer/DbProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,21 @@ void query(int iThread, const TC_DBConf & conf, map<string,string>& mSqlPart, ma

string sTbName("");
string sSql("");

string sCutType = g_pconf->get("/tars/reapSql<CutType>", "hour");
bool cutByDay = (sCutType == "day");

//select range by f_date and f_tflag
for(string day = dateFrom; day <= dateTo; day = dateInc(day))
{
for(string tflag = tflagFrom; tflag <= tflagTo && (tflag.substr(0,2) < "24"); tflag = tFlagInc(tflag))
{
//table name:tars_2012060723
sTbName = sTbNamePre + day + tflag.substr(0,2);
sTbName = sTbNamePre + day;
if (!cutByDay) {
sTbName += tflag.substr(0,2);
}
//sTbName = sTbNamePre + day + tflag.substr(0,2);

sSql = "select " + selectCond + " from " + sTbName + " " + ignoreKey + whereCond + groupCond + " order by null;";

Expand Down Expand Up @@ -598,6 +606,10 @@ void query(int iThread, const TC_DBConf & conf, map<string,string>& mSqlPart, ma
}

TLOGINFO("query iDb :" << iThread << " day:" << day <<" tflag:" << tflag << endl);

if (cutByDay) {
break;
}
}
} //day

Expand Down
14 changes: 13 additions & 1 deletion QueryStatServer/DbProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,21 @@ void query(int iThread, const TC_DBConf & conf, map<string,string>& mSqlPart, ma

string sTbName("");
string sSql("");

string sCutType = g_pconf->get("/tars/reapSql<CutType>", "hour");
bool cutByDay = (sCutType == "day");

//select range by f_date and f_tflag
for(string day = dateFrom; day <= dateTo; day = dateInc(day))
{
for(string tflag = tflagFrom; tflag <= tflagTo && (tflag.substr(0,2) < "24"); tflag = tFlagInc(tflag))
{
//table name:tars_2012060723
sTbName = sTbNamePre + day + tflag.substr(0,2);
sTbName = sTbNamePre + day;
if (!cutByDay) {
sTbName += tflag.substr(0,2);
}
//sTbName = sTbNamePre + day + tflag.substr(0,2);

sSql = "select " + selectCond + " from " + sTbName + " " + ignoreKey + whereCond + groupCond + " order by null;";

Expand Down Expand Up @@ -548,6 +556,10 @@ void query(int iThread, const TC_DBConf & conf, map<string,string>& mSqlPart, ma
}

TLOGINFO("query iDb :" << iThread << " day:" << day <<" tflag:" << tflag << endl);

if (cutByDay) {
break;
}
}
} //day

Expand Down

0 comments on commit 893f6ee

Please sign in to comment.