Github user aarondav commented on the pull request:

    https://github.com/apache/spark/pull/771#issuecomment-57513660
  
    I talked with @JoshRosen for a second opinion, and we came to the 
realization that fundamentally, the PersistenceEngine is just a persisted 
KV-store, which maps String names to serialized Array[Byte]. The current API 
that uses Application/Driver/WorkerInfos is nice for the Master's type safety 
purposes, but not good for extensibility. Note, for instance, that 
ApplicationInfo contains an ActorRef to the driver!
    
    The proposal we came up with is to simplify PersistenceEngine to this API:
    ```scala
    @DevelperApi
    trait PersistenceEngine {
      def persist(name: String, bytes: Array[Byte])
      def unpersist(name: String)
      def readPersistedData(): (Seq[(String, Array[Byte])]
      def close() {}
    }
    ```
    
    And then
    ```
    private[spark]
    class MasterFailoverAgent(persistenceEngine: PersistenceEngine, 
leaderElectionAgent: LeaderElectionAgent) {
      def addApplication(app: ApplicationInfo) {
        persist(name, serialize(app))
      }
      ...
      def readPersistedData(): (Seq[ApplicationInfo], Seq[DriverInfo], 
Seq[WorkerInfo])
      def stop() {} 
    }
    ```
    
    Then the Master would invoke the StandaloneRecoveryModeFactory to get the 
PersistenceEngine and LeaderElectionAgent, and then create a 
MasterFailoverAgent to wrap them (or the StandaloneRecoveryModeFactory could 
have a `final def` that does this).
    
    This is very close to what you suggested earlier with the FailoverAgent -- 
the only difference is that it keeps this API as a construct of the Master, 
built out of the much simpler APIs that the user has to implement in 
StandaloneRecoveryModeFactory.
    
    What are your thoughts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to