constrain parser is not reading the pages file in correct order while processing the pages file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Data Recovery Tool for InnoDB |
New
|
Undecided
|
Unassigned |
Bug Description
In the Main class when the directory is open and the files are read
The pages files are NOT read from the readdir function in sorted order.
As such the resulting file has the pages not following the correct sorted order, and this can be an issue in general and is not optimal when reloading the data on the MySQL server.
The following patch replace part of the code and allow to have them sorted correctly.
*******
Replace
/*
while(NULL != (de = readdir(src_dir))){
if(!
if(!
if(debug) { fprintf(stderr, "Processing %s\n", src_file); }
fprintf(stderr, "Processing %s\n", src_file);
if(0 == (fn = open_ibfile(
fprintf(stderr, "Can't open %s\n", src_file);
perror(
exit(-1);
}
process_
close(fn);
}
*/
WITH
=======
*/
/*The pages are NOT read from the readdir function in sorted order
* To have them sorted we have to process them first
*
* Below we first identify the number of files to parse
*
* then we create an array with all the names and we sort it
*
* Then we process it.
*
* Process can be optimize, but at least is not presenting the pages in sparse order in the result file.
*/
/*
* Start Patch \/
*/
while(NULL != (de = readdir(src_dir))){
if(!
if(!
file_count++;
}
char result[
int indexres = 0;
src_dir = opendir(src);
while(NULL != (de = readdir(src_dir))){
if(!
if(!
if(debug){ fprintf(stderr, "Processing %s\n", src_file); }
}
closedir(
int i,j;
char t[file_count];
for(i=
for(
{
{
}
}
}
indexres = 0;
fprintf(stderr, "Processing, \nTotal pages to process %d %s",file_count, ":");
while(
fprintf(stderr, "%s", ".");
if(0 == (fn = open_ibfile(
fprintf(
perror(
exit(-1);
}
process_
indexres++;
close(fn);
}
fprintf(stderr, "%s\n", ".");
/*
* END Patch /\
*/
Here the final patch with also the option to see the process when in debug mode, I had forgot to remove them in the previous ------- ------- ------- ------- ------- ------- ------- ------- ------- ---
-------
Index: constraints_ parser. c ======= ======= ======= ======= ======= ======= ======= ======= ==== parser. c (revision 4) parser. c (working copy)
=======
--- constraints_
+++ constraints_
@@ -657,6 +657,7 @@
struct stat st;
char src[256];
+
setvbuf( stdout, buffer, _IOFBF, sizeof(buffer));
char buffer[16*1024];
@@ -727,11 +728,16 @@ !strncmp( de->d_name, ".", sizeof( de->d_name) )) continue; !strncmp( de->d_name, "..", sizeof( de->d_name) )) continue;
snprintf( src_file, sizeof(src_file), "%s/%s", src, de->d_name); src_file) )){ stderr, "Can't open %s\n", src_file); "open_ibfile" ); ibfile( fn); de->d_name, ".", sizeof( de->d_name) )) continue; de->d_name, "..", sizeof( de->d_name) )) continue; file_count] [255]; de->d_name, ".", sizeof( de->d_name) )) continue; de->d_name, "..", sizeof( de->d_name) )) continue; result[ indexres+ +], src_file) ; src_dir) ; i<file_ count;i+ +){ j<file_ count;j+ +) result[ j-1],result[ j])>0); result[ j-1],result[ j])>0) t,result[ j-1]); result[ j-1],result[ j]); result[ j],t); {fprintf( stderr, "Processing, \nTotal pages to process %d %s",file_count, ":");} file_count) { {fprintf( stderr, "%s", ".");} result[ indexres] ))){ "open_ibfile" );
char src_file[256];
struct dirent *de;
src_dir = opendir(src);
+ int file_count = 0;
+
+
+/*
while(NULL != (de = readdir(src_dir))){
if(
if(
if(debug) { fprintf(stderr, "Processing %s\n", src_file); }
+ fprintf(stderr, "Processing %s\n", src_file);
if(0 == (fn = open_ibfile(
fprintf(
perror(
@@ -740,7 +746,82 @@
process_
close(fn);
}
+*/
+/*The pages are NOT read from the readdir function in sorted order
+ * To have them sorted we have to process them first
+ *
+ * Below we first identify the number of files to parse
+ *
+ * then we create an array with all the names and we sort it
+ *
+ * Then we process it.
+ *
+ * Process can be optimize, but at least is not presenting the pages in sparse order in the result file.
+ *
+ * Use debug option to enable the progress view
+ */
+
+/*
+ * Start Patch \/
+ */
+ while(NULL != (de = readdir(src_dir))){
+ if(!strncmp(
+ if(!strncmp(
+ file_count++;
+
+ }
+
+ char result[
+ int indexres = 0;
+
+ src_dir = opendir(src);
+ while(NULL != (de = readdir(src_dir))){
+ if(!strncmp(
+ if(!strncmp(
+ snprintf(src_file, sizeof(src_file), "%s/%s", src, de->d_name);
+
+ strcpy(
+ if(debug){ fprintf(stderr, "Processing %s\n", src_file); }
+ }
+
closedir(
+
+ int i,j;
+ char t[file_count];
+
+ for(i=1;
+ for(j=1;
+ {
+ //fprintf(stderr, "value %d\n", strcmp(
+ if(strcmp(
+ {
+ strcpy(
+ strcpy(
+ strcpy(
+ }
+ }
+ }
+
+
+ indexres = 0;
+ if(debug)
+ while(indexres<
+ if(debug)
+ if(0 == (fn = open_ibfile(
+ fprintf(stderr, "Can't open %s\n", result[indexres]);
+ perror(
+ exit(-1);
+ }
+ process_ibfile(fn);
+ indexres++;
+ close(fn);
+ }
+ if(debug){fp...