mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-29 07:02:34 +02:00
2020-10-09 Fred Gleason <fredg@paravelsystems.com>
* Added an index to the 'GPIO_EVENTS.EVENT_DATETIME' field. * Incremented the database version to 342. * Implemented the '--verbose' switch for rdmaint(8). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
910be74180
commit
410de24139
@ -20442,3 +20442,7 @@
|
|||||||
asserted after exiting when handling schedule import errors.
|
asserted after exiting when handling schedule import errors.
|
||||||
2020-10-09 Fred Gleason <fredg@paravelsystems.com>
|
2020-10-09 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Updated rdservice(8) to use standard exit code defines.
|
* Updated rdservice(8) to use standard exit code defines.
|
||||||
|
2020-10-09 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added an index to the 'GPIO_EVENTS.EVENT_DATETIME' field.
|
||||||
|
* Incremented the database version to 342.
|
||||||
|
* Implemented the '--verbose' switch for rdmaint(8).
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/*
|
/*
|
||||||
* Current Database Version
|
* Current Database Version
|
||||||
*/
|
*/
|
||||||
#define RD_VERSION_DATABASE 341
|
#define RD_VERSION_DATABASE 342
|
||||||
|
|
||||||
|
|
||||||
#endif // DBVERSION_H
|
#endif // DBVERSION_H
|
||||||
|
5
lib/rd.h
5
lib/rd.h
@ -632,4 +632,9 @@
|
|||||||
#define RD_EXIT_NO_PERMS 11 // Insufficient permissions
|
#define RD_EXIT_NO_PERMS 11 // Insufficient permissions
|
||||||
#define RD_EXIT_REPORT_FAILED 12 // Report generation failed
|
#define RD_EXIT_REPORT_FAILED 12 // Report generation failed
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shelf life for GPIO event records
|
||||||
|
*/
|
||||||
|
#define RD_GPIO_EVENT_DAYS 30
|
||||||
|
|
||||||
#endif // RD_H
|
#endif // RD_H
|
||||||
|
@ -40,6 +40,15 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
// NEW SCHEMA REVERSIONS GO HERE...
|
// NEW SCHEMA REVERSIONS GO HERE...
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Revert 342
|
||||||
|
//
|
||||||
|
if((cur_schema==342)&&(set_schema<cur_schema)) {
|
||||||
|
DropIndex("GPIO_EVENTS","EVENT_DATETIME_IDX");
|
||||||
|
|
||||||
|
WriteSchemaVersion(--cur_schema);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Revert 341
|
// Revert 341
|
||||||
//
|
//
|
||||||
@ -47,6 +56,7 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
DropColumn("IMPORTER_LINES","FILE_LINE");
|
DropColumn("IMPORTER_LINES","FILE_LINE");
|
||||||
DropColumn("IMPORTER_LINES","LINK_START_TIME");
|
DropColumn("IMPORTER_LINES","LINK_START_TIME");
|
||||||
DropColumn("IMPORTER_LINES","LINK_LENGTH");
|
DropColumn("IMPORTER_LINES","LINK_LENGTH");
|
||||||
|
|
||||||
WriteSchemaVersion(--cur_schema);
|
WriteSchemaVersion(--cur_schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void MainObject::InitializeSchemaMap() {
|
|||||||
global_version_map["3.2"]=311;
|
global_version_map["3.2"]=311;
|
||||||
global_version_map["3.3"]=314;
|
global_version_map["3.3"]=314;
|
||||||
global_version_map["3.4"]=317;
|
global_version_map["3.4"]=317;
|
||||||
global_version_map["3.5"]=341;
|
global_version_map["3.5"]=342;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10363,6 +10363,16 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
|||||||
WriteSchemaVersion(++cur_schema);
|
WriteSchemaVersion(++cur_schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((cur_schema<342)&&(set_schema>cur_schema)) {
|
||||||
|
sql=
|
||||||
|
QString("create index EVENT_DATETIME_IDX on GPIO_EVENTS(EVENT_DATETIME)");
|
||||||
|
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteSchemaVersion(++cur_schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// NEW SCHEMA UPDATES GO HERE...
|
// NEW SCHEMA UPDATES GO HERE...
|
||||||
|
|
||||||
|
@ -120,6 +120,8 @@ void MainObject::RunSystemMaintenance()
|
|||||||
q=new RDSqlQuery(sql);
|
q=new RDSqlQuery(sql);
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Starting System Maintenance");
|
||||||
|
|
||||||
PurgeCuts();
|
PurgeCuts();
|
||||||
PurgeLogs();
|
PurgeLogs();
|
||||||
PurgeElr();
|
PurgeElr();
|
||||||
@ -127,6 +129,8 @@ void MainObject::RunSystemMaintenance()
|
|||||||
PurgeWebapiAuths();
|
PurgeWebapiAuths();
|
||||||
PurgeStacks();
|
PurgeStacks();
|
||||||
RehashCuts();
|
RehashCuts();
|
||||||
|
|
||||||
|
PrintMessage("Finished System Maintenance");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,6 +142,8 @@ void MainObject::RunLocalMaintenance()
|
|||||||
|
|
||||||
void MainObject::PurgeCuts()
|
void MainObject::PurgeCuts()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeCuts()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
RDSqlQuery *q1;
|
RDSqlQuery *q1;
|
||||||
@ -188,11 +194,15 @@ void MainObject::PurgeCuts()
|
|||||||
delete q1;
|
delete q1;
|
||||||
}
|
}
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed PurgeCuts()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::PurgeLogs()
|
void MainObject::PurgeLogs()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeLogs()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
QDateTime dt=QDateTime(QDate::currentDate(),QTime::currentTime());
|
QDateTime dt=QDateTime(QDate::currentDate(),QTime::currentTime());
|
||||||
@ -210,11 +220,15 @@ void MainObject::PurgeLogs()
|
|||||||
delete log;
|
delete log;
|
||||||
}
|
}
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed PurgeLogs()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::PurgeElr()
|
void MainObject::PurgeElr()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeElr()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
QDateTime dt=QDateTime(QDate::currentDate(),QTime::currentTime());
|
QDateTime dt=QDateTime(QDate::currentDate(),QTime::currentTime());
|
||||||
@ -233,11 +247,15 @@ void MainObject::PurgeElr()
|
|||||||
RDSqlQuery::apply(sql);
|
RDSqlQuery::apply(sql);
|
||||||
}
|
}
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed PurgeElr()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::PurgeDropboxes()
|
void MainObject::PurgeDropboxes()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeDropboxes()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
RDSqlQuery *q1;
|
RDSqlQuery *q1;
|
||||||
@ -259,35 +277,46 @@ void MainObject::PurgeDropboxes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed PurgeDropboxes()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::PurgeGpioEvents()
|
void MainObject::PurgeGpioEvents()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeGpioEvents()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
|
||||||
|
|
||||||
sql=QString("delete from GPIO_EVENTS where ")+
|
sql=QString("delete from GPIO_EVENTS where ")+
|
||||||
"EVENT_DATETIME<\""+
|
"EVENT_DATETIME<\""+
|
||||||
QDate::currentDate().addDays(-30).toString("yyyy-MM-dd")+" 00:00:00\"";
|
QDate::currentDate().addDays(-RD_GPIO_EVENT_DAYS).toString("yyyy-MM-dd")+" 00:00:00\"";
|
||||||
q=new RDSqlQuery(sql);
|
printf("SQL: %s\n",sql.toUtf8().constData());
|
||||||
delete q;
|
RDSqlQuery::apply(sql);
|
||||||
|
|
||||||
|
PrintMessage("Starting Completed GpioEvents()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::PurgeWebapiAuths()
|
void MainObject::PurgeWebapiAuths()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeWebapiAuths()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
|
|
||||||
sql=QString("delete from WEBAPI_AUTHS where EXPIRATION_DATETIME<now()");
|
sql=QString("delete from WEBAPI_AUTHS where EXPIRATION_DATETIME<now()");
|
||||||
q=new RDSqlQuery(sql);
|
q=new RDSqlQuery(sql);
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed PurgeWebapiAuths()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::PurgeStacks()
|
void MainObject::PurgeStacks()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting PurgeStacks()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
RDSqlQuery *q1;
|
RDSqlQuery *q1;
|
||||||
@ -348,11 +377,15 @@ void MainObject::PurgeStacks()
|
|||||||
delete q1;
|
delete q1;
|
||||||
}
|
}
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed PurgeStacks()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainObject::RehashCuts()
|
void MainObject::RehashCuts()
|
||||||
{
|
{
|
||||||
|
PrintMessage("Starting RehashCuts()");
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
RDRehash::ErrorCode err;
|
RDRehash::ErrorCode err;
|
||||||
@ -377,9 +410,22 @@ void MainObject::RehashCuts()
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
delete q;
|
delete q;
|
||||||
|
|
||||||
|
PrintMessage("Completed RehashCuts()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainObject::PrintMessage(const QString &msg) const
|
||||||
|
{
|
||||||
|
if(maint_verbose) {
|
||||||
|
printf("%s: %s\n",
|
||||||
|
QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss").
|
||||||
|
toUtf8().constData(),
|
||||||
|
msg.toUtf8().constData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc,argv,false);
|
QApplication a(argc,argv,false);
|
||||||
|
@ -45,6 +45,7 @@ class MainObject : public QObject
|
|||||||
void PurgeWebapiAuths();
|
void PurgeWebapiAuths();
|
||||||
void PurgeStacks();
|
void PurgeStacks();
|
||||||
void RehashCuts();
|
void RehashCuts();
|
||||||
|
void PrintMessage(const QString &msg) const;
|
||||||
bool maint_verbose;
|
bool maint_verbose;
|
||||||
bool maint_system;
|
bool maint_system;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user