Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28435

Implement KeysCollectionCacheReader

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.5.7
    • None
    • Sharding
    • None
    • Fully Compatible
    • Sharding 2017-04-17, Sharding 2017-05-08

    Description

      The KeysCollectionReader is responsible for reading the keys in the admin.system.keys collection.
      Its owned by the KeysCollectionManager and started and stopped upon transition to / from config primary to be replaced by the KeysCollectionUpdater.

      1. implement KeysCollectionCache abstract class

      class KeysCollectionCache {
      public:
          /**
           * Refreshes cache and returns the latest known key
           */
          virtual StatusWith<KeysCollectionDocument> refresh(OperationContext* opCtx) = 0;
       
          // gets the keyDoc where min(set{keyDoc.expiresAt > forThisTime})
          virtual StatusWith<KeysCollectionDocument> getKey(const LogicalTime& forThisTime) = 0;
      };
      

      2. The KeysCollectionCacheReader must implement KeysCollectionCache API:

      class KeysCollectionCacheReader : public KeysCollectionCache {
      public:
          /**
           * Check if there are new documents expiresAt > latestKeyDoc.expiresAt.
           */
          StatusWith<KeysCollectionDocument> refresh(OperationContext* opCtx) override;
          StatusWith<KeysCollectionDocument> getKey(const LogicalTime& forThisTime) override;
       
      private:
          std::map<LogicalTime, KeysCollectionDocument> _cache;  // expiresAt -> KeysDocument
      };
      

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            misha.tyulenev@mongodb.com Misha Tyulenev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: