litebackup 1.4.0-x86_64-linux-gnu → 1.5.0-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2edb57e9dcae7cf4904424e61874f24cefc09c65d6058cbf5b84cd28564f6dde
4
- data.tar.gz: cc3df181b7f41d1efa60a69109fc87cf1d3b1358cae220e89e87b34524b699bd
3
+ metadata.gz: feb0d54ce419dd981d414f6664fedd8ee1cdc28040d4d09cb16e2e5d70c141b1
4
+ data.tar.gz: b7d5bca6e9a38d781f8150de64e3d3345392c5bb5fb02d5087aa40400cae81d9
5
5
  SHA512:
6
- metadata.gz: b6f0e7919df9a777254774d59fd871c1abd5111e34768409807100f7b58b535e7473b16d058834772f9267ac58c2a361fae2c1ebfbdc05c1d8cf4e9030cf8c9e
7
- data.tar.gz: 6be20356bda003af705b968742ffd5d87e9d105ea7172543b64526723e8b6f78981ab17cccc7c468759e11a2803a5f6ac14b5c67a3334ecf57026dcf9a54ac5b
6
+ metadata.gz: c56d4ef9ad8bdcf92861a38afc83ef8045b463a750b2d7ec2402e224de5668652b26edfb2f6df2e41ceb94f9762d5050863ae81caf95fce1f28d6aad45c7d835
7
+ data.tar.gz: 5fe73b05a3e27093e9f67a956a2a639a776b3c45475fffeeabad59973268ee4bed665c64c95df1270095ca2b81b72139c8a6599c93e79a55b0c5bf8ae6e653c5
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: data/lib/litebackup/bin/litebackup
3
- size: 56727760 bytes
4
- sha256: 6d535508fb58e107c8428f4decc7a15c4353407983de0e469efd108eebc8131f
3
+ size: 56834000 bytes
4
+ sha256: 575e861a85b57c97222a2a80d80103d82b6ee4c0ce70997486a9b8dcfc1ed14a
@@ -117,7 +117,7 @@ module Litebackup
117
117
  end
118
118
 
119
119
  # Connects, starting the daemon when needed; fails with daemon_unsupported
120
- # for a daemon older than 1.1.0.
120
+ # for a daemon older than 1.5.0.
121
121
  def connect
122
122
  ensure_open
123
123
  @connect_lock.synchronize do
@@ -487,9 +487,9 @@ module Litebackup
487
487
 
488
488
  # Final-syncs every database, releases every write lock, and stops the
489
489
  # daemon. A backup another machine writes has no lock and stays waiting.
490
- # Each database it could not sync or release is in failed, with its code,
490
+ # Each database it could not sync or release is in failures, with its code,
491
491
  # and keeps any write lock it has; the session and the daemon then stay.
492
- # An empty failed is the only complete shutdown. close never does this.
492
+ # An empty failures is the only complete shutdown. close never does this.
493
493
  def shutdown(durability: nil, timeout: nil)
494
494
  @client.call(Wire.shutdown(durability: durability, timeout: timeout))
495
495
  end
@@ -26,6 +26,7 @@ module Litebackup
26
26
  NOT_DURABLE = "not_durable"
27
27
  NOT_FOUND = "not_found"
28
28
  PLAN_LIMIT = "plan_limit"
29
+ RATE_LIMITED = "rate_limited"
29
30
  RULE_DATABASE = "rule_database"
30
31
  RULE_EXISTS = "rule_exists"
31
32
  SDK_UNSUPPORTED = "sdk_unsupported"
@@ -100,7 +100,7 @@ module Litebackup
100
100
  ].freeze
101
101
  end
102
102
 
103
- class DatabaseStatus < Data.define(:name, :path, :role, :state, :acquired, :failover, :backup_rule_id, :local_changed, :synced_server, :synced_cloud, :journal_mode, :page_count, :sync_count, :hint_misses, :last_full_scan_reason, :writer_machine_label, :last_error, :last_error_time, :first_unsynced_change_time, :next_retry_time, :draining, :machine_label, :maintenance, :offload_on_release, :offload_durability)
103
+ class DatabaseStatus < Data.define(:name, :path, :role, :state, :acquired, :failover, :backup_rule_id, :local_changed, :synced_server, :synced_cloud, :journal_mode, :page_count, :sync_count, :hint_misses, :full_scan_reason, :writer_machine_label, :error, :failed, :syncing, :retrying, :synced, :pending, :released, :offloaded, :next_retry, :draining, :machine_label, :maintenance, :offload_on_release, :offload_durability)
104
104
  extend WireModel
