Tanuj Khurana created PHOENIX-8057:
--------------------------------------

             Summary: Initialize ReplicationLogGroup outside the instance cache 
and close it when init fails
                 Key: PHOENIX-8057
                 URL: https://issues.apache.org/jira/browse/PHOENIX-8057
             Project: Phoenix
          Issue Type: Sub-task
            Reporter: Tanuj Khurana
            Assignee: Tanuj Khurana


ReplicationLogGroup.getOrCreate runs init() inside INSTANCES.computeIfAbsent. 
That has three consequences:
- Blocking under a map lock. init() does HDFS and ZooKeeper work: it creates 
the log writer, resolves the HA group state, and may enter STORE_AND_FORWARD. 
All of that runs while holding the ConcurrentHashMap bin lock, so other callers 
for the same key, and for other keys in the same bin, block behind it.
- A failed init() leaks resources. When init() throws, the group never enters 
the map and nothing closes it. Whatever it had already built is left running:
 - the Disruptor consumer;
 - the open log writer;
 - the store-and-forward status task;
 - the HA state listeners it registered.
- Failing inits repeat. Each blocked caller runs a failing init() again, so one 
bad state, for example an unreachable peer HDFS during a failover, produces a 
burst of repeated init attempts and leaks.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to