refactor NameNodeBlockTokenSecretManager


There are several problems with NameNodeBlockTokenSecretManager:

  1. It contains a lot of duplicate code from BlockTokenSecretManager.

  2. It goes to the database each time the namenode want to create a new token (for every block)

  3. In the constructor it behaves differently if leader or not leader, but the leader election system is not activated yet when it is called so it can't work.

We propose to refactor the class to only go to the database when renewing the keys. When renewing the keys the leader NN will write new keys and nonleader NN will fetch the keys from the database. The keys life period is extended by one renewal period to handle the case of nonleader renewing their keys just before the leader and then being slow in their next renewal. Doing this make that most functions can use the parent implementation.
We also propose to fix the problem of the constructor by initializing the tokens when the service is started (after the leader election) rather than when the constructor is called.


Gautier Berthou


Gautier Berthou



Fix versions