dolt icon indicating copy to clipboard operation
dolt copied to clipboard

set @@persist doesn't update session values

Open zachmu opened this issue 2 years ago • 2 comments

In the SQL shell:

difftest> set @@persist.dolt_transaction_commit = 1;
difftest> show variables like '%dolt%';
+-------------------------------+-------+
| Variable_name                 | Value |
+-------------------------------+-------+
| dolt_allow_commit_conflicts   | 0     |
| dolt_async_replication        | 0     |
| dolt_force_transaction_commit | 0     |
| dolt_read_replica_remote      |       |
| dolt_replicate_all_heads      | 0     |
| dolt_replicate_heads          |       |
| dolt_replicate_to_remote      |       |
| dolt_skip_replication_errors  | 0     |
| dolt_transaction_commit       | 0     |
| dolt_transactions_disabled    | 0     |
+-------------------------------+-------+

It did persist though:

% dolt config --list --local
sqlserver.global.dolt_transaction_commit = 1

zachmu avatar Jun 23 '22 22:06 zachmu

It also showed up when I restarted the shell.

zachmu avatar Jun 23 '22 22:06 zachmu

For this variable it also is not actually working. ie. there is no dolt commit on transaction commit:

mysql> set @@persist.dolt_transaction_commit = 1;
Query OK, 1 row affected (0.00 sec)

mysql> show variables like '%dolt%';
+-------------------------------+-------+
| Variable_name                 | Value |
+-------------------------------+-------+
| dolt_allow_commit_conflicts   | 0     |
| dolt_async_replication        | 0     |
| dolt_force_transaction_commit | 0     |
| dolt_read_replica_remote      |       |
| dolt_replicate_all_heads      | 0     |
| dolt_replicate_heads          |       |
| dolt_replicate_to_remote      |       |
| dolt_skip_replication_errors  | 0     |
| dolt_transaction_commit       | 0     |
| dolt_transactions_disabled    | 0     |
+-------------------------------+-------+
10 rows in set (0.00 sec)

mysql> use test_precision;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from dolt_status
    -> ;
+------------+--------+-----------+
| table_name | staged | status    |
+------------+--------+-----------+
| test       |      0 | new table |
+------------+--------+-----------+
1 row in set (0.00 sec)

mysql> insert into test values (1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from dolt_status
    -> ;
+------------+--------+-----------+
| table_name | staged | status    |
+------------+--------+-----------+
| test       |      0 | new table |
+------------+--------+-----------+
1 row in set (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from dolt_status
    -> ;
+------------+--------+-----------+
| table_name | staged | status    |
+------------+--------+-----------+
| test       |      0 | new table |
+------------+--------+-----------+
1 row in set (0.00 sec)

timsehn avatar Aug 31 '22 17:08 timsehn

Above case matches MySQL behavior.

set @@persist.dolt_transaction_commit = 1; persists and sets GLOBAL variable only. show variables like '%dolt%'; shows SESSION variables by default. The user needs to set the variable at session-scope to configure the current session, or the user needs to reconnect to the server to reconfigure the session variables.

The result of set @@persist. query should be visible for SHOW GLOBAL VARIABLES LIKE '%dolt%'query, which we do not support yet, but adding support for it as fix for this issue.

jennifersp avatar Jan 31 '23 22:01 jennifersp