redis-server 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. data/bin/redis +1 -1
  2. data/redis/Makefile +1 -1
  3. data/redis/{redis-2.2.11 → redis-2.2.12}/00-RELEASENOTES +16 -0
  4. data/redis/{redis-2.2.11 → redis-2.2.12}/BUGS +0 -0
  5. data/redis/{redis-2.2.11 → redis-2.2.12}/CONTRIBUTING +0 -0
  6. data/redis/{redis-2.2.11 → redis-2.2.12}/COPYING +0 -0
  7. data/redis/{redis-2.2.11 → redis-2.2.12}/Changelog +0 -0
  8. data/redis/{redis-2.2.11 → redis-2.2.12}/INSTALL +0 -0
  9. data/redis/{redis-2.2.11 → redis-2.2.12}/Makefile +0 -0
  10. data/redis/{redis-2.2.11 → redis-2.2.12}/README +0 -0
  11. data/redis/{redis-2.2.11 → redis-2.2.12}/TODO +0 -0
  12. data/redis/{redis-2.2.11 → redis-2.2.12}/client-libraries/README +0 -0
  13. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/COPYING +0 -0
  14. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/Makefile +0 -0
  15. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/README.md +0 -0
  16. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/TODO +0 -0
  17. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/adapters/ae.h +0 -0
  18. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/adapters/libev.h +0 -0
  19. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/adapters/libevent.h +0 -0
  20. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/async.c +0 -0
  21. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/async.h +0 -0
  22. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/example-ae.c +0 -0
  23. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/example-libev.c +0 -0
  24. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/example-libevent.c +0 -0
  25. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/example.c +0 -0
  26. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/fmacros.h +0 -0
  27. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/hiredis.c +3 -3
  28. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/hiredis.h +0 -0
  29. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/net.c +0 -0
  30. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/net.h +0 -0
  31. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/sds.c +0 -0
  32. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/sds.h +0 -0
  33. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/test.c +0 -0
  34. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/hiredis/util.h +0 -0
  35. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/linenoise/Makefile +0 -0
  36. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/linenoise/README.markdown +0 -0
  37. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/linenoise/example.c +0 -0
  38. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/linenoise/linenoise.c +0 -0
  39. data/redis/{redis-2.2.11 → redis-2.2.12}/deps/linenoise/linenoise.h +0 -0
  40. data/redis/{redis-2.2.11 → redis-2.2.12}/design-documents/REDIS-CLUSTER +0 -0
  41. data/redis/{redis-2.2.11 → redis-2.2.12}/design-documents/REDIS-CLUSTER-2 +0 -0
  42. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/AppendCommand.html +0 -0
  43. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/AppendOnlyFileHowto.html +0 -0
  44. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/AuthCommand.html +0 -0
  45. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Benchmarks.html +0 -0
  46. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/BgrewriteaofCommand.html +0 -0
  47. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/BgsaveCommand.html +0 -0
  48. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/BlpopCommand.html +0 -0
  49. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/BrpoplpushCommand.html +0 -0
  50. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/CommandReference.html +0 -0
  51. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Comparisons.html +0 -0
  52. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ConfigCommand.html +0 -0
  53. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Configuration.html +0 -0
  54. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ConnectionHandlingSidebar.html +0 -0
  55. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ControlCommandsSidebar.html +0 -0
  56. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Credits.html +0 -0
  57. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/DbsizeCommand.html +0 -0
  58. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/DelCommand.html +0 -0
  59. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/DesignPatterns.html +0 -0
  60. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/EventLibray.html +0 -0
  61. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ExistsCommand.html +0 -0
  62. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ExpireCommand.html +0 -0
  63. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/FAQ.html +0 -0
  64. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Features.html +0 -0
  65. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/FlushallCommand.html +0 -0
  66. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/FlushdbCommand.html +0 -0
  67. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/FromSqlToDataStructures.html +0 -0
  68. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/GenericCommandsSidebar.html +0 -0
  69. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/GetCommand.html +0 -0
  70. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/GetbitCommand.html +0 -0
  71. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/GetsetCommand.html +0 -0
  72. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HackingStrings.html +0 -0
  73. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HashCommandsSidebar.html +0 -0
  74. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Hashes.html +0 -0
  75. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HdelCommand.html +0 -0
  76. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HexistsCommand.html +0 -0
  77. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HgetCommand.html +0 -0
  78. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HgetallCommand.html +0 -0
  79. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HincrbyCommand.html +0 -0
  80. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HlenCommand.html +0 -0
  81. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HmgetCommand.html +0 -0
  82. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HmsetCommand.html +0 -0
  83. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HsetCommand.html +0 -0
  84. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/HsetnxCommand.html +0 -0
  85. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/IncrCommand.html +0 -0
  86. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/InfoCommand.html +0 -0
  87. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/IntroductionToRedisDataTypes.html +0 -0
  88. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/KeysCommand.html +0 -0
  89. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LastsaveCommand.html +0 -0
  90. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LindexCommand.html +0 -0
  91. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ListCommandsSidebar.html +0 -0
  92. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Lists.html +0 -0
  93. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LlenCommand.html +0 -0
  94. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LpopCommand.html +0 -0
  95. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LrangeCommand.html +0 -0
  96. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LremCommand.html +0 -0
  97. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LsetCommand.html +0 -0
  98. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/LtrimCommand.html +0 -0
  99. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/MgetCommand.html +0 -0
  100. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/MonitorCommand.html +0 -0
  101. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/MoveCommand.html +0 -0
  102. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/MsetCommand.html +0 -0
  103. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/MultiExecCommand.html +0 -0
  104. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/NonexistentCommands.html +0 -0
  105. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ObjectHashMappers.html +0 -0
  106. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Pipelining.html +0 -0
  107. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ProgrammingExamples.html +0 -0
  108. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ProtocolSpecification.html +0 -0
  109. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/PublishSubscribe.html +0 -0
  110. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/QuickStart.html +0 -0
  111. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/QuitCommand.html +0 -0
  112. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/README.html +0 -0
  113. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RandomkeyCommand.html +0 -0
  114. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Redis0100ChangeLog.html +0 -0
  115. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Redis0900ChangeLog.html +0 -0
  116. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisBigData.html +0 -0
  117. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisCLI.html +0 -0
  118. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisEventLibrary.html +0 -0
  119. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisGuides.html +0 -0
  120. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisInternals.html +0 -0
  121. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisPipelining.html +0 -0
  122. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RedisStatus.html +0 -0
  123. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Redis_1_2_0_Changelog.html +0 -0
  124. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Redis_2_0_0_Changelog.html +0 -0
  125. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Redis_2_0_Whats_new.html +0 -0
  126. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RenameCommand.html +0 -0
  127. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RenamenxCommand.html +0 -0
  128. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ReplicationHowto.html +0 -0
  129. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ReplyTypes.html +0 -0
  130. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RoadMap.html +0 -0
  131. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RpoplpushCommand.html +0 -0
  132. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/RpushCommand.html +0 -0
  133. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SaddCommand.html +0 -0
  134. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SaveCommand.html +0 -0
  135. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ScardCommand.html +0 -0
  136. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SdiffCommand.html +0 -0
  137. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SdiffstoreCommand.html +0 -0
  138. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SelectCommand.html +0 -0
  139. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SetCommand.html +0 -0
  140. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SetCommandsSidebar.html +0 -0
  141. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SetbitCommand.html +0 -0
  142. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SetexCommand.html +0 -0
  143. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SetnxCommand.html +0 -0
  144. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SetrangeCommand.html +0 -0
  145. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Sets.html +0 -0
  146. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ShutdownCommand.html +0 -0
  147. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SideBar.html +0 -0
  148. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SinterCommand.html +0 -0
  149. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SinterstoreCommand.html +0 -0
  150. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SismemberCommand.html +0 -0
  151. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SlaveofCommand.html +0 -0
  152. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SmembersCommand.html +0 -0
  153. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SmoveCommand.html +0 -0
  154. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SortCommand.html +0 -0
  155. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SortedSetCommandsSidebar.html +0 -0
  156. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SortedSets.html +0 -0
  157. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Speed.html +0 -0
  158. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SponsorshipHistory.html +0 -0
  159. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SpopCommand.html +0 -0
  160. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SrandmemberCommand.html +0 -0
  161. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SremCommand.html +0 -0
  162. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/StringCommandsSidebar.html +0 -0
  163. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/Strings.html +0 -0
  164. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/StrlenCommand.html +0 -0
  165. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SubstrCommand.html +0 -0
  166. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SunionCommand.html +0 -0
  167. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SunionstoreCommand.html +0 -0
  168. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SupportedLanguages.html +0 -0
  169. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/SupportedPlatforms.html +0 -0
  170. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/TemplateCommand.html +0 -0
  171. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/TtlCommand.html +0 -0
  172. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/TwitterAlikeExample.html +0 -0
  173. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/TypeCommand.html +0 -0
  174. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/UnstableSource.html +0 -0
  175. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/VirtualMemorySpecification.html +0 -0
  176. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/VirtualMemoryUserGuide.html +0 -0
  177. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZaddCommand.html +0 -0
  178. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZcardCommand.html +0 -0
  179. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZincrbyCommand.html +0 -0
  180. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZrangeCommand.html +0 -0
  181. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZrangebyscoreCommand.html +0 -0
  182. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZrankCommand.html +0 -0
  183. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZremCommand.html +0 -0
  184. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZremrangebyrankCommand.html +0 -0
  185. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZremrangebyscoreCommand.html +0 -0
  186. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZscoreCommand.html +0 -0
  187. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZunionCommand.html +0 -0
  188. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/ZunionstoreCommand.html +0 -0
  189. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/index.html +0 -0
  190. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/redis.png +0 -0
  191. data/redis/{redis-2.2.11 → redis-2.2.12}/doc/style.css +0 -0
  192. data/redis/{redis-2.2.11 → redis-2.2.12}/redis.conf +27 -0
  193. data/redis/{redis-2.2.11 → redis-2.2.12}/src/Makefile +38 -18
  194. data/redis/{redis-2.2.11 → redis-2.2.12}/src/adlist.c +0 -0
  195. data/redis/{redis-2.2.11 → redis-2.2.12}/src/adlist.h +0 -0
  196. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ae.c +0 -0
  197. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ae.h +0 -0
  198. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ae_epoll.c +0 -0
  199. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ae_kqueue.c +0 -0
  200. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ae_select.c +0 -0
  201. data/redis/{redis-2.2.11 → redis-2.2.12}/src/anet.c +0 -0
  202. data/redis/{redis-2.2.11 → redis-2.2.12}/src/anet.h +0 -0
  203. data/redis/{redis-2.2.11 → redis-2.2.12}/src/aof.c +5 -3
  204. data/redis/{redis-2.2.11 → redis-2.2.12}/src/config.c +37 -0
  205. data/redis/{redis-2.2.11 → redis-2.2.12}/src/config.h +0 -0
  206. data/redis/{redis-2.2.11 → redis-2.2.12}/src/db.c +20 -3
  207. data/redis/{redis-2.2.11 → redis-2.2.12}/src/debug.c +6 -0
  208. data/redis/{redis-2.2.11 → redis-2.2.12}/src/dict.c +0 -0
  209. data/redis/{redis-2.2.11 → redis-2.2.12}/src/dict.h +0 -0
  210. data/redis/{redis-2.2.11 → redis-2.2.12}/src/fmacros.h +0 -0
  211. data/redis/{redis-2.2.11 → redis-2.2.12}/src/help.h +0 -0
  212. data/redis/{redis-2.2.11 → redis-2.2.12}/src/intset.c +0 -0
  213. data/redis/{redis-2.2.11 → redis-2.2.12}/src/intset.h +0 -0
  214. data/redis/{redis-2.2.11 → redis-2.2.12}/src/lzf.h +0 -0
  215. data/redis/{redis-2.2.11 → redis-2.2.12}/src/lzfP.h +0 -0
  216. data/redis/{redis-2.2.11 → redis-2.2.12}/src/lzf_c.c +0 -0
  217. data/redis/{redis-2.2.11 → redis-2.2.12}/src/lzf_d.c +0 -0
  218. data/redis/{redis-2.2.11 → redis-2.2.12}/src/mkreleasehdr.sh +0 -0
  219. data/redis/{redis-2.2.11 → redis-2.2.12}/src/multi.c +8 -3
  220. data/redis/{redis-2.2.11 → redis-2.2.12}/src/networking.c +2 -1
  221. data/redis/{redis-2.2.11 → redis-2.2.12}/src/object.c +0 -0
  222. data/redis/{redis-2.2.11 → redis-2.2.12}/src/pqsort.c +0 -0
  223. data/redis/{redis-2.2.11 → redis-2.2.12}/src/pqsort.h +0 -0
  224. data/redis/{redis-2.2.11 → redis-2.2.12}/src/pubsub.c +0 -0
  225. data/redis/{redis-2.2.11 → redis-2.2.12}/src/rdb.c +0 -0
  226. data/redis/{redis-2.2.11 → redis-2.2.12}/src/redis-benchmark.c +0 -0
  227. data/redis/{redis-2.2.11 → redis-2.2.12}/src/redis-check-aof.c +0 -0
  228. data/redis/{redis-2.2.11 → redis-2.2.12}/src/redis-check-dump.c +0 -0
  229. data/redis/{redis-2.2.11 → redis-2.2.12}/src/redis-cli.c +0 -0
  230. data/redis/{redis-2.2.11 → redis-2.2.12}/src/redis.c +65 -49
  231. data/redis/{redis-2.2.11 → redis-2.2.12}/src/redis.h +11 -3
  232. data/redis/{redis-2.2.11 → redis-2.2.12}/src/release.c +0 -0
  233. data/redis/{redis-2.2.11 → redis-2.2.12}/src/replication.c +0 -0
  234. data/redis/{redis-2.2.11 → redis-2.2.12}/src/sds.c +0 -0
  235. data/redis/{redis-2.2.11 → redis-2.2.12}/src/sds.h +0 -0
  236. data/redis/{redis-2.2.11 → redis-2.2.12}/src/sha1.c +0 -0
  237. data/redis/{redis-2.2.11 → redis-2.2.12}/src/sha1.h +0 -0
  238. data/redis/redis-2.2.12/src/slowlog.c +115 -0
  239. data/redis/redis-2.2.12/src/slowlog.h +15 -0
  240. data/redis/{redis-2.2.11 → redis-2.2.12}/src/solarisfixes.h +0 -0
  241. data/redis/{redis-2.2.11 → redis-2.2.12}/src/sort.c +0 -0
  242. data/redis/{redis-2.2.11 → redis-2.2.12}/src/syncio.c +0 -0
  243. data/redis/{redis-2.2.11 → redis-2.2.12}/src/t_hash.c +0 -0
  244. data/redis/{redis-2.2.11 → redis-2.2.12}/src/t_list.c +3 -0
  245. data/redis/{redis-2.2.11 → redis-2.2.12}/src/t_set.c +0 -0
  246. data/redis/{redis-2.2.11 → redis-2.2.12}/src/t_string.c +0 -0
  247. data/redis/{redis-2.2.11 → redis-2.2.12}/src/t_zset.c +0 -0
  248. data/redis/{redis-2.2.11 → redis-2.2.12}/src/testhelp.h +0 -0
  249. data/redis/{redis-2.2.11 → redis-2.2.12}/src/util.c +12 -0
  250. data/redis/{redis-2.2.11 → redis-2.2.12}/src/valgrind.sup +0 -0
  251. data/redis/redis-2.2.12/src/version.h +1 -0
  252. data/redis/{redis-2.2.11 → redis-2.2.12}/src/vm.c +4 -4
  253. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ziplist.c +0 -0
  254. data/redis/{redis-2.2.11 → redis-2.2.12}/src/ziplist.h +0 -0
  255. data/redis/{redis-2.2.11 → redis-2.2.12}/src/zipmap.c +0 -0
  256. data/redis/{redis-2.2.11 → redis-2.2.12}/src/zipmap.h +0 -0
  257. data/redis/{redis-2.2.11 → redis-2.2.12}/src/zmalloc.c +0 -10
  258. data/redis/{redis-2.2.11 → redis-2.2.12}/src/zmalloc.h +0 -3
  259. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/assets/default.conf +0 -0
  260. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/integration/aof.tcl +18 -0
  261. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/integration/redis-cli.tcl +0 -0
  262. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/integration/replication.tcl +0 -0
  263. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/support/redis.tcl +0 -0
  264. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/support/server.tcl +0 -0
  265. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/support/test.tcl +0 -0
  266. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/support/tmpfile.tcl +0 -0
  267. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/support/util.tcl +0 -0
  268. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/test_helper.tcl +2 -1
  269. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/auth.tcl +0 -0
  270. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/basic.tcl +0 -0
  271. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/cas.tcl +0 -0
  272. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/expire.tcl +0 -0
  273. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/other.tcl +0 -0
  274. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/printver.tcl +0 -0
  275. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/protocol.tcl +0 -0
  276. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/pubsub.tcl +0 -0
  277. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/quit.tcl +0 -0
  278. data/redis/redis-2.2.12/tests/unit/slowlog.tcl +41 -0
  279. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/sort.tcl +0 -0
  280. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/type/hash.tcl +0 -0
  281. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/type/list.tcl +0 -0
  282. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/type/set.tcl +0 -0
  283. data/redis/{redis-2.2.11 → redis-2.2.12}/tests/unit/type/zset.tcl +0 -0
  284. data/redis/{redis-2.2.11 → redis-2.2.12}/utils/build-static-symbols.tcl +0 -0
  285. data/redis/{redis-2.2.11 → redis-2.2.12}/utils/generate-command-help.rb +0 -0
  286. data/redis/{redis-2.2.11 → redis-2.2.12}/utils/mktarball.sh +0 -0
  287. data/redis/{redis-2.2.11 → redis-2.2.12}/utils/redis-copy.rb +0 -0
  288. data/redis/{redis-2.2.11 → redis-2.2.12}/utils/redis-sha1.rb +0 -0
  289. data/redis/{redis-2.2.11 → redis-2.2.12}/utils/redis_init_script +0 -0
  290. metadata +294 -291
  291. data/redis/redis-2.2.11/src/version.h +0 -1
