bug fixed: storage_disk_recovery.c skip the first file (binlog first line)
parent
7eed149511
commit
41581aae6b
3
HISTORY
3
HISTORY
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
Version 5.07 2015-08-07
|
Version 5.07 2015-08-14
|
||||||
* schedule task add the "second" field
|
* schedule task add the "second" field
|
||||||
* make.sh changed, you must upgrade libfastcommon to V1.20 or later
|
* make.sh changed, you must upgrade libfastcommon to V1.20 or later
|
||||||
|
* bug fixed: storage_disk_recovery.c skip the first file (binlog first line)
|
||||||
|
|
||||||
Version 5.06 2015-05-12
|
Version 5.06 2015-05-12
|
||||||
* compile passed in mac OS Darwin
|
* compile passed in mac OS Darwin
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
|
||||||
This package provides tracker & storage of fastdfs
|
This package provides tracker & storage of fastdfs
|
||||||
|
|
||||||
%package -n %{FDFSServer}
|
%package -n %{FDFSServer}
|
||||||
Requires: libfastcommon >= 1.0.18
|
Requires: libfastcommon >= 1.0.20
|
||||||
Summary: fastdfs tracker & storage
|
Summary: fastdfs tracker & storage
|
||||||
|
|
||||||
%package -n %{FDFSTool}
|
%package -n %{FDFSTool}
|
||||||
|
|
|
||||||
|
|
@ -497,6 +497,17 @@ static int recovery_reader_init(const char *pBasePath, \
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int recovery_reader_check_init(const char *pBasePath, \
|
||||||
|
StorageBinLogReader *pReader)
|
||||||
|
{
|
||||||
|
if (pReader->binlog_fd >= 0 && pReader->binlog_buff.buffer != NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return recovery_reader_init(pBasePath, pReader);
|
||||||
|
}
|
||||||
|
|
||||||
static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pReader, \
|
static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pReader, \
|
||||||
ConnectionInfo *pSrcStorage)
|
ConnectionInfo *pSrcStorage)
|
||||||
{
|
{
|
||||||
|
|
@ -512,6 +523,7 @@ static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pRead
|
||||||
int64_t file_size;
|
int64_t file_size;
|
||||||
int64_t total_count;
|
int64_t total_count;
|
||||||
int64_t success_count;
|
int64_t success_count;
|
||||||
|
int64_t noent_count;
|
||||||
bool bContinueFlag;
|
bool bContinueFlag;
|
||||||
char local_filename[MAX_PATH_SIZE];
|
char local_filename[MAX_PATH_SIZE];
|
||||||
char src_filename[MAX_PATH_SIZE];
|
char src_filename[MAX_PATH_SIZE];
|
||||||
|
|
@ -520,6 +532,7 @@ static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pRead
|
||||||
count = 0;
|
count = 0;
|
||||||
total_count = 0;
|
total_count = 0;
|
||||||
success_count = 0;
|
success_count = 0;
|
||||||
|
noent_count = 0;
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
logInfo("file: "__FILE__", line: %d, " \
|
logInfo("file: "__FILE__", line: %d, " \
|
||||||
|
|
@ -529,6 +542,10 @@ static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pRead
|
||||||
bContinueFlag = true;
|
bContinueFlag = true;
|
||||||
while (bContinueFlag)
|
while (bContinueFlag)
|
||||||
{
|
{
|
||||||
|
if ((result=recovery_reader_check_init(pBasePath, pReader)) != 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ((pStorageConn=tracker_connect_server(pSrcStorage, &result)) == NULL)
|
if ((pStorageConn=tracker_connect_server(pSrcStorage, &result)) == NULL)
|
||||||
{
|
{
|
||||||
sleep(5);
|
sleep(5);
|
||||||
|
|
@ -605,8 +622,13 @@ static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pRead
|
||||||
|
|
||||||
success_count++;
|
success_count++;
|
||||||
}
|
}
|
||||||
else if (result != ENOENT)
|
else if (result == ENOENT)
|
||||||
{
|
{
|
||||||
|
result = 0;
|
||||||
|
noent_count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -673,6 +695,10 @@ static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pRead
|
||||||
bContinueFlag = false;
|
bContinueFlag = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -692,25 +718,30 @@ static int storage_do_recovery(const char *pBasePath, StorageBinLogReader *pRead
|
||||||
logDebug("file: "__FILE__", line: %d, " \
|
logDebug("file: "__FILE__", line: %d, " \
|
||||||
"disk recovery: recover path: %s, " \
|
"disk recovery: recover path: %s, " \
|
||||||
"file count: %"PRId64 \
|
"file count: %"PRId64 \
|
||||||
", success count: %"PRId64, \
|
", success count: %"PRId64", noent_count: %"PRId64, \
|
||||||
__LINE__, pBasePath, total_count, \
|
__LINE__, pBasePath, total_count, \
|
||||||
success_count);
|
success_count, noent_count);
|
||||||
recovery_write_to_mark_file(pBasePath, pReader);
|
recovery_write_to_mark_file(pBasePath, pReader);
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tracker_disconnect_server_ex(pStorageConn, result != 0);
|
tracker_disconnect_server_ex(pStorageConn, result != 0);
|
||||||
|
recovery_write_to_mark_file(pBasePath, pReader);
|
||||||
|
if (bContinueFlag)
|
||||||
|
{
|
||||||
|
storage_reader_destroy(pReader);
|
||||||
|
}
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
recovery_write_to_mark_file(pBasePath, pReader);
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
logInfo("file: "__FILE__", line: %d, " \
|
logInfo("file: "__FILE__", line: %d, " \
|
||||||
"disk recovery: recover path: %s, " \
|
"disk recovery: recover path: %s, " \
|
||||||
"file count: %"PRId64 \
|
"file count: %"PRId64 \
|
||||||
", success count: %"PRId64, \
|
", success count: %"PRId64", noent_count: %"PRId64, \
|
||||||
__LINE__, pBasePath, total_count, success_count);
|
__LINE__, pBasePath, total_count, success_count, noent_count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue