diff --git a/HISTORY b/HISTORY index b1e6d12..65c41d3 100644 --- a/HISTORY +++ b/HISTORY @@ -4,7 +4,8 @@ Version 6.04 2019-12-05 * use get_gzip_command_filename from libfastcommon v1.42 * support compress error log and access log * disk recovery support multi-threads to speed up - * bugfix: init pReader->binlog_buff.version/length to 0 + * bugfix: should use memset to init pReader in function + storage_reader_init, this bug is caused by v6.01 NOTE: you MUST upgrade libfastcommon to V1.42 or later diff --git a/storage/storage_sync.c b/storage/storage_sync.c index 9d6103d..4037fd5 100644 --- a/storage/storage_sync.c +++ b/storage/storage_sync.c @@ -2198,26 +2198,17 @@ int storage_reader_init(FDFSStorageBrief *pStorage, StorageBinLogReader *pReader bool bFileExist; bool bNeedSyncOld; - pReader->binlog_index = 0; - pReader->binlog_offset = 0; - pReader->need_sync_old = 0; - pReader->sync_old_done = 0; - pReader->until_timestamp = 0; - pReader->scan_row_count = 0; - pReader->sync_row_count = 0; - pReader->last_file_exist = 0; - pReader->binlog_fd = -1; - pReader->binlog_buff.version = 0; - pReader->binlog_buff.length = 0; + memset(pReader, 0, sizeof(StorageBinLogReader)); + pReader->binlog_fd = -1; - pReader->binlog_buff.buffer = (char *)malloc( \ + pReader->binlog_buff.buffer = (char *)malloc( STORAGE_BINLOG_BUFFER_SIZE); if (pReader->binlog_buff.buffer == NULL) { - logError("file: "__FILE__", line: %d, " \ - "malloc %d bytes fail, " \ - "errno: %d, error info: %s", \ - __LINE__, STORAGE_BINLOG_BUFFER_SIZE, \ + logError("file: "__FILE__", line: %d, " + "malloc %d bytes fail, " + "errno: %d, error info: %s", + __LINE__, STORAGE_BINLOG_BUFFER_SIZE, errno, STRERROR(errno)); return errno != 0 ? errno : ENOMEM; }