@@ -28,6 +28,7 @@
28
28
  */
29
29
 
30
30
  #include "redis.h"
31
+ #include "slowlog.h"
31
32
 
32
33
  #ifdef HAVE_BACKTRACE
33
34
  #include <execinfo.h>
@@ -188,7 +189,8 @@ struct redisCommand readonlyCommandTable[] = {
188
189
  {"publish",publishCommand,3,REDIS_CMD_FORCE_REPLICATION,NULL,0,0,0},
189
190
  {"watch",watchCommand,-2,0,NULL,0,0,0},
190
191
  {"unwatch",unwatchCommand,1,0,NULL,0,0,0},
191
- {"object",objectCommand,-2,0,NULL,0,0,0}
192
+ {"object",objectCommand,-2,0,NULL,0,0,0},
193
+ {"slowlog",slowlogCommand,-2,0,NULL,0,0,0}
192
194
  };
193
195
 
194
196
  /*============================ Utility functions ============================ */
@@ -675,7 +677,7 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
675
677
  readQueryFromClient, c);
676
678
  cmd = lookupCommand(c->argv[0]->ptr);
677
679
  redisAssert(cmd != NULL);
678
- call(c,cmd);
680
+ call(c);
679
681
  resetClient(c);
680
682
  /* There may be more data to process in the input buffer. */
