Closed shvachko closed 9 years ago
It will require LeaseManager
to be shared between NamespaceProcessor
and BlockManagementAgent
. In #31 we tried to place it in coprocessors sharedData
, but sharedData
is only shared between the same instances of the same coprocessor, and therefore it didn't work.
If there is no better way (let's try to find it first though), we can make LeaseManager
a static singleton, which is one way to share the reference between classes.
We should investigate into this after the HBase upgrade is complete. If we can turn NamespaceProcessor into an endpoint coprocessor and get access to the "openRegion" methods then we can listen in on the lease columns and add to the LeaseManager as needed.
The logic seems to be solid. Few comments:
@VisibleForTesting
. Just public
- that's it. Useless decorations...RegionServerServices
as the key in leaseManagerMap
. Would it be better to use getRpcServer().getListenerAddress().toString()
?LeaseManager.getLeaseManager()
.
originateSharedLeaseManager()
? Seems like this is what it used to be until now.isNamespaceTable()
should be static, and not private then.BlockManagementAgent.getLease()
should be getFileLease()
byteArrayToLease()
@return sounds odd. I understand it was pasta-copied from the previous method. But let's not multiply oddness in this project.GiraffaPBHelper.bytesToHdfsLease()
and get rid of BlockManagementAgent.byteArrayToLease()
.testLeaseMigration()
would be quite helpful.Changes can be seen here: https://github.com/GiraffaFS/giraffa/commit/0d904dbe10300fad33e243cd1b2d5a8084da1488
This is how its done in Hadoop as well. It would be nice to build protobuf generation into our build but that seems like a separate issue.
I thought in Hadoop protobuf is generated in target\generated-sources
. Let's file a new issue to do that.
I changed leaseManagerMap
to map String to LeaseManager. This is what I meant in (4). Also added a JavaDoc explaining it is only needed in unit tests.
Got rid of byteArrayToLease()
as described in (9). Yes, let's file another issue to refactor serialization into a separate class.
The rest looks good. +1. Will commit if no objections.
Just committed. Thank you Plamen.
Need to reopen this. The upgrade branch is colliding with this commit. I fixed compilation, but then TestLeaseManagement fails, and it looks like it requires a lot of changes to fix it.
So I propose to revert this for now. Commit the upgrade and then rework this issue with new HBase APIs.
Particularly, BlockManagementAgent should mostly work with Cell
instead of KeyValue
. I simply did a contextual replace of KeyValue to Cell.
Restored branch issue-132 as current trunk (before reverting).
Found out the cause of the issues. Stopping the only remaining RegionServer while maintaining that ZK assigns the META storage was triggering some ShutdownProcessHook that was causing the migration test to fail.
I've updated my branch "issue-132" with some configuration parameter changes to the unit test that allow the MiniHBaseCluster to not get stuck when we stop a RegionServer.
Now the problem comes down to the GiraffaClient getting ConnectionRefused exceptions when it tries to close the file or renew the lease AFTER the RegionServer dies.
Plamen, you probably want to reveal a bit more info about what didn't work. Or you will forget it by next Wednesday :-).
I merged this with current trunk (post #153 commit). Pushed the branch. Will commit as tests are passing.
Committed!! Thank you Plamen.
Lease information in Giraffa is persisted in the file row. That way when the region moves to another region server as the result of RS failure or a split of the region, the new RS will recreate the lease from the lease info stored in the row. We should implement this logic.