Esempio n. 1
0
/*
*_______________________________________________________________________
*
*  show exportd configuration path
*/
void show_conf_path(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();

  sprintf(pChar,"%s\n",export_get_config_file_path());
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
  return;
}
Esempio n. 2
0
/**
*  Restart from scratch the FID synchronization
   Every FID must be synchronized toward the other site

   @param ctx_p : pointer to replication context
   
   @retval 0 on success
   @retval -1 on error (see errno for details)
*/
int geo_rep_restart_from_scratch(geo_rep_srv_ctx_t *ctx_p) {
  char     cmd[256];
  char     path[256];
  int      idx;
  int      status=-1;
  
  /*
  ** Call geoRepList tool to build lists of FIDs to synchronize
  */
  GEO_REP_BUILD_PATH_NONAME;
  sprintf (cmd, "rozo_geoRepList -e %d -p %s -c %s",
           ctx_p->eid, path, export_get_config_file_path());   
  if (system(cmd)!=0) {};

  /*
  ** Get the lock
  */   
  if (pthread_rwlock_wrlock(&ctx_p->flush_lock) != 0) {
    severe("pthread_rwlock_wrlock %s", strerror(errno));
    return -1;
  }

  /*
  ** Check whether a file is pending
  */
  if (ctx_p->file_idx_wr_pending) {
    /*
    ** Finish this file and go to next index
    */
    geo_rep_disk_next_index(ctx_p);
  }  
  	   
  /*
  ** Loop on the result files and add them to geo replication list
  */
  idx = 1;
  while (1) {
  
    GEO_REP_BUILD_PATH_NONAME;
    sprintf(cmd,"%s/geoList.%d",path,idx);
    
    /*
    ** Check whether this result file exists
    */
    if (access(cmd,R_OK) != 0) {
      /*
      ** No more file
      */
      status = 0;
      break;
    }

    /*
    ** Build destination name
    */
    GEO_REP_BUILD_PATH_FILE(GEO_FILE,ctx_p->geo_rep_main_file.last_index);    

    /*
    ** Rename the file
    */
    if (rename(cmd,path)<0) {
      severe("rename(%s,%s) %s", cmd, path, strerror(errno));
      unlink(cmd);
      break;
    }

    /*
    ** Finish this file and go to next file
    */
    geo_rep_disk_next_index(ctx_p);
    
    /*
    ** Next result file
    */
    idx++;
  }
  
  /*
  ** Release the lock
  */
  if (pthread_rwlock_unlock(&ctx_p->flush_lock) != 0) {
    severe("pthread_rwlock_unlock %s", strerror(errno));
  }  
  
  return status;
}