Skip to content

sql: either unexport Executor or remove the Executor reference from Session. #10096

@knz

Description

@knz

Currently there is both an Executor pointer in sql.Session and the API to use the executor is executor.DoStuff(session, ...). The redundancy of information is confusing.

It also seems that this executor reference in Session is not used for much; we can find it used only for:

  • e.TxnAbortCount.Inc(1) in session.txnState.updateStateAndCleanupOnErr() (this could be passed explicitly in arguments, since this method is always only called from other executor method)
  • p.session.executor.virtualSchemas in planner.virtualSchemas() (this dependency could be dropped by hosting the virtualSchemas reference directly in the session objects, which may make sense in the future if we support per-session virtual tables.)

This suggests the executor pointer in Session could be removed, which would incidentally remove an argument from a few function in pgwire.

Alternatively, if we find it interesting to link the session to a particular executor (which makes some sense, if we squint enough) then we could unexport the methods of Executor and have Session be the only interface exported by sql, with appropriate prepare/execute entry points.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.E-easyEasy issue to tackle, requires little or no CockroachDB experiencehelp wantedHelp is requested / needed by the one who filed the issue to fix it.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions