Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[patch 4/8] WL4081: read compressed backup files

From: <stewart(at)mysql.com>
Date: Thu Oct 11 2007 - 04:45:45 EDT

  • use azio in ndb_restore
  • makes ndb_backup_compressed test pass (as can restore compressed backups)

Index: telco/storage/ndb/tools/restore/Restore.cpp


  • telco.orig/storage/ndb/tools/restore/Restore.cpp 2007-10-11 15:52:43.647087510 +1000 +++ telco/storage/ndb/tools/restore/Restore.cpp 2007-10-11 16:44:19.666936757 +1000 @@ -761,7 +761,7 @@ RestoreDataIterator::getNextTuple(int & BackupFile::BackupFile(void (* _free_data_callback)()) : free_data_callback(_free_data_callback) {
    - m_file = 0;
    + m_file.file = -1; m_path[0] = 0; m_fileName[0] = 0;

@@ -775,29 +775,29 @@ BackupFile::BackupFile(void (* _free_dat  }  

 BackupFile::~BackupFile(){
- if(m_file != 0)

  • fclose(m_file); + if(m_file.file > 1) + azclose(&m_file); if(m_buffer != 0) free(m_buffer); }

 bool
 BackupFile::openFile(){
- if(m_file != NULL){

  • fclose(m_file);
  • m_file = 0; + if(m_file.file > 1){ + azclose(&m_file); + m_file.file = 0; m_file_size = 0; m_file_pos = 0; }
    -
    + info.setLevel(254); info << "Opening file '" << m_fileName << "'\n";
  • m_file = fopen(m_fileName, "r"); + int r= azopen(&m_file,m_fileName, O_RDONLY);
  • if (m_file) + if (r==0) { struct stat buf;
  • if (fstat(fileno(m_file), &buf) == 0) + if (fstat(m_file.file, &buf) == 0) { m_file_size = (Uint64)buf.st_size; info << "File size " << m_file_size << " bytes\n"; @@ -810,7 +810,7 @@ BackupFile::openFile(){ } }
  • return m_file != 0; + return r != 0; }

 Uint32 BackupFile::buffer_get_ptr_ahead(void **p_buf_ptr, Uint32 size, Uint32 nmemb) @@ -823,7 +823,10 @@ Uint32 BackupFile::buffer_get_ptr_ahead(  

     memcpy(m_buffer, m_buffer_ptr, m_buffer_data_left);  

  • size_t r = fread(((char *)m_buffer) + m_buffer_data_left, 1, m_buffer_sz - m_buffer_data_left, m_file); + int error; + size_t r = azread(&m_file, + ((char *)m_buffer) + m_buffer_data_left, + m_buffer_sz - m_buffer_data_left, &error); m_file_pos += r; m_buffer_data_left += r; m_buffer_ptr = m_buffer; Index: telco/storage/ndb/tools/restore/Restore.hpp
    • telco.orig/storage/ndb/tools/restore/Restore.hpp 2007-10-11 15:52:43.703090257 +1000 +++ telco/storage/ndb/tools/restore/Restore.hpp 2007-10-11 16:08:07.240386621 +1000 @@ -21,6 +21,7 @@ #include "../src/kernel/blocks/backup/BackupFormat.hpp" #include "../src/ndbapi/NdbDictionaryImpl.hpp" #include <NdbApi.hpp> +#include <azlib.h>

 #include <ndb_version.h>
 #include <version.h>
@@ -257,7 +258,7 @@ class RestoreLogIterator;  

Do you need help?X

 class BackupFile {
 protected:
- FILE * m_file;

+ azio_stream m_file;

   char m_path[PATH_MAX];
   char m_fileName[PATH_MAX];
   bool m_hostByteOrder;

Index: telco/storage/ndb/src/common/util/azio.c
  • telco.orig/storage/ndb/src/common/util/azio.c 2007-10-11 16:08:05.400296371 +1000 +++ telco/storage/ndb/src/common/util/azio.c 2007-10-11 16:43:35.672778993 +1000 @@ -320,6 +320,7 @@ void check_header(azio_stream *s) } else { + s->transparent = 1; s->z_err = Z_OK;

     return;

--
Stewart Smith

-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Thu Oct 11 09:21:55 2007

This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 09:43:20 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library