~linuxjedi/mydumper/mydumper-bp-ctest

« back to all changes in this revision

Viewing changes to mydumper.c

  • Committer: Mark Leith
  • Date: 2009-09-08 13:51:56 UTC
  • Revision ID: mark.leith@sun.com-20090908135156-v0b7dxnkeb73h3h5
Warning clean up

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
        { "ignore-engines", 'i', 0, G_OPTION_ARG_STRING, &ignore_engines, "Comma delimited list of storage engines to ignore", NULL },
81
81
        { "long-query-guard", 'l', 0, G_OPTION_ARG_INT, &longquery, "Set long query timer (60s by default)", NULL },
82
82
        { "kill-long-queries", 'k', 0, G_OPTION_ARG_NONE, &killqueries, "Kill long running queries (instead of aborting)", NULL }, 
83
 
        { NULL }
 
83
        { NULL, 0, 0, G_OPTION_ARG_NONE,   NULL, NULL, NULL }
84
84
};
85
85
 
86
86
enum job_type { JOB_SHUTDOWN, JOB_DUMP };
97
97
struct tm tval;
98
98
 
99
99
void dump_table(MYSQL *conn, char *database, char *table, struct configuration *conf);
100
 
void dump_table_data(MYSQL *, FILE *, char *, char *, char *, struct configuration *conf);
 
100
void dump_table_data(MYSQL *, FILE *, char *, char *, char *);
101
101
void dump_database(MYSQL *, char *, struct configuration *conf);
102
102
GList * get_chunks_for_table(MYSQL *, char *, char*,  struct configuration *conf);
103
103
guint64 estimate_count(MYSQL *conn, char *database, char *table, char *field, char *from, char *to);
104
 
void dump_table_data_file(MYSQL *conn, char *database, char *table, char *where, char *filename, struct configuration *conf);
 
104
void dump_table_data_file(MYSQL *conn, char *database, char *table, char *where, char *filename);
105
105
void create_backup_dir(char *directory);
106
106
int write_data(FILE *,GString*);
107
107
gboolean check_regex(char *database, char *table);
218
218
                job=(struct job *)g_async_queue_pop(conf->queue);
219
219
                switch (job->type) {
220
220
                        case JOB_DUMP:
221
 
                                dump_table_data_file(thrconn, job->database, job->table, job->where, job->filename, job->conf);
 
221
                                dump_table_data_file(thrconn, job->database, job->table, job->where, job->filename);
222
222
                                break;
223
223
                        case JOB_SHUTDOWN:
224
224
                                if (thrconn)
651
651
        mysql_free_result(result);
652
652
}
653
653
 
654
 
void dump_table_data_file(MYSQL *conn, char *database, char *table, char *where, char *filename, struct configuration *conf) {
 
654
void dump_table_data_file(MYSQL *conn, char *database, char *table, char *where, char *filename) {
655
655
        void *outfile;
656
656
        
657
657
        if (!compress_output)
663
663
                g_critical("Error: DB: %s TABLE: %s Could not create output file %s (%d)", database, table, filename, errno);
664
664
                return;
665
665
        }
666
 
        dump_table_data(conn, (FILE *)outfile, database, table, where, conf);
 
666
        dump_table_data(conn, (FILE *)outfile, database, table, where);
667
667
        if (!compress_output)
668
668
                fclose((FILE *)outfile);
669
669
        else
705
705
}
706
706
 
707
707
/* Do actual data chunk reading/writing magic */
708
 
void dump_table_data(MYSQL * conn, FILE *file, char *database, char *table, char *where, struct configuration *conf)
 
708
void dump_table_data(MYSQL * conn, FILE *file, char *database, char *table, char *where)
709
709
{
710
710
        guint i;
711
711
        guint num_fields = 0;