Skip to content
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

Learner node #210

Merged
merged 13 commits into from
Jan 31, 2018
Merged

Learner node #210

merged 13 commits into from
Jan 31, 2018

Conversation

delamonpansie
Copy link

No description provided.

@@ -144,7 +144,7 @@ def copyDirTree(self,src,dst):

root = os.environ.get('TEST_HOME')
if root is None:
root = os.environ['HOME']
raise Exception("TEST_HOME is undefined")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impact on travis/jenkins?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea, but after cleaning my home directory several times I believe this is the right thing to do.

@@ -0,0 +1,203 @@
(*
Copyright (2010-2014) INCUBAID BVBA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably move to a copyright notice like the one in Alba. I think it's not acceptable to attribute copyright to someone who didn't create it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

let sides =
if is_election constants
then [log_e; EStartElectionTimeout (current_n, current_i); mcast_e]
else [log_e; mcast_e]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

factor out common [log_e; mcast_e] ?

end
| ElectionTimeout _ | LeaseExpired _ ->
let log_e = ELog (fun () ->
Printf.sprintf "steady_state: ignoring lease expiration because I am a learner")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sprintf not needed.

Fsm.return (Learner_steady_state (future_n, current_i', None));
end
else
failwith "FIXME"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be impossible maybe replace with some kind of assert ?

Copy link

@domsj domsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few minor comments below, but I would like to make a few more general comments too (and perhaps tomorrow have some discussion in the chat):

  • this (almost) duplicates a bunch of existing code
  • the existing (now duplicated) code contains some logic related to constants.is_learner which is now obsolete
  • should the consensus nodes actually know about the learner nodes? perhaps we could have a design where the learner node subscribes to the stream of updates instead (in which case it can even choose which node it wants to follow - e.g. it could follow the master, or some slave in the same datacenter)

@@ -741,6 +744,25 @@ let _execute_effects constants e =

(* the entry methods *)

let enter_learner ?(stop = ref false) constants buffers new_i =
let me = constants.me in
Logger.debug_f_ "%s: +starting FSM for forced_slave." me >>= fun () ->
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/forced_slave/learner?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.



type learner_transitions =
| Learner_start_transition
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constructor isn't actually used anywhere and could be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want to test it, then yes.

let mcast_e = EMCast fake in
let sides =
if is_election constants
then [log_e; EStartElectionTimeout (current_n, current_i); mcast_e]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a learner ever produce the EStartElectionTimeout action? If I'm not mistaken it will ignore the resulting ElectionTimeout event anyway...
(so I think the if can go away)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suspicious about elections too. We've discussed with Romain this yesterday.

@delamonpansie
Copy link
Author

should the consensus nodes actually know about the learner nodes? perhaps we could have a design where the learner node subscribes to the stream of updates instead (in which case it can even choose which node it wants to follow - e.g. it could follow the master, or some slave in the same datacenter)

this can be done, but it should not be named "learner"

@delamonpansie
Copy link
Author

This is still a work in progress. Your comments are very much appreciated.

Copy link
Member

@toolslive toolslive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(github can't show changes to slave.ml)

let handle_from_node ((n,i,previous) as state) (type s) (module S : Store.STORE with type t = s)
{store; me;on_witness} msg source =
Logger.ign_debug_f_ "Learner.steady_state n:%s i:%s v:%s store_i:%Li got %S from %s"
(Sn.string_of n) (Sn.string_of i) (match previous with Some v -> "Some " ^ Value.value2s v | None -> "None")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's To_string.option

@@ -0,0 +1,129 @@
(*
Copyright (C) iNuron - info@openvstorage.com
This file is part of Open vStorage. For license information, see <OVS_LICENSE.txt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just point to the LICENSE file (the apache 2.0)

OVS_LICENSE.TXT Outdated
@@ -0,0 +1,208 @@
Open vStorage License Agreement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. all we add keeps being released under Apache 2.0. (see lower)

@delamonpansie delamonpansie force-pushed the learner-node branch 3 times, most recently from 3550e17 to a1ff885 Compare January 26, 2018 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants