You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@livy.apache.org by GitBox <gi...@apache.org> on 2019/02/08 01:24:09 UTC

[GitHub] meisam commented on a change in pull request #103: [LIVY-239] Generate session IDs in SessionStore, not in SessionManager

meisam commented on a change in pull request #103: [LIVY-239] Generate session IDs in SessionStore, not in SessionManager
URL: https://github.com/apache/incubator-livy/pull/103#discussion_r254929749
 
 

 ##########
 File path: server/src/main/scala/org/apache/livy/server/recovery/SessionStore.scala
 ##########
 @@ -67,15 +61,14 @@ class SessionStore(
   }
 
   /**
-   * Return the next unused session id with specified session type.
-   * If checks the SessionManagerState stored and returns the next free session id.
-   * If no SessionManagerState is stored, it returns 0.
+   * Return the next unused session ID from the state store for the specified session type.
+   * Return 0 if no value is stored in the state store.
+   * Save the next unused session ID to the session store before returning the current value.
    *
-   * @throws Exception If SessionManagerState stored is corrupted, it throws an error.
+   * @throws Exception If session store is corrupted or unreachable, it throws an error.
    */
   def getNextSessionId(sessionType: String): Int = {
-    store.get[SessionManagerState](sessionManagerPath(sessionType))
-      .map(_.nextSessionId).getOrElse(0)
+    store.increment(sessionManagerPath(sessionType)).toInt
 
 Review comment:
   @alex-the-man I changed the path.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services