WL#2788: Distributed LOCK TABLE for mysqld

Affects: Server-7.1   —   Status: Assigned

To support online alter table
  one needs a mysqld table lock in each mysqld

One ide to implement this is using a table: NDB$TABLE_LOCKS
Each mysqld will have an event on NDB$TABLE_LOCKS
When one needs the lock one inserts a row into the table
  and waits for all mysqld to update it's bit that the table is locked

Note: one additional feature needed from event api is subscribing to API_FAIL_REP

Locking:
INSERT INTO NDB$TABLE_LOCK
Wait for all alive API nodes to update it bits.

Other mysqld:
Wait for INSERT into NDB$TABLE_LOCK
  On event: lock table locally
  Update NDB$TABLE_LOCK with bit representing on nodeid


Note: This will note safe guard against ndbapi programs...
   (i.e. we still need table locks inside kernel for some cases...)