You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Beibei Zhao (Jira)" <ji...@apache.org> on 2022/12/12 14:28:00 UTC

[jira] [Created] (ZOOKEEPER-4648) FinalRequestProcessor addAuditLog after the process of request maybe better.

Beibei Zhao created ZOOKEEPER-4648:
--------------------------------------

             Summary: FinalRequestProcessor addAuditLog after the process of request maybe better.
                 Key: ZOOKEEPER-4648
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4648
             Project: ZooKeeper
          Issue Type: Bug
            Reporter: Beibei Zhao



which rc is better???

{code:java}
public void processRequest(Request request) {
        ......
        try {
            if (request.getHdr() != null && request.getHdr().getType() == OpCode.error) {
                AuditHelper.addAuditLog(request, rc, true);
                /*
                 * When local session upgrading is disabled, leader will
                 * reject the ephemeral node creation due to session expire.
                 * However, if this is the follower that issue the request,
                 * it will have the correct error code, so we should use that
                 * and report to user
                 */
                if (request.getException() != null) {
                    throw request.getException();
                } else {
                    throw KeeperException.create(KeeperException.Code.get(((ErrorTxn) request.getTxn()).getErr()));
                }
            }

            ......
            AuditHelper.addAuditLog(request, rc);

            switch (request.type) {
            ......
            case OpCode.getAllChildrenNumber: {
                lastOp = "GETACN";
                ......
                zks.checkACL(
                    request.cnxn,
                    zks.getZKDatabase().aclForNode(n),
                    ZooDefs.Perms.READ,
                    request.authInfo,
                    path,
                    null);
                ......
                break;
            }
            ......
            }
        } catch (SessionMovedException e) {
            ......
        } catch (KeeperException e) {
            err = e.code();
        } catch (Exception e) {
            ......
        }
{code}




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