-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transition away from Java serialization for storing state on disk or in Zookeeper #625
Open
mrflip
wants to merge
13
commits into
nathanmarz:master
Choose a base branch
from
infochimps-labs:ser_dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
59d4187
Change StormTopology state serialization from Java to Thrift
hausdorff 46ca749
Move serialization of Storm conf from Java default to Clojure default
hausdorff 44cfa94
Fix serialization concurrency bug
hausdorff 50070c7
Make serialization funcitons more generic
hausdorff 9492da3
Transition cluster state serialization to Clojure form serialization
hausdorff 00f0274
Source LocalState serialization logic to state serialization interface
hausdorff 9d673a8
Source LocalState constants to Constants.java
hausdorff 55682d8
Add sketch of LocalStateSerializer
hausdorff 1aba69c
Add clojure-based serialization implementation for LocalState
hausdorff 8a83664
Update Supervisor to use clojure serialization
hausdorff a70c170
Require LocalState to take a serializer in constructor
hausdorff 6366e75
Remove Java implementation of LocalStateSerializer
hausdorff b99a90b
Fixup for rebase of hausdorff/ser_dev onto nathanmarz/master
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,12 +40,6 @@ | |
(defprotocol DaemonCommon | ||
(waiting? [this])) | ||
|
||
(def LS-WORKER-HEARTBEAT "worker-heartbeat") | ||
|
||
;; LocalState constants | ||
(def LS-ID "supervisor-id") | ||
(def LS-LOCAL-ASSIGNMENTS "local-assignments") | ||
(def LS-APPROVED-WORKERS "approved-workers") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we want to move these constants to Constants.java? We have many other CLJ constants, and Constants only has a small subset. Personally, I would rather we have a separated PR on that. This PR should just focus on getting serialization issues addressed. |
||
|
||
|
||
|
@@ -321,7 +315,7 @@ | |
(supervisor-storm-resources-path | ||
(supervisor-stormdist-root (:conf worker) (:storm-id worker))) | ||
(worker-pids-root (:conf worker) (:worker-id worker)) | ||
(:port worker) | ||
(int (:port worker)) | ||
(:task-ids worker) | ||
(:default-shared-resources worker) | ||
(:user-shared-resources worker) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
storm-core/src/clj/backtype/storm/utils/localstate_serializer.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
;; Use to serialize LocalState. We assume that LocalState is a k/v store that | ||
;; uses java.util.HashMap to store the following keys | ||
;; LS_ID : String | ||
;; LS_WORKER_HEARTBEAT : backtype.storm.daemon.common.WorkerHeartbeat | ||
;; LS_LOCAL_ASSIGNMENTS : clojure.lang.PersistentArrayMap | ||
;; LS_APPROVED_WORKERS : clojure.lang.PersistentArrayMap | ||
|
||
(ns backtype.storm.utils.localstate-serializer | ||
(:import [backtype.storm.utils Utils]) | ||
(:import [backtype.storm Constants]) | ||
(:use [backtype.storm util]) | ||
) | ||
|
||
; java.util.HashMap -> byte[] | ||
(defn serialize-localstate [form] | ||
(serialize-clj-bytes (into {} form))) | ||
|
||
; byte[] -> java.util.HashMap | ||
(defn deserialize-localstate [form] | ||
(let [newm (java.util.HashMap.)] | ||
(.putAll newm (deserialize-clj-bytes form)) | ||
newm)) | ||
|
||
(defn localstate-serializer [] | ||
(reify | ||
backtype.storm.utils.StateSerializer | ||
(serializeState [this val] (serialize-localstate val)) | ||
(deserializeState [this ser] (deserialize-localstate ser)))) | ||
|
||
(defn localstate-default-serializer [] | ||
(reify | ||
backtype.storm.utils.StateSerializer | ||
(serializeState [this val] (Utils/serialize val)) | ||
(deserializeState [this ser] (Utils/deserialize ser)))) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we renaming these functions? If we stick the original func name, we will have less code to worry about. No?