hive
hive copied to clipboard
HIVE-26555 Read-only mode
What changes were proposed in this pull request?
Introduces a read-only mode.
Why are the changes needed?
In failover/fail-back scenarios, a Hive instance needs to be read-only, while other one is writable to keep a single source of truth.
Does this PR introduce any user-facing change?
Yes. EnforceReadOnlyHiveHook class can implement ExecuteWithHookContext interface. hive.exec.pre.hooks needs to have the class name to initiate an instance. "hive.enforce.readonly" can be configured to turn it on and off.
Allowed operations prefixes
- USE(or SWITCHDATABASE)
- SELECT
- DESC
- DESCRIBE
- SET
- EXPLAIN
- ROLLBACK
- KILL
- ABORT
How was this patch tested?
- read_only_hook.q: USE, SHOW, DESC, DESCRIBE, EXPLAIN, SELECT
- read_only_hook_delete_failure.q
- read_only_hook_insert_failure.q
- read_only_hook_update_failure.q
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Feel free to reach out on the [email protected] list if the patch is in need of reviews.
thanks for clarifying @pudidic , implementation looks good to me +1, pending tests
Thank you @abstractdog !