105
105
  ROLE_ORIGIN = "origin"
106
106
  ROLE_REPLICA = "replica"
@@ -119,14 +119,14 @@ module Litebackup
119
119
  # state: pending while a backup or failover origin holds no write lock, as after a start or a
120
120
  # drain, until a sync takes it (a start takes back the lock of each backup a drain left
121
121
  # pending while the head is still the version it last synced); syncing while changes stream;
122
- # retrying while an origin's syncs fail, with last_error saying why and next_retry_time when
123
- # the next attempt runs; synced when the server holds every change: a backup or failover
124
- # origin whose last sync landed with no change seen after it, until its next change, or a
125
- # released database whose last version is on the server; waiting while another machine is the
126
- # origin; offloaded when the local file was removed because the server, or the bucket when the
127
- # offload asked for it, holds its last version; stopped for a stopped replica; conflicted when
128
- # this copy was refused and left as it is, because its file differs from the server head or
129
- # its write lock was lost or broken; error with last_error
122
+ # retrying while an origin's syncs fail, with error saying why and next_retry when the next
123
+ # attempt runs; synced when the server holds every change: a backup or failover origin whose
124
+ # last sync landed with no change seen after it, until its next change, or a released database
125
+ # whose last version is on the server; waiting while another machine is the origin; offloaded
126
+ # when the local file was removed because the server, or the bucket when the offload asked for
127
+ # it, holds its last version; stopped for a stopped replica; conflicted when this copy was
128
+ # refused and left as it is, because its file differs from the server head or its write lock
129
+ # was lost or broken; error, with error saying why
130
130
  # acquired: the database is acquired and released by a worker rather than backed up
131
131
  # continuously
132
132
  # failover: the database belongs to a failover and changes role when the origin does
@@ -141,10 +141,18 @@ module Litebackup
141
141
  # writer_machine_label: the machine label of the last writer this machine saw; empty once this
142
142
  # machine released the database, drained it, or offloaded a copy whose write lock it held, as
143
143
  # no writer is known then
144
- # first_unsynced_change_time: when the first change the server lacks was seen; absent when the
145
- # server has every change seen. It survives restarts and may be earlier than the real first
146
- # change, never later.
147
- # next_retry_time: when the next attempt of a failed sync runs; absent when none is scheduled
144
+ # syncing: when the first change the server lacks was seen; absent when the server has every
145
+ # change seen. It survives restarts and may be earlier than the real first change, never
146
+ # later.
147
+ # retrying: when the current run of failed syncs began, with the first failure after the last
148
+ # success; absent once a sync succeeds
149
+ # synced: when the newest sync landed, the time synced_server holds
150
+ # pending: when a backup or failover origin was left without its write lock, by a start, a
151
+ # drain, or a dropped lock; absent once a sync takes the lock
152
+ # released: when this machine last released the database
153
+ # offloaded: when the local file was removed because the server or the bucket holds its
154
+ # version; absent once an acquire brings it back
155
+ # next_retry: when the next attempt of a failed sync runs; absent when none is scheduled
148
156
  # draining: set on a failover origin while this machine drains, and on one a drain released,
149
157
  # which holds no write lock until it takes one again; a failover then reports its role as
150
158
  # unknown, as after a draining event
@@ -169,12 +177,17 @@ module Litebackup
169
177
  page_count: [:integer, true],
170
178
  sync_count: [:integer, true],
171
179
  hint_misses: [:integer, true],
172
- last_full_scan_reason: [:string, false],
180
+ full_scan_reason: [:string, false],
173
181
  writer_machine_label: [:string, false],
174
- last_error: [:string, false],
175
- last_error_time: [:time, false],
176
- first_unsynced_change_time: [:time, false],
177
- next_retry_time: [:time, false],
182
+ error: [:string, false],
183
+ failed: [:time, false],
184
+ syncing: [:time, false],
185
+ retrying: [:time, false],
186
+ synced: [:time, false],
187
+ pending: [:time, false],
188
+ released: [:time, false],
189
+ offloaded: [:time, false],
190
+ next_retry: [:time, false],
178
191
  draining: [:boolean, false],
