Merge branch 'keydbpro' into PRO_RELEASE_6

Former-commit-id: 507b791211b4b0c3251dc538fa385cd95a189e80
This commit is contained in:
John Sully 2020-07-11 22:27:32 +00:00
commit d1a03fcd62
3 changed files with 28 additions and 5 deletions

View File

@ -578,7 +578,7 @@ void loadServerConfigFromString(char *config) {
err = "KeyDB not compliled with scratch-file support.";
goto loaderr;
#endif
} else if (!strcasecmp(argv[0],"server-threads") && argc == 2) {
} else if ((!strcasecmp(argv[0],"server-threads") || !strcasecmp(argv[0],"io-threads")) && argc == 2) {
cserver.cthreads = atoi(argv[1]);
if (cserver.cthreads <= 0 || cserver.cthreads > MAX_EVENT_LOOPS) {
err = "Invalid number of threads specified";
@ -2256,6 +2256,7 @@ static int updateTlsCfgBool(int val, int prev, const char **err) {
}
#endif /* USE_OPENSSL */
int fDummy = false;
standardConfig configs[] = {
/* Bool configs */
createBoolConfig("rdbchecksum", NULL, IMMUTABLE_CONFIG, g_pserver->rdb_checksum, 1, NULL, NULL),
@ -2271,6 +2272,7 @@ standardConfig configs[] = {
createBoolConfig("lazyfree-lazy-eviction", NULL, MODIFIABLE_CONFIG, g_pserver->lazyfree_lazy_eviction, 0, NULL, NULL),
createBoolConfig("lazyfree-lazy-expire", NULL, MODIFIABLE_CONFIG, g_pserver->lazyfree_lazy_expire, 0, NULL, NULL),
createBoolConfig("lazyfree-lazy-server-del", NULL, MODIFIABLE_CONFIG, g_pserver->lazyfree_lazy_server_del, 0, NULL, NULL),
createBoolConfig("lazyfree-lazy-user-del", NULL, MODIFIABLE_CONFIG, g_pserver->lazyfree_lazy_user_del , 0, NULL, NULL),
createBoolConfig("repl-disable-tcp-nodelay", NULL, MODIFIABLE_CONFIG, g_pserver->repl_disable_tcp_nodelay, 0, NULL, NULL),
createBoolConfig("repl-diskless-sync", NULL, MODIFIABLE_CONFIG, g_pserver->repl_diskless_sync, 0, NULL, NULL),
createBoolConfig("aof-rewrite-incremental-fsync", NULL, MODIFIABLE_CONFIG, g_pserver->aof_rewrite_incremental_fsync, 1, NULL, NULL),
@ -2292,6 +2294,7 @@ standardConfig configs[] = {
createBoolConfig("appendonly", NULL, MODIFIABLE_CONFIG, g_pserver->aof_enabled, 0, NULL, updateAppendonly),
createBoolConfig("cluster-allow-reads-when-down", NULL, MODIFIABLE_CONFIG, g_pserver->cluster_allow_reads_when_down, 0, NULL, NULL),
createBoolConfig("delete-on-evict", NULL, MODIFIABLE_CONFIG, cserver.delete_on_evict, 0, NULL, NULL),
createBoolConfig("io-threads-do-reads", NULL, IMMUTABLE_CONFIG, fDummy, 0,NULL, NULL), // Not applicable to KeyDB, just there for compatibility
/* String Configs */
createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, g_pserver->acl_filename, "", NULL, NULL),

View File

@ -2720,9 +2720,17 @@ void syncWithMaster(connection *conn) {
{
err = sendSynchronousCommand(mi, SYNC_CMD_READ,conn,NULL);
if (err[0] == '-') {
serverLog(LL_WARNING, "Recieved error from client: %s", err);
sdsfree(err);
goto error;
if (err[1] == 'E' && err[2] == 'R' && err[3] == 'R') {
// Replicating with non-pro
serverLog(LL_WARNING, "Replicating with non-pro server.");
mi->repl_state = REPL_STATE_SEND_PORT;
sdsfree(err);
return;
} else {
serverLog(LL_WARNING, "Recieved error from client: %s", err);
sdsfree(err);
goto error;
}
}
sdsfree(err);
mi->repl_state = REPL_STATE_SEND_PORT;

View File

@ -1126,6 +1126,8 @@ void serverLog(int level, const char *fmt, ...) {
static void checkTrialTimeout()
{
#ifndef NO_LICENSE_CHECK
if (g_pserver->sentinel_mode)
return; // sentinel is not licensed
if (cserver.license_key != nullptr && FValidKey(cserver.license_key, strlen(cserver.license_key)))
return;
time_t curtime = time(NULL);
@ -5094,6 +5096,16 @@ sds genRedisInfoString(const char *section) {
}
}
if (allsections || defsections || !strcasecmp(section,"keydb")) {
if (sections++) info = sdscat(info,"\r\n");
info = sdscatprintf(info,
"# KeyDB\r\n"
"variant:pro\r\n"
"license_status:%s\r\n",
cserver.license_key ? "OK" : "Trial"
);
}
/* Get info from modules.
* if user asked for "everything" or "modules", or a specific section
* that's not found yet. */
@ -5252,7 +5264,7 @@ void redisAsciiArt(void) {
serverLogRaw(LL_NOTICE|LL_RAW,buf);
}
if (cserver.license_key == nullptr)
if (cserver.license_key == nullptr && !g_pserver->sentinel_mode)
{
#ifndef NO_LICENSE_CHECK
serverLog(LL_WARNING, "!!!! KeyDB Pro is being run in trial mode !!!!");