OpenAtomFoundation / pikiwidb

a high-performance, large-capacity, multi-tenant, data-persistent, strong data consistency based on raft, Redis-compatible elastic KV data storage system based on RocksDB
BSD 3-Clause "New" or "Revised" License
194 stars 63 forks source link

feat: make add command group style same with single command #296

Closed iyenli closed 3 months ago

iyenli commented 4 months ago

Hi all, here is Optics. I'm trying to merge debug command into pikiwidb, but debug has many subcommands (over 30)

The only command group is config and its adding style not match with other single command.

So I try to fix it before pr of debug coming. The fix has been tested.

iyenli commented 4 months ago

Maybe this could be discussed futher.

EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d_%H:%M:%S" OUTPUT_VARIABLE BUILD_TIMESTAMP OUTPUT_STRIP_TRAILING_WHITESPACE)
ADD_DEFINITIONS(-DKPIKIWIDB_BUILD_DATE="${BUILD_TIMESTAMP}")

Fetching BUILD_TIMESTAMP and COMMIT_ID every time and using them as cmake definitions can lead to a full rebuild of the entire project.

Additionally, requiring developers to uncomment the sanitizer is not a good practice.

This approach attempts to only retrieve and print the date and commit ID in release mode, enable ADDRESS SANITIZER by default in debug mode, and disable ADDRESS SANITIZER when THREAD SANITIZER is enabled by the user to prevent both from being enabled simultaneously.

iyenli commented 4 months ago

@AlexStocks

Hi, CMakeLists keywords has been updated.

Another commit which make debug framework and 3 base subcommands was also included in this commit. Could you consider this commit, and what subcommands is in priority queue?