681
683
  if (c->querybuf && sdslen(c->querybuf) > 0)
@@ -831,6 +833,10 @@ void initServerConfig() {
831
833
  populateCommandTable();
832
834
  server.delCommand = lookupCommandByCString("del");
833
835
  server.multiCommand = lookupCommandByCString("multi");
836
+
837
+ /* Slow log */
838
+ server.slowlog_log_slower_than = REDIS_SLOWLOG_LOG_SLOWER_THAN;
839
+ server.slowlog_max_len = REDIS_SLOWLOG_MAX_LEN;
834
840
  }
835
841
 
836
842
  void initServer() {
@@ -917,6 +923,7 @@ void initServer() {
917
923
  }
918
924
 
919
925
  if (server.vm_enabled) vmInit();
926
+ slowlogInit();
920
927
  srand(time(NULL)^getpid());
921
928
  }
922
929
 
@@ -951,16 +958,18 @@ struct redisCommand *lookupCommandByCString(char *s) {
951
958
  }
952
959
 
953
960
  /* Call() is the core of Redis execution of a command */
954
- void call(redisClient *c, struct redisCommand *cmd) {
955
- long long dirty;
961
+ void call(redisClient *c) {
962
+ long long dirty, start = ustime(), duration;
956
963
 
957
964
  dirty = server.dirty;
958
- cmd->proc(c);
965
+ c->cmd->proc(c);
959
966
  dirty = server.dirty-dirty;
967
+ duration = ustime()-start;
968
+ slowlogPushEntryIfNeeded(c->argv,c->argc,duration);
960
969
 
961
970
  if (server.appendonly && dirty)
962
- feedAppendOnlyFile(cmd,c->db->id,c->argv,c->argc);
963
- if ((dirty || cmd->flags & REDIS_CMD_FORCE_REPLICATION) &&
971
+ feedAppendOnlyFile(c->cmd,c->db->id,c->argv,c->argc);
972
+ if ((dirty || c->cmd->flags & REDIS_CMD_FORCE_REPLICATION) &&
964
973
  listLength(server.slaves))
965
974
  replicationFeedSlaves(server.slaves,c->db->id,c->argv,c->argc);
966
975
  if (listLength(server.monitors))
@@ -977,8 +986,6 @@ void call(redisClient *c, struct redisCommand *cmd) {
977
986
  * and other operations can be performed by the caller. Otherwise
978
987
  * if 0 is returned the client was destroied (i.e. after QUIT). */
979
988
  int processCommand(redisClient *c) {
980
- struct redisCommand *cmd;
981
-
982
989
  /* The QUIT command is handled separately. Normal command procs will
983
990
  * go through checking for replication and QUIT will cause trouble
984
991
  * when FORCE_REPLICATION is enabled and would be implemented in
@@ -990,21 +997,22 @@ int processCommand(redisClient *c) {
990
997
  }
991
998
 
992
999
  /* Now lookup the command and check ASAP about trivial error conditions
993
- * such wrong arity, bad command name and so forth. */
994
- cmd = lookupCommand(c->argv[0]->ptr);
995
- if (!cmd) {
1000
+ * such as wrong arity, bad command name and so forth. */
1001
+ c->cmd = lookupCommand(c->argv[0]->ptr);
1002
+ if (!c->cmd) {
996
1003
  addReplyErrorFormat(c,"unknown command '%s'",
997
1004
  (char*)c->argv[0]->ptr);
998
1005
  return REDIS_OK;
999
- } else if ((cmd->arity > 0 && cmd->arity != c->argc) ||
1000
- (c->argc < -cmd->arity)) {
1006
+ } else if ((c->cmd->arity > 0 && c->cmd->arity != c->argc) ||
1007
+ (c->argc < -c->cmd->arity)) {
1001
1008
  addReplyErrorFormat(c,"wrong number of arguments for '%s' command",
1002
- cmd->name);
1009
+ c->cmd->name);
1003
1010
  return REDIS_OK;
1004
1011
  }
1005
1012
 
1006
1013
  /* Check if the user is authenticated */
1007
- if (server.requirepass && !c->authenticated && cmd->proc != authCommand) {
1014
+ if (server.requirepass && !c->authenticated && c->cmd->proc != authCommand)
1015
+ {
1008
1016
  addReplyError(c,"operation not permitted");
1009
1017
  return REDIS_OK;
1010
1018
  }
@@ -1015,7 +1023,7 @@ int processCommand(redisClient *c) {
1015
1023
  * keys in the dataset). If there are not the only thing we can do
1016
1024
  * is returning an error. */
1017
1025
  if (server.maxmemory) freeMemoryIfNeeded();
1018
- if (server.maxmemory && (cmd->flags & REDIS_CMD_DENYOOM) &&
1026
+ if (server.maxmemory && (c->cmd->flags & REDIS_CMD_DENYOOM) &&
1019
1027
  zmalloc_used_memory() > server.maxmemory)
1020
1028
  {
1021
1029
  addReplyError(c,"command not allowed when used memory > 'maxmemory'");
@@ -1025,8 +1033,10 @@ int processCommand(redisClient *c) {
1025
1033
  /* Only allow SUBSCRIBE and UNSUBSCRIBE in the context of Pub/Sub */
1026
1034
  if ((dictSize(c->pubsub_channels) > 0 || listLength(c->pubsub_patterns) > 0)
1027
1035
  &&
1028
- cmd->proc != subscribeCommand && cmd->proc != unsubscribeCommand &&
1029
- cmd->proc != psubscribeCommand && cmd->proc != punsubscribeCommand) {
1036
+ c->cmd->proc != subscribeCommand &&
1037
+ c->cmd->proc != unsubscribeCommand &&
1038
+ c->cmd->proc != psubscribeCommand &&
1039
+ c->cmd->proc != punsubscribeCommand) {
1030
1040
  addReplyError(c,"only (P)SUBSCRIBE / (P)UNSUBSCRIBE / QUIT allowed in this context");
1031
1041
  return REDIS_OK;
1032
1042
  }
@@ -1035,7 +1045,7 @@ int processCommand(redisClient *c) {
1035
1045
  * we are a slave with a broken link with master. */
1036
1046
  if (server.masterhost && server.replstate != REDIS_REPL_CONNECTED &&
1037
1047
  server.repl_serve_stale_data == 0 &&
1038
- cmd->proc != infoCommand && cmd->proc != slaveofCommand)
1048
+ c->cmd->proc != infoCommand && c->cmd->proc != slaveofCommand)
1039
1049
  {
1040
1050
  addReplyError(c,
1041
1051
  "link with MASTER is down and slave-serve-stale-data is set to no");
@@ -1043,22 +1053,22 @@ int processCommand(redisClient *c) {
1043
1053
  }
1044
1054
 
1045
1055
  /* Loading DB? Return an error if the command is not INFO */
1046
- if (server.loading && cmd->proc != infoCommand) {
1056
+ if (server.loading && c->cmd->proc != infoCommand) {
1047
1057
  addReply(c, shared.loadingerr);
1048
1058
  return REDIS_OK;
1049
1059
  }
1050
1060
 
1051
1061
  /* Exec the command */
1052
1062
  if (c->flags & REDIS_MULTI &&
1053
- cmd->proc != execCommand && cmd->proc != discardCommand &&
1054
- cmd->proc != multiCommand && cmd->proc != watchCommand)
1063
+ c->cmd->proc != execCommand && c->cmd->proc != discardCommand &&
1064
+ c->cmd->proc != multiCommand && c->cmd->proc != watchCommand)
1055
1065
  {
1056
- queueMultiCommand(c,cmd);
1066
+ queueMultiCommand(c);
1057
1067
  addReply(c,shared.queued);
1058
1068
  } else {
1059
1069
  if (server.vm_enabled && server.vm_max_threads > 0 &&
1060
- blockClientOnSwappedKeys(c,cmd)) return REDIS_ERR;
1061
- call(c,cmd);
1070
+ blockClientOnSwappedKeys(c)) return REDIS_ERR;
1071
+ call(c);
1062
1072
  }
1063
1073
  return REDIS_OK;
1064
1074
  }
@@ -1066,20 +1076,29 @@ int processCommand(redisClient *c) {
1066
1076
  /*================================== Shutdown =============================== */
1067
1077
 
1068
1078
  int prepareForShutdown() {
1069
- redisLog(REDIS_WARNING,"User requested shutdown, saving DB...");
1079
+ redisLog(REDIS_WARNING,"User requested shutdown...");
1070
1080
  /* Kill the saving child if there is a background saving in progress.
1071
1081
  We want to avoid race conditions, for instance our saving child may
1072
1082
  overwrite the synchronous saving did by SHUTDOWN. */
1073
1083
  if (server.bgsavechildpid != -1) {
1074
- redisLog(REDIS_WARNING,"There is a live saving child. Killing it!");
1084
+ redisLog(REDIS_WARNING,"There is a child saving an .rdb. Killing it!");
1075
1085
  kill(server.bgsavechildpid,SIGKILL);
1076
1086
  rdbRemoveTempFile(server.bgsavechildpid);
1077
1087
  }
1078
1088
  if (server.appendonly) {
1089
+ /* Kill the AOF saving child as the AOF we already have may be longer
1090
+ * but contains the full dataset anyway. */
1091
+ if (server.bgrewritechildpid != -1) {
1092
+ redisLog(REDIS_WARNING,
1093
+ "There is a child rewriting the AOF. Killing it!");
1094
+ kill(server.bgrewritechildpid,SIGKILL);
1095
+ }
1079
1096
  /* Append only file: fsync() the AOF and exit */
1097
+ redisLog(REDIS_NOTICE,"Calling fsync() on the AOF file.");
1080
1098
  aof_fsync(server.appendfd);
1081
- if (server.vm_enabled) unlink(server.vm_swap_file);
1082
- } else if (server.saveparamslen > 0) {
1099
+ }
1100
+ if (server.saveparamslen > 0) {
1101
+ redisLog(REDIS_NOTICE,"Saving the final RDB snapshot before exiting.");
1083
1102
  /* Snapshotting. Perform a SYNC SAVE and exit */
1084
1103
  if (rdbSave(server.dbfilename) != REDIS_OK) {
1085
1104
  /* Ooops.. error saving! The best we can do is to continue
@@ -1087,14 +1106,23 @@ int prepareForShutdown() {
1087
1106
  * in the next cron() Redis will be notified that the background
1088
1107
  * saving aborted, handling special stuff like slaves pending for
1089
1108
  * synchronization... */
1090
- redisLog(REDIS_WARNING,"Error trying to save the DB, can't exit");
1109
+ redisLog(REDIS_WARNING,"Error trying to save the DB, can't exit.");
1091
1110
  return REDIS_ERR;
1092
1111
  }
1093
- } else {
1094
- redisLog(REDIS_WARNING,"Not saving DB.");
1095
1112
  }
1096
- if (server.daemonize) unlink(server.pidfile);
1097
- redisLog(REDIS_WARNING,"Server exit now, bye bye...");
1113
+ if (server.vm_enabled) {
1114
+ redisLog(REDIS_NOTICE,"Removing the swap file.");
1115
+ unlink(server.vm_swap_file);
1116
+ }
1117
+ if (server.daemonize) {
1118
+ redisLog(REDIS_NOTICE,"Removing the pid file.");
1119
+ unlink(server.pidfile);
1120
+ }
1121
+ /* Close the listening sockets. Apparently this allows faster restarts. */
1122
+ if (server.ipfd != -1) close(server.ipfd);
1123
+ if (server.sofd != -1) close(server.sofd);
1124
+
1125
+ redisLog(REDIS_WARNING,"Redis is now ready to exit, bye bye...");
1098
1126
  return REDIS_OK;
1099
1127
  }
1100
1128
 
@@ -1167,8 +1195,8 @@ sds genRedisInfoString(void) {
1167
1195
  "lru_clock:%ld\r\n"
1168
1196
  "used_cpu_sys:%.2f\r\n"
1169
1197
  "used_cpu_user:%.2f\r\n"
1170
- "used_cpu_sys_childrens:%.2f\r\n"
1171
- "used_cpu_user_childrens:%.2f\r\n"
1198
+ "used_cpu_sys_children:%.2f\r\n"
1199
+ "used_cpu_user_children:%.2f\r\n"
1172
1200
  "connected_clients:%d\r\n"
1173
1201
  "connected_slaves:%d\r\n"
1174
1202
  "client_longest_output_list:%lu\r\n"
@@ -1326,18 +1354,6 @@ sds genRedisInfoString(void) {
1326
1354
  );
1327
1355
  }
1328
1356
 
1329
- info = sdscat(info,"allocation_stats:");
1330
- for (j = 0; j <= ZMALLOC_MAX_ALLOC_STAT; j++) {
1331
- size_t count = zmalloc_allocations_for_size(j);
1332
- if (count) {
1333
- if (info[sdslen(info)-1] != ':') info = sdscatlen(info,",",1);
1334
- info = sdscatprintf(info,"%s%d=%zu",
1335
- (j == ZMALLOC_MAX_ALLOC_STAT) ? ">=" : "",
1336
- j,count);
1337
- }
1338
- }
1339
- info = sdscat(info,"\r\n");
1340
-
1341
1357
  for (j = 0; j < server.dbnum; j++) {
1342
1358
  long long keys, vkeys;
1343
1359
 
@@ -49,6 +49,8 @@
49
49
  #define REDIS_SHARED_INTEGERS 10000
50
50
  #define REDIS_REPLY_CHUNK_BYTES (5*1500) /* 5 TCP packets with default MTU */
51
51
  #define REDIS_MAX_LOGMSG_LEN 1024 /* Default maximum length of syslog messages */
52
+ #define REDIS_SLOWLOG_LOG_SLOWER_THAN 10000
53
+ #define REDIS_SLOWLOG_MAX_LEN 64
52
54
 
53
55
  /* Hash table parameters */
54
56
  #define REDIS_HT_MINFILL 10 /* Minimal hash table fill 10% */
@@ -312,6 +314,7 @@ typedef struct redisClient {
312
314
  sds querybuf;
313
315
  int argc;
314
316
  robj **argv;
317
+ struct redisCommand *cmd;
315
318
  int reqtype;
316
319
  int multibulklen; /* number of multi bulk arguments left to read */
317
320
  long bulklen; /* length of bulk argument in multi bulk request */
@@ -388,6 +391,10 @@ struct redisServer {
388
391
  long long stat_evictedkeys; /* number of evicted keys (maxmemory) */
389
392
  long long stat_keyspace_hits; /* number of successful lookups of keys */
390
393
  long long stat_keyspace_misses; /* number of failed lookups of keys */
394
+ list *slowlog;
395
+ long long slowlog_entry_id;
396
+ long long slowlog_log_slower_than;
397
+ unsigned long slowlog_max_len;
391
398
  /* Configuration */
392
399
  int verbosity;
393
400
  int maxidletime;
@@ -694,7 +701,7 @@ void popGenericCommand(redisClient *c, int where);
694
701
  void unwatchAllKeys(redisClient *c);
695
702
  void initClientMultiState(redisClient *c);
696
703
  void freeClientMultiState(redisClient *c);
697
- void queueMultiCommand(redisClient *c, struct redisCommand *cmd);
704
+ void queueMultiCommand(redisClient *c);
698
705
  void touchWatchedKey(redisDb *db, robj *key);
699
706
  void touchWatchedKeysOnFlush(int dbid);
700
707
 
@@ -782,7 +789,7 @@ int processCommand(redisClient *c);
782
789
  void setupSignalHandlers(void);
783
790
  struct redisCommand *lookupCommand(sds name);
784
791
  struct redisCommand *lookupCommandByCString(char *s);
785
- void call(redisClient *c, struct redisCommand *cmd);
792
+ void call(redisClient *c);
786
793
  int prepareForShutdown();
787
794
  void redisLog(int level, const char *fmt, ...);
788
795
  void usage();
@@ -813,7 +820,7 @@ void vmReopenSwapFile(void);
813
820
  int vmFreePage(off_t page);
814
821
  void zunionInterBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int argc, robj **argv);
815
822
  void execBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int argc, robj **argv);
816
- int blockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd);
823
+ int blockClientOnSwappedKeys(redisClient *c);
817
824
  int dontWaitForSwappedKey(redisClient *c, robj *key);
818
825
  void handleClientsBlockedOnSwappedKey(redisDb *db, robj *key);
819
826
  vmpointer *vmSwapObjectBlocking(robj *val);
@@ -863,6 +870,7 @@ int ll2string(char *s, size_t len, long long value);
863
870
  int isStringRepresentableAsLong(sds s, long *longval);
864
871
  int isStringRepresentableAsLongLong(sds s, long long *longval);
865
872
  int isObjectRepresentableAsLongLong(robj *o, long long *llongval);
873
+ long long ustime(void);
866
874
 
867
875
  /* Configuration */
868
876
  void loadServerConfig(char *filename);
@@ -0,0 +1,115 @@
1
+ #include "redis.h"
2
+ #include "slowlog.h"
3
+
4
+ /* Slowlog implements a system that is able to remember the latest N
5
+ * queries that took more than M microseconds to execute.
6
+ *
7
+ * The execution time to reach to be logged in the slow log is set
8
+ * using the 'slowlog-log-slower-than' config directive, that is also
9
+ * readable and writable using the CONFIG SET/GET command.
10
+ *
11
+ * The slow queries log is actually not "logged" in the Redis log file
12
+ * but is accessible thanks to the SLOWLOG command. */
13
+
14
+ /* Create a new slowlog entry.
15
+ * Incrementing the ref count of all the objects retained is up to
16
+ * this function. */
17
+ slowlogEntry *slowlogCreateEntry(robj **argv, int argc, long long duration) {
18
+ slowlogEntry *se = zmalloc(sizeof(*se));
19
+ int j;
20
+
21
+ se->argc = argc;
22
+ se->argv = zmalloc(sizeof(robj*)*argc);
23
+ for (j = 0; j < argc; j++) {
24
+ se->argv[j] = argv[j];
25
+ incrRefCount(argv[j]);
26
+ }
27
+ se->time = time(NULL);
28
+ se->duration = duration;
29
+ se->id = server.slowlog_entry_id++;
30
+ return se;
31
+ }
32
+
33
+ /* Free a slow log entry. The argument is void so that the prototype of this
34
+ * function matches the one of the 'free' method of adlist.c.
35
+ *
36
+ * This function will take care to release all the retained object. */
37
+ void slowlogFreeEntry(void *septr) {
38
+ slowlogEntry *se = septr;
39
+ int j;
40
+
41
+ for (j = 0; j < se->argc; j++)
42
+ decrRefCount(se->argv[j]);
43
+ zfree(se->argv);
44
+ zfree(se);
45
+ }
46
+
47
+ /* Initialize the slow log. This function should be called a single time
48
+ * at server startup. */
49
+ void slowlogInit(void) {
50
+ server.slowlog = listCreate();
51
+ server.slowlog_entry_id = 0;
52
+ listSetFreeMethod(server.slowlog,slowlogFreeEntry);
53
+ }
54
+
55
+ /* Push a new entry into the slow log.
56
+ * This function will make sure to trim the slow log accordingly to the
57
+ * configured max length. */
58
+ void slowlogPushEntryIfNeeded(robj **argv, int argc, long long duration) {
59
+ if (server.slowlog_log_slower_than < 0) return; /* Slowlog disabled */
60
+ if (duration >= server.slowlog_log_slower_than)
61
+ listAddNodeHead(server.slowlog,slowlogCreateEntry(argv,argc,duration));
62
+
63
+ /* Remove old entries if needed. */
64
+ while (listLength(server.slowlog) > server.slowlog_max_len)
65
+ listDelNode(server.slowlog,listLast(server.slowlog));
66
+ }
67
+
68
+ /* Remove all the entries from the current slow log. */
69
+ void slowlogReset(void) {
70
+ while (listLength(server.slowlog) > 0)
71
+ listDelNode(server.slowlog,listLast(server.slowlog));
72
+ }
73
+
74
+ /* The SLOWLOG command. Implements all the subcommands needed to handle the
75
+ * Redis slow log. */
76
+ void slowlogCommand(redisClient *c) {
77
+ if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"reset")) {
78
+ slowlogReset();
79
+ addReply(c,shared.ok);
80
+ } else if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"len")) {
81
+ addReplyLongLong(c,listLength(server.slowlog));
82
+ } else if ((c->argc == 2 || c->argc == 3) &&
83
+ !strcasecmp(c->argv[1]->ptr,"get"))
84
+ {
85
+ long count = 10, sent = 0;
86
+ listIter li;
87
+ void *totentries;
88
+ listNode *ln;
89
+ slowlogEntry *se;
90
+
91
+ if (c->argc == 3 &&
92
+ getLongFromObjectOrReply(c,c->argv[2],&count,NULL) != REDIS_OK)
93
+ return;
94
+
95
+ listRewind(server.slowlog,&li);
96
+ totentries = addDeferredMultiBulkLength(c);
97
+ while(count-- && (ln = listNext(&li))) {
98
+ int j;
99
+
100
+ se = ln->value;
101
+ addReplyMultiBulkLen(c,4);
102
+ addReplyLongLong(c,se->id);
103
+ addReplyLongLong(c,se->time);
104
+ addReplyLongLong(c,se->duration);
105
+ addReplyMultiBulkLen(c,se->argc);
106
+ for (j = 0; j < se->argc; j++)
107
+ addReplyBulk(c,se->argv[j]);
108
+ sent++;
109
+ }
110
+ setDeferredMultiBulkLength(c,totentries,sent);
111
+ } else {
112
+ addReplyError(c,
113
+ "Unknown SLOWLOG subcommand or wrong # of args. Try GET, RESET, LEN.");
114
+ }
115
+ }