179
192
  machine_label: [:string, false],
180
193
  maintenance: [:boolean, false],
@@ -225,11 +238,15 @@ module Litebackup
225
238
  # on this machine) or, with 503, not_configured (the server waits for setup), wrong_server (the
226
239
  # server this machine reached is not the one its session joined, or does not own the database),
227
240
  # unauthenticated (the server no longer accepts this machine's key), forbidden (the key may not
228
- # do this), plan_limit (the server's plan has no room for another database), or integrity (the
229
- # version's bucket objects failed an integrity check). lock_unavailable, lock_lost, not_found,
230
- # invalid_argument, and timeout keep their meaning, and any other refusal (a busy server, one
231
- # short of disk, one unreachable) is unavailable. A client treats a code it does not know as a
232
- # failure.
241
+ # do this), plan_limit (the server's plan has no room for another database), rate_limited (the
242
+ # server sheds load and asks to be tried later: a restore retries it for about 30 seconds, as
243
+ # its Retry-After says, before it answers so), or integrity (the version's bucket objects failed
244
+ # an integrity check). A restore answers integrity too when every page of the version arrived
245
+ # intact but SQLite's quick_check finds the database damaged: the version itself is corrupt, so
246
+ # a retry gives the same file, and an earlier version is the way back. A transfer cut short
247
+ # stays unavailable. lock_unavailable, lock_lost, not_found, invalid_argument, and timeout keep
248
+ # their meaning, and any other refusal (a busy server, one short of disk, one unreachable) is
249
+ # unavailable. A client treats a code it does not know as a failure.
233
250
  module ErrorCode
234
251
  BUSY = "busy"
235
252
  CANCELLED = "cancelled"
@@ -252,6 +269,7 @@ module Litebackup
252
269
  NOT_DURABLE = "not_durable"
253
270
  NOT_FOUND = "not_found"
254
271
  PLAN_LIMIT = "plan_limit"
272
+ RATE_LIMITED = "rate_limited"
255
273
  RULE_DATABASE = "rule_database"
256
274
  RULE_EXISTS = "rule_exists"
257
275
  SDK_UNSUPPORTED = "sdk_unsupported"
@@ -282,6 +300,7 @@ module Litebackup
282
300
  NOT_DURABLE,
283
301
  NOT_FOUND,
284
302
  PLAN_LIMIT,
303
+ RATE_LIMITED,
285
304
  RULE_DATABASE,
286
305
  RULE_EXISTS,
287
306
  SDK_UNSUPPORTED,
@@ -485,11 +504,12 @@ module Litebackup
485
504
 
486
505
  class ReleaseResult < Data.define(:database, :checkpointed, :vacuumed, :offloaded)
487
506
  extend WireModel
507
+ # offloaded: when the release removed the local file; absent when it kept the file
488
508
  WIRE_FIELDS = {
489
509
  database: [[:model, :DatabaseStatus], true],
490
510
  checkpointed: [:boolean, true],
491
511
  vacuumed: [:boolean, true],
492
- offloaded: [:boolean, true]
512
+ offloaded: [:time, false]
493
513
  }.freeze
494
514
  end
495
515
 
@@ -504,12 +524,12 @@ module Litebackup
504
524
  }.freeze
505
525
  end
506
526
 
507
- class Writer < Data.define(:name, :active, :this_machine, :writer_machine_label, :acquired_time, :lease_expires, :lease_remaining_millis, :lapsed)
527
+ class Writer < Data.define(:name, :active, :this_machine, :writer_machine_label, :lock_acquired, :lease_expires, :lease_remaining_millis, :lapsed)
508
528
  extend WireModel
509
529
  # active: whether some machine holds the write lock and its lease still runs
510
530
  # this_machine: whether this machine's session holds the write lock
511
531
  # writer_machine_label: the machine label of the writer, or empty when nobody holds the lock
512
- # acquired_time: when the writer took the lock
532
+ # lock_acquired: when the writer took the lock
513
533
  # lease_expires: on the server's clock
514
534
  # lease_remaining_millis: how long the lease still runs, negative once it ran out
515
535
  # lapsed: the writer's lease ran out, so another machine may take over
