Changeset - 81f92ae54ec0
[Not reviewed]
default
0 3 0
Ethan Zonca (ethanzonca) - 15 years ago 2010-06-07 20:24:32
e@ethanzonca.com
Moved watchdog to mysql
3 files changed with 15 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -81,7 +81,6 @@ struct general_info
 

	
 
/* ************General Functions************* */
 
int distrend_do();
 
void frame_watchdog(struct distrenjob *distrenjob_head);
 
int distrend_do_config(int argc, char *argv[], struct distrend_config **config);
 
int distrend_config_free(struct distrend_config *config);
 

	
 
@@ -160,7 +159,7 @@ int main(int argc, char *argv[])
 
      distrend_accept(general_info.config, clients);
 

	
 
      /* Make the following code more event-driven */
 
      frame_watchdog(&general_info.head);
 
      frame_watchdog(general_info.conn);
 

	
 
      struct frameset frame;
 
      struct distrenjob *job;
 
@@ -211,21 +210,6 @@ int distrend_do()
 
  return 0;
 
}
 

	
 

	
 
/** Checks for dead, latent, or stale slaves */
 
void frame_watchdog(struct distrenjob *distrenjob_head)
 
{
 
  // Replace with mysqlness, maybe
 
  // iterate through jobs
 
    // if the job has been started, checks by seeing if either to first or second frame has been started
 
    // FRAMESETSTATUS_UNASSIGNED
 
      // iterate through all frames for this job:
 
          //watchdog_forgiveness = seconds of forgiveness before frame is re-assigned:
 
             //   If frame is not completed within the number of seconds specified by watchdog_forgiveness
 
             //   Then change the frame status to unassigned
 
}
 

	
 

	
 
/* Grabs config info from confs */
 
int distrend_do_config(int argc, char *argv[], struct distrend_config **config)
 
{
src/server/mysql.c
Show inline comments
 
@@ -382,3 +382,12 @@ int auth_slave(distrend_mysql_conn_t con
 

	
 
  return rtn;
 
}
 

	
 
/** Runs frame watchdog to reassign stale frames */
 
void frame_watchdog(distrend_mysql_conn_t conn)
 
{
 
  char *query;
 
  _distren_asprintf(&query, "CALL `distren`.`Watchdog_Delete`()");
 
  mysqlQuery(conn, query, 0);
 
  free(query);
 
}
src/server/mysql.h
Show inline comments
 
@@ -77,5 +77,10 @@ int find_jobframe(distrend_mysql_conn_t 
 
int auth_slave(distrend_mysql_conn_t conn, int32_t slavekey, char *slavepass);
 

	
 

	
 
/**
 
  Frame Watchdog: Reassigns stale frames on server
 
*/
 
void frame_watchdog(distrend_mysql_conn_t conn);
 

	
 

	
 
#endif /* MYSQL_H_ */
0 comments (0 inline, 0 general)