virgodb 0.4.0-x86_64-linux-gnu → 0.4.3-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 +40 -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: cf65c3b3358ca912775317f6585e1fd8165cd946858dbde7a1579a46bc06a49f
|
|
4
|
+
data.tar.gz: 426164c6523a12febea491fd22f3f0abd1b35aa8143a021eeee618cb05c488bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d66eba8e855836990f0238391555fba6395a1057aef42964c01048a8bcda28a273e16abbf09469607b36b4d5cf55436a496c49c1e0fc08607fc0ce84eaf909f
|
|
7
|
+
data.tar.gz: 141f6d02920b5c4c84c7649c4dea4aa7266ce1db90a325583d5f96f70c5bd1a1598ca6f2bb3820bf46da6ee0a009b7ee80490bcf26043df1743b8daccd1fe848
|
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
|
|
@@ -144,6 +146,7 @@ module Virgodb
|
|
|
144
146
|
|
|
145
147
|
def build_writer
|
|
146
148
|
ensure_maintenance_started
|
|
149
|
+
ensure_flush_timer_started
|
|
147
150
|
Virgodb::Writer.new(@manifest_path, @sql_table_name, @tier1_max_rows, @tier1_max_age_secs, @data_dir)
|
|
148
151
|
end
|
|
149
152
|
|
|
@@ -154,5 +157,41 @@ module Virgodb
|
|
|
154
157
|
Virgodb.start_maintenance(@manifest_path, @sql_table_name, @data_dir, @key_column, @sort_by, @tuning, @partition_column)
|
|
155
158
|
@maintenance_started = true
|
|
156
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
|
|
157
196
|
end
|
|
158
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.
|
|
4
|
+
version: 0.4.3
|
|
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
|