Remote based replication requires server restart to take effect if configured from the server
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 120
Description
Repro:
1. Create a new database on DoltHub. Make a table and commit so you can clone.
2. Clone it locally:
```
$ dolt clone timsehn/replication_restart
cloning https://doltremoteapi.dolthub.com/timsehn/replication_restart
$ cd replication_restart
```
3. Start a SQL server:
```
$ dolt sql-server
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"|S="/tmp/mysql.sock"
```
4. Open a sql shell, set replication variables:
```
$ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.9-Vitess Dolt
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> use replication_restart;
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 [replication_restart]> select * from t;
Empty set (0.007 sec)
MySQL [replication_restart]> set @@persist.dolt_replicate_to_remote = 'origin';
Query OK, 1 row affected (0.004 sec)
MySQL [replication_restart]> set @@persist.dolt_replicate_all_heads = 1;
```
5. Insert values and make a commit:
```
MySQL [replication_restart]> insert into t values (1,1);
Query OK, 1 row affected (0.027 sec)
MySQL [replication_restart]> call dolt_commit('-am', '1,1');
+----------------------------------+
| hash |
+----------------------------------+
| em4tkcvluh7f6qgjitabg6olu4217gkg |
+----------------------------------+
1 row in set (0.023 sec)
```
6. Go to DoltHub. Does not replicate:
7. Restart SQL server.
8. Make another insert and commit
```
MySQL [replication_restart]> insert into t values (2,2);
ERROR 2006 (HY000): Server has gone away
No connection. Trying to reconnect...
Connection id: 1
Current database: replication_restart
Query OK, 1 row affected (0.032 sec)
MySQL [replication_restart]> call dolt_commit('-am', '2,2');
+----------------------------------+
| hash |
+----------------------------------+
| 7mrupsen61i1km5asqbjvf2amh26ef9q |
+----------------------------------+
1 row in set (2.078 sec)
```
9. Go to DoltHub. Replication succeeds.
Starting replication should not require a server restart.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the behavior with dolt sql-server and the SET @@persist.dolt_replicate_to_remote and SET @@persist.dolt_replicate_all_heads statements. Trace where these settings take effect and compare behavior before and after a server restart. Done means a commit made after configuring replication is replicated without restarting the SQL server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100