space size such as total_mb and free_mb use int64_t instead of int
parent
14079d19ef
commit
326d83bb6e
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
Version 6.9.2 2022-11-28
|
||||||
|
* space size such as total_mb and free_mb use int64_t instead of int
|
||||||
|
|
||||||
Version 6.9.1 2022-11-25
|
Version 6.9.1 2022-11-25
|
||||||
* bugfixed: clear task extra data correctly when the connection broken
|
* bugfixed: clear task extra data correctly when the connection broken
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ typedef struct
|
||||||
char src_id[FDFS_STORAGE_ID_MAX_SIZE]; //src storage id
|
char src_id[FDFS_STORAGE_ID_MAX_SIZE]; //src storage id
|
||||||
char domain_name[FDFS_DOMAIN_NAME_MAX_SIZE]; //http domain name
|
char domain_name[FDFS_DOMAIN_NAME_MAX_SIZE]; //http domain name
|
||||||
char version[FDFS_VERSION_SIZE];
|
char version[FDFS_VERSION_SIZE];
|
||||||
int total_mb; //total disk storage in MB
|
int64_t total_mb; //total disk storage in MB
|
||||||
int free_mb; //free disk storage in MB
|
int64_t free_mb; //free disk storage in MB
|
||||||
int upload_priority; //upload priority
|
int upload_priority; //upload priority
|
||||||
time_t join_time; //storage join timestamp (create timestamp)
|
time_t join_time; //storage join timestamp (create timestamp)
|
||||||
time_t up_time; //storage service started timestamp
|
time_t up_time; //storage service started timestamp
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ static int fdfs_dump_global_vars(char *buff, const int buffSize)
|
||||||
"g_trunk_file_size=%d\n"
|
"g_trunk_file_size=%d\n"
|
||||||
"g_store_path_mode=%d\n"
|
"g_store_path_mode=%d\n"
|
||||||
"storage_reserved_mb=%s\n"
|
"storage_reserved_mb=%s\n"
|
||||||
"g_avg_storage_reserved_mb=%d\n"
|
"g_avg_storage_reserved_mb=%"PRId64"\n"
|
||||||
"g_store_path_index=%d\n"
|
"g_store_path_index=%d\n"
|
||||||
"g_current_trunk_file_id=%d\n"
|
"g_current_trunk_file_id=%d\n"
|
||||||
"g_trunk_sync_thread_count=%d\n"
|
"g_trunk_sync_thread_count=%d\n"
|
||||||
|
|
@ -243,7 +243,7 @@ static int fdfs_dump_global_vars(char *buff, const int buffSize)
|
||||||
{
|
{
|
||||||
total_len += snprintf(buff + total_len, buffSize - total_len,
|
total_len += snprintf(buff + total_len, buffSize - total_len,
|
||||||
"\tg_fdfs_store_paths.paths[%d]=%s, " \
|
"\tg_fdfs_store_paths.paths[%d]=%s, " \
|
||||||
"total=%d MB, free=%d MB\n", i, \
|
"total=%"PRId64" MB, free=%"PRId64" MB\n", i, \
|
||||||
g_fdfs_store_paths.paths[i].path, \
|
g_fdfs_store_paths.paths[i].path, \
|
||||||
g_fdfs_store_paths.paths[i].total_mb, \
|
g_fdfs_store_paths.paths[i].total_mb, \
|
||||||
g_fdfs_store_paths.paths[i].free_mb);
|
g_fdfs_store_paths.paths[i].free_mb);
|
||||||
|
|
|
||||||
|
|
@ -4368,7 +4368,7 @@ static int storage_upload_file(struct fast_task_info *pTask, bool bAppenderFile)
|
||||||
{
|
{
|
||||||
logError("file: "__FILE__", line: %d, " \
|
logError("file: "__FILE__", line: %d, " \
|
||||||
"no space to upload file, "
|
"no space to upload file, "
|
||||||
"free space: %d MB is too small, file bytes: " \
|
"free space: %"PRId64" MB is too small, file bytes: " \
|
||||||
"%"PRId64", reserved space: %s", \
|
"%"PRId64", reserved space: %s", \
|
||||||
__LINE__, g_fdfs_store_paths.paths[store_path_index].\
|
__LINE__, g_fdfs_store_paths.paths[store_path_index].\
|
||||||
free_mb, file_bytes, \
|
free_mb, file_bytes, \
|
||||||
|
|
@ -5222,7 +5222,7 @@ static int storage_upload_slave_file(struct fast_task_info *pTask)
|
||||||
{
|
{
|
||||||
logError("file: "__FILE__", line: %d, " \
|
logError("file: "__FILE__", line: %d, " \
|
||||||
"no space to upload file, "
|
"no space to upload file, "
|
||||||
"free space: %d MB is too small, file bytes: " \
|
"free space: %"PRId64" MB is too small, file bytes: " \
|
||||||
"%"PRId64", reserved space: %s", __LINE__,\
|
"%"PRId64", reserved space: %s", __LINE__,\
|
||||||
g_fdfs_store_paths.paths[store_path_index].free_mb, \
|
g_fdfs_store_paths.paths[store_path_index].free_mb, \
|
||||||
file_bytes, fdfs_storage_reserved_space_to_string_ex(\
|
file_bytes, fdfs_storage_reserved_space_to_string_ex(\
|
||||||
|
|
|
||||||
|
|
@ -2246,7 +2246,7 @@ static int tracker_report_df_stat(ConnectionInfo *pTrackerServer,
|
||||||
|
|
||||||
if (g_store_path_mode == FDFS_STORE_PATH_LOAD_BALANCE)
|
if (g_store_path_mode == FDFS_STORE_PATH_LOAD_BALANCE)
|
||||||
{
|
{
|
||||||
int max_free_mb;
|
int64_t max_free_mb;
|
||||||
|
|
||||||
/* find the max free space path */
|
/* find the max free space path */
|
||||||
max_free_mb = 0;
|
max_free_mb = 0;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ int g_trunk_file_size = 0;
|
||||||
int g_store_path_mode = FDFS_STORE_PATH_ROUND_ROBIN;
|
int g_store_path_mode = FDFS_STORE_PATH_ROUND_ROBIN;
|
||||||
FDFSStorageReservedSpace g_storage_reserved_space = {
|
FDFSStorageReservedSpace g_storage_reserved_space = {
|
||||||
TRACKER_STORAGE_RESERVED_SPACE_FLAG_MB};
|
TRACKER_STORAGE_RESERVED_SPACE_FLAG_MB};
|
||||||
int g_avg_storage_reserved_mb = FDFS_DEF_STORAGE_RESERVED_MB;
|
int64_t g_avg_storage_reserved_mb = FDFS_DEF_STORAGE_RESERVED_MB;
|
||||||
int g_store_path_index = 0;
|
int g_store_path_index = 0;
|
||||||
volatile int g_current_trunk_file_id = 0;
|
volatile int g_current_trunk_file_id = 0;
|
||||||
TimeInfo g_trunk_create_file_time_base = {0, 0};
|
TimeInfo g_trunk_create_file_time_base = {0, 0};
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ extern int g_trunk_alloc_alignment_size; //the alignment size for trunk alloc
|
||||||
extern int g_trunk_file_size; //the trunk file size, such as 64MB
|
extern int g_trunk_file_size; //the trunk file size, such as 64MB
|
||||||
extern int g_store_path_mode; //store which path mode, fetch from tracker
|
extern int g_store_path_mode; //store which path mode, fetch from tracker
|
||||||
extern FDFSStorageReservedSpace g_storage_reserved_space; //fetch from tracker
|
extern FDFSStorageReservedSpace g_storage_reserved_space; //fetch from tracker
|
||||||
extern int g_avg_storage_reserved_mb; //calc by above var: g_storage_reserved_mb
|
extern int64_t g_avg_storage_reserved_mb; //calc by above var: g_storage_reserved_mb
|
||||||
extern int g_store_path_index; //store to which path
|
extern int g_store_path_index; //store to which path
|
||||||
extern volatile int g_current_trunk_file_id; //current trunk file id
|
extern volatile int g_current_trunk_file_id; //current trunk file id
|
||||||
extern TimeInfo g_trunk_create_file_time_base;
|
extern TimeInfo g_trunk_create_file_time_base;
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int total_mb; //total spaces
|
int64_t total_mb; //total spaces
|
||||||
int free_mb; //free spaces
|
int64_t free_mb; //free spaces
|
||||||
int path_len; //the length of store path
|
int path_len; //the length of store path
|
||||||
char *path; //file store path
|
char *path; //file store path
|
||||||
char *mark; //path mark to avoid confusion
|
char *mark; //path mark to avoid confusion
|
||||||
|
|
|
||||||
|
|
@ -222,8 +222,7 @@ int fdfs_parse_storage_reserved_space(IniContext *pIniContext,
|
||||||
if (*(pReservedSpaceStr + len - 1) == '%')
|
if (*(pReservedSpaceStr + len - 1) == '%')
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
pStorageReservedSpace->flag = \
|
pStorageReservedSpace->flag = TRACKER_STORAGE_RESERVED_SPACE_FLAG_RATIO;
|
||||||
TRACKER_STORAGE_RESERVED_SPACE_FLAG_RATIO;
|
|
||||||
endptr = NULL;
|
endptr = NULL;
|
||||||
*(pReservedSpaceStr + len - 1) = '\0';
|
*(pReservedSpaceStr + len - 1) = '\0';
|
||||||
pStorageReservedSpace->rs.ratio = \
|
pStorageReservedSpace->rs.ratio = \
|
||||||
|
|
@ -261,41 +260,40 @@ int fdfs_parse_storage_reserved_space(IniContext *pIniContext,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *fdfs_storage_reserved_space_to_string(FDFSStorageReservedSpace \
|
const char *fdfs_storage_reserved_space_to_string(FDFSStorageReservedSpace
|
||||||
*pStorageReservedSpace, char *buff)
|
*pStorageReservedSpace, char *buff)
|
||||||
{
|
{
|
||||||
if (pStorageReservedSpace->flag == \
|
if (pStorageReservedSpace->flag ==
|
||||||
TRACKER_STORAGE_RESERVED_SPACE_FLAG_MB)
|
TRACKER_STORAGE_RESERVED_SPACE_FLAG_MB)
|
||||||
{
|
{
|
||||||
sprintf(buff, "%dMB", pStorageReservedSpace->rs.mb);
|
sprintf(buff, "%"PRId64"MB", pStorageReservedSpace->rs.mb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(buff, "%.2f%%", 100.00 * \
|
sprintf(buff, "%.2f%%", 100.00 * pStorageReservedSpace->rs.ratio);
|
||||||
pStorageReservedSpace->rs.ratio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *fdfs_storage_reserved_space_to_string_ex(const bool flag, \
|
const char *fdfs_storage_reserved_space_to_string_ex(const bool flag,
|
||||||
const int space_mb, const int total_mb, const double space_ratio, \
|
const int64_t space_mb, const int64_t total_mb,
|
||||||
char *buff)
|
const double space_ratio, char *buff)
|
||||||
{
|
{
|
||||||
if (flag == TRACKER_STORAGE_RESERVED_SPACE_FLAG_MB)
|
if (flag == TRACKER_STORAGE_RESERVED_SPACE_FLAG_MB)
|
||||||
{
|
{
|
||||||
sprintf(buff, "%d MB", space_mb);
|
sprintf(buff, "%"PRId64" MB", space_mb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(buff, "%d MB(%.2f%%)", (int)(total_mb * space_ratio), \
|
sprintf(buff, "%"PRId64" MB(%.2f%%)", (int64_t)(total_mb * space_ratio),
|
||||||
100.00 * space_ratio);
|
100.00 * space_ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fdfs_get_storage_reserved_space_mb(const int total_mb, \
|
int64_t fdfs_get_storage_reserved_space_mb(const int64_t total_mb,
|
||||||
FDFSStorageReservedSpace *pStorageReservedSpace)
|
FDFSStorageReservedSpace *pStorageReservedSpace)
|
||||||
{
|
{
|
||||||
if (pStorageReservedSpace->flag == \
|
if (pStorageReservedSpace->flag == \
|
||||||
|
|
@ -305,7 +303,7 @@ int fdfs_get_storage_reserved_space_mb(const int total_mb, \
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (int)(total_mb * pStorageReservedSpace->rs.ratio);
|
return (int64_t)(total_mb * pStorageReservedSpace->rs.ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,7 +361,7 @@ bool fdfs_check_reserved_space_trunk(FDFSGroupInfo *pGroup, \
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fdfs_check_reserved_space_path(const int64_t total_mb, \
|
bool fdfs_check_reserved_space_path(const int64_t total_mb, \
|
||||||
const int64_t free_mb, const int avg_mb, \
|
const int64_t free_mb, const int64_t avg_mb, \
|
||||||
FDFSStorageReservedSpace *pStorageReservedSpace)
|
FDFSStorageReservedSpace *pStorageReservedSpace)
|
||||||
{
|
{
|
||||||
if (pStorageReservedSpace->flag == \
|
if (pStorageReservedSpace->flag == \
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,17 @@ extern "C" {
|
||||||
int fdfs_get_tracker_leader_index_ex(TrackerServerGroup *pServerGroup, \
|
int fdfs_get_tracker_leader_index_ex(TrackerServerGroup *pServerGroup, \
|
||||||
const char *leaderIp, const int leaderPort);
|
const char *leaderIp, const int leaderPort);
|
||||||
|
|
||||||
int fdfs_parse_storage_reserved_space(IniContext *pIniContext, \
|
int fdfs_parse_storage_reserved_space(IniContext *pIniContext,
|
||||||
FDFSStorageReservedSpace *pStorageReservedSpace);
|
FDFSStorageReservedSpace *pStorageReservedSpace);
|
||||||
|
|
||||||
const char *fdfs_storage_reserved_space_to_string(FDFSStorageReservedSpace \
|
const char *fdfs_storage_reserved_space_to_string(FDFSStorageReservedSpace
|
||||||
*pStorageReservedSpace, char *buff);
|
*pStorageReservedSpace, char *buff);
|
||||||
|
|
||||||
const char *fdfs_storage_reserved_space_to_string_ex(const bool flag, \
|
const char *fdfs_storage_reserved_space_to_string_ex(const bool flag,
|
||||||
const int space_mb, const int total_mb, const double space_ratio, \
|
const int64_t space_mb, const int64_t total_mb,
|
||||||
char *buff);
|
const double space_ratio, char *buff);
|
||||||
|
|
||||||
int fdfs_get_storage_reserved_space_mb(const int total_mb, \
|
int64_t fdfs_get_storage_reserved_space_mb(const int64_t total_mb,
|
||||||
FDFSStorageReservedSpace *pStorageReservedSpace);
|
FDFSStorageReservedSpace *pStorageReservedSpace);
|
||||||
|
|
||||||
bool fdfs_check_reserved_space(FDFSGroupInfo *pGroup, \
|
bool fdfs_check_reserved_space(FDFSGroupInfo *pGroup, \
|
||||||
|
|
@ -55,7 +55,7 @@ bool fdfs_check_reserved_space_trunk(FDFSGroupInfo *pGroup, \
|
||||||
FDFSStorageReservedSpace *pStorageReservedSpace);
|
FDFSStorageReservedSpace *pStorageReservedSpace);
|
||||||
|
|
||||||
bool fdfs_check_reserved_space_path(const int64_t total_mb, \
|
bool fdfs_check_reserved_space_path(const int64_t total_mb, \
|
||||||
const int64_t free_mb, const int avg_mb, \
|
const int64_t free_mb, const int64_t avg_mb, \
|
||||||
FDFSStorageReservedSpace *pStorageReservedSpace);
|
FDFSStorageReservedSpace *pStorageReservedSpace);
|
||||||
|
|
||||||
int fdfs_connection_pool_init(const char *config_filename, \
|
int fdfs_connection_pool_init(const char *config_filename, \
|
||||||
|
|
|
||||||
|
|
@ -2435,7 +2435,7 @@ static int tracker_deal_service_query_storage( \
|
||||||
char *p;
|
char *p;
|
||||||
bool bHaveActiveServer;
|
bool bHaveActiveServer;
|
||||||
int write_path_index;
|
int write_path_index;
|
||||||
int avg_reserved_mb;
|
int64_t avg_reserved_mb;
|
||||||
|
|
||||||
if (cmd == TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ONE
|
if (cmd == TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ONE
|
||||||
|| cmd == TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ALL)
|
|| cmd == TRACKER_PROTO_CMD_SERVICE_QUERY_STORE_WITH_GROUP_ALL)
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ typedef struct
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char flag;
|
char flag;
|
||||||
union {
|
union {
|
||||||
int mb;
|
int64_t mb;
|
||||||
double ratio;
|
double ratio;
|
||||||
} rs;
|
} rs;
|
||||||
} FDFSStorageReservedSpace;
|
} FDFSStorageReservedSpace;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue