Skip to content

Commit c9525a5

Browse files
committed
c-sdk: set the NONLINEARIZABLE client key (if set) from initial configuration before the AUTH command so AUTH and USE DATABASE commands don't wait for linearizability guarantees
1 parent a1768ad commit c9525a5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

C/sqcloud.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,10 @@ static bool internal_connect_apply_config (SQCloudConnection *connection, SQClou
16631663
char buffer[2048];
16641664
int len = 0;
16651665

1666+
if (config->non_linearizable) {
1667+
len += snprintf(&buffer[len], sizeof(buffer) - len, "SET CLIENT KEY NONLINEARIZABLE TO 1;");
1668+
}
1669+
16661670
if (config->username && config->password && strlen(config->username) && strlen(config->password)) {
16671671
char *command = config->password_hashed ? "HASH" : "PASSWORD";
16681672
len += snprintf(&buffer[len], sizeof(buffer) - len, "AUTH USER %s %s %s;", config->username, command, config->password);
@@ -1685,10 +1689,6 @@ static bool internal_connect_apply_config (SQCloudConnection *connection, SQClou
16851689
len += snprintf(&buffer[len], sizeof(buffer) - len, "SET CLIENT KEY ZEROTEXT TO 1;");
16861690
}
16871691

1688-
if (config->non_linearizable) {
1689-
len += snprintf(&buffer[len], sizeof(buffer) - len, "SET CLIENT KEY NONLINEARIZABLE TO 1;");
1690-
}
1691-
16921692
if (config->no_blob) {
16931693
len += snprintf(&buffer[len], sizeof(buffer) - len, "SET CLIENT KEY NOBLOB TO 1;");
16941694
}

0 commit comments

Comments
 (0)