Merge lp:~ubuntu-43/undrop-for-innodb/pierre into lp:undrop-for-innodb

Proposed by Aleksandr Kuzminsky
Status: Merged
Merged at revision: 33
Proposed branch: lp:~ubuntu-43/undrop-for-innodb/pierre
Merge into: lp:undrop-for-innodb
Diff against target: 303 lines (+73/-36) (has conflicts)
3 files modified
Makefile (+10/-6)
c_parser.c (+45/-25)
print_data.c (+18/-5)
Text conflict in c_parser.c
Text conflict in print_data.c
To merge this branch: bzr merge lp:~ubuntu-43/undrop-for-innodb/pierre
Reviewer Review Type Date Requested Status
Aleksandr Kuzminsky Approve
Review via email: mp+238809@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Aleksandr Kuzminsky (akuzminsky) wrote :

conflicts fixed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2014-09-03 23:24:55 +0000
+++ Makefile 2014-10-19 02:20:41 +0000
@@ -3,19 +3,23 @@
3SRCS = stream_parser.c include/mysql_def.h c_parser.c3SRCS = stream_parser.c include/mysql_def.h c_parser.c
4INC_PATH = -I./include4INC_PATH = -I./include
5LIBS = -pthread -lm5LIBS = -pthread -lm
6BINDIR = ./bin
67
7CC ?= gcc8CC ?= gcc
9INSTALL ?=install
8YACC = bison10YACC = bison
9LEX = flex11LEX = flex
1012
11CFLAGS += -g -O313CFLAGS += -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -fomit-frame-pointer -march=k8
14#LDFLAGS=-static
15INSTALLFLAGS ?=-s
12CentOS5 = $(findstring .el5,$(shell cat /proc/version))16CentOS5 = $(findstring .el5,$(shell cat /proc/version))
13ifeq ($(CentOS5), .el5)17ifeq ($(CentOS5), .el5)
14CFLAGS += -DCentOS518CFLAGS += -DCentOS5
15endif19endif
1620
17all: $(TARGETS)21all: $(TARGETS)
18 22
19debug: LEX_DEBUG = -d 23debug: LEX_DEBUG = -d
20debug: YACC_DEBUG = -r all24debug: YACC_DEBUG = -r all
21debug: CFLAGS += -DDEBUG -DSTREAM_PARSER_DEBUG25debug: CFLAGS += -DDEBUG -DSTREAM_PARSER_DEBUG
@@ -25,7 +29,7 @@
25 $(CC) $(CFLAGS) $(INC_PATH) -c $<29 $(CC) $(CFLAGS) $(INC_PATH) -c $<
2630
27stream_parser: stream_parser.o31stream_parser: stream_parser.o
28 $(CC) $(CFLAGS) $(INC_PATH) $(LIB_PATH) $(LIBS) $< -o $@32 $(CC) $(CFLAGS) $(INC_PATH) $(LIB_PATH) $(LIBS) $(LDFLAGS) $< -o $@
2933
30sql_parser.o: sql_parser.c34sql_parser.o: sql_parser.c
31 $(CC) $(CFLAGS) $(INC_PATH) -c $< 35 $(CC) $(CFLAGS) $(INC_PATH) -c $<
@@ -49,17 +53,17 @@
49 $(CC) $(CFLAGS) $(INC_PATH) -c $<53 $(CC) $(CFLAGS) $(INC_PATH) -c $<
5054
51c_parser: sql_parser.o c_parser.o tables_dict.o print_data.o check_data.o55c_parser: sql_parser.o c_parser.o tables_dict.o print_data.o check_data.o
52 $(CC) $(CFLAGS) $(INC_PATH) $(LIB_PATH) $^ -o $@ $(LIBS)56 $(CC) $(CFLAGS) $(LDFLAGS) $(INC_PATH) $(LIB_PATH) $^ -o $@ $(LIBS)
5357
54innochecksum_changer: innochecksum.c include/innochecksum.h58innochecksum_changer: innochecksum.c include/innochecksum.h
55 $(CC) $(CFLAGS) $(INC_PATH) -o $@ $<59 $(CC) $(CFLAGS) $(LDFLAGS) $(INC_PATH) -o $@ $<
5660
57sys_parser: sys_parser.c61sys_parser: sys_parser.c
58 @ which mysql_config || (echo "sys_parser needs mysql development package( either -devel or -dev)"; exit -1)62 @ which mysql_config || (echo "sys_parser needs mysql development package( either -devel or -dev)"; exit -1)
59 $(CC) `mysql_config --cflags` `mysql_config --libs` -o $@ $< 63 $(CC) `mysql_config --cflags` `mysql_config --libs` -o $@ $<
6064
61install: $(TARGETS)65install: $(TARGETS)
62 $(INSTALL) $(INSTALLFLAGS) $(TARGETS) $(BINDIR)/$(TARGETS)66 $(INSTALL) $(INSTALLFLAGS) $(TARGETS) $(BINDIR)
6367
64clean:68clean:
65 rm -f $(OBJECTS) $(TARGETS) lex.yy.c sql_parser.c sql_parser.output sys_parser69 rm -f $(OBJECTS) $(TARGETS) lex.yy.c sql_parser.c sql_parser.output sys_parser
6670
=== modified file 'c_parser.c'
--- c_parser.c 2014-10-07 22:51:39 +0000
+++ c_parser.c 2014-10-19 02:20:41 +0000
@@ -89,12 +89,13 @@
89int use_filter_id = 0;89int use_filter_id = 0;
9090
91FILE* f_result;91FILE* f_result;
92FILE* f_sql;
9293
93extern int load_table(char*);94extern int load_table(char*);
9495
95inline void error(char *msg) {96inline void error(char *msg) {
96 printf("Error: %s\n", msg);97 fprintf(stderr, "Error: %s\n", msg);
97 exit(1);98 exit(1);
98}99}
99100
100101
@@ -612,7 +613,7 @@
612 }613 }
613 fprintf(f_result, ", Records list: %s", is_page_valid? "Valid": "Invalid");614 fprintf(f_result, ", Records list: %s", is_page_valid? "Valid": "Invalid");
614 expected_records_inheader = mach_read_from_2(page + PAGE_HEADER + PAGE_N_RECS);615 expected_records_inheader = mach_read_from_2(page + PAGE_HEADER + PAGE_N_RECS);
615 fprintf(f_result, ", Expected records: (%u %lu)", expected_records, expected_records_inheader);616 fprintf(f_result, ", Expected records: (%u %u)", expected_records, expected_records_inheader);
616 fprintf(f_result, "\n");617 fprintf(f_result, "\n");
617 if (debug) printf("Starting offset: %lu (%lX). Checking %d table definitions.\n", offset, offset, table_definitions_cnt);618 if (debug) printf("Starting offset: %lu (%lX). Checking %d table definitions.\n", offset, offset, table_definitions_cnt);
618 619
@@ -692,8 +693,8 @@
692 while ((read_bytes = read(fn, page, UNIV_PAGE_SIZE)) == UNIV_PAGE_SIZE) {693 while ((read_bytes = read(fn, page, UNIV_PAGE_SIZE)) == UNIV_PAGE_SIZE) {
693 pos = lseek(fn, 0, SEEK_CUR);694 pos = lseek(fn, 0, SEEK_CUR);
694 695
695 if (pos % (UNIV_PAGE_SIZE * 10) == 0) {696 if (pos % (UNIV_PAGE_SIZE * 512) == 0) {
696 fprintf(stderr, "-- %.2f%% done\n", 100.0 * pos / st.st_size);697 fprintf(f_sql, "-- %.2f%% done\n", 100.0 * pos / st.st_size);
697 }698 }
698699
699 if (deleted_pages_only) {700 if (deleted_pages_only) {
@@ -746,6 +747,7 @@
746 " -f <InnoDB page(s)> -- InnoDB page or directory with pages(all pages should have same index_id)\n"747 " -f <InnoDB page(s)> -- InnoDB page or directory with pages(all pages should have same index_id)\n"
747 " -t <table.sql> -- CREATE statement of a table\n"748 " -t <table.sql> -- CREATE statement of a table\n"
748 " -o <file> -- Save dump in this file. Otherwise print to stdout\n"749 " -o <file> -- Save dump in this file. Otherwise print to stdout\n"
750 " -l <file> -- Save SQL statements in this file. Otherwise print to stderr\n"
749 " -h -- Print this help\n"751 " -h -- Print this help\n"
750 " -d -- Process only those pages which potentially could have deleted records (default = NO)\n"752 " -d -- Process only those pages which potentially could have deleted records (default = NO)\n"
751 " -D -- Recover deleted rows only (default = NO)\n"753 " -D -- Recover deleted rows only (default = NO)\n"
@@ -770,12 +772,19 @@
770 struct stat st;772 struct stat st;
771 char src[256] = "";773 char src[256] = "";
772774
773 char buffer[16*1024];775 char buffer[BUFSIZ];
774 setvbuf(stdout, buffer, _IOFBF, sizeof(buffer));776 setvbuf(stdout, buffer, _IOFBF, sizeof(buffer));
775777
776 f_result = stdout;778 f_result = stdout;
779 f_sql = stderr;
777 char result_file[1024];780 char result_file[1024];
781<<<<<<< TREE
778 while ((ch = getopt(argc, argv, "t:456hdDUVf:T:b:p:o:i:")) != -1) {782 while ((ch = getopt(argc, argv, "t:456hdDUVf:T:b:p:o:i:")) != -1) {
783=======
784 char sql_file[1024];
785
786 while ((ch = getopt(argc, argv, "t:456hdDUVf:T:b:p:o:l:")) != -1) {
787>>>>>>> MERGE-SOURCE
779 switch (ch) {788 switch (ch) {
780 case 'd':789 case 'd':
781 deleted_pages_only = 1;790 deleted_pages_only = 1;
@@ -794,10 +803,21 @@
794 exit(-1);803 exit(-1);
795 }804 }
796 break;805 break;
806<<<<<<< TREE
797 case 'i':807 case 'i':
798 strncpy(path_ibdata, optarg, sizeof(path_ibdata));808 strncpy(path_ibdata, optarg, sizeof(path_ibdata));
799 external_in_ibdata = 1;809 external_in_ibdata = 1;
800 break;810 break;
811=======
812 case 'l':
813 strncpy(sql_file, optarg, sizeof(sql_file));
814 if(NULL == (f_sql = fopen(sql_file, "w"))){
815 fprintf(stderr, "Can't open file %s for writing\n", sql_file);
816 exit(-1);
817 }
818 break;
819
820>>>>>>> MERGE-SOURCE
801 case 't':821 case 't':
802 if(load_table(optarg) != 0){822 if(load_table(optarg) != 0){
803 fprintf(stderr, "Failed to parse table structure\n");823 fprintf(stderr, "Failed to parse table structure\n");
@@ -882,63 +902,63 @@
882 close(fn);902 close(fn);
883 }903 }
884 table_def_t *table = &(table_definitions[0]);904 table_def_t *table = &(table_definitions[0]);
885 fprintf(stderr, "SET FOREIGN_KEY_CHECKS=0;\n");905 fprintf(f_sql, "SET FOREIGN_KEY_CHECKS=0;\n");
886 fprintf(stderr, "LOAD DATA LOCAL INFILE '");906 fprintf(f_sql, "LOAD DATA LOCAL INFILE '");
887 if(f_result == stdout){907 if(f_result == stdout){
888 fprintf(stderr, "%s/dumps/%s/%s", getenv("PWD"), dump_prefix, table->name);908 fprintf(f_sql, "%s/dumps/%s/%s", getenv("PWD"), dump_prefix, table->name);
889 }909 }
890 else{910 else{
891 fprintf(stderr, "%s", result_file);911 fprintf(f_sql, "%s", result_file);
892 }912 }
893 fprintf(stderr, "' REPLACE INTO TABLE `%s` FIELDS TERMINATED BY '\\t' OPTIONALLY ENCLOSED BY '\"' LINES STARTING BY '%s\\t' ", table->name, table->name);913 fprintf(f_sql, "' REPLACE INTO TABLE `%s` FIELDS TERMINATED BY '\\t' OPTIONALLY ENCLOSED BY '\"' LINES STARTING BY '%s\\t' ", table->name, table->name);
894 int i = 0;914 int i = 0;
895 int comma = 0;915 int comma = 0;
896 int has_set = 0;916 int has_set = 0;
897 fprintf(stderr, "(");917 fprintf(f_sql, "(");
898 for(i = 0; i < table->fields_count; i++) {918 for(i = 0; i < table->fields_count; i++) {
899 if(table->fields[i].type == FT_INTERNAL) continue;919 if(table->fields[i].type == FT_INTERNAL) continue;
900 if(comma) fprintf(stderr, ", ");920 if(comma) fprintf(f_sql, ", ");
901 switch(table->fields[i].type){921 switch(table->fields[i].type){
902 case FT_BLOB:922 case FT_BLOB:
903 case FT_BIN:923 case FT_BIN:
904 fprintf(stderr, "@var_%s", table->fields[i].name);924 fprintf(f_sql, "@var_%s", table->fields[i].name);
905 has_set = 1;925 has_set = 1;
906 break;926 break;
907 case FT_BIT:927 case FT_BIT:
908 fprintf(stderr, "@var_%s", table->fields[i].name);928 fprintf(f_sql, "@var_%s", table->fields[i].name);
909 has_set = 1;929 has_set = 1;
910 break;930 break;
911 default:931 default:
912 fprintf(stderr, "`%s`", table->fields[i].name);932 fprintf(f_sql, "`%s`", table->fields[i].name);
913 }933 }
914 comma = 1;934 comma = 1;
915 }935 }
916 fprintf(stderr, ")");936 fprintf(f_sql, ")");
917 comma = 0;937 comma = 0;
918 if(has_set){938 if(has_set){
919 fprintf(stderr, "\nSET\n");939 fprintf(f_sql, "\nSET\n");
920 for(i = 0; i < table->fields_count; i++) {940 for(i = 0; i < table->fields_count; i++) {
921 if(table->fields[i].type == FT_INTERNAL) continue;941 if(table->fields[i].type == FT_INTERNAL) continue;
922 switch(table->fields[i].type){942 switch(table->fields[i].type){
923 case FT_BLOB:943 case FT_BLOB:
924 case FT_BIN:944 case FT_BIN:
925 if(comma) fprintf(stderr, ",\n");945 if(comma) fprintf(f_sql, ",\n");
926 fprintf(stderr, " %s = UNHEX(@var_%s)", table->fields[i].name, table->fields[i].name);946 fprintf(f_sql, " %s = UNHEX(@var_%s)", table->fields[i].name, table->fields[i].name);
927 comma = 1;947 comma = 1;
928 break;948 break;
929 case FT_BIT:949 case FT_BIT:
930 if(comma) fprintf(stderr, ",\n");950 if(comma) fprintf(f_sql, ",\n");
931 fprintf(stderr, " %s = CAST(@var_%s AS UNSIGNED)", table->fields[i].name, table->fields[i].name);951 fprintf(f_sql, " %s = CAST(@var_%s AS UNSIGNED)", table->fields[i].name, table->fields[i].name);
932 comma = 1;952 comma = 1;
933 break;953 break;
934 default: break;954 default: break;
935 }955 }
936 }956 }
937 }957 }
938 fprintf(stderr, ";\n");958 fprintf(f_sql, ";\n");
939 if (!process_compact && !process_redundant) {959 if (!process_compact && !process_redundant) {
940 printf("Error: Please, specify what format your datafile in. Use -4 for mysql 4.1 and below and -5 for 5.X+\n");960 fprintf(stderr,"Error: Please, specify what format your datafile in. Use -4 for mysql 4.1 and below and -5 for 5.X+\n");
941 usage();961 usage();
942 }962 }
943 963
944 return 0;964 return 0;
945965
=== modified file 'print_data.c'
--- print_data.c 2014-10-08 00:15:51 +0000
+++ print_data.c 2014-10-19 02:20:41 +0000
@@ -112,11 +112,19 @@
112void print_string_raw(char *value, ulint len) {112void print_string_raw(char *value, ulint len) {
113 ulint i;113 ulint i;
114 for(i = 0; i < len; i++) {114 for(i = 0; i < len; i++) {
115<<<<<<< TREE
115 if (value[i] == '"') fprintf(f_result, "\\\"");116 if (value[i] == '"') fprintf(f_result, "\\\"");
116 else if (value[i] == '\n') fprintf(f_result, "\\n");117 else if (value[i] == '\n') fprintf(f_result, "\\n");
117 else if (value[i] == '\r') fprintf(f_result, "\\r");118 else if (value[i] == '\r') fprintf(f_result, "\\r");
118 else fprintf(f_result, "%c", value[i]);119 else fprintf(f_result, "%c", value[i]);
119 }120 }
121=======
122 if (value[i] == '"') fprintf(f_result,"\\\"");
123 else if (value[i] == '\n') fprintf(f_result,"\\n");
124 else if (value[i] == '\r') fprintf(f_result,"\\r");
125 else fprintf(f_result, "%c", value[i]);
126 }
127>>>>>>> MERGE-SOURCE
120}128}
121129
122void print_hex(char *value, ulint len) {130void print_hex(char *value, ulint len) {
@@ -196,10 +204,8 @@
196204
197/*******************************************************************/205/*******************************************************************/
198inline void print_set(int value, field_def_t *field) {206inline void print_set(int value, field_def_t *field) {
199 int i;207 /* int i;
200 int comma = 0;208 int comma = 0
201 fprintf(f_result, "%d", value);
202 /*
203 fprintf(f_result, "\"");209 fprintf(f_result, "\"");
204 for(i=0; i<field->limits.set_values_count; i++){210 for(i=0; i<field->limits.set_values_count; i++){
205 if(((value>>i) % 2) == 1){211 if(((value>>i) % 2) == 1){
@@ -210,6 +216,7 @@
210 }216 }
211 fprintf(f_result, "\"");217 fprintf(f_result, "\"");
212 */218 */
219 fprintf(f_result, "%d", value);
213}220}
214221
215/*******************************************************************/222/*******************************************************************/
@@ -336,7 +343,7 @@
336343
337/*******************************************************************/344/*******************************************************************/
338inline void print_field_value(byte *value, ulint len, field_def_t *field) {345inline void print_field_value(byte *value, ulint len, field_def_t *field) {
339 time_t t;346 /* time_t t;*/
340347
341 switch (field->type) {348 switch (field->type) {
342 case FT_INTERNAL:349 case FT_INTERNAL:
@@ -481,9 +488,15 @@
481 if (len_sum >= extern_len)488 if (len_sum >= extern_len)
482 break;489 break;
483 } else {490 } else {
491<<<<<<< TREE
484 fprintf(stderr, "-- #####CannotOpen_%s;\n", tmp);492 fprintf(stderr, "-- #####CannotOpen_%s;\n", tmp);
485 perror("-- print_field_value_with_external(): open()");493 perror("-- print_field_value_with_external(): open()");
486 break;494 break;
495=======
496 fprintf(stderr, "-- #####CannotOpen_%s;\n", tmp);
497 perror("External page:");
498 break;
499>>>>>>> MERGE-SOURCE
487 }500 }
488 }501 }
489 if (field->type == FT_TEXT) {502 if (field->type == FT_TEXT) {

Subscribers

People subscribed via source and target branches

to status/vote changes: