changeset 616: | c48704d7b06f |
parent: | 57813b8ee029 |
child: | 5e57683a0c28 |
author: | Richard Westhaver <ellis@rwest.io> |
date: | Tue, 20 Aug 2024 21:02:58 -0400 |
permissions: | -rw-r--r-- |
description: | writebatch callbacks and fixes |
2 | 1 | ;;; rocksdb/tests.lisp --- RocksDB tests |
2 | ||
3 | ;;; Code: |
|
7 | 4 | (defpackage :rocksdb/tests |
269 | 5 | (:use :cl :std :rt :rocksdb :sb-ext :sb-alien :log)) |
2 | 6 | |
7 | 7 | (in-package :rocksdb/tests) |
47 | 8 | |
14 | 9 | (defsuite :rocksdb) |
10 | (in-suite :rocksdb) |
|
47 | 11 | |
14 | 12 | (load-rocksdb) |
269 | 13 | (init-log-timestamp) |
47 | 14 | |
15 | (defun rocksdb-test-dir () |
|
16 | (format nil "/tmp/~A/" (gensym "rocksdb-tests-"))) |
|
2 | 17 | |
269 | 18 | (defun rocksdb-test-file () |
19 | (format nil "/tmp/~A" (gensym "rocksdb-test-"))) |
|
20 | ||
47 | 21 | (defun test-opts () |
22 | (let ((default (rocksdb-options-create))) |
|
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
23 | (rocksdb-options-set-create-if-missing default t) |
47 | 24 | default)) |
2 | 25 | |
26 | ;; not thread safe (gensym-counter) |
|
27 | (defun genkey (&optional prefix) (string-to-octets (symbol-name (gensym (or prefix "key"))))) |
|
28 | (defun genval (&optional prefix) (string-to-octets (symbol-name (gensym (or prefix "val"))))) |
|
29 | ||
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
30 | (defmacro with-opt ((var create destroy) &body body) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
31 | `(let ((,var ,create)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
32 | (unwind-protect (progn ,@body) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
33 | ,destroy))) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
34 | |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
35 | (deftest opts () |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
36 | (with-opt (o (rocksdb-options-create) (rocksdb-options-destroy o)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
37 | ;; unsigned-char |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
38 | (rocksdb-options-set-create-if-missing o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
39 | (rocksdb-options-get-create-if-missing o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
40 | (rocksdb-options-set-create-missing-column-families o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
41 | (rocksdb-options-get-create-missing-column-families o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
42 | (rocksdb-options-set-error-if-exists o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
43 | (rocksdb-options-get-error-if-exists o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
44 | (rocksdb-options-set-paranoid-checks o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
45 | (rocksdb-options-get-paranoid-checks o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
46 | (rocksdb-options-set-compression-options-use-zstd-dict-trainer o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
47 | (rocksdb-options-get-compression-options-use-zstd-dict-trainer o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
48 | (rocksdb-options-set-enable-blob-gc o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
49 | (rocksdb-options-get-enable-blob-gc o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
50 | (rocksdb-options-set-allow-ingest-behind o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
51 | (rocksdb-options-get-allow-ingest-behind o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
52 | (rocksdb-options-set-skip-stats-update-on-db-open o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
53 | (rocksdb-options-get-skip-stats-update-on-db-open o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
54 | (rocksdb-options-set-skip-checking-sst-file-sizes-on-db-open o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
55 | (rocksdb-options-get-skip-checking-sst-file-sizes-on-db-open o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
56 | (rocksdb-options-set-enable-blob-files o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
57 | (rocksdb-options-get-enable-blob-files o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
58 | (rocksdb-options-set-enable-pipelined-write o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
59 | (rocksdb-options-get-enable-pipelined-write o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
60 | (rocksdb-options-set-unordered-write o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
61 | (rocksdb-options-get-unordered-write o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
62 | (rocksdb-options-set-allow-mmap-reads o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
63 | (rocksdb-options-get-allow-mmap-reads o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
64 | (rocksdb-options-set-allow-mmap-writes o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
65 | (rocksdb-options-get-allow-mmap-writes o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
66 | (rocksdb-options-set-use-direct-reads o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
67 | (rocksdb-options-get-use-direct-reads o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
68 | (rocksdb-options-set-use-direct-io-for-flush-and-compaction o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
69 | (rocksdb-options-get-use-direct-io-for-flush-and-compaction o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
70 | (rocksdb-options-set-is-fd-close-on-exec o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
71 | (rocksdb-options-get-is-fd-close-on-exec o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
72 | (rocksdb-options-set-inplace-update-support o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
73 | (rocksdb-options-get-inplace-update-support o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
74 | (rocksdb-options-set-advise-random-on-open o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
75 | (rocksdb-options-get-advise-random-on-open o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
76 | (rocksdb-options-set-atomic-flush o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
77 | (rocksdb-options-get-atomic-flush o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
78 | (rocksdb-options-set-manual-wal-flush o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
79 | (rocksdb-options-get-manual-wal-flush o) |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
80 | (rocksdb-options-set-avoid-unnecessary-blocking-io o t) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
81 | (rocksdb-options-get-avoid-unnecessary-blocking-io o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
82 | ;; this is full-width value 0-255, not boolean |
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
83 | (rocksdb-options-set-level-compaction-dynamic-level-bytes o 20) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
84 | (rocksdb-options-get-level-compaction-dynamic-level-bytes o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
85 | ;; int |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
86 | (rocksdb-options-set-compression-options-parallel-threads o 4) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
87 | (rocksdb-options-get-compression-options-parallel-threads o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
88 | (rocksdb-options-set-info-log-level o 1) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
89 | (rocksdb-options-get-info-log-level o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
90 | (rocksdb-options-set-max-open-files o 100) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
91 | (rocksdb-options-get-max-open-files o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
92 | (rocksdb-options-set-max-file-opening-threads o 4) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
93 | (rocksdb-options-get-max-file-opening-threads o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
94 | (rocksdb-options-set-compression-options-zstd-max-train-bytes o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
95 | (rocksdb-options-get-compression-options-zstd-max-train-bytes o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
96 | (rocksdb-options-set-num-levels o 4) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
97 | (rocksdb-options-get-num-levels o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
98 | (rocksdb-options-set-level0-file-num-compaction-trigger o 16) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
99 | (rocksdb-options-get-level0-file-num-compaction-trigger o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
100 | (rocksdb-options-set-level0-slowdown-writes-trigger o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
101 | (rocksdb-options-get-level0-slowdown-writes-trigger o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
102 | (rocksdb-options-set-level0-stop-writes-trigger o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
103 | (rocksdb-options-get-level0-stop-writes-trigger o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
104 | (rocksdb-options-set-target-file-size-multiplier o 4) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
105 | (rocksdb-options-get-target-file-size-multiplier o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
106 | ;; size-t |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
107 | (rocksdb-options-set-write-buffer-size o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
108 | (rocksdb-options-get-write-buffer-size o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
109 | (rocksdb-options-set-db-write-buffer-size o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
110 | (rocksdb-options-get-db-write-buffer-size o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
111 | ;; unsigned-long |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
112 | (rocksdb-options-set-compression-options-max-dict-buffer-bytes o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
113 | (rocksdb-options-get-compression-options-max-dict-buffer-bytes o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
114 | (rocksdb-options-set-max-total-wal-size o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
115 | (rocksdb-options-get-max-total-wal-size o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
116 | (rocksdb-options-set-target-file-size-base o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
117 | (rocksdb-options-get-target-file-size-base o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
118 | (rocksdb-options-set-max-bytes-for-level-base o 1024) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
119 | (rocksdb-options-get-max-bytes-for-level-base o) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
120 | ;; double |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
121 | ;; (rocksdb-options-set-max-bytes-for-level-multiplier o (the double-float (/ 1 3))) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
122 | ) |
2 | 123 | (let ((opts (rocksdb-options-create)) |
124 | (wopts (rocksdb-writeoptions-create)) |
|
125 | (ropts (rocksdb-readoptions-create)) |
|
126 | (bopts (rocksdb-block-based-options-create))) |
|
284
597f34d43df7
x.lisp upgrades, skel upgrades, worked on shell reader macros
Richard Westhaver <ellis@rwest.io>
parents:
271
diff
changeset
|
127 | (rocksdb-options-set-create-if-missing opts t) |
47 | 128 | ;; cleanup |
2 | 129 | (rocksdb-options-destroy opts) |
130 | (rocksdb-writeoptions-destroy wopts) |
|
131 | (rocksdb-readoptions-destroy ropts) |
|
132 | (rocksdb-block-based-options-destroy bopts))) |
|
133 | ||
97 | 134 | (defun make-errptr () |
135 | (make-alien rocksdb-errptr)) |
|
136 | ||
85 | 137 | (deftest db-basic () |
82 | 138 | "Test basic RocksDB functionality. Inserts KV pair into a temporary |
47 | 139 | DB where K and V are both Lisp strings." |
2 | 140 | (let* ((opts (test-opts)) |
141 | (path (rocksdb-test-dir)) |
|
47 | 142 | (db (rocksdb-open opts path nil)) |
143 | (key (genkey)) |
|
144 | (val (genval)) |
|
145 | (klen (length key)) |
|
146 | (vlen (length val)) |
|
147 | (wopts (rocksdb-writeoptions-create)) |
|
148 | (ropts (rocksdb-readoptions-create))) |
|
267
f3d814fb136a
db upgrades, alik, ignoring c files (for now)
Richard Westhaver <ellis@rwest.io>
parents:
110
diff
changeset
|
149 | (with-alien ((k (* unsigned-char) (make-alien unsigned-char klen)) |
f3d814fb136a
db upgrades, alik, ignoring c files (for now)
Richard Westhaver <ellis@rwest.io>
parents:
110
diff
changeset
|
150 | (v (* unsigned-char) (make-alien unsigned-char vlen)) |
110
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
151 | (errptr rocksdb-errptr nil)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
152 | ;; copy KEY to K |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
153 | (setfa k key) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
154 | ;; copy VAL to V |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
155 | (setfa v val) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
156 | ;; put K:V in DB |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
157 | (rocksdb-put db |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
158 | wopts |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
159 | k |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
160 | klen |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
161 | v |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
162 | vlen |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
163 | errptr) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
164 | (is (null-alien errptr)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
165 | ;; get V from DB given K |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
166 | (rocksdb:rocksdb-cancel-all-background-work db t) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
167 | (rocksdb-get db ropts k klen (make-alien size-t vlen) errptr) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
168 | (is (null-alien errptr)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
169 | ;; copy V to RVAL and validate |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
170 | (let ((rval (make-array vlen :element-type 'unsigned-byte))) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
171 | (loop for i from 0 below vlen do (let ((x (deref v i))) (setf (aref rval i) x))) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
172 | (is (string= (octets-to-string val) (concatenate 'string (map 'vector #'code-char rval))))) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
173 | (rocksdb-delete db wopts k klen errptr) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
174 | (is (null-alien errptr)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
175 | (rocksdb-writeoptions-destroy wopts) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
176 | (rocksdb-readoptions-destroy ropts) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
177 | (rocksdb-cancel-all-background-work db nil) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
178 | (rocksdb-close db) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
179 | (rocksdb-destroy-db opts path errptr) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
180 | (is (null-alien errptr)) |
cae8da4b1415
rocksdb macrofication, fixes for RDB (C Strings will be the death of me), removed PWN - quicklisp package conflict, smh.
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
181 | (rocksdb-options-destroy opts)))) |
269 | 182 | |
183 | (deftest sstfiles () |
|
184 | "Test SST file write/ingest functionality." |
|
185 | (let* ((opts (test-opts)) |
|
186 | (path (rocksdb-test-dir)) |
|
187 | (file (rocksdb-test-file)) |
|
188 | (db (rocksdb-open opts path nil)) |
|
189 | (key (genkey)) |
|
190 | (val (genval)) |
|
191 | (klen (length key)) |
|
192 | (vlen (length val)) |
|
193 | (eopts (rocksdb-envoptions-create)) |
|
194 | (iopts (rocksdb-ingestexternalfileoptions-create)) |
|
195 | (ropts (rocksdb-readoptions-create)) |
|
196 | (writer (rocksdb-sstfilewriter-create eopts opts))) |
|
197 | (with-alien ((k (* unsigned-char) (make-alien unsigned-char klen)) |
|
198 | (v (* unsigned-char) (make-alien unsigned-char vlen)) |
|
199 | (flist (array c-string 1)) |
|
200 | (errptr rocksdb-errptr nil)) |
|
201 | ;; copy KEY to K |
|
202 | (setfa k key) |
|
203 | ;; copy VAL to V |
|
204 | (setfa v val) |
|
205 | (setf (deref flist 0) file) |
|
206 | ;; create writer |
|
207 | (rocksdb-sstfilewriter-open writer file errptr) |
|
208 | ;; insert rows into sst file |
|
209 | (rocksdb-sstfilewriter-put writer k klen v vlen errptr) |
|
210 | (is (null-alien errptr)) |
|
211 | (rocksdb-sstfilewriter-finish writer errptr) |
|
212 | (is (null-alien errptr)) |
|
213 | ;; ingest sst file |
|
214 | (rocksdb-ingest-external-file db (cast flist (* c-string)) 1 iopts errptr) |
|
215 | (is (null-alien errptr)) |
|
216 | (let ((vres (make-array vlen :element-type 'octet :fill-pointer 0))) |
|
217 | (is (string= (octets-to-string val) (cast (rocksdb-get db ropts k klen (make-alien size-t vlen) errptr) c-string)))) |
|
218 | |
|
219 | ;; rocksdb-sstfilewriter-file-size |
|
220 | (rocksdb-sstfilewriter-destroy writer) |
|
221 | (rocksdb-close db) |
|
222 | (rocksdb-destroy-db opts path errptr) |
|
223 | (rocksdb-options-destroy opts) |
|
224 | (rocksdb-envoptions-destroy eopts) |
|
225 | (delete-file file) |
|
226 | (is (null-alien errptr))))) |
|
227 | ||
228 | (deftest stats () |
|
229 | "Test statistics and performance-context related functionality." |
|
230 | (rocksdb-set-perf-level (rocksdb-perf-level "enable-time-except-for-mutex")) |
|
231 | (let* ((opts (test-opts)) |
|
232 | (path (rocksdb-test-dir)) |
|
233 | (db (rocksdb-open opts path nil)) |
|
234 | (key (random-bytes 100)) |
|
235 | (val (random-bytes 100000)) |
|
236 | (klen (length key)) |
|
237 | (vlen (length val)) |
|
238 | (wopts (rocksdb-writeoptions-create)) |
|
239 | (ropts (rocksdb-readoptions-create)) |
|
240 | (ctx (rocksdb::rocksdb-perfcontext-create)) |
|
241 | (hist (rocksdb-statistics-histogram-data-create))) |
|
242 | (with-alien ((k (* (unsigned 8)) (make-alien (unsigned 8) klen)) |
|
243 | (v (* (unsigned 8)) (make-alien (unsigned 8) vlen)) |
|
244 | (errptr rocksdb-errptr nil)) |
|
245 | ;; copy KEY to K |
|
246 | (setfa k key) |
|
247 | ;; copy VAL to V |
|
248 | (setfa v val) |
|
249 | ;; put K:V in DB |
|
250 | (rocksdb-put db |
|
251 | wopts |
|
252 | k |
|
253 | klen |
|
254 | v |
|
255 | vlen |
|
256 | errptr) |
|
257 | |
|
258 | (debug! "stats:" (rocksdb-options-statistics-get-string opts)) |
|
259 | (rocksdb-options-statistics-get-histogram-data opts 5 hist) ;; histogram data types? uint64 somewhere |
|
260 | (debug! "count:" (rocksdb-statistics-histogram-data-get-count hist)) |
|
261 | (rocksdb-perfcontext-reset ctx) |
|
262 | ;; ... |
|
263 | (rocksdb-set-perf-level (rocksdb-perf-level "disable")) |
|
264 | (rocksdb-statistics-histogram-data-destroy hist) |
|
265 | (rocksdb-close db) |
|
266 | (rocksdb-destroy-db opts path errptr) |
|
267 | (rocksdb-options-destroy opts)))) |
|
268 | ||
269 | ;; stats-dump-period-sec |
|
270 | ||
271 | (deftest blob () |
|
272 | "Test BlobDB functionality." |
|
273 | (let* ((opts (test-opts)) |
|
274 | (path (rocksdb-test-dir)) |
|
275 | db |
|
270 | 276 | (key (random-bytes 8)) |
277 | (val (make-array 9999 :initial-element 36)) |
|
269 | 278 | (klen (length key)) |
279 | (vlen (length val)) |
|
280 | (wopts (rocksdb-writeoptions-create)) |
|
281 | (ropts (rocksdb-readoptions-create)) |
|
282 | (bcache (rocksdb-cache-create-lru 128))) |
|
301 | 283 | (rocksdb-options-set-enable-blob-files opts t) |
284 | (rocksdb-options-set-enable-blob-gc opts t) |
|
269 | 285 | (rocksdb-options-set-blob-compression-type opts (rocksdb-compression-backend "zstd")) |
286 | (rocksdb-options-set-blob-cache opts bcache) |
|
287 | (setf db (rocksdb-open opts path nil)) |
|
288 | ||
289 | (with-alien ((k (* (unsigned 8)) (make-alien (unsigned 8) klen)) |
|
290 | (v (* (unsigned 8)) (make-alien (unsigned 8) vlen)) |
|
291 | (errptr rocksdb-errptr nil)) |
|
292 | (debug! "min blob file size: " (rocksdb-options-get-min-blob-size opts)) |
|
293 | (debug! "max blob file size: " (rocksdb-options-get-blob-file-size opts)) |
|
294 | ||
295 | ;; copy KEY to K |
|
296 | (setfa k key) |
|
297 | ;; copy VAL to V |
|
298 | (setfa v val) |
|
299 | ;; put K:V in DB - |
|
300 | (rocksdb-put db |
|
301 | wopts |
|
302 | k |
|
303 | klen |
|
304 | v |
|
305 | vlen |
|
306 | errptr) |
|
307 | (is (null-alien errptr)) |
|
308 | (rocksdb:rocksdb-flush db (rocksdb-flushoptions-create) errptr) |
|
309 | (is (null-alien errptr)) |
|
270 | 310 | (is (stringp |
311 | (cast |
|
312 | (rocksdb-get db |
|
313 | ropts |
|
314 | k |
|
315 | klen |
|
316 | (make-alien size-t vlen) |
|
317 | errptr) |
|
318 | c-string))) |
|
269 | 319 | (rocksdb-writeoptions-destroy wopts) |
320 | (rocksdb-readoptions-destroy ropts) |
|
321 | (rocksdb-close db) |
|
322 | (rocksdb-destroy-db opts path errptr) |
|
323 | (is (null-alien errptr)) |
|
324 | (rocksdb-options-destroy opts)))) |
|
325 | ||
326 | (deftest transaction () |
|
327 | "Test simple transactions using both TransactionDB and OptimisticTransactionDB." |
|
328 | (let* ((opts (test-opts)) |
|
329 | (path (rocksdb-test-dir)) |
|
330 | (db (rocksdb-open opts path nil)) |
|
331 | (key (genkey)) |
|
332 | (val (genval)) |
|
333 | (klen (length key)) |
|
334 | (vlen (length val)) |
|
335 | (wopts (rocksdb-writeoptions-create)) |
|
336 | (ropts (rocksdb-readoptions-create))) |
|
337 | (with-alien ((k (* (unsigned 8)) (make-alien (unsigned 8) klen)) |
|
338 | (v (* (unsigned 8)) (make-alien (unsigned 8) vlen)) |
|
339 | (errptr rocksdb-errptr nil)) |
|
340 | ;; copy KEY to K |
|
341 | (setfa k key) |
|
342 | ;; copy VAL to V |
|
343 | (setfa v val) |
|
344 | ;; put K:V in DB - |
|
345 | (rocksdb-writeoptions-destroy wopts) |
|
346 | (rocksdb-readoptions-destroy ropts) |
|
347 | (rocksdb-close db) |
|
348 | (rocksdb-destroy-db opts path errptr) |
|
349 | (rocksdb-options-destroy opts) |
|
350 | (is (null-alien errptr))))) |
|
271
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
351 | |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
352 | (deftest metadata () |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
353 | "Test metadata functionality :: cf-meta -> level-meta -> sst-file-meta" |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
354 | nil) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
355 | |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
356 | (deftest properties () |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
357 | "Test the ROCKSDB-GET-PROPERTY-* functions." |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
358 | ;; *rocksdb-properties* |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
359 | (let* ((opts (test-opts)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
360 | (path (rocksdb-test-dir)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
361 | (db (rocksdb-open opts path nil)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
362 | (key (genkey)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
363 | (val (genval)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
364 | (klen (length key)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
365 | (vlen (length val)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
366 | (wopts (rocksdb-writeoptions-create)) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
367 | (ropts (rocksdb-readoptions-create))) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
368 | (is (stringp (debug! (rocksdb-property-value db (make-alien-string "rocksdb.stats"))))) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
369 | (is (zerop (parse-integer (rocksdb-property-value db (make-alien-string "rocksdb.num-files-at-level3"))))))) |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
370 | |
4a1a21ff46ee
metadata,props,merge-ops
Richard Westhaver <ellis@rwest.io>
parents:
270
diff
changeset
|
371 | (deftest merge () |
599 | 372 | "Test low-level merge-operator functionality using Alien Callbacks." |
597
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
373 | (is (with-alien ((k (array unsigned-char)) |
598
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
374 | (v (array unsigned-char)) |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
375 | (ops (array (array unsigned-char))) |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
376 | (s (array unsigned-char))) |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
377 | (alien-funcall |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
378 | (alien-callable-function |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
379 | 'rocksdb-concat-full-merge) |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
380 | k 0 v 0 ops (make-alien size-t 0) 0 s (make-alien size-t 0)))) |
597
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
381 | (is |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
382 | (not |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
383 | (with-alien ((k (array unsigned-char)) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
384 | (ops (array (array unsigned-char))) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
385 | (s (array unsigned-char))) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
386 | (alien-funcall |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
387 | (alien-callable-function |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
388 | 'rocksdb-concat-partial-merge) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
389 | k 0 ops (make-alien size-t 0) 0 s (make-alien size-t 0))))) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
390 | (alien-callable-function 'rocksdb-concat-full-merge) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
391 | (alien-callable-function 'rocksdb-concat-partial-merge) |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
392 | (is (integerp |
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
393 | (parse-integer |
598
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
394 | (string-trim "rocksdb:" (alien-funcall (alien-callable-function 'rocksdb-name)))))) |
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
395 | ;; returns No Value |
606
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
396 | (with-alien ((str c-string (make-alien-string "")) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
397 | (state (* t))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
398 | (is (null (alien-funcall (alien-callable-function 'rocksdb-delete-value) state str 1)))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
399 | |
599 | 400 | (is (null (alien-funcall (alien-callable-function 'rocksdb-destructor) (make-alien (* t))))) |
401 | ||
402 | ;; null merge op |
|
403 | (with-alien ((state (* t)) |
|
404 | (destructor (* rocksdb-destructor-function)) |
|
405 | (full-merge (* rocksdb-full-merge-function)) |
|
406 | (partial-merge (* rocksdb-partial-merge-function)) |
|
407 | (delete-value (* rocksdb-delete-value-function)) |
|
408 | (name (* rocksdb-name-function))) |
|
409 | (is (typep (rocksdb-mergeoperator-create state destructor full-merge partial-merge delete-value name) |
|
410 | '(alien (* rocksdb-mergeoperator))))) |
|
597
5b2ca5b2a9db
rocksdb merge-op progress
Richard Westhaver <ellis@rwest.io>
parents:
513
diff
changeset
|
411 | |
599 | 412 | ;; concat merge op |
413 | (with-alien ((state (* t)) |
|
414 | (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor))) |
|
415 | (full-merge (* rocksdb-full-merge-function) (alien-sap (alien-callable-function 'rocksdb-concat-full-merge))) |
|
416 | (partial-merge (* rocksdb-partial-merge-function) (alien-sap (alien-callable-function 'rocksdb-concat-partial-merge))) |
|
616
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
417 | (delete-value (* rocksdb-delete-value-function) (alien-sap (alien-callable-function 'rocksdb-delete-value))) |
599 | 418 | (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-concat-merge-name)))) |
419 | (is (typep (rocksdb-mergeoperator-create state destructor full-merge partial-merge delete-value name) |
|
420 | '(alien (* rocksdb-mergeoperator)))))) |
|
598
c7f9bfc9570f
rm duplicate files, add rocksdb batch and logger files
Richard Westhaver <ellis@rwest.io>
parents:
597
diff
changeset
|
421 | |
599 | 422 | (deftest comparator () |
423 | "Test low-level comparator API." |
|
424 | (with-alien ((state (* t)) |
|
606
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
425 | (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
426 | (compare (* rocksdb-compare-function) (alien-sap (alien-callable-function 'rocksdb-compare-never))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
427 | (compare-with-ts (* rocksdb-compare-with-ts-function)) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
428 | (compare-without-ts (* rocksdb-compare-without-ts-function)) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
429 | (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-name)))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
430 | (is (typep (rocksdb-comparator-create state destructor compare name) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
431 | '(alien (* rocksdb-comparator)))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
432 | (is (typep (rocksdb-comparator-with-ts-create state destructor compare compare-with-ts compare-without-ts name) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
433 | '(alien (* rocksdb-comparator)))))) |
599 | 434 | |
435 | (deftest compaction () |
|
436 | "Test low-level compactionfilter API." |
|
437 | (with-alien ((state (* t)) |
|
606
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
438 | (context (* rocksdb-compactionfiltercontext))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
439 | (is (typep |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
440 | (rocksdb-compactionfilter-create state |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
441 | (alien-sap (alien-callable-function 'rocksdb-destructor)) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
442 | (alien-sap (alien-callable-function 'rocksdb-filter-never)) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
443 | (alien-sap (alien-callable-function 'rocksdb-name))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
444 | '(alien (* rocksdb-compactionfilter)))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
445 | (is (typep |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
446 | (rocksdb-compactionfilterfactory-create state |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
447 | (alien-sap (alien-callable-function 'rocksdb-destructor)) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
448 | (alien-sap (alien-callable-function |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
449 | 'rocksdb-create-compaction-filter-never)) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
450 | (alien-sap (alien-callable-function 'rocksdb-name))) |
6fc04c4d465c
emacs and rocksdb upgrades
Richard Westhaver <ellis@rwest.io>
parents:
599
diff
changeset
|
451 | '(alien (* rocksdb-compactionfilterfactory)))))) |
599 | 452 | |
453 | (deftest logger () |
|
608 | 454 | "Test logging functionality." |
455 | (with-alien ((state (* t)) |
|
456 | (lev unsigned 0) |
|
457 | (msg c-string) |
|
458 | (log (* rocksdb-log-function) (alien-sap (alien-callable-function 'rocksdb-log-default)))) |
|
459 | (is (typep |
|
460 | (rocksdb-logger-create-stderr-logger lev msg) |
|
461 | '(alien (* rocksdb-logger)))) |
|
462 | (is (typep |
|
463 | (rocksdb-logger-create-callback-logger lev log state) |
|
464 | '(alien (* rocksdb-logger)))))) |
|
610 | 465 | |
466 | (deftest writebatch () |
|
467 | "Test writebatch functionality." |
|
616
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
468 | (with-alien ((fput (* rocksdb-put-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
469 | (fdeleted (* rocksdb-deleted-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
470 | (fdeleted-cf (* rocksdb-deleted-cf-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
471 | (fput-cf (* rocksdb-put-cf-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
472 | (fmerge-cf (* rocksdb-merge-cf-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
473 | (fget-ts (* rocksdb-get-ts-size-function))) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
474 | (is (typep |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
475 | (rocksdb-writebatch-create) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
476 | '(alien (* rocksdb-writebatch)))) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
477 | (is (typep |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
478 | (rocksdb-writebatch-wi-create 0 0) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
479 | '(alien (* rocksdb-writebatch-wi)))))) |
611
57813b8ee029
more rocksdb work, slice -> slicetransform
Richard Westhaver <ellis@rwest.io>
parents:
610
diff
changeset
|
480 | |
616
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
481 | (deftest slicetransform (:skip t) |
611
57813b8ee029
more rocksdb work, slice -> slicetransform
Richard Westhaver <ellis@rwest.io>
parents:
610
diff
changeset
|
482 | "Test slicetransform functionality." |
616
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
483 | (with-alien ((state (* t)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
484 | (destructor (* rocksdb-destructor-function) (alien-sap (alien-callable-function 'rocksdb-destructor))) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
485 | (transform (* t) (* rocksdb-transform-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
486 | (in-domain (* rocksdb-in-domain-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
487 | (in-range (* rocksdb-in-range-function)) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
488 | (name (* rocksdb-name-function) (alien-sap (alien-callable-function 'rocksdb-name)))) |
c48704d7b06f
writebatch callbacks and fixes
Richard Westhaver <ellis@rwest.io>
parents:
611
diff
changeset
|
489 | (rocksdb-slicetransform-create state destructor transform in-domain in-range name))) |