For automatic splits the following happens.
- Tablet group watcher periodically scans the metadata table looking for tablets to split
- When a tablet is found to split, the manager tracks in memory that the tablet is in the process of splitting
- A Fate operation is started to split the tablet.
In #4178 the above tracking that is done in manager memory is moved to FATE. However the FATE implementation is not complete, its only stubbed out in #4178. To complete #4178, need the following capabilities in FATE.
- The ability to specify a key when creating a FATE operation. For the split this case this key would be the extent. The fate operation should only be created if the key does not exists.
- The ability to handle failures in the case where the FATE operation is created with a key, but is not seeded.
The following is an example of one way this could work.
FateStore store = ...;
KeyExtent extent = ...; // extent to split
OptionalLong txid = store.create("split", toByteArray(extent));
if(!txid.isPresent()){
// check to see if it was created but not seeded
txid = store.findByKey("split", toByteArray(extent));
if(txid.isPresent()){
// TODO reserve and if in the new state, then seed fate op
}
} else {
// TODO seed the fate op
}
Maybe the above code would be more efficient as something like Optional<Pair<Long, TStatus>> createOrFind(key).
The implementation of the create(key) function could hash the key to obtain a 64 bit fate id. It would need to handle collisions in a similar way to a hashmap.
For automatic splits the following happens.
In #4178 the above tracking that is done in manager memory is moved to FATE. However the FATE implementation is not complete, its only stubbed out in #4178. To complete #4178, need the following capabilities in FATE.
The following is an example of one way this could work.
Maybe the above code would be more efficient as something like
Optional<Pair<Long, TStatus>> createOrFind(key).The implementation of the create(key) function could hash the key to obtain a 64 bit fate id. It would need to handle collisions in a similar way to a hashmap.