Update of /cvsroot/perfparse/_perfparse/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2944/modules
Modified Files:
storage_mysql.c storage_mysql.h
Log Message:
some more work on purging data
Index: storage_mysql.h
===================================================================
RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** storage_mysql.h 9 Dec 2007 20:40:40 -0000 1.6
--- storage_mysql.h 10 Dec 2007 18:55:09 -0000 1.7
***************
*** 33,39 ****
#define STORAGE_MYSQL_VERSION "0.0.2"
- #define DEL_POLICY_UNDEFINED -1
- #define DEL_POLICY_INFINITY -2
-
int storage_mysql_init(void);
--- 33,36 ----
Index: storage_mysql.c
===================================================================
RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** storage_mysql.c 9 Dec 2007 20:40:40 -0000 1.16
--- storage_mysql.c 10 Dec 2007 18:55:09 -0000 1.17
***************
*** 35,39 ****
#include "common.h"
#include "dbms.h"
!
#include "storage_mysql.h"
#include <config.h>
--- 35,39 ----
#include "common.h"
#include "dbms.h"
! #include "del_policy.h"
#include "storage_mysql.h"
#include <config.h>
***************
*** 357,360 ****
--- 357,361 ----
void storage_mysql_periodic_cleanup(storage_module_t*this) {
+ pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,"storage_mysql_periodic_cleanup called.\n");
/* delete all data of objects that are marked as deleted */
GSList *tmplist2,*tmplist=NULL;
***************
*** 363,367 ****
// connect again to mysql since this is a forked process
now_connect(TRUE);
! pp_log(__FILE__,__LINE__,LOG_DEBUG,"MySQL version: %s\n", query_char("SELECT VERSION()"));
// find metric ids to delete completely
--- 364,368 ----
// connect again to mysql since this is a forked process
now_connect(TRUE);
! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"MySQL version: %s\n", query_char("SELECT VERSION()"));
// find metric ids to delete completely
***************
*** 408,422 ****
/* walk through all services and metrics and purge old data */
! // raw data
! typedef struct t_raw_policyinfo {
! int iServiceId;
! char *sServiceDesc;
! int iHostId;
! char *sPolicyName;
! int iPolicySource;
! int iPolicySeconds;
! int iRawDelPolicy;
! } t_raw_policyinfo;
!
t_raw_policyinfo *raw_policyinfo=NULL;
--- 409,413 ----
/* walk through all services and metrics and purge old data */
!
t_raw_policyinfo *raw_policyinfo=NULL;
***************
*** 427,436 ****
raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo));
raw_policyinfo->iServiceId = iData(0);
! raw_policyinfo->sServiceDesc=malloc(strlen(sData(1))+sizeof(char));
! strncpy(raw_policyinfo->sServiceDesc,sData(1),strlen(sData(1))+1);
raw_policyinfo->iHostId=iData(2);
// todo: check if this policy matches and if not search for matching parent policy
! raw_policyinfo->sPolicyName=malloc(strlen(sData(3))+sizeof(char));
! strncpy(raw_policyinfo->sPolicyName,sData(3),strlen(sData(3))+1);
if(isNull(4)){
raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED;
--- 418,425 ----
raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo));
raw_policyinfo->iServiceId = iData(0);
! raw_policyinfo->sServiceDesc=strdup(sData(1));
raw_policyinfo->iHostId=iData(2);
// todo: check if this policy matches and if not search for matching parent policy
! raw_policyinfo->sPolicyName=strdup(sData(3));
if(isNull(4)){
raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED;
***************
*** 449,452 ****
--- 438,451 ----
tmplist=g_slist_append(tmplist,raw_policyinfo);
}
+
+ tmplist2=tmplist;
+ while(tmplist2) {
+ raw_policyinfo=(t_raw_policyinfo *) tmplist2->data;
+ if(raw_policyinfo->iRawDelPolicy==DEL_POLICY_UNDEFINED &&
+ raw_policyinfo->iPolicySeconds==DEL_POLICY_UNDEFINED) {
+ getRawHostPolicy(raw_policyinfo);
+ }
+ //todo: now purge data
+ }
|