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

System Event log should handle nested tuples

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      While doing the following I observed a error

      curl -s -u Administrator:asdasd localhost:9000/events
      ["Unexpected server error, request logged."] 

      and in the debug log see

      [ns_server:error,2021-10-28T16:22:56.551-07:00,n_0@cb.local:<0.12080.10>:menelaus_util:reply_server_error:210]Server error during processing: ["web request failed",
                                       {path,"/events"},
                                       {method,'GET'},
                                       {type,throw},
                                       {what,
                                        {json_encode,
                                         {bad_term,
                                          {magma_fragmentation_percentage,22}}}},
                                       {trace,
                                        [{ejson,encode_rev,1,
                                          [{file,
                                            "/Users/stevewatanabe/master/couchdb/src/ejson/ejson.erl"},
                                           {line,81}]}, 

      Here's the struct that was being ejson encoded

      Event - {struct,
                  [{timestamp,<<"2021-10-28T23:03:03.183Z">>},
                   {event_id,8192},
                   {component,data},
                   {description,<<"Bucket created">>},
                   {severity,info},
                   {node,<<"cb.local">>},
                   {uuid,<<"19ecdfaa-29e2-4051-8e8e-5b96cba62fa5">>},
                   {extra_attributes,
                       {struct,
                           [{bucket,<<"magma2">>},
                            {bucket_uuid,<<"bbfd900272fcaece93e53f7e88dc4f29">>},
                            {bucket_type,couchbase},
                            {bucket_props,
                                {struct,
                                    [{replica_index,true},
                                     {ram_quota,268435456},
                                     {durability_min_level,none},
                                     {storage_quota_percentage,10},
                                     {autocompaction,
                                         [{magma_fragmentation_percentage,22}]},
                                     {flush_enabled,false},
                                     {num_threads,3},
                                     {eviction_policy,value_only},
                                     {conflict_resolution_type,seqno},
                                     {storage_mode,magma},
                                     {max_ttl,0},
                                     {compression_mode,passive}]}}]}}]} 

      It does like

      {autocompaction,
                                         [{magma_fragmentation_percentage,22}]}, 

      and instead expects something like

                                     {autocompaction,
                                          {struct,
                                             [{magma_fragmentation_percentage,22}]}}, 

      Working with Hareen he said "Adding the bucket props to the event log can make it inflexible for case where you would want to add properties like the one you had (a nested tuple). It can easily go under the radar and blow up when somebody fetches the events via /events endpoint."

      This isn't specific to magma buckets. Here's a couchstore bucket

      (n_0@cb.local)6> rp(ns_bucket:get_bucket("bbb")).
      {ok,[{num_replicas,1},
           {replica_index,false},
           {ram_quota,104857600},
           {durability_min_level,none},
           {autocompaction,[{parallel_db_and_view_compaction,false},
                            {database_fragmentation_threshold,{33,undefined}},
                            {view_fragmentation_threshold,{30,undefined}}]},
           {purge_interval,3}, 

      Hareen is going to look into a solution for this.

      Attachments

        For Gerrit Dashboard: MB-49231
        # Subject Branch Project Status CR V

        Activity

          People

            hareen.kancharla Hareen Kancharla
            steve.watanabe Steve Watanabe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty