virgodb 0.3.0-x86_64-linux-gnu → 0.4.2-x86_64-linux-gnu
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.
- checksums.yaml +4 -4
- data/lib/virgodb/table.rb +52 -1
- data/lib/virgodb/version.rb +1 -1
- data/lib/virgodb/virgodb_ruby.so +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1f9d93ae7a3e693c2d7f2d7ba19a30ea89a3e54c53c7e9ab604eadc3afe3eda
|
|
4
|
+
data.tar.gz: c25d394c1ee0e2554abebdbcc58233f6fb13a816b8676e916861511e8689f81a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc0fce13a70b6de835b7ad1077520915ef5baacaa48b7bacc69cfe35607de9e9e5be1e717e0fa3a9e654c5a8d0f7624cb4be8c6db7b957ca7026842c498b8b1e
|
|
7
|
+
data.tar.gz: bc9891ee73cffeb89a56f2512cc8047af9779cdac1c3b6671a4c542c2c38ed29eb8e337831c78e6aa72ed911dfc537de2f0a2cbc1090a30c8c6681506321fd8c
|
data/lib/virgodb/table.rb
CHANGED
|
@@ -4,7 +4,8 @@ require "json"
|
|
|
4
4
|
require "fileutils"
|
|
5
5
|
|
|
6
6
|
module Virgodb
|
|
7
|
-
# A memoized Writer + its maintenance thread
|
|
7
|
+
# A memoized Writer + its maintenance thread + its periodic flush timer
|
|
8
|
+
# (see `ensure_flush_timer_started` below), all created lazily on first
|
|
8
9
|
# use -- not eagerly at process boot, since Writer.new and
|
|
9
10
|
# Virgodb.start_maintenance both raise if this table hasn't been migrated
|
|
10
11
|
# yet, and eager init would crash the whole process on that instead of
|
|
@@ -44,6 +45,7 @@ module Virgodb
|
|
|
44
45
|
@tuning = tuning
|
|
45
46
|
@mutex = Mutex.new
|
|
46
47
|
@maintenance_started = false
|
|
48
|
+
@flush_timer_started = false
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
attr_reader :manifest_path
|
|
@@ -124,6 +126,18 @@ module Virgodb
|
|
|
124
126
|
Virgodb.release_maintenance_lease(@manifest_path, @sql_table_name, holder.to_s)
|
|
125
127
|
end
|
|
126
128
|
|
|
129
|
+
# Extends a lease claimed via `claim_maintenance_lease` above without
|
|
130
|
+
# needing it to expire first -- calling `claim_maintenance_lease` again
|
|
131
|
+
# on a lease you already validly hold is a guaranteed no-op, not a
|
|
132
|
+
# renewal (see `Manifest::renew_maintenance_lease`'s own doc comment).
|
|
133
|
+
# For a caller whose work under the lease might run longer than one
|
|
134
|
+
# fixed grant. Returns `false` (not an error) if `holder` no longer
|
|
135
|
+
# matches the current holder -- treat that as "lost the lease," not
|
|
136
|
+
# something to retry blindly.
|
|
137
|
+
def renew_maintenance_lease(holder:, lease_duration_secs:)
|
|
138
|
+
Virgodb.renew_maintenance_lease(@manifest_path, @sql_table_name, holder.to_s, lease_duration_secs)
|
|
139
|
+
end
|
|
140
|
+
|
|
127
141
|
private
|
|
128
142
|
|
|
129
143
|
def writer
|
|
@@ -132,6 +146,7 @@ module Virgodb
|
|
|
132
146
|
|
|
133
147
|
def build_writer
|
|
134
148
|
ensure_maintenance_started
|
|
149
|
+
ensure_flush_timer_started
|
|
135
150
|
Virgodb::Writer.new(@manifest_path, @sql_table_name, @tier1_max_rows, @tier1_max_age_secs, @data_dir)
|
|
136
151
|
end
|
|
137
152
|
|
|
@@ -142,5 +157,41 @@ module Virgodb
|
|
|
142
157
|
Virgodb.start_maintenance(@manifest_path, @sql_table_name, @data_dir, @key_column, @sort_by, @tuning, @partition_column)
|
|
143
158
|
@maintenance_started = true
|
|
144
159
|
end
|
|
160
|
+
|
|
161
|
+
# Periodically force-flushes this table's Tier 1 buffer on a real
|
|
162
|
+
# timer, independent of write traffic -- see `Writer#write_row`'s own
|
|
163
|
+
# doc comment (crates/virgodb_ruby/src/writer.rs) for the full
|
|
164
|
+
# reasoning: write_row's inline flush only fires on the ROW-COUNT half
|
|
165
|
+
# of tier1_max_rows/tier1_max_age_secs, not age, because an actual
|
|
166
|
+
# flush fsyncs (storage::write_inline_file) and checking age inline
|
|
167
|
+
# meant whichever request happened to cross that threshold paid for a
|
|
168
|
+
# real disk sync on its own thread -- under low/sparse traffic, that
|
|
169
|
+
# was effectively every request. This background thread is what makes
|
|
170
|
+
# tier1_max_age_secs a real wall-clock bound again, off any caller's
|
|
171
|
+
# own thread -- moved here (not left to each host app to build its
|
|
172
|
+
# own copy) so every consumer of this gem gets the same guarantee
|
|
173
|
+
# write_row itself no longer provides alone.
|
|
174
|
+
#
|
|
175
|
+
# Uses `flush!` (force-flush regardless of policy) through the SAME
|
|
176
|
+
# `@mutex` write_row/tombstone already use -- a Ruby Thread cooperates
|
|
177
|
+
# correctly with that lock, unlike a Rust-native thread would (the
|
|
178
|
+
# underlying Writer's RefCell isn't safe for genuine concurrent access
|
|
179
|
+
# outside Ruby's own GVL/Mutex protection -- see this class's own doc
|
|
180
|
+
# comment above). No locking needed around @flush_timer_started itself:
|
|
181
|
+
# this method only ever runs from inside build_writer, which only ever
|
|
182
|
+
# runs once per instance, already inside `writer`'s own @mutex-guarded
|
|
183
|
+
# lazy-init (`@writer ||= build_writer`).
|
|
184
|
+
def ensure_flush_timer_started
|
|
185
|
+
return if @flush_timer_started
|
|
186
|
+
|
|
187
|
+
@flush_timer_started = true
|
|
188
|
+
Thread.new { loop { sleep(@tier1_max_age_secs); flush_timer_tick } }
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def flush_timer_tick
|
|
192
|
+
flush!
|
|
193
|
+
rescue => e
|
|
194
|
+
warn "[virgodb] #{@sql_table_name} periodic flush failed: #{e.class}: #{e.message}"
|
|
195
|
+
end
|
|
145
196
|
end
|
|
146
197
|
end
|
data/lib/virgodb/version.rb
CHANGED
data/lib/virgodb/virgodb_ruby.so
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: virgodb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: x86_64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- virgodb
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Embeds virgodb (an OLAP engine backed by Parquet + DataFusion) directly into a Ruby process
|