Skip to content

Add delete_device support#32

Open
shelling wants to merge 9 commits intomogilefs:masterfrom
shelling:master
Open

Add delete_device support#32
shelling wants to merge 9 commits intomogilefs:masterfrom
shelling:master

Conversation

@shelling
Copy link

abstract

This patch provides cmd to delete device permanently in MogileFS::Worker::Query.

Client-side usage is like following.

my $admin = MogileFS::Admin->new(hosts => ["ip:port"])
$admin->{backend}
      ->do_request(
          "delete_device", 
          {devid => $devid, host => $hostname}
      );

implementation detail

Actually. this command keeps the primary key devid of specified device in TABLE device
that prevents reuse of identical devid

It moves the hostid of specified device to be 0 when host id starts from 1.
Thus, hosts contains no devices can be removed permanently as well.

This patch also prevents any further interactions with deleted devices (hostid = 0)
That is, get_all_devices() returns devices with condition hostid > 0.

It also validates the specified device contains no file, accepts no incoming file, and is marked as dead,
which prevents deleting of incident and implosion of the cluster.

@shelling
Copy link
Author

shelling commented Nov 1, 2013

@dormando hello, any comment or recommendation for this pull request? thanks a lot!

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.

1 participant