Let’s fork it…

It’s seems like Undrop for Innodb official repo on githut is now private.

Bad news for the open world, i don’t know if the official repo will be accessible in the future. I don’t know if my 70 lines of script is a part of the problem and if it’s interfer with TwinDB’s business.

I forked the last version of undrop for innodb on bitbucket and i bundled my script with it. You can find the repo here : https://bitbucket.org/Marc-T/undrop-for-innodb

I’ve no project of maintaining undrop-for-innodb core code but the attached script may evolve in the future. Maybe it will be broken in the future. You can fork it / create pull request if you want.

If you have a broken database you could try my little script or try TwinDB’s professional services.

One last word, you should really take care of your backups & binlogs.

🙁

2 thoughts on “Let’s fork it…”

  1. Hi Marc,

    Thank you for your hard work. I have cloned the repo but can’t get it to compile. I have all required dependencies, running OSX El Capitan and have been able to build an old version I found here;

    https://code.google.com/archive/p/innodb-tools/downloads

    Would it be possible to provide the compiled code somewhere or even a link to the old script if it was supported with the older version?

    I’ll paste the output below for you in case it helps explain my issue;

    Cheers!

    cat: /proc/version: No such file or directory
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c stream_parser.c
    stream_parser.c:38:1: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    off64_t ib_size = 0;
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:149:65: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    inline int valid_innodb_page(page_t* page, uint64_t block_size, off64_t* step){
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:256:20: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    void show_progress(off64_t offset, off64_t length){
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:256:36: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    void show_progress(off64_t offset, off64_t length){
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:261:12: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    static off64_t offset_prev = 0;
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:305:70: warning: format specifies type ‘unsigned long’ but the argument has type ‘uint64_t’ (aka ‘unsigned long long’) [-Wformat]
    sprintf(file_name, “%s/FIL_PAGE_INDEX/%016lu.page”, dst_dir, index_id);
    ~~~~~~ ^~~~~~~~
    %016llu
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro ‘sprintf’
    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
    ^~~~~~~~~~~
    stream_parser.c:328:29: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    void process_ibfile(int fn, off64_t start_offset, ssize_t length){
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:332:5: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    off64_t curr_disk_offset = 0;
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:333:5: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    off64_t prev_disk_offset = 0;
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:334:5: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
    off64_t global_offset = 0;
    ^~~~~~~
    off_t
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_types/_off_t.h:30:25: note: ‘off_t’ declared here
    typedef __darwin_off_t off_t;
    ^
    stream_parser.c:349:24: warning: implicit declaration of function ‘lseek64’ is invalid in C99 [-Wimplicit-function-declaration]
    curr_disk_offset = lseek64(fn, start_offset, SEEK_SET);
    ^
    stream_parser.c:381:105: warning: incompatible pointer types passing ‘ssize_t *’ (aka ‘long *’) to parameter of type ‘off_t *’ (aka ‘long long *’) [-Wincompatible-pointer-types]
    || valid_innodb_page(cache + curr_cache_offset, bytes_in_cache – curr_cache_offset, &cache_step)){
    ^~~~~~~~~~~
    stream_parser.c:149:74: note: passing argument to parameter ‘step’ here
    inline int valid_innodb_page(page_t* page, uint64_t block_size, off64_t* step){
    ^
    stream_parser.c:440:62: warning: format specifies type ‘uintmax_t’ (aka ‘unsigned long’) but the argument has type ‘dev_t’ (aka ‘int’) [-Wformat]
    fprintf(stderr, “ID of device containing file: %12ju\n”, st.st_dev);
    ~~~~~ ^~~~~~~~~
    %12d
    stream_parser.c:441:62: warning: format specifies type ‘uintmax_t’ (aka ‘unsigned long’) but the argument has type ‘__darwin_ino64_t’ (aka ‘unsigned long long’) [-Wformat]
    fprintf(stderr, “inode number: %12ju\n”, st.st_ino);
    ~~~~~ ^~~~~~~~~
    %12llu
    stream_parser.c:453:62: warning: format specifies type ‘size_t’ (aka ‘unsigned long’) but the argument has type ‘nlink_t’ (aka ‘unsigned short’) [-Wformat]
    fprintf(stderr, “number of hard links: %12zu\n”, st.st_nlink);
    ~~~~~ ^~~~~~~~~~~
    %12hu
    stream_parser.c:456:62: warning: format specifies type ‘uintmax_t’ (aka ‘unsigned long’) but the argument has type ‘dev_t’ (aka ‘int’) [-Wformat]
    fprintf(stderr, “device ID (if special file): %12ju\n”, st.st_rdev);
    ~~~~~ ^~~~~~~~~~
    %12d
    stream_parser.c:457:62: warning: format specifies type ‘unsigned long’ but the argument has type ‘blksize_t’ (aka ‘int’) [-Wformat]
    fprintf(stderr, “blocksize for filesystem I/O: %12lu\n”, st.st_blksize);
    ~~~~~ ^~~~~~~~~~~~~
    %12d
    stream_parser.c:458:62: warning: format specifies type ‘uintmax_t’ (aka ‘unsigned long’) but the argument has type ‘blkcnt_t’ (aka ‘long long’) [-Wformat]
    fprintf(stderr, “number of blocks allocated: %12ju\n”, st.st_blocks);
    ~~~~~ ^~~~~~~~~~~~
    %12lld
    stream_parser.c:465:32: error: use of undeclared identifier ‘O_LARGEFILE’
    fn = open(fname, O_RDONLY, O_LARGEFILE);
    ^
    stream_parser.c:466:5: warning: implicit declaration of function ‘posix_fadvise’ is invalid in C99 [-Wimplicit-function-declaration]
    posix_fadvise(fn, 0, 0, POSIX_FADV_SEQUENTIAL);
    ^
    stream_parser.c:466:29: error: use of undeclared identifier ‘POSIX_FADV_SEQUENTIAL’
    posix_fadvise(fn, 0, 0, POSIX_FADV_SEQUENTIAL);
    ^
    stream_parser.c:480:67: warning: format specifies type ‘unsigned long’ but the argument has type ‘off_t’ (aka ‘long long’) [-Wformat]
    fprintf(stderr, “Size to process: %12lu (%s)\n”, ib_size, h_size(ib_size, buf));
    ~~~~~ ^~~~~~~
    %12lld
    stream_parser.c:595:9: warning: ‘sem_init’ is deprecated [-Wdeprecated-declarations]
    sem_init(index_mutex + i, 1, 1);
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/semaphore.h:55:5: note: ‘sem_init’ has been explicitly marked deprecated here
    int sem_init(sem_t *, int, unsigned int) __deprecated;
    ^
    stream_parser.c:596:9: warning: ‘sem_init’ is deprecated [-Wdeprecated-declarations]
    sem_init(blob_mutex + i, 1, 1);
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/semaphore.h:55:5: note: ‘sem_init’ has been explicitly marked deprecated here
    int sem_init(sem_t *, int, unsigned int) __deprecated;
    ^
    stream_parser.c:643:9: warning: ‘sem_destroy’ is deprecated [-Wdeprecated-declarations]
    sem_destroy(index_mutex + i);
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/semaphore.h:53:5: note: ‘sem_destroy’ has been explicitly marked deprecated here
    int sem_destroy(sem_t *) __deprecated;
    ^
    stream_parser.c:644:9: warning: ‘sem_destroy’ is deprecated [-Wdeprecated-declarations]
    sem_destroy(blob_mutex + i);
    ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/semaphore.h:53:5: note: ‘sem_destroy’ has been explicitly marked deprecated here
    int sem_destroy(sem_t *) __deprecated;
    ^
    15 warnings and 11 errors generated.
    make: *** [stream_parser.o] Error 1

Leave a Reply

Your email address will not be published. Required fields are marked *