diff --git a/HISTORY b/HISTORY index 254fb97..c5973dd 100644 --- a/HISTORY +++ b/HISTORY @@ -7,6 +7,7 @@ Version 5.10 2017-03-29 * do NOT sync storage server info to tracker leader * adjust parameter store_server when use_trunk_file is true * clear sync src id when tracker response ENOENT + * log more info when fdfs_recv_header / fdfs_recv_response fail Version 5.09 2016-12-29 * bug fixed: list_all_groups expand buffer auto for so many groups diff --git a/client/storage_client.c b/client/storage_client.c index c665d52..4b53b63 100644 --- a/client/storage_client.c +++ b/client/storage_client.c @@ -266,6 +266,9 @@ int storage_get_metadata(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &file_buff, 0, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } @@ -364,6 +367,9 @@ int storage_query_file_info_ex(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pInBuff, sizeof(in_buff), &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } @@ -490,6 +496,9 @@ int storage_delete_file(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pBuff, 0, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } @@ -584,6 +593,9 @@ int storage_do_download_file_ex(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_header(pStorageServer, \ &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_header fail, result: %d", + __LINE__, result); break; } @@ -601,6 +613,9 @@ int storage_do_download_file_ex(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_response(pStorageServer, \ file_buff, 0, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } } @@ -614,6 +629,9 @@ int storage_do_download_file_ex(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_header(pStorageServer, \ &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_header fail, result: %d", + __LINE__, result); break; } @@ -973,6 +991,9 @@ int storage_do_upload_file(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pInBuff, sizeof(in_buff), &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } @@ -1229,6 +1250,12 @@ int storage_set_metadata(ConnectionInfo *pTrackerServer, \ pBuff = in_buff; result = fdfs_recv_response(pStorageServer, \ &pBuff, 0, &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } while (0); if (meta_buff != NULL) @@ -1426,6 +1453,9 @@ int storage_client_create_link(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pInBuff, sizeof(in_buff), &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } @@ -1750,6 +1780,9 @@ int storage_do_append_file(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_header(pStorageServer, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_header fail, result: %d", + __LINE__, result); break; } @@ -1878,6 +1911,9 @@ int storage_do_modify_file(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_header(pStorageServer, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_header fail, result: %d", + __LINE__, result); break; } @@ -2290,6 +2326,9 @@ int storage_truncate_file(ConnectionInfo *pTrackerServer, \ if ((result=fdfs_recv_header(pStorageServer, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_header fail, result: %d", + __LINE__, result); break; } diff --git a/client/tracker_client.c b/client/tracker_client.c index c40a8d4..79ac122 100644 --- a/client/tracker_client.c +++ b/client/tracker_client.c @@ -317,6 +317,12 @@ int tracker_list_servers(ConnectionInfo *pTrackerServer, \ pInBuff = (char *)stats; result = fdfs_recv_response(conn, &pInBuff, \ sizeof(stats), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -514,6 +520,12 @@ int tracker_list_one_group(ConnectionInfo *pTrackerServer, \ pInBuff = (char *)&src; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(TrackerGroupStat), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -588,6 +600,12 @@ int tracker_list_groups(ConnectionInfo *pTrackerServer, \ pInBuff = (char *)stats; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(stats), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -699,6 +717,12 @@ int tracker_do_query_storage(ConnectionInfo *pTrackerServer, \ pInBuff = in_buff; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(in_buff), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -777,6 +801,12 @@ int tracker_query_storage_list(ConnectionInfo *pTrackerServer, \ pInBuff = in_buff; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(in_buff), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -870,6 +900,12 @@ int tracker_query_storage_store_without_group(ConnectionInfo *pTrackerServer, pInBuff = in_buff; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(in_buff), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -947,6 +983,12 @@ int tracker_query_storage_store_with_group(ConnectionInfo *pTrackerServer, \ pInBuff = in_buff; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(in_buff), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -1036,6 +1078,12 @@ int tracker_query_storage_store_list_with_group( \ pInBuff = in_buff; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(in_buff), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -1198,7 +1246,13 @@ int tracker_delete_storage(TrackerServerGroup *pTrackerGroup, \ { pInBuff = in_buff; result = fdfs_recv_response(conn, &pInBuff, 0, &in_bytes); - } + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } + } tracker_disconnect_server_ex(conn, result != 0 && result != ENOENT); if (result != 0) @@ -1275,6 +1329,9 @@ int tracker_delete_group(TrackerServerGroup *pTrackerGroup, \ tracker_disconnect_server_ex(conn, result != 0 && result != ENOENT); if (result != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } } @@ -1370,6 +1427,9 @@ int tracker_set_trunk_server(TrackerServerGroup *pTrackerGroup, \ } else { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); return result; } } @@ -1430,6 +1490,12 @@ int tracker_get_storage_status(ConnectionInfo *pTrackerServer, \ pInBuff = (char *)pDestBuff; result = fdfs_recv_response(conn, \ &pInBuff, sizeof(FDFSStorageBrief), &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) @@ -1511,6 +1577,12 @@ int tracker_get_storage_id(ConnectionInfo *pTrackerServer, \ { result = fdfs_recv_response(conn, \ &storage_id, FDFS_STORAGE_ID_MAX_SIZE, &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } } if (new_connection) diff --git a/storage/storage_func.c b/storage/storage_func.c index b430508..03e2054 100644 --- a/storage/storage_func.c +++ b/storage/storage_func.c @@ -153,6 +153,9 @@ static int storage_do_get_group_name(ConnectionInfo *pTrackerServer) if ((result=fdfs_recv_response(pTrackerServer, \ &pInBuff, FDFS_GROUP_NAME_MAX_LEN, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); return result; } diff --git a/storage/storage_ip_changed_dealer.c b/storage/storage_ip_changed_dealer.c index 5b07282..4c6dee5 100644 --- a/storage/storage_ip_changed_dealer.c +++ b/storage/storage_ip_changed_dealer.c @@ -97,6 +97,12 @@ static int storage_report_ip_changed(ConnectionInfo *pTrackerServer) if (result == 0 || result == EALREADY || result == ENOENT) { + if (result != 0) + { + logWarning("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } return 0; } else diff --git a/storage/storage_sync.c b/storage/storage_sync.c index 918ee7d..90c0fa6 100644 --- a/storage/storage_sync.c +++ b/storage/storage_sync.c @@ -249,6 +249,9 @@ static int storage_sync_copy_file(ConnectionInfo *pStorageServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pBuff, 0, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } } while (0); @@ -442,6 +445,9 @@ static int storage_sync_modify_file(ConnectionInfo *pStorageServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pBuff, 0, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } } while (0); @@ -590,6 +596,9 @@ static int storage_sync_truncate_file(ConnectionInfo *pStorageServer, \ if ((result=fdfs_recv_response(pStorageServer, \ &pBuff, 0, &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; } } while (0); @@ -658,10 +667,19 @@ static int storage_sync_delete_file(ConnectionInfo *pStorageServer, \ pBuff = in_buff; result = fdfs_recv_response(pStorageServer, &pBuff, 0, &in_bytes); - if (result == ENOENT) - { - result = 0; - } + if (result != 0) + { + if (result == ENOENT) + { + result = 0; + } + else + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } + } return result; } @@ -698,7 +716,14 @@ static int storage_report_my_server_id(ConnectionInfo *pStorageServer) } pBuff = in_buff; - return fdfs_recv_response(pStorageServer, &pBuff, 0, &in_bytes); + result = fdfs_recv_response(pStorageServer, &pBuff, 0, &in_bytes); + if (result != 0) + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } + return result; } /** @@ -917,10 +942,19 @@ static int storage_sync_link_file(ConnectionInfo *pStorageServer, \ pBuff = in_buff; result = fdfs_recv_response(pStorageServer, &pBuff, 0, &in_bytes); - if (result == ENOENT) - { - result = 0; - } + if (result != 0) + { + if (result == ENOENT) + { + result = 0; + } + else + { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); + } + } return result; } diff --git a/storage/tracker_client_thread.c b/storage/tracker_client_thread.c index 0f87576..c3ff030 100644 --- a/storage/tracker_client_thread.c +++ b/storage/tracker_client_thread.c @@ -1102,6 +1102,31 @@ static void set_tracker_leader(const int leader_index) g_tracker_group.leader_index = leader_index; } +static void get_tracker_leader() +{ + int i; + TrackerRunningStatus tracker_status; + ConnectionInfo tracker_server; + + for (i=0; istorage_port, STORAGE_PROTO_CMD_TRUNK_DELETE_BINLOG_MARKS)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_deal_no_body_cmd_ex fail, result: %d", + __LINE__, result); return result; } } diff --git a/tracker/tracker_proto.c b/tracker/tracker_proto.c index d3a6667..685734f 100644 --- a/tracker/tracker_proto.c +++ b/tracker/tracker_proto.c @@ -183,6 +183,9 @@ int fdfs_deal_no_body_cmd(ConnectionInfo *pTrackerServer, const int cmd) result = fdfs_recv_header(pTrackerServer, &in_bytes); if (result != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_header fail, cmd: %d, result: %d", + __LINE__, cmd, result); return result; } diff --git a/tracker/tracker_relationship.c b/tracker/tracker_relationship.c index 7eb6e88..78ae19f 100644 --- a/tracker/tracker_relationship.c +++ b/tracker/tracker_relationship.c @@ -64,6 +64,9 @@ static int fdfs_ping_leader(ConnectionInfo *pTrackerServer) if ((result=fdfs_recv_response(pTrackerServer, &pInBuff, \ sizeof(in_buff), &in_bytes)) != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); return result; } @@ -282,6 +285,9 @@ static int do_notify_leader_changed(ConnectionInfo *pTrackerServer, \ 0, &in_bytes); if (result != 0) { + logError("file: "__FILE__", line: %d, " + "fdfs_recv_response fail, result: %d", + __LINE__, result); break; }