Compaction works for me (see below); what FleetDB version are you
using and on what platform?
$ fleetdb-server -f data.fdb &
$ echo '["insert", "data", {"id": 1}]' | nc localhost 3400
$ echo '["insert", "data", {"id": 2}]' | nc localhost 3400
$ cat data.fdb
["insert","data",{"id":1}]
["insert","data",{"id":2}]
$ echo '["compact"]' | nc localhost 3400
$ cat data.fdb
["insert","data",[{"id":2},{"id":1}]]
$ ls
data.fdb
- Mark
A few things:
You rightly pointed out that I hadn't pushed either 0.2.0-RC2 or 0.2.0
to Clojars - I've now done that.
Your problem brings up the issue of Clojure 1.2 compatibility. I
didn't have Clojure 1.2 compatibility as a goal for the 0.2 series. At
the source level 0.2 may be Clojure 1.2 compatible, but unfortunately
the jars have Clojure 1.1 compiled code that does not seem to be
accepted by Clojure 1.2 runtimes. The issue of compiled Clojure code
in jars is a significant one that I'll need to return to later.
That said, if you are just using FleetDB 0.2.0-RC2 or 0.2.0 from
source at least the following example should work fine:
$ cat embedded.clj
(require '[fleetdb.embedded :as emb])
(let [dba (emb/init-persistent "demo.fdb")]
(emb/query dba ["insert" "data" {"id" 1}])
(emb/query dba ["insert" "data" {"id" 2}])
(emb/compact dba)
(Thread/sleep 100)
(emb/close dba))
$ clj embedded.clj
$ cat data.fdb
["insert","data",[{"id":2},{"id":1}]]
This works for me locally, even with Clojure 1.2; do you see something
different?
- Mark