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

Replace custom file rotating sink with spdlogs own sink

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Fix
    • Major
    • None
    • None
    • memcached
    • None
    • 0

    Description

      We've got our own internal custom file rotating sink which injects a message when the log file gets opened and closed. Recent versions of spdlog allows to add hooks to do so.

      The intention of these log lines was:

      1) to be able to split the concatenated log file from cbcollect_info (as a lot of the time one would just need the logs entries between a restart of memcached)

      2) easily differentiate a clean "restart" of the memcached process from an abnormal restart (one would have a "close" followed by an "open" in the clean shutdown case. one could always look for "other known log messages" to get the same information)

       

      Given that spdlog contains the ability to add a "hook" to insert this information and do all of the other work we do, it would be less code to maintain by using spdlog's (tested) implementation instead.

      By flipping to spdlogs implementation we loose the following:

      1) We'll no longer use new unique names for each file (it'll rename the files and the latest will always be memcached.log)

      2) Our implementation would open the next file before closing the old one, so in case we ran out of file descriptors we would continue to use the old file. spdlogs implementation seems to close first and then open (which means that there might be a race?). That being said memcached do set aside a fairly large pool of file descriptors for the core to use which means that the odds for this to happen is relatively small.

       

      This change has an impact on ns_server as it currently tries to purge old log files (which would no longer be needed), and it would need to change the way it currently concatenates all of the log files into one (we would probably be better off if we stop doing that)

      Attachments

        Issue Links

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

          Activity

            People

              trond Trond Norbye
              trond Trond Norbye
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty