trunk file id printf format change from %d to %u
parent
71856858eb
commit
ef31a31152
2
HISTORY
2
HISTORY
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
Version 6.05 2019-12-23
|
||||
Version 6.05 2019-12-24
|
||||
* fdfs_trackerd and fdfs_storaged print the server version in usage.
|
||||
you can execute fdfs_trackerd or fdfs_storaged without parameters
|
||||
to show the server version
|
||||
|
|
|
|||
2
INSTALL
2
INSTALL
|
|
@ -21,7 +21,7 @@ Chinese language: http://www.fastken.com/
|
|||
# command lines as:
|
||||
|
||||
git clone https://github.com/happyfish100/fastdfs.git
|
||||
cd fastdfs; git checkout V6.04
|
||||
cd fastdfs; git checkout V6.05
|
||||
./make.sh clean && ./make.sh && ./make.sh install
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
%define FDFSClient libfdfsclient
|
||||
%define FDFSClientDevel libfdfsclient-devel
|
||||
%define FDFSTool fastdfs-tool
|
||||
%define FDFSVersion 6.0.4
|
||||
%define FDFSVersion 6.0.5
|
||||
%define CommitVersion %(echo $COMMIT_VERSION)
|
||||
|
||||
Name: %{FastDFS}
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ int storage_write_to_sync_ini_file()
|
|||
"%s=%s\n"
|
||||
"%s=%d\n"
|
||||
"%s=%d\n"
|
||||
"%s=%d\n"
|
||||
"%s=%u\n"
|
||||
"%s=%d\n"
|
||||
"%s=%d\n",
|
||||
INIT_ITEM_STORAGE_JOIN_TIME, g_storage_join_time,
|
||||
|
|
@ -1107,7 +1107,7 @@ static int storage_check_and_make_data_dirs()
|
|||
"g_last_storage_ip = %s, "
|
||||
"g_last_server_port = %d, "
|
||||
"g_last_http_port = %d, "
|
||||
"g_current_trunk_file_id = %d, "
|
||||
"g_current_trunk_file_id = %u, "
|
||||
"g_trunk_last_compress_time = %d",
|
||||
g_sync_old_done, g_sync_src_id, g_sync_until_timestamp,
|
||||
g_last_storage_ip, g_last_server_port, g_last_http_port,
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ static int storage_trunk_node_compare_offset(void *p1, void *p2)
|
|||
pTrunkInfo1 = &(((FDFSTrunkNode *)p1)->trunk);
|
||||
pTrunkInfo2 = &(((FDFSTrunkNode *)p2)->trunk);
|
||||
|
||||
result = memcmp(&(pTrunkInfo1->path), &(pTrunkInfo2->path), \
|
||||
result = memcmp(&(pTrunkInfo1->path), &(pTrunkInfo2->path),
|
||||
sizeof(FDFSTrunkPathInfo));
|
||||
if (result != 0)
|
||||
{
|
||||
|
|
@ -329,8 +329,6 @@ static int64_t storage_trunk_get_binlog_size()
|
|||
char full_filename[MAX_PATH_SIZE];
|
||||
struct stat stat_buf;
|
||||
|
||||
trunk_binlog_sync_func(NULL);
|
||||
|
||||
get_trunk_binlog_filename(full_filename);
|
||||
if (stat(full_filename, &stat_buf) != 0)
|
||||
{
|
||||
|
|
@ -418,7 +416,7 @@ static int save_one_trunk(struct walk_callback_args *pCallbackArgs,
|
|||
int result;
|
||||
|
||||
len = sprintf(pCallbackArgs->pCurrent,
|
||||
"%d %c %d %d %d %d %d %d\n",
|
||||
"%d %c %d %d %d %u %d %d\n",
|
||||
(int)g_current_time, TRUNK_OP_TYPE_ADD_SPACE,
|
||||
pTrunkInfo->path.store_path_index,
|
||||
pTrunkInfo->path.sub_path_high,
|
||||
|
|
@ -547,7 +545,9 @@ typedef struct trunk_merge_stat
|
|||
{
|
||||
int merge_count;
|
||||
int merged_trunk_count;
|
||||
int deleted_file_count;
|
||||
int64_t merged_size;
|
||||
int64_t deleted_file_size;
|
||||
} TrunkMergeStat;
|
||||
|
||||
static void trunk_merge_spaces(FDFSTrunkFullInfo **ppMergeFirst,
|
||||
|
|
@ -613,6 +613,9 @@ static void trunk_merge_spaces(FDFSTrunkFullInfo **ppMergeFirst,
|
|||
logInfo("file: "__FILE__", line: %d, "
|
||||
"delete unused trunk file: %s",
|
||||
__LINE__, full_filename);
|
||||
|
||||
merge_stat->deleted_file_count++;
|
||||
merge_stat->deleted_file_size += merged_size;
|
||||
trunk_delete_space_ex(*ppMergeFirst, false, false);
|
||||
*ppMergeFirst = NULL;
|
||||
} while (0);
|
||||
|
|
@ -638,7 +641,8 @@ static int trunk_save_merged_spaces(struct walk_callback_args *pCallbackArgs)
|
|||
FDFSTrunkFullInfo **previous;
|
||||
FDFSTrunkFullInfo **ppMergeFirst;
|
||||
TrunkMergeStat merge_stat;
|
||||
char comma_buff[32];
|
||||
char merged_comma_buff[32];
|
||||
char deleted_comma_buff[32];
|
||||
int result;
|
||||
|
||||
if (pCallbackArgs->trunk_array.count == 0)
|
||||
|
|
@ -652,6 +656,8 @@ static int trunk_save_merged_spaces(struct walk_callback_args *pCallbackArgs)
|
|||
merge_stat.merge_count = 0;
|
||||
merge_stat.merged_trunk_count = 0;
|
||||
merge_stat.merged_size = 0;
|
||||
merge_stat.deleted_file_count = 0;
|
||||
merge_stat.deleted_file_size = 0;
|
||||
previous = NULL;
|
||||
|
||||
ppEnd = pCallbackArgs->trunk_array.trunks +
|
||||
|
|
@ -697,10 +703,13 @@ static int trunk_save_merged_spaces(struct walk_callback_args *pCallbackArgs)
|
|||
|
||||
logInfo("file: "__FILE__", line: %d, "
|
||||
"merge free trunk spaces, merge count: %d, "
|
||||
"merged trunk count: %d, merged size: %s",
|
||||
"merged trunk count: %d, merged size: %s, "
|
||||
"deleted file count: %d, deleted file size: %s",
|
||||
__LINE__, merge_stat.merge_count,
|
||||
merge_stat.merged_trunk_count,
|
||||
long_to_comma_str(merge_stat.merged_size, comma_buff));
|
||||
long_to_comma_str(merge_stat.merged_size, merged_comma_buff),
|
||||
merge_stat.deleted_file_count, long_to_comma_str(
|
||||
merge_stat.deleted_file_size, deleted_comma_buff));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -715,10 +724,14 @@ static int do_save_trunk_data()
|
|||
int result;
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&trunk_mem_lock);
|
||||
trunk_binlog_flush(false);
|
||||
trunk_binlog_size = storage_trunk_get_binlog_size();
|
||||
if (trunk_binlog_size < 0)
|
||||
{
|
||||
return errno != 0 ? errno : EPERM;
|
||||
result = errno != 0 ? errno : EIO;
|
||||
pthread_mutex_unlock(&trunk_mem_lock);
|
||||
return result;
|
||||
}
|
||||
|
||||
memset(&callback_args, 0, sizeof(callback_args));
|
||||
|
|
@ -736,6 +749,8 @@ static int do_save_trunk_data()
|
|||
"errno: %d, error info: %s",
|
||||
__LINE__, callback_args.temp_trunk_filename,
|
||||
result, STRERROR(result));
|
||||
|
||||
pthread_mutex_unlock(&trunk_mem_lock);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -744,7 +759,6 @@ static int do_save_trunk_data()
|
|||
callback_args.pCurrent += len;
|
||||
|
||||
result = 0;
|
||||
pthread_mutex_lock(&trunk_mem_lock);
|
||||
for (i=0; i<g_fdfs_store_paths.count; i++)
|
||||
{
|
||||
if (g_trunk_free_space_merge)
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ char *trunk_info_dump(const FDFSTrunkFullInfo *pTrunkInfo, char *buff, \
|
|||
"store_path_index=%d, " \
|
||||
"sub_path_high=%d, " \
|
||||
"sub_path_low=%d, " \
|
||||
"id=%d, offset=%d, size=%d, status=%d", \
|
||||
"id=%u, offset=%d, size=%d, status=%d", \
|
||||
pTrunkInfo->path.store_path_index, \
|
||||
pTrunkInfo->path.sub_path_high, \
|
||||
pTrunkInfo->path.sub_path_low, \
|
||||
|
|
@ -382,7 +382,7 @@ void trunk_file_info_encode(const FDFSTrunkFileInfo *pTrunkFile, char *str)
|
|||
int2buff(pTrunkFile->id, buff);
|
||||
int2buff(pTrunkFile->offset, buff + sizeof(int));
|
||||
int2buff(pTrunkFile->size, buff + sizeof(int) * 2);
|
||||
base64_encode_ex(&g_fdfs_base64_context, buff, sizeof(buff), \
|
||||
base64_encode_ex(&g_fdfs_base64_context, buff, sizeof(buff),
|
||||
str, &len, false);
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ void trunk_file_info_decode(const char *str, FDFSTrunkFileInfo *pTrunkFile)
|
|||
char buff[FDFS_TRUNK_FILE_INFO_LEN];
|
||||
int len;
|
||||
|
||||
base64_decode_auto(&g_fdfs_base64_context, str, FDFS_TRUNK_FILE_INFO_LEN, \
|
||||
base64_decode_auto(&g_fdfs_base64_context, str, FDFS_TRUNK_FILE_INFO_LEN,
|
||||
buff, &len);
|
||||
|
||||
pTrunkFile->id = buff2int(buff);
|
||||
|
|
@ -659,10 +659,13 @@ int trunk_file_do_lstat_func_ex(const FDFSStorePaths *pStorePaths, \
|
|||
}
|
||||
else
|
||||
{
|
||||
close(fd);
|
||||
logError("file: "__FILE__", line: %d, " \
|
||||
"Invalid file type: %d", __LINE__, \
|
||||
/*
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"Invalid file type: %d", __LINE__,
|
||||
pTrunkHeader->file_type);
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#define IS_TRUNK_FILE_BY_ID(trunkInfo) (trunkInfo.file.id > 0)
|
||||
|
||||
#define TRUNK_GET_FILENAME(file_id, filename) \
|
||||
sprintf(filename, "%06d", file_id)
|
||||
sprintf(filename, "%06u", file_id)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1331,6 +1331,13 @@ static int trunk_binlog_fsync_ex(const bool bNeedLock,
|
|||
return write_ret;
|
||||
}
|
||||
|
||||
int trunk_binlog_flush(const bool bNeedLock)
|
||||
{
|
||||
return trunk_binlog_fsync_ex(bNeedLock,
|
||||
trunk_binlog_write_cache_buff,
|
||||
(&trunk_binlog_write_cache_len));
|
||||
}
|
||||
|
||||
int trunk_binlog_write(const int timestamp, const char op_type, \
|
||||
const FDFSTrunkFullInfo *pTrunk)
|
||||
{
|
||||
|
|
@ -1347,7 +1354,7 @@ int trunk_binlog_write(const int timestamp, const char op_type, \
|
|||
|
||||
trunk_binlog_write_cache_len += sprintf(trunk_binlog_write_cache_buff + \
|
||||
trunk_binlog_write_cache_len, \
|
||||
"%d %c %d %d %d %d %d %d\n", \
|
||||
"%d %c %d %d %d %u %d %d\n", \
|
||||
timestamp, op_type, \
|
||||
pTrunk->path.store_path_index, \
|
||||
pTrunk->path.sub_path_high, \
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ int trunk_sync_thread_start_all();
|
|||
int trunk_sync_thread_start(const FDFSStorageBrief *pStorage);
|
||||
int kill_trunk_sync_threads();
|
||||
int trunk_binlog_sync_func(void *args);
|
||||
int trunk_binlog_flush(const bool bNeedLock); //wrapper for trunk_binlog_fsync
|
||||
void trunk_waiting_sync_thread_exit();
|
||||
|
||||
char *get_trunk_binlog_filename(char *full_filename);
|
||||
|
|
|
|||
Loading…
Reference in New Issue