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

Implement KeysCollectionCacheReader

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.7
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2017-04-17, Sharding 2017-05-08

      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
      };
      

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

              Created:
              Updated:
              Resolved: