Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgwire: add telemetry for fetch limits #31637

Merged
merged 1 commit into from
Oct 23, 2018

Conversation

knz
Copy link
Contributor

@knz knz commented Oct 19, 2018

Requested by @awoods187

The JDBC driver and perhaps others commonly try to use the "fetch
limit" parameter, which is yet unsupported in
CockroachDB (#4035). This patch adds telemetry to gauge demand.

Release note (sql change): attempts by client apps to use the
unsupported "fetch limit" parameter (e.g. via JDBC) will now be
captured in telemetry if statistics reporting is enabled, to gauge
support for this feature.

@knz knz requested review from dt, andreimatei, awoods187 and a team October 19, 2018 16:15
@cockroach-teamcity
Copy link
Member

This change is Reviewable

// We have to do the telemetry explicitly here because automatic
// telemetry for unimplemented features is only done in the
// connExecutor.
telemetry.Count("errorcodes." + pgerror.CodeFeatureNotSupportedError)
Copy link
Member

@dt dt Oct 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing something -- why can't we let the regular unimplemented code counting in conn exec get this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I said, I'm probably missing something. Usually we let the error bubble up to the conn executor and it inspects it as a goes back to the client, so I was wondering why that didn't work for this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually pretty painless. I had forgotten that I had dropped the dependency on the executor in a previous PR. Done.

Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/sql/pgwire/command_result.go, line 134 at r1 (raw file):

Previously, dt (David Taylor) wrote…

I'm missing something -- why can't we let the regular unimplemented code counting in conn exec get this?

how would you propose to do that?

@knz
Copy link
Contributor Author

knz commented Oct 22, 2018

the conn executor sits above pgwire. This error is not originating in conn executor, it originates in pgwire.

Copy link
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/sql/pgwire/command_result.go, line 134 at r1 (raw file):

		// telemetry for unimplemented features is only done in the
		// connExecutor.
		telemetry.Count("errorcodes." + pgerror.CodeFeatureNotSupportedError)

I'd use r.err.code instead of repeating the code here

@dt
Copy link
Member

dt commented Oct 22, 2018

I'd have a slight preference to library-sizing recordErr for use here and in the conn executor rather than copy/paste and keeping the prefixes in agreement by hand, but if that approach introduces some unfortunately deps or something, then LGTM as-is.

@knz
Copy link
Contributor Author

knz commented Oct 22, 2018

lemme look if I can factor this code then

@dt
Copy link
Member

dt commented Oct 22, 2018

Thanks, and again, that's a slight preference, so if it turns out to be annoying or if there's no good home for such a function, still LGTM as-is.

@knz
Copy link
Contributor Author

knz commented Oct 22, 2018

aye

@knz knz requested review from a team October 23, 2018 12:22
@knz
Copy link
Contributor Author

knz commented Oct 23, 2018

TFYRs!

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 23, 2018

Merge conflict (retrying...)

The JDBC driver and perhaps others commonly try to use the "fetch
limit" parameter, which is yet unsupported in
CockroachDB (cockroachdb#4035). This patch adds telemetry to gauge demand.

Release note (sql change): attempts by client apps to use the
unsupported "fetch limit" parameter (e.g. via JDBC) will now be
captured in telemetry if statistics reporting is enabled, to gauge
support for this feature.
@craig
Copy link
Contributor

craig bot commented Oct 23, 2018

Canceled

@knz
Copy link
Contributor Author

knz commented Oct 23, 2018

bors r+

craig bot pushed a commit that referenced this pull request Oct 23, 2018
31637: pgwire: add telemetry for fetch limits r=knz a=knz

Requested by @awoods187 

The JDBC driver and perhaps others commonly try to use the "fetch
limit" parameter, which is yet unsupported in
CockroachDB (#4035). This patch adds telemetry to gauge demand.

Release note (sql change): attempts by client apps to use the
unsupported "fetch limit" parameter (e.g. via JDBC) will now be
captured in telemetry if statistics reporting is enabled, to gauge
support for this feature.

31725: sql/parser: re-allow FAMILY, MINVALUE, MAXVALUE, NOTHING and INDEX in table names r=knz a=knz

Fixes #31589.

CockroachDB introduced non-standard extensions to its SQL dialect very
early in its history, before concerns of compatibility with existing
PostgreSQL clients became a priority. When these features were added,
new keywords were liberally marked as "reserved", so as to "make the
grammar work", and without noticing / care for the fact that this
change would make existing valid SQL queries/clients encounter new
errors.

An example of this:

1. let's make "column families" a thing

2. the syntax `create table(..., constraint xxx family(a,b,c))` is not
   good enough (although this would not require reserved keywords), we
   really want also `create table (..., family (a,b,c))` to be
   possible.

3. oh, the grammar won't let us because "family" is a possible column
   name? No matter! let's mark "FAMILY" as a reserved name for
   column/function names.

   - No concern for the fact that "family" is a  perfectly valid
	 English name for things that people want to make an attribute of
	 in inventory / classification tables.

   - No concern for the fact that reserved column/function names are
	 also reserved for table names.

4. (much later) Clients complaining about the fact they can't call
   their columns or tables `family` without quoting.

Ditto "INDEX", "MINVALUE", "MAXVALUE", and perhaps others.

Moral of the story: DO NOT MAKE NEW RESERVED KEYWORDS UNLESS YOU'RE
VERY VERY VERY SURE THAT THERE IS NO LEGITIMATE USE FOR THEM IN CLIENT
APPS EVER.

(An example perhaps: the word "NOTHING" was also marked as reserved,
but it's much more unlikely this word will ever be used for something
useful.)

This patch restores the use of FAMILY, INDEX, NOTHING, MINVALUE and
MAXVALUE in table and function names, by introducing an awkward dance
in the grammar of keyword non-terminals and database object names.

They remain reserved as colum names because of the non-standard
CockroachDB extensions.

Release note (sql change): It is now again possible to use the
keywords FAMILY, MINVALUE, MAXVALUE, INDEX or NOTHING as table names,
for compatibility with PostgreSQL.

31731: sql/parser: unreserve INDEX and NOTHING from the RHS of SET statements r=knz a=knz

First commit from #31725.

The SET statement in the pg dialect is special because it
auto-converts identifiers on its RHS to symbolic values or strings. In
particular it is meant to support a diversity of special keywords as
pseudo-values.

This patch ensures that INDEX and NOTHING are accepted on the RHS.

Release note (sql change): the names "index" and "nothing" are again
accepted in the right-hand-side of the assignment in SET statements,
for compatibility with PostgreSQL.


Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Oct 23, 2018

Build succeeded

@craig craig bot merged commit 552aabd into cockroachdb:master Oct 23, 2018
@knz knz deleted the 20181019-limit-telemetry branch February 14, 2019 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants