You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Write docs for the "STORE" operaiton of SORT, and GET "#" option.
11
11
* Append only mode: testing and a command to rebuild the log from scratch.
12
12
* Profiling and optimizations. For instance the commands lookup is probably starting to eat too CPU being a simple list. To implement binary search or an hash table lookup can be a win probably.
13
-
* Expiring algorithm should be adaptive. Use the following algorithm. Start testing REDIS_EXPIRELOOKUPS_PER_CRON in the first iteration, and continue with the same amount of keys until the percentage of expired keys > 25%.
/* Try to match against the Symbol with the smallest offset */
5665
-
for (i=0; symsTable[i].pointer; i++) {
5666
-
unsigned longlp= (unsigned long) pointer;
5545
+
if (!fp) return-1;
5546
+
if (fgets(buf,64,fp) ==NULL) {
5547
+
fclose(fp);
5548
+
return-1;
5549
+
}
5550
+
fclose(fp);
5667
5551
5668
-
if (lp!= (unsigned long)-1&&lp >= symsTable[i].pointer) {
5669
-
off=lp-symsTable[i].pointer;
5670
-
if (ret<0||off<minoff) {
5671
-
minoff=off;
5672
-
ret=i;
5673
-
}
5674
-
}
5552
+
returnatoi(buf);
5553
+
}
5554
+
5555
+
voidlinuxOvercommitMemoryWarning(void) {
5556
+
if (linuxOvercommitMemoryValue() ==0) {
5557
+
redisLog(REDIS_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low condition memory. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.");
5558
+
}
5559
+
}
5560
+
#endif/* __linux__ */
5561
+
5562
+
staticvoiddaemonize(void) {
5563
+
intfd;
5564
+
FILE*fp;
5565
+
5566
+
if (fork() !=0) exit(0); /* parent exits */
5567
+
setsid(); /* create a new session */
5568
+
5569
+
/* Every output goes to /dev/null. If Redis is daemonized but
5570
+
* the 'logfile' is set to 'stdout' in the configuration file
redisLog(REDIS_WARNING,"Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'");
5596
+
}
5597
+
initServer();
5598
+
if (server.daemonize) daemonize();
5599
+
redisLog(REDIS_NOTICE,"Server started, Redis version "REDIS_VERSION);
5600
+
#ifdef__linux__
5601
+
linuxOvercommitMemoryWarning();
5602
+
#endif
5603
+
if (server.appendonly) {
5604
+
if (loadAppendOnlyFile(server.appendfilename) ==REDIS_OK)
5605
+
redisLog(REDIS_NOTICE,"DB loaded from append only file");
5606
+
} else {
5607
+
if (rdbLoad(server.dbfilename) ==REDIS_OK)
5608
+
redisLog(REDIS_NOTICE,"DB loaded from disk");
5609
+
}
5610
+
if (aeCreateFileEvent(server.el, server.fd, AE_READABLE,
/* Try to match against the Symbol with the smallest offset */
5727
+
for (i=0; symsTable[i].pointer; i++) {
5728
+
unsigned longlp= (unsigned long) pointer;
5786
5729
5787
-
if (!fp) return-1;
5788
-
if (fgets(buf,64,fp) ==NULL) {
5789
-
fclose(fp);
5790
-
return-1;
5730
+
if (lp!= (unsigned long)-1&&lp >= symsTable[i].pointer) {
5731
+
off=lp-symsTable[i].pointer;
5732
+
if (ret<0||off<minoff) {
5733
+
minoff=off;
5734
+
ret=i;
5735
+
}
5736
+
}
5791
5737
}
5792
-
fclose(fp);
5793
-
5794
-
returnatoi(buf);
5738
+
if (ret==-1) returnNULL;
5739
+
*offset=minoff;
5740
+
returnsymsTable[ret].name;
5795
5741
}
5796
-
5797
-
voidlinuxOvercommitMemoryWarning(void) {
5798
-
if (linuxOvercommitMemoryValue() ==0) {
5799
-
redisLog(REDIS_WARNING,"WARNING overcommit_memory is set to 0! Background save may fail under low condition memory. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.");
5800
-
}
5742
+
#else/* HAVE_BACKTRACE */
5743
+
staticvoidsetupSigSegvAction(void) {
5801
5744
}
5802
-
#endif/* __linux__ */
5745
+
#endif/* HAVE_BACKTRACE */
5803
5746
5804
-
staticvoiddaemonize(void) {
5805
-
intfd;
5806
-
FILE*fp;
5807
5747
5808
-
if (fork() !=0) exit(0); /* parent exits */
5809
-
setsid(); /* create a new session */
5810
5748
5811
-
/* Every output goes to /dev/null. If Redis is daemonized but
5812
-
* the 'logfile' is set to 'stdout' in the configuration file
redisLog(REDIS_WARNING,"Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'");
5838
-
}
5839
-
initServer();
5840
-
if (server.daemonize) daemonize();
5841
-
redisLog(REDIS_NOTICE,"Server started, Redis version "REDIS_VERSION);
5842
-
#ifdef__linux__
5843
-
linuxOvercommitMemoryWarning();
5844
-
#endif
5845
-
if (server.appendonly) {
5846
-
if (loadAppendOnlyFile(server.appendfilename) ==REDIS_OK)
5847
-
redisLog(REDIS_NOTICE,"DB loaded from append only file");
5848
-
} else {
5849
-
if (rdbLoad(server.dbfilename) ==REDIS_OK)
5850
-
redisLog(REDIS_NOTICE,"DB loaded from disk");
5851
-
}
5852
-
if (aeCreateFileEvent(server.el, server.fd, AE_READABLE,
0 commit comments