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

Introduce system variables #7

Merged
merged 32 commits into from
Oct 27, 2024
Merged

Conversation

apstndb
Copy link
Owner

@apstndb apstndb commented Oct 25, 2024

Introduce Spanner JDBC driver style system variables.

Statements

  • SHOW VARIABLE <name>;
  • SET <name> = <value>;
  • SHOW VARIABLES;

Flags

  • --set name=value

Implemented variables

  • READ_ONLY_STALENESS
  • OPTIMIZER_VERSION (not work because backend bug?)
  • OPTIMIZER_STATISTICS_PACKAGE
  • RPC_PRIORITY
  • READ_TIMESTAMP
  • COMMIT_TIMESTAMP
  • COMMIT_RESPONSE

Refs:

Example

$ spanner-mycli -t --set 'read_only_staleness=max_staleness 10m' -v
Connected.
spanner> SHOW VARIABLES;
+------------------------------+---------------------+
| name                         | value               |
+------------------------------+---------------------+
| OPTIMIZER_STATISTICS_PACKAGE |                     |
| OPTIMIZER_VERSION            |                     |
| READ_ONLY_STALENESS          | MAX_STALENESS 10m0s |
| RPC_PRIORITY                 | MEDIUM              |
+------------------------------+---------------------+
Empty set (0.00 sec)

spanner> SELECT 1;
+-------+
|       |
| INT64 |
+-------+
| 1     |
+-------+
1 rows in set (0.14 msecs)
timestamp:            2024-10-26T22:57:45.759191+09:00
cpu time:             0.12 msecs
rows scanned:         0 rows
deleted rows scanned: 0 rows
optimizer version:    7
optimizer statistics: auto_20241023_13_33_54UTC

spanner> SET READ_ONLY_STALENESS = "READ_TIMESTAMP 2024-10-26T22:45:00+09:00";
Empty set (0.00 sec)

spanner> SELECT 1;
+-------+
|       |
| INT64 |
+-------+
| 1     |
+-------+
1 rows in set (0.2 msecs)
timestamp:            2024-10-26T22:45:00+09:00
cpu time:             0.16 msecs
rows scanned:         0 rows
deleted rows scanned: 0 rows
optimizer version:    7
optimizer statistics: auto_20241023_13_33_54UTC

spanner> SHOW VARIABLES;
+------------------------------+------------------------------------------+
| name                         | value                                    |
+------------------------------+------------------------------------------+
| OPTIMIZER_STATISTICS_PACKAGE |                                          |
| OPTIMIZER_VERSION            |                                          |
| READ_ONLY_STALENESS          | READ_TIMESTAMP 2024-10-26T22:45:00+09:00 |
| READ_TIMESTAMP               | 2024-10-26T22:45:00+09:00                |
| RPC_PRIORITY                 | MEDIUM                                   |
+------------------------------+------------------------------------------+
Empty set (0.00 sec)

@apstndb apstndb merged commit 3b15186 into main Oct 27, 2024
1 check passed
@apstndb apstndb deleted the feature/introduce-system-variables branch October 27, 2024 00:25
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.

1 participant