From b82bbd8218a95de7b50522a61dd7c53adedb445d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=85=E6=B2=B3=E6=9C=A8=E5=AD=90?= Date: Mon, 22 Feb 2021 10:15:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E5=8F=B0=E6=9C=BA=E5=99=A8=E4=B8=8A=E7=BB=91=E5=AE=9A=E4=B8=8D?= =?UTF-8?q?=E5=90=8Cip=E7=9A=84storage=E5=AE=9E=E4=BE=8B=E9=97=B4=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/storage_sync.c | 10 ++++++++++ storage/trunk_mgr/trunk_sync.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/storage/storage_sync.c b/storage/storage_sync.c index 6aaf6e0..0bddfb1 100644 --- a/storage/storage_sync.c +++ b/storage/storage_sync.c @@ -3040,8 +3040,13 @@ static void* storage_sync_thread_entrance(void* arg) __LINE__, pStorage->ip_addr, local_ip_addr); */ + /* if (strcmp(pStorage->id, g_my_server_id_str) == 0 || is_local_host_ip(pStorage->ip_addr)) + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) { //can't self sync to self logError("file: "__FILE__", line: %d, " \ "ip_addr %s belong to the local host," \ @@ -3267,8 +3272,13 @@ int storage_sync_thread_start(const FDFSStorageBrief *pStorage) return 0; } + /* if (strcmp(pStorage->id, g_my_server_id_str) == 0 || is_local_host_ip(pStorage->ip_addr)) //can't self sync to self + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) //can't self sync to self { logWarning("file: "__FILE__", line: %d, " "storage id: %s is myself, can't start sync thread!", diff --git a/storage/trunk_mgr/trunk_sync.c b/storage/trunk_mgr/trunk_sync.c index 751d43c..70503e5 100644 --- a/storage/trunk_mgr/trunk_sync.c +++ b/storage/trunk_mgr/trunk_sync.c @@ -2121,8 +2121,13 @@ static void *trunk_sync_thread_entrance(void* arg) __LINE__, pStorage->ip_addr, local_ip_addr); */ + /* if ((strcmp(pStorage->id, g_my_server_id_str) == 0) || is_local_host_ip(pStorage->ip_addr)) + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) { //can't self sync to self logError("file: "__FILE__", line: %d, " \ "ip_addr %s belong to the local host," \ @@ -2378,8 +2383,13 @@ int trunk_sync_thread_start(const FDFSStorageBrief *pStorage) return 0; } + /* if ((strcmp(pStorage->id, g_my_server_id_str) == 0) || is_local_host_ip(pStorage->ip_addr)) //can't self sync to self + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) //can't self sync to self { return 0; } -- Gitee From 133b197218a37aa9daad3437d298c50aa9a28289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=85=E6=B2=B3=E6=9C=A8=E5=AD=90?= Date: Mon, 22 Feb 2021 14:21:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E5=8F=B0=E6=9C=BA=E5=99=A8=E4=B8=8A=E7=BB=91=E5=AE=9A=E4=B8=8D?= =?UTF-8?q?=E5=90=8Cip=E7=9A=84storage=E5=AE=9E=E4=BE=8B=E9=97=B4=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/storage_sync.c | 4 ++-- storage/trunk_mgr/trunk_sync.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/storage_sync.c b/storage/storage_sync.c index 0bddfb1..c73a7ef 100644 --- a/storage/storage_sync.c +++ b/storage/storage_sync.c @@ -3049,9 +3049,9 @@ static void* storage_sync_thread_entrance(void* arg) if (strcmp(pStorage->id, g_my_server_id_str) == 0) { //can't self sync to self logError("file: "__FILE__", line: %d, " \ - "ip_addr %s belong to the local host," \ + "storage id: %s is myself," \ " sync thread exit.", \ - __LINE__, pStorage->ip_addr); + __LINE__, pStorage->id); fdfs_quit(&storage_server); close(storage_server.sock); break; diff --git a/storage/trunk_mgr/trunk_sync.c b/storage/trunk_mgr/trunk_sync.c index 70503e5..324f23c 100644 --- a/storage/trunk_mgr/trunk_sync.c +++ b/storage/trunk_mgr/trunk_sync.c @@ -2130,9 +2130,9 @@ static void *trunk_sync_thread_entrance(void* arg) if (strcmp(pStorage->id, g_my_server_id_str) == 0) { //can't self sync to self logError("file: "__FILE__", line: %d, " \ - "ip_addr %s belong to the local host," \ + "storage id: %s is myself," \ " trunk sync thread exit.", \ - __LINE__, pStorage->ip_addr); + __LINE__, pStorage->id); fdfs_quit(&storage_server); close(storage_server.sock); break; -- Gitee