All subcommands are listed below:

  1) DEBUG <subcommand> [<arg> [value] [opt] ...]. Subcommands are:
  2) AOF-FLUSH-SLEEP <microsec>
  3)     Server will sleep before flushing the AOF, this is used for testing.
  4) ASSERT
  5)     Crash by assertion failed.
  6) CHANGE-REPL-ID
  7)     Change the replication IDs of the instance.
  8)     Dangerous: should be used only for testing the replication subsystem.
  9) CONFIG-REWRITE-FORCE-ALL
 10)     Like CONFIG REWRITE but writes all configuration options, including
 11)     keywords not listed in original configuration file or default values.
 12) CRASH-AND-RECOVER [<milliseconds>]
 13)     Hard crash and restart after a <milliseconds> delay (default 0).
 14) DIGEST
 15)     Output a hex signature representing the current DB content.
 16) DIGEST-VALUE <key> [<key> ...]
 17)     Output a hex signature of the values of all the specified keys.
 18) ERROR <string>
 19)     Return a Redis protocol error with <string> as message. Useful for clients
 20)     unit tests to simulate Redis errors.
 21) LEAK <string>
 22)     Create a memory leak of the input string.
 23) LOG <message>
 24)     Write <message> to the server log.
 25) HTSTATS <dbid> [full]
 26)     Return hash table statistics of the specified Redis database.
 27) HTSTATS-KEY <key> [full]
 28)     Like HTSTATS but for the hash table stored at <key>'s value.
 29) LOADAOF
 30)     Flush the AOF buffers on disk and reload the AOF in memory.
 31) REPLICATE <string>
 32)     Replicates the provided string to replicas, allowing data divergence.
 33) MALLCTL <key> [<val>]
 34)     Get or set a malloc tuning integer.
 35) MALLCTL-STR <key> [<val>]
 36)     Get or set a malloc tuning string.
 37) OBJECT <key>
 38)     Show low level info about `key` and associated value.
 39) DROP-CLUSTER-PACKET-FILTER <packet-type>
 40)     Drop all packets that match the filtered type. Set to -1 allow all packets.
 41) OOM
 42)     Crash the server simulating an out-of-memory error.
 43) PANIC
 44)     Crash the server simulating a panic.
 45) POPULATE <count> [<prefix>] [<size>]
 46)     Create <count> string keys named key:<num>. If <prefix> is specified then
 47)     it is used instead of the 'key' prefix. These are not propagated to
 48)     replicas. Cluster slots are not respected so keys not belonging to the
 49)     current node can be created in cluster mode.
 50) PROTOCOL <type>
 51)     Reply with a test value of the specified type. <type> can be: string,
 52)     integer, double, bignum, null, array, set, map, attrib, push, verbatim,
 53)     true, false.
 54) RELOAD [option ...]
 55)     Save the RDB on disk and reload it back to memory. Valid <option> values:
 56)     * MERGE: conflicting keys will be loaded from RDB.
 57)     * NOFLUSH: the existing database will not be removed before load, but
 58)       conflicting keys will generate an exception and kill the server.
 59)     * NOSAVE: the database will be loaded from an existing RDB file.
 60)     Examples:
 61)     * DEBUG RELOAD: verify that the server is able to persist, flush and reload
 62)       the database.
 63)     * DEBUG RELOAD NOSAVE: replace the current database with the contents of an
 64)       existing RDB file.
 65)     * DEBUG RELOAD NOSAVE NOFLUSH MERGE: add the contents of an existing RDB
 66)       file to the database.
 67) RESTART [<milliseconds>]
 68)     Graceful restart: save config, db, restart after a <milliseconds> delay (default 0).
 69) SDSLEN <key>
 70)     Show low level SDS string info representing `key` and value.
 71) SEGFAULT
 72)     Crash the server with sigsegv.
 73) SET-ACTIVE-EXPIRE <0|1>
 74)     Setting it to 0 disables expiring keys in background when they are not
 75)     accessed (otherwise the Redis behavior). Setting it to 1 reenables back the
 76)     default.
 77) QUICKLIST-PACKED-THRESHOLD <size>
 78)     Sets the threshold for elements to be inserted as plain vs packed nodes
 79)     Default value is 1GB, allows values up to 4GB. Setting to 0 restores to default.
 80) SET-SKIP-CHECKSUM-VALIDATION <0|1>
 81)     Enables or disables checksum checks for RDB files and RESTORE's payload.
 82) SLEEP <seconds>
 83)     Stop the server for <seconds>. Decimals allowed.
 84) STRINGMATCH-TEST
 85)     Run a fuzz tester against the stringmatchlen() function.
 86) STRUCTSIZE
 87)     Return the size of different Redis core C structures.
 88) LISTPACK <key>
 89)     Show low level info about the listpack encoding of <key>.
 90) QUICKLIST <key> [<0|1>]
 91)     Show low level info about the quicklist encoding of <key>.
 92)     The optional argument (0 by default) sets the level of detail
 93) CLIENT-EVICTION
 94)     Show low level client eviction pools info (maxmemory-clients).
 95) PAUSE-CRON <0|1>
 96)     Stop periodic cron job processing.
 97) REPLYBUFFER PEAK-RESET-TIME <NEVER||RESET|time>
 98)     Sets the time (in milliseconds) to wait between client reply buffer peak resets.
 99)     In case NEVER is provided the last observed peak will never be reset
100)     In case RESET is provided the peak reset time will be restored to the default value
101) REPLYBUFFER RESIZING <0|1>
102)     Enable or disable the reply buffer resize cron job
103) DICT-RESIZING <0|1>
104)     Enable or disable the main dict and expire dict resizing.
105) CLUSTERLINK KILL <to|from|all> <node-id>
106)     Kills the link based on the direction to/from (both) with the provided node.
107) HELP
108)     Print this help.
panlei-coder commented 3 months ago

解决一下代码冲突

Issues-translate-bot commented 3 months ago

Bot detected the issue body's language is not English, translate it automatically.


Resolve code conflicts

dingxiaoshuai123 commented 3 months ago

Thank you for your PR, it's very useful. Please handle the conflicts.

iyenli commented 3 months ago

@panlei-coder target_compile_definitions better, could you please consider this pr?