Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-50464

js-evaluator : Add support for dynamic global config change

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Attachments

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

      Activity

        Build couchbase-server-7.1.0-2259 contains query commit 2a1fdd4 with commit message:
        MB-50464 : Jsonschema parsing dependency for js-evaluator

        build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-2259 contains query commit 2a1fdd4 with commit message: MB-50464 : Jsonschema parsing dependency for js-evaluator

        Abhishek Jindal can you pls help with details on how to validate this fix ?

        mihir.kamdar Mihir Kamdar (Inactive) added a comment - Abhishek Jindal can you pls help with details on how to validate this fix ?

        This patch adds ability to specify a global config to js-evaluator / JS-UDFs.

        We're currently accepting log_level (changes the logging level of JS-UDFs) and conn_pool_size (limits the number of open query iterators at a given point during UDF execution). Schema is as follows:

        {
            "log_level": integer between 1-6
            "conn_pool_capacity" : integer between 1-20
        }
        

        config can be accessed via the following endpoints (for JS-UDFs only Global External Functions Manage role is allowed):

        curl -v  -s -k -X POST http://127.0.0.1:8096/evaluator/config -u Administrator:asdasd -H 'content-type: application/json' --data-binary @config.json
        curl  -s -k -X GET http://127.0.0.1:8096/evaluator/config -u Administrator:asdasd
        

        With this change users can now update the log level dynamically between Fatal (1) and Trace (6).
        And can change the connection pool size anytime during execution between 1-20 handles.

        Config is replicated over metakv across all query nodes.

        abhishek.jindal Abhishek Jindal added a comment - This patch adds ability to specify a global config to js-evaluator / JS-UDFs. We're currently accepting log_level (changes the logging level of JS-UDFs) and conn_pool_size (limits the number of open query iterators at a given point during UDF execution). Schema is as follows: { "log_level": integer between 1-6 "conn_pool_capacity" : integer between 1-20 } config can be accessed via the following endpoints (for JS-UDFs only Global External Functions Manage role is allowed): curl -v -s -k -X POST http://127.0.0.1:8096/evaluator/config -u Administrator:asdasd -H 'content-type: application/json' --data-binary @config.json curl -s -k -X GET http://127.0.0.1:8096/evaluator/config -u Administrator:asdasd — With this change users can now update the log level dynamically between Fatal (1) and Trace (6). And can change the connection pool size anytime during execution between 1-20 handles. Config is replicated over metakv across all query nodes.

        Verified on 7.1.0-2281

        # curl  -s -k -X GET http://127.0.0.1:8093/evaluator/config -u Administrator:password
        {
          "log_level": 4,
          "conn_pool_capacity": 10
        }
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 6}'
        {"status": "OK"}
         
        # curl  -s -k -X GET http://127.0.0.1:8093/evaluator/config -u Administrator:password
        {
          "log_level": 6,
          "conn_pool_capacity": 10
        }
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 8}'
        {"status": "OK"}
         
        # curl  -s -k -X GET http://127.0.0.1:8093/evaluator/config -u Administrator:password
        {
          "log_level": 6,
          "conn_pool_capacity": 8
        }
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 10, "log_level": 4}'
        {"status": "OK"}
         
        # curl  -s -k -X GET http://127.0.0.1:8093/evaluator/config -u Administrator:password
        {
          "log_level": 4,
          "conn_pool_capacity": 10
        } 

        Invalid values:

        # curl-s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 0}'
        Invalid globalGonfig schema, err: [I[#/conn_pool_capacity] S[#/properties/conn_pool_capacity/minimum] must be >= 1 but found 0
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 21}' 
        Invalid globalGonfig schema, err: [I[#/conn_pool_capacity] S[#/properties/conn_pool_capacity/maximum] must be <= 20 but found 21
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 50}' 
        Invalid globalGonfig schema, err: [I[#/conn_pool_capacity] S[#/properties/conn_pool_capacity/maximum] must be <= 20 but found 50
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 20}' 
        {"status": "OK"}
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 0}'
        Invalid globalGonfig schema, err: [I[#/log_level] S[#/properties/log_level/minimum] must be >= 1 but found 0
         
        # curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 6}'
        {"status": "OK"}[root@node1 ~]# curl -s -k -X POST http://127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 7}'
        Invalid globalGonfig schema, err: [I[#/log_level] S[#/properties/log_level/maximum] must be <= 6 but found 7] 

        Abhishek Jindal could error above be more human readable

        pierre.regazzoni Pierre Regazzoni added a comment - Verified on 7.1.0-2281 # curl  -s -k -X GET http: //127.0.0.1:8093/evaluator/config -u Administrator:password {   "log_level" : 4 ,   "conn_pool_capacity" : 10 }   # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 6}' { "status" : "OK" }   # curl  -s -k -X GET http: //127.0.0.1:8093/evaluator/config -u Administrator:password {   "log_level" : 6 ,   "conn_pool_capacity" : 10 }   # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 8}' { "status" : "OK" }   # curl  -s -k -X GET http: //127.0.0.1:8093/evaluator/config -u Administrator:password {   "log_level" : 6 ,   "conn_pool_capacity" : 8 }   # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 10, "log_level": 4}' { "status" : "OK" }   # curl  -s -k -X GET http: //127.0.0.1:8093/evaluator/config -u Administrator:password {   "log_level" : 4 ,   "conn_pool_capacity" : 10 } Invalid values: # curl-s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 0}' Invalid globalGonfig schema, err: [I[#/conn_pool_capacity] S[#/properties/conn_pool_capacity/minimum] must be >= 1 but found 0 ]    # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 21}'  Invalid globalGonfig schema, err: [I[#/conn_pool_capacity] S[#/properties/conn_pool_capacity/maximum] must be <= 20 but found 21 ]    # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 50}'  Invalid globalGonfig schema, err: [I[#/conn_pool_capacity] S[#/properties/conn_pool_capacity/maximum] must be <= 20 but found 50 ]    # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"conn_pool_capacity": 20}'  { "status" : "OK" }   # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 0}' Invalid globalGonfig schema, err: [I[#/log_level] S[#/properties/log_level/minimum] must be >= 1 but found 0 ]    # curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 6}' { "status" : "OK" }[root @node1 ~]# curl -s -k -X POST http: //127.0.0.1:8093/evaluator/config -u Administrator:password -d '{"log_level": 7}' Invalid globalGonfig schema, err: [I[#/log_level] S[#/properties/log_level/maximum] must be <= 6 but found 7 ] Abhishek Jindal could error above be more human readable

        Pierre Regazzoni Currently couldn't find a better way of extracting the relevant error only. Hence, this might remain as is in Neo.
        Can re-work on this in later release as part of further work on js-evaluator's REST layer.

        abhishek.jindal Abhishek Jindal added a comment - Pierre Regazzoni Currently couldn't find a better way of extracting the relevant error only. Hence, this might remain as is in Neo. Can re-work on this in later release as part of further work on js-evaluator's REST layer.

        People

          pierre.regazzoni Pierre Regazzoni
          abhishek.jindal Abhishek Jindal
          Votes:
          0 Vote for this issue
          Watchers:
          3 Start watching this issue

          Dates

            Created:
            Updated:
            Resolved:

            PagerDuty