hive icon indicating copy to clipboard operation
hive copied to clipboard

HIVE-26555 Read-only mode

Open pudidic opened this issue 2 years ago • 1 comments

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

pudidic avatar Sep 22 '22 12:09 pudidic

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Oct 17 '22 05:10 sonarqubecloud[bot]

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.

github-actions[bot] avatar Dec 17 '22 00:12 github-actions[bot]

thanks for clarifying @pudidic , implementation looks good to me +1, pending tests

abstractdog avatar Jan 03 '23 08:01 abstractdog

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Jan 03 '23 09:01 sonarqubecloud[bot]

Thank you @abstractdog !

pudidic avatar Jan 04 '23 04:01 pudidic