Create repl::interface to specify a complete API for disagg to use for modularity

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Replication
    • ALL
    • Repl 2026-03-30
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Classes that belong to both repl and disagg present a problem for the Modularity project. By design, each module is only allowed to have one parent module. This means that a class like ReplicationCoordinatorDisaggregatedStorage will never be able to access private implementation details in both the repl module and the disagg module, regardless of which module it's in.

      We have solved this somewhat by just extending the scope of repl's public/open API to "make way" for disagg, but having to make almost every module public/open defeats the purpose of disagg.

      I suggest making a repl::interface namespace and a repl.interface module to publicly expose all classes/structs/functions that disagg would need to "recreate" the repl module. That way we could still express, for example, that classes like NoopWriter are private implementation details of replication, while also allowing the disagg module to implement the class themselves.

      /** module: repl.interface */
      namespace repl::interface {
      class MONGO_MOD_OPEN NoopWriter {
          NoopWriter(const NoopWriter&) = delete;
          NoopWriter& operator=(const NoopWriter&) = delete;
      
      public:
          virtual NoopWriter(Seconds waitTime) = 0;
          virtual ~NoopWriter() = 0;
          virtual Status startWritingPeriodicNoops(OpTime lastKnownOpTime) = 0;
          void stopWritingPeriodicNoops() = 0;
      };
      }
      
      /** module: repl */
      namespace repl {
      class MONGO_MOD_PARENT_PRIVATE NoopWriter final :
                                     public interface::NoopWriter {
          NoopWriter(const NoopWriter&) = delete;
          NoopWriter& operator=(const NoopWriter&) = delete;
      
      public:
          NoopWriter(Seconds waitTime) final;
          ~NoopWriter() final;
          Status startWritingPeriodicNoops(OpTime lastKnownOpTime) final;
          void stopWritingPeriodicNoops() final;
      };
      }
      
      /** module: disagg */
      namespace disagg {
      class MONGO_MOD_PARENT_PRIVATE NoopWriter final :
                                     public repl::interface::NoopWriter {
          NoopWriter(const NoopWriter&) = delete;
          NoopWriter& operator=(const NoopWriter&) = delete;
      
      public:
          NoopWriter(Seconds waitTime) final;
          ~NoopWriter() final;
          Status startWritingPeriodicNoops(OpTime lastKnownOpTime) final;
          void stopWritingPeriodicNoops() final;
      };
      }
      

      For more expressiveness, we could also split the namespace in two:

      namespace repl::api         { ... };
      namespace repl::api::hidden { ... };
      

            Assignee:
            Joseph Obaraye
            Reporter:
            Joseph Obaraye
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: