Skip to content

Commit

Permalink
Remove option to retain vectors from ILiveTableTx openWatermark
Browse files Browse the repository at this point in the history
There should be no need to retain the vectors backing the Live Table
during a transaction as said transaction is the only thing able to mutate
the Live Table.
  • Loading branch information
mbutlerw committed Aug 22, 2023
1 parent 3468dc3 commit e9070ce
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions core/src/main/clojure/xtdb/indexer/live_index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(definterface ILiveTableTx
(^xtdb.indexer.live_index.ILiveTableWatermark openWatermark [^boolean retain])
(^xtdb.indexer.live_index.ILiveTableWatermark openWatermark [])
(^xtdb.vector.IVectorWriter docWriter [])
(^void logPut [^java.nio.ByteBuffer iid, ^long validFrom, ^long validTo, writeDocFn])
(^void logDelete [^java.nio.ByteBuffer iid, ^long validFrom, ^long validTo])
Expand Down Expand Up @@ -141,9 +141,9 @@

(swap! !transient-trie #(.add ^LiveHashTrie % (dec (.getPosition (.writerPosition live-rel))))))

(openWatermark [_ retain?]
(openWatermark [_]
(locking this-table
(let [wm-live-rel (open-wm-live-rel live-rel retain?)
(let [wm-live-rel (open-wm-live-rel live-rel false)
col-types (live-rel->col-types wm-live-rel)
wm-live-trie @!transient-trie]

Expand All @@ -153,8 +153,7 @@
(liveTrie [_] wm-live-trie)

AutoCloseable
(close [_]
(when retain? (util/close wm-live-rel)))))))
(close [_])))))

(commit [_]
(locking this-table
Expand Down Expand Up @@ -252,7 +251,7 @@
(openWatermark [_]
(util/with-close-on-catch [wms (HashMap.)]
(doseq [[table-name ^ILiveTableTx live-table] table-txs]
(.put wms table-name (.openWatermark live-table false)))
(.put wms table-name (.openWatermark live-table)))

(doseq [[table-name ^ILiveTable live-table] tables]
(.computeIfAbsent wms table-name
Expand Down

0 comments on commit e9070ce

Please sign in to comment.