Each instance is required to independently
come
up with the same assignment answer for the
same
input key, which leads to the need for a
uniform
hash function. Traditional modulo based
hashes may
not be well suited to serve the p u r p o s e
as they
result in unnecessary rebalancing costs as
and when
cluster topology gets impacted. The
distribution
manager employs a technique called
rendezvous
hashing (Laprie, 1985) that allows each
follower
background process to achieve distributed
agreement on the instance home location for a given
IMCU. Given a key, the algorithm computes a hash
weight over each instance in the set of participating
instances in the payload broadcast by the leader and
selects the instance that generates the highest weight
as the home location.
f(K, N) = ∑max(h(K, i)), i = 1..N
Table 1: Hypothetical home location assignments by each
follower instance.
IMCU
Context
IMCU
Boundaries
Assignments
IMCU 1 <E1, E2’> Inst. 1
IMCU 2 <E2’’, E3’> Inst. 2
IMCU 3 <E3’’, E4’> Inst. 3
IMCU 4 <E4’’> Inst. 4
In context of IMCU distribution, the key chosen
depends on the distribution scheme. If the
distribution is block range based, then the address of
the first block in the IMCU context is used as the
key. Otherwise, the partition number or the relative
subpartition number is used as the key. As the key is
chosen in consensus across all follower instances,
the rendezvous hashing scheme ensures global
agreement on their home locations (an example is
demonstrated in Table 1). Besides achieving low
computation overheads and load balancing, the
primary benefit of rendezvous hashing scheme is
minimal disruption on instance failure or restart, as
only the IMCUs mapped to that particular instance
need to be redistributed.
Once the follower background process
determines the instance locations for all IMCU
contexts, it divides the workload into two sets, one
where IMCU contexts are assigned to its own
instance and the other where they are assigned to
remote instances. For the first set, it hands off the
IMCU contexts to a pool of local background server
processes to create IMCUs from the underlying data
blocks in parallel. If an in-memory segment is not
present, the population of the first local IMCU
Figure 7: Logical view of in-memory home location
index
on completion of distribution across 4 RAC
instances.
creates the in-memory segment within the column
store. Once the IMCUs are created locally in the
physical memory, they are registered in the block
address based home location index described in
section 2.2. An IMCU becomes visible to the data
access as well as the transaction management
components once it has been registered in the index.
For the second set, the follower process iteratively
registers only the remote home location metadata
without undergoing actual IMCU population.
The follower background process waits for all
local background processes undergoing IMCU
population to complete. By the time all instances
release their accesses on the global object lock, the
mechanism results in laying out IMCUs consistently
across all participating home location nodes
resulting in a globally consistent home location
index maintained locally on every instance
(illustrated in Figure 7).
2.3.3 SQL Execution
The distribution manager is seamlessly integrated
with the Oracle SQL execution engine (Parallel
2013) to provide in-memory distribution awareness
to traditional SQL queries without explicit query
rewrites or changes in execution plan. For a given
query issued from any instance in the cluster, the
SQL optimizer component first uses the local in-
memory home location index to extrapolate the cost
of full object scan across the cluster and compares
the cost against index based accesses. If the access
path chooses full object scan, the optimizer
determines the degree of parallelism (DOP) based on
the in-memory scan cost. The degree of parallelism
is rounded up to a multiple of the number of active
instances in the cluster. This ensures allocation of at
least one parallel execution server process per
instance to scan its local IMCUs.
Once parallel execution server processes have
been allocated across instances, the Oracle parallel
HowdoesOracleDatabaseIn-MemoryScaleout?
43