[ 
https://issues.apache.org/jira/browse/HIVE-26555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653808#comment-17653808
 ] 

Teddy Choi edited comment on HIVE-26555 at 1/3/23 7:03 AM:
-----------------------------------------------------------

[~abstractdog], sorry for late reply.

It's assuming an [active-passive HA 
configuration|https://en.wikipedia.org/wiki/High-availability_cluster#Node_configurations]
 with reads on the passive. The active instance should be the single source of 
the truth, while the passive instance should follow it. However, the current 
Hive replication design allows the passive instance to diverge from the active 
instance. A data divergence between the active-passive instances is hard to 
detect and resolve. This read-only mode prevents the passive instance to change 
to avoid any unintended divergence.

References
 * Microsoft SQL Server: [Configure read-only access to a secondary replica of 
an Always On availability 
group|https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-access-on-an-availability-replica-sql-server?view=sql-server-ver16]
 * Oracle Database: [High Availability Overview and Best Practices - Features 
for Maximizing 
Availability|https://docs.oracle.com/en/database/oracle/oracle-database/21/haovw/ha-features.html#GUID-314F15CE-BD8F-45B0-911E-B7FCC2B8006A]
 * IBM DB2: [Enabling reads on 
standby|https://www.ibm.com/docs/en/db2/11.5?topic=feature-enabling-reads-standby]

 


was (Author: teddy.choi):
[~abstractdog], sorry for late reply.

It's assuming an [active-passive HA 
configuration|https://en.wikipedia.org/wiki/High-availability_cluster#Node_configurations]
 with reads on the passive. The active instance should be the single source of 
the truth, while the passive instance should follow it. However, the current 
Hive replication design allows the passive instance to diverge from the active 
instance. A data divergence between the active-passive instances is hard to 
detect and resolve. This read-only mode prevents the passive instance to change 
to avoid any unintended divergence.

References
 * Microsoft SQL Server: [Configure read-only access to a secondary replica of 
an Always On availability 
group|https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-access-on-an-availability-replica-sql-server?view=sql-server-ver16]
 * Oracle Database: [High Availability Overview and Best Practices | Features 
for Maximizing 
Availability|https://docs.oracle.com/en/database/oracle/oracle-database/21/haovw/ha-features.html#GUID-314F15CE-BD8F-45B0-911E-B7FCC2B8006A]
 * IBM DB2: [Enabling reads on 
standby|https://www.ibm.com/docs/en/db2/11.5?topic=feature-enabling-reads-standby]

 

> Read-only mode for Hive database
> --------------------------------
>
>                 Key: HIVE-26555
>                 URL: https://issues.apache.org/jira/browse/HIVE-26555
>             Project: Hive
>          Issue Type: New Feature
>            Reporter: Teddy Choi
>            Assignee: Teddy Choi
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> h1. Purpose
> In failover/fail-back scenarios, a Hive database needs to be read-only, while 
> other one is writable to keep a single source of truth.
> h1. User-Facing Changes
> Yes. EnforceReadOnlyDatabaseHook class implements ExecuteWithHookContext 
> interface. hive.exec.pre.hooks needs to have the class name to initiate an 
> instance. The "readonly" database property can be configured to turn it on 
> and off.
> h2. Allowed read operations
> All read operations without any data/metadata change are allowed.
>  * EXPLAIN
>  * USE(or SWITCHDATABASE)
>  * REPLDUMP
>  * REPLSTATUS
>  * EXPORT
>  * KILL_QUERY
>  * DESC prefix
>  * SHOW prefix
>  * QUERY with SELECT or EXPLAIN. INSERT, DELETE, UPDATE are disallowed.
> h2. Allowed write operations
> Most of write operations that change data/metadata are disallowed. There are 
> few allowed exceptions. The first one is alter database to make a database 
> writable. The second one is replication load to load a dumped database.
>  * ALTER DATABASE db_name SET DBPROPERTIES without "readonly"="true".
>  * REPLLOAD
> h1. Tests
>  * read_only_hook.q: USE, SHOW, DESC, DESCRIBE, EXPLAIN, SELECT
>  * read_only_delete.q
>  * read_only_insert.q



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to