Issue Details (XML | Word | Printable)

Key: HADOOP-5640
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Todd Lipcon
Reporter: Todd Lipcon
Votes: 0
Watchers: 11
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Allow ServicePlugins to hook callbacks into key service events

Created: 08/Apr/09 05:01 AM   Updated: 23/Oct/09 12:07 AM
Return to search
Component/s: util
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works hadoop-5640.txt 2009-07-01 08:16 PM Todd Lipcon 11 kB
Text File Licensed for inclusion in ASF works hadoop-5640.txt 2009-04-16 12:29 AM Todd Lipcon 19 kB
Text File Licensed for inclusion in ASF works HADOOP-5640.v2.txt 2009-04-17 12:06 AM Todd Lipcon 20 kB
Text File Licensed for inclusion in ASF works hadoop-5640.v3.txt 2009-05-22 10:14 PM Todd Lipcon 20 kB
Issue Links:
Blocker
 
Dependants
 
Reference
 


 Description  « Hide
HADOOP-5257 added the ability for NameNode and DataNode to start and stop ServicePlugin implementations at NN/DN start/stop. However, this is insufficient integration for some common use cases.

We should add some functionality for Plugins to subscribe to events generated by the service they're plugging into. Some potential hook points are:

NameNode:

  • new datanode registered
  • datanode has died
  • exception caught
  • etc?

DataNode:

  • startup
  • initial registration with NN complete (this is important for HADOOP-4707 to sync up datanode.dnRegistration.name with the NN-side registration)
  • namenode reconnect
  • some block transfer hooks?
  • exception caught

I see two potential routes for implementation:

1) We make an enum for the types of hookpoints and have a general function in the ServicePlugin interface. Something like:

enum HookPoint {
  DN_STARTUP,
  DN_RECEIVED_NEW_BLOCK,
  DN_CAUGHT_EXCEPTION,
 ...
}

void runHook(HookPoint hp, Object value);

2) We make classes specific to each "pluggable" as was originally suggested in HADDOP-5257. Something like:

class DataNodePlugin {
  void datanodeStarted() {}
  void receivedNewBlock(block info, etc) {}
  void caughtException(Exception e) {}
  ...
}

I personally prefer option (2) since we can ensure plugin API compatibility at compile-time, and we avoid an ugly switch statement in a runHook() function.

Interested to hear what people's thoughts are here.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.