@@ -518,7 +538,7 @@ module Litebackup
518
538
  active: [:boolean, true],
519
539
  this_machine: [:boolean, true],
520
540
  writer_machine_label: [:string, true],
521
- acquired_time: [:time, false],
541
+ lock_acquired: [:time, false],
522
542
  lease_expires: [:time, false],
523
543
  lease_remaining_millis: [:integer, false],
524
544
  lapsed: [:boolean, true]
@@ -708,16 +728,16 @@ module Litebackup
708
728
  }.freeze
709
729
  end
710
730
 
711
- class ShutdownResult < Data.define(:released, :failed)
731
+ class ShutdownResult < Data.define(:released_count, :failures)
712
732
  extend WireModel
713
- # released: how many databases the drain synced as asked and released
714
- # failed: every database the drain could not sync, wait for, or release, each keeping any
733
+ # released_count: how many databases the drain synced as asked and released
734
+ # failures: every database the drain could not sync, wait for, or release, each keeping any
715
735
  # write lock it holds, and every conflicted copy whose writes are not on the server, with
716
736
  # conflict; empty only when the drain released every database it covers, which is the one case
717
737
  # the daemon stops
718
738
  WIRE_FIELDS = {
719
- released: [:integer, true],
720
- failed: [[:list, [:model, :DrainFailure]], true]
739
+ released_count: [:integer, true],
740
+ failures: [[:list, [:model, :DrainFailure]], true]
721
741
  }.freeze
722
742
  end
723
743
  end
@@ -128,7 +128,7 @@ module Litebackup
128
128
 
129
129
  # One database of a pool. turn serializes opening, bringing back,
130
130
  # acquiring, lease calls, and releasing; use calls share the open handle
131
- # without it. users and last_used are guarded by the pool's mutex.
131
+ # without it. users and used are guarded by the pool's mutex.
132
132
  class Entry
133
133
  attr_reader :name, :turn
134
134
  # handle is open while opened is set; leased is set while this pool
@@ -140,7 +140,7 @@ module Litebackup
140
140
  # the last use block exits; users counts calls between joining and
141
141
  # leaving, blocks included.
142
142
  attr_accessor :handle, :path, :opened, :leased, :lease_settings, :last_call_failed, :idle_close,
143
- :close_after_use, :users, :last_used
143
+ :close_after_use, :users, :used
144
144
 
145
145
  def initialize(name)
146
146
  @name = name
@@ -154,7 +154,7 @@ module Litebackup
154
154
  @idle_close = nil
155
155
  @close_after_use = false
156
156
  @users = 0
157
- @last_used = nil
157
+ @used = nil
158
158
  end
159
159
  end
160
160
 
@@ -389,7 +389,7 @@ module Litebackup
389
389
  @mutex.synchronize do
390
390
  entry.users -= 1
391
391
  @active_calls -= 1
392
- entry.last_used = monotonic
392
+ entry.used = monotonic
393
393
  if entry.users.zero? && !entry.opened && !entry.leased && @entries[entry.name].equal?(entry)
394
394
  @entries.delete(entry.name)
395
395
  end
@@ -412,13 +412,13 @@ module Litebackup
412
412
  end
413
413
 
414
414
  def idle_entries
415
- @mutex.synchronize { @entries.values.select { |entry| entry.users.zero? && !entry.last_used.nil? } }
415
+ @mutex.synchronize { @entries.values.select { |entry| entry.users.zero? && !entry.used.nil? } }
416
416
  end
417
417
 
418
418
  # How long an entry has been unused, or nil while a call uses it.
419
419
  def idle_seconds(entry, now)
420
420
  @mutex.synchronize do
421
- entry.users.positive? || entry.last_used.nil? ? nil : now - entry.last_used
421
+ entry.users.positive? || entry.used.nil? ? nil : now - entry.used
422
422
  end
423
423
  end
424
424
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Litebackup
4
4
  # Sent with every call. Daemons refuse SDKs older than their minimum with sdk_unsupported.
5
- VERSION = "1.4.0"
5
+ VERSION = "1.5.0"
6
6
  # Connecting to an older daemon fails with daemon_unsupported.
7
- MINIMUM_DAEMON_VERSION = "1.1.0"
7
+ MINIMUM_DAEMON_VERSION = "1.5.0"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litebackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - Litebackup