mirror of https://github.com/yandex/odyssey.git
drop steal users connections on restart
This commit is contained in:
parent
15adddf05a
commit
20e97cae09
|
@ -1,4 +1,4 @@
|
|||
daemonize yes
|
||||
daemonize no
|
||||
|
||||
unix_socket_dir "/tmp"
|
||||
unix_socket_mode "0644"
|
||||
|
|
|
@ -741,8 +741,23 @@ od_frontend_remote(od_client_t *client)
|
|||
}
|
||||
|
||||
od_server_t *server;
|
||||
od_instance_t *instance = client->global->instance;
|
||||
for (;;) {
|
||||
machine_cond_wait(client->cond, UINT32_MAX);
|
||||
/* we go to the eternal wait
|
||||
* mode during normal work and set the timeout to the client
|
||||
* in 1 minute to perform actions in the shutdown mode */
|
||||
while (1) {
|
||||
if (machine_cond_wait(client->cond, 60000) == 0) {
|
||||
break;
|
||||
}
|
||||
if (instance->shutdown_worker_id != -1) {
|
||||
status = OD_ECLIENT_READ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (od_frontend_status_is_err(status))
|
||||
break;
|
||||
|
||||
/* client operations */
|
||||
status = od_frontend_ctl(client);
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
void
|
||||
od_grac_shutdown_worker(void *arg);
|
||||
|
||||
#endif /* ODYSSEY_GRAC_KILLER_H */
|
||||
#endif /* ODYSSEY_GRAC_KILLER_H */
|
||||
|
|
|
@ -19,6 +19,7 @@ od_system_gracefully_killer_invoke(od_system_t *system)
|
|||
"failed to invoke gracefully killer coroutine");
|
||||
return NOT_OK_RESPONSE;
|
||||
}
|
||||
instance->shutdown_worker_id = mid;
|
||||
|
||||
return OK_RESPONSE;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -184,8 +184,52 @@ func sigusr2Test(
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
func usrNoReadResultWhilesigusr2Test(
|
||||
ctx context.Context,
|
||||
) error {
|
||||
|
||||
err := ensurePostgresqlRunning(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ensureOdysseyRunning(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
db, err := getConn(ctx, databaseName, 1)
|
||||
|
||||
if _, err := db.Query("Select 42"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := signalToProc(syscall.SIGUSR2, "odyssey"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
time.Sleep(30 * time.Second)
|
||||
if err := db.Ping(); err != nil {
|
||||
return err
|
||||
}
|
||||
time.Sleep(70 * time.Second)
|
||||
if err := db.Ping(); err != nil {
|
||||
fmt.Println(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("connection not closed!!!\n")
|
||||
}
|
||||
|
||||
func odyClientServerInteractionsTestSet(ctx context.Context) error {
|
||||
|
||||
if err := usrNoReadResultWhilesigusr2Test(ctx); err != nil {
|
||||
err = fmt.Errorf("usrNoReadResultWhilesigusr2 error %w", err)
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := onlineRestartTest(ctx); err != nil {
|
||||
err = fmt.Errorf("online restart error %w", err)
|
||||
fmt.Println(err)
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
for _, f := range []func(ctx2 context.Context) error{
|
||||
|
|
Loading…
Reference in New Issue