You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/01/23 13:08:14 UTC

[incubator-doris] branch master updated: [Meta] Add some consistency check in image put api (#5219)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ddf537  [Meta] Add some consistency check in image put api (#5219)
2ddf537 is described below

commit 2ddf537094370981ec860742e9d0cc4fac72b53c
Author: gengjun-git <54...@users.noreply.github.com>
AuthorDate: Sat Jan 23 21:08:04 2021 +0800

    [Meta] Add some consistency check in image put api (#5219)
---
 .../org/apache/doris/http/meta/MetaService.java    | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/http/meta/MetaService.java b/fe/fe-core/src/main/java/org/apache/doris/http/meta/MetaService.java
index 631b579..a707900 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/http/meta/MetaService.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/http/meta/MetaService.java
@@ -173,7 +173,28 @@ public class MetaService {
                 writeResponse(request, response, HttpResponseStatus.BAD_REQUEST);
                 return;
             }
-            checkLongParam(versionStr);
+
+            long version = checkLongParam(versionStr);
+
+            // for master node, reject image put
+            if (Catalog.getCurrentCatalog().isMaster()) {
+                response.appendContent("this node is master, reject image put");
+                writeResponse(request, response, HttpResponseStatus.BAD_REQUEST);
+                LOG.error("this node is master, but receive image put from host {}, reject it", machine);
+                return;
+            }
+
+            // do not accept image whose version is bigger than max journalId
+            // if accepted, newly added log will not be replayed when restart
+            long maxJournalId = Catalog.getCurrentCatalog().getMaxJournalId();
+            if (version > maxJournalId) {
+                response.appendContent("image version [" + version + "] is bigger than local max journal id ["
+                                               + maxJournalId + "], reject image put");
+                writeResponse(request, response, HttpResponseStatus.BAD_REQUEST);
+                LOG.error("receive image whose version [{}] is bigger than local max journal id [{}], reject it",
+                          version, maxJournalId);
+                return;
+            }
 
             String url = "http://" + machine + ":" + portStr
                     + "/image?version=" + versionStr;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org