Git Product home page Git Product logo

Comments (6)

zyxxoo avatar zyxxoo commented on June 18, 2024

Hi, your understanding is generally correct. The master/slaver design is mainly used to perform asynchronous tasks. The master node distributes tasks and the slave performs tasks. For requests that need to create tasks, such as rebuilding the index, the request needs to be redirected to the master. No. CRUD requests that need to create tasks do not need to go through the master. If we only have one node, there will be a single point problem.
VertexApi/EdgeApi does not create asynchronous tasks, so it can be executed on the any both node

from incubator-hugegraph.

qwtsc avatar qwtsc commented on June 18, 2024

but why do GremlinApi need this annotation? see this https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java and following code.

    @POST
    @Timed
    @Compress
    @Consumes(APPLICATION_JSON)
    @Produces(APPLICATION_JSON_WITH_CHARSET)
    @RedirectFilter.RedirectMasterRole
    public Response post(@Context HugeConfig conf,
                         @Context HttpHeaders headers,
                         String request) {
        /* The following code is reserved for forwarding request */
        // context.getRequestDispatcher(location).forward(request, response);
        // return Response.seeOther(UriBuilder.fromUri(location).build())
        // .build();
        // Response.temporaryRedirect(UriBuilder.fromUri(location).build())
        // .build();
        String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
        Response response = this.client().doPostRequest(auth, request);
        GREMLIN_INPUT_HISTOGRAM.update(request.length());
        GREMLIN_OUTPUT_HISTOGRAM.update(response.getLength());
        return transformResponseIfNeeded(response);
    }

from incubator-hugegraph.

qwtsc avatar qwtsc commented on June 18, 2024

another issue is that the Apis that add and update vertex/edge/index label won't create async task as well, but these apis are also annotated with RedirectMasterRole. Some of the references can be viewed as following:

  • org.apache.hugegraph.api.schema.VertexLabelAPI#create
  • org.apache.hugegraph.api.schema.VertexLabelAPI#update

I cannot find any clue to create async tasks in the schema update/add code.

    protected void updateSchema(SchemaElement schema,
                                Consumer<SchemaElement> updateCallback) {
        LOG.debug("SchemaTransaction update {} with id '{}'",
                  schema.type(), schema.id());
        this.saveSchema(schema, true, updateCallback);
    }

    protected void addSchema(SchemaElement schema) {
        LOG.debug("SchemaTransaction add {} with id '{}'",
                  schema.type(), schema.id());
        setCreateTimeIfNeeded(schema);
        this.saveSchema(schema, false, null);
    }

Thx.

from incubator-hugegraph.

zyxxoo avatar zyxxoo commented on June 18, 2024

Thank you for your question. It seems that this annotation is not needed in these places. I will wait for other people in the community to see their opinions.

from incubator-hugegraph.

qwtsc avatar qwtsc commented on June 18, 2024

Do U have a realtime communication way, like Zoom or wechat meeting, to discuss some technique problem? so that I can report some concurrent safety issues and related concerns which are to some extent hard to describe in github.

Just ignore the above request. It's fine to use github issue and PR workflow. let's respect the method that an open-source project often operates.

from incubator-hugegraph.

imbajin avatar imbajin commented on June 18, 2024

Do U have a realtime communication way, like Zoom or wechat meeting, to discuss some technique problem? so that I can report some concurrent safety issues and related concerns which are to some extent hard to describe in github.

Just ignore the above request. It's fine to use github issue and PR workflow. let's respect the method that an open-source project often operates.

Thank you for your understanding and support. We also have groups to discuss issues and more documents. You can send me an email (as I'm not sure about your email address)

BTW, current master-worker mechanism will be replaced by PD in future (refer #2265)

from incubator-hugegraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.