Kim Alvefur <zash@zash.se> [Sun, 27 Aug 2023 15:46:19 +0200] rev 13258
util.prosodyctl.check: Correct modern replacement for 'disallow_s2s'
The code would have suggested adding to modules_enabled instead of
modules_disabled
Kim Alvefur <zash@zash.se> [Sat, 05 Aug 2023 20:41:24 +0200] rev 13257
mod_s2s: Fix reporting of DANE mismatch
Thought it was a case mismatch at first, fixed that, but it changed
nothing because the error was in the leaf part of the errors, not the
chain part.
Kim Alvefur <zash@zash.se> [Sat, 29 Jul 2023 02:04:24 +0200] rev 13256
core.portmanager: Join strings broken into multiple lines
Improves readability. Reduces line count. What's not to like?
The code style and luacheck rules allows longer lines, and these strings
aren't long enough to need breaking into multiple lines like this.
Kim Alvefur <zash@zash.se> [Sat, 29 Jul 2023 02:00:55 +0200] rev 13255
core.portmanager: Hint at HTTP servers for conflicts over port 443
Since 443 is just as much a web port as port 80 these days, if not more.
What's with port 81 here?
Kim Alvefur <zash@zash.se> [Sat, 29 Jul 2023 01:42:19 +0200] rev 13254
net.websocket.frames: Remove completed TODO
The XOR is done in C since 4e5a2af9dd19
Kim Alvefur <zash@zash.se> [Wed, 26 Jul 2023 14:39:36 +0200] rev 13253
mod_http: Generate URL from configuration in prosodyctl
This removes the need to configure e.g. http_external_url or similar
settings in order to get correct URLs out of prosodyctl, as the API
depends on portmanager to know the actual ports that are used.
Kim Alvefur <zash@zash.se> [Tue, 25 Jul 2023 12:35:11 +0200] rev 13252
Merge 0.12->trunk
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 16:31:05 +0200] rev 13251
util.array: Fix new() library function
Backport of ffe4adbd2af9 since new was added in the 0.12 branch
Kim Alvefur <zash@zash.se> [Sun, 23 Jul 2023 02:54:49 +0200] rev 13250
mod_tokenauth: Fix revoking a single token without revoking whole grant
This appears to have been a copy-paste of the grant revocation function,
or maybe the other way around. Either way, it deleted the whole grant
instead of the individual token as might be expected.
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 16:31:05 +0200] rev 13249
util.array: Fix new() library function
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 16:20:36 +0200] rev 13248
tests: Add hack to test only a single storage driver
Fixes that LuaDBI being unavailable makes these produce nothing but
endless stack overflows in luarocks.
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 16:17:13 +0200] rev 13247
tests: Update storagemanager tests for prosody.* namespace change
Part of an attempt to make these tests work again. Previously they would
just explode in a million luarocks stack overflows
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 16:15:48 +0200] rev 13246
mod_storage_sql: Spell out missing dependencies
Using util.dependencies appeared to cause problems with running tests in
Busted, so this also removes that and uses pcall directly.
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 15:22:54 +0200] rev 13245
mod_storage_sql: Pass variables as arguments instead of upvalues
Probably a workaround for the lack of argument passing when using xpcall
in Lua 5.1, no longer relevant.
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 14:55:27 +0200] rev 13244
util.sql: Remove unused String() and Integer() functions
According to MattJ, leftovers from an earlier vision for util.sql
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 14:54:17 +0200] rev 13243
util.sqlite3: Clean up unused variables
Many leftovers from the earlier version of util.sql this was based on
and cleanup applied there since then.
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 14:02:01 +0200] rev 13242
util.datamanager: Always reset index after list shift
Shifting the index does not work reliably yet, better to rebuild it from
scratch. Since there is minimal parsing involved in that, it should be
more efficient anyway.
Kim Alvefur <zash@zash.se> [Sat, 22 Jul 2023 12:08:01 +0200] rev 13241
core.moduleapi: Parse period min/max arguments
Allows specifying them the same way as the default and in the config,
for consistency
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 18:30:06 +0200] rev 13240
util.datamanager: Add way to close indexed list store
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 18:28:54 +0200] rev 13239
util.datamanager: Close file handle when done using it
It gets closed eventually but at high load they could potentially
lead to reaching FD limits faster.
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 18:28:16 +0200] rev 13238
util.datamanager: Disable blockwise removal
In desperate need of tests
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 22:49:01 +0200] rev 13237
mod_muc: Use enum config API for 'restrict_room_creation'
This communicates the accepted values in case the config diverges from
them. Note that older documentation used an "admin" value behaving like
an alias to true, but this is no longer handled. Should it?
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 22:48:54 +0200] rev 13236
plugins: Use get_option_array for some list shaped options
Passing something from module:get_option() to ipairs() suggests that the
option is a list of some sort.
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 18:03:22 +0200] rev 13235
util.datamanager: Disable block alignment
Until we have more test coverage. Somehow the index becomes incorrect
after inserting padding, unclear why.
Kim Alvefur <zash@zash.se> [Fri, 21 Jul 2023 17:23:00 +0200] rev 13234
plugins: Handle how get_option_period returns "never"
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 12:38:16 +0200] rev 13233
plugins: Use boolean config method in some places
Because it makes sense and improves feedback via logging
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 12:36:47 +0200] rev 13232
mod_storage_internal: Use integer option method for cache size
Missed this one in previous sweep
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 12:33:51 +0200] rev 13231
mod_muc_mam: Use period option method
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 12:32:41 +0200] rev 13230
mod_muc: Use enum option method for 'muc_room_default_presence_broadcast'
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 12:32:05 +0200] rev 13229
mod_storage_xep0227: Use enum option method
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 12:31:29 +0200] rev 13228
mod_auth_ldap: Use enum option method
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 11:53:31 +0200] rev 13227
mod_storage_sql: Use integer config option for cache size
Missed this one, was probably only looking for get_option_number
Kim Alvefur <zash@zash.se> [Tue, 18 Jul 2023 11:53:12 +0200] rev 13226
mod_storage_sql: Use config enum for 'sqlite_tune'
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 04:52:50 +0200] rev 13225
mod_storage_sql: Allow higher precision timestamps in SQLite3
Since it doesn't actually do strict typing :)
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 14:57:27 +0200] rev 13224
Merge 0.12->trunk
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 14:56:57 +0200] rev 13223
util.prosodyctl.check: Hint about the 'external_addresses' config option
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 14:47:39 +0200] rev 13222
Merge 0.12->trunk
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 14:45:15 +0200] rev 13221
util.prosodyctl.check: Validate format of module list options
Should detect things like misplaced settings inside modules_enabled
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 14:03:13 +0200] rev 13220
util.prosodyctl.check: Get some config options via minimal moduleapi #896
The module API has certain coercion features that are useful.
Fixes traceback reported in #1812 and other duplicates
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 02:32:47 +0200] rev 13219
core.moduleapi: Fix min/maxinteger fallback for Lua 5.2
Maybe these should live in util.mathcompat?
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 02:26:16 +0200] rev 13218
mod_http: Fix passing minimum limits in wrong argument position
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 01:38:54 +0200] rev 13217
plugins: Use integer config API with interval specification where sensible
Many of these fall into a few categories:
- util.cache size, must be >= 1
- byte or item counts that logically can't be negative
- port numbers that should be in 1..0xffff
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 00:37:44 +0200] rev 13216
core.moduleapi: Add min/max range support to :get_option_period
To match :get_option_number etc, specifying the allowed interval.
Default is essentially (0, inf].
Kim Alvefur <zash@zash.se> [Mon, 17 Jul 2023 00:09:41 +0200] rev 13215
moduleapi: Add :get_option_integer()
Many options in Prosody that are treated as numbers don't make sense as
floats, e.g. sizes and limits measured in bytes.
Simplified implementation based on an earlier attempt dating back to 2020
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 21:21:37 +0200] rev 13214
util.human.io: Fix stray 'stty' error by only querying width of real ttys
This adds a dependency on a binary and *nix-specific module but then
stty is probably *nix-specific anyway so maybe that's fine.
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 20:49:33 +0200] rev 13213
plugins: Switch to :get_option_period() for time range options
Improves readability ("1 day" vs 86400) and centralizes validation.
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 21:04:42 +0200] rev 13212
core.moduleapi: Accept boolean false to disable period setting
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 21:02:24 +0200] rev 13211
core.moduleapi: Log error for unexpected types (booleans?) set as periods
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 21:01:31 +0200] rev 13210
core.moduleapi: Turn negative periods or "never" into infinity
As a way to signal that the periodic thing should be disabled, matching
existing mod_mam usage
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 20:59:27 +0200] rev 13209
core.moduleapi: Improve handling of different types in :get_option_period
Pass positive numbers trough unharmed, parse strings as periods, discard
anything else.
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 19:49:12 +0200] rev 13208
core.moduleapi: Add :get_option_period for parsing time intervals
E.g. for use in mod_mam and others that take an amount of time before
some (usually cleanup) action is taken.
Kim Alvefur <zash@zash.se> [Tue, 05 Oct 2021 15:36:38 +0200] rev 13207
core.moduleapi: Allow specifying an acceptable range for number options
Kim Alvefur <zash@zash.se> [Sat, 16 Jan 2021 21:04:58 +0100] rev 13206
plugins: Use get_option_enum where appropriate
Kim Alvefur <zash@zash.se> [Sat, 16 Jan 2021 20:40:14 +0100] rev 13205
moduleapi: Add enum config option method
For when a setting has a few fixed values it can take
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 20:29:06 +0200] rev 13204
tools: Fix file ending of mod2spec.sh (thanks buildbot)
Accidentally .lua ?
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 19:27:18 +0200] rev 13203
util.human.io: Fix pattern in parse_duration() to cover all used letters
Notably 'h' was missing. Awkwardly, 'hour' would result in 'ho' which
was missing from table.
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 19:26:05 +0200] rev 13202
util.human.io: Add tests for parse_duration() (some failing)
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 19:17:06 +0200] rev 13201
util.human.io: Include relevant arguments in test messages
This way the relevant arguments are shown in case a test case fails
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 18:42:58 +0200] rev 13200
util.human.io: Use tail call in test to get correct line numbers
This is probably not guaranteed to work and might vary with Lua version,
but it's good enough for me to get accurate line numbers out of Busted
that don't all point to the test() function.
Kim Alvefur <zash@zash.se> [Sun, 16 Jul 2023 18:33:53 +0200] rev 13199
tools: Add mod2spec.sh, turns util.example into spec/util_example_spec.lua
Useful for opening a module and its tests at the same, can be awkward to
auto-complete sometimes.
sensible-editor util/example.lua $(./tools/mod2spec.sh util.example)
Kim Alvefur <zash@zash.se> [Sat, 15 Jul 2023 10:41:30 +0200] rev 13198
editorconfig: Include the command used to normalize *.xml
The double asterisk seems unnecessary.
Kim Alvefur <zash@zash.se> [Sat, 15 Jul 2023 10:25:10 +0200] rev 13197
editorconfig: Specify max line length to match luacheck settings
Kim Alvefur <zash@zash.se> [Sat, 15 Jul 2023 10:22:49 +0200] rev 13196
editorconfig: Explicitly specify preferred charset (UTF-8)
Really should be the default everywhere by now, but doesn't hurt to be
extra explicit
Kim Alvefur <zash@zash.se> [Sat, 15 Jul 2023 10:22:37 +0200] rev 13195
editorconfig: Add link to format description
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 22:51:37 +0200] rev 13194
mod_storage_sql: Remove completed TODO (testing UPSERT on PostgreSQL)
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 22:50:24 +0200] rev 13193
CHANGES: Move line about LuaSQLite3 to Storage section
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 22:48:10 +0200] rev 13192
CHANGES: Mention performance improvements for internal archives
Specifically the index and more efficient delete.
These are however still in need of testing.
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 15:03:24 +0200] rev 13191
mod_storage_internal: Implement efficient deletion of oldest archive items
Using the new shift function in datamanager, either the oldest items are
removed or all the later items are moved into a new file that replaces
the old.
Hidden behind a feature flag for now.
Kim Alvefur <zash@zash.se> [Wed, 07 Jun 2023 00:39:30 +0200] rev 13190
util.datamanager: Pad list writes to avoid crossing block boundaries
By padding items so that they do not cross block boundaries, it becomes
eaiser to delete whole blocks with fallocate() without cutting items
in half, improving efficiency of such operations.
Since list stores are used for message archives, where the most common
deletion operation would be of the oldest entires, at the top of the
file. With this, all blocks that contain items to be removed could be
deleted without needing to read, delete and write out the whole file.
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 11:45:12 +0200] rev 13189
util.datamanager: Efficiently remove whole blocks to shift lists
Using the new pposix.remove_blocks() it should be very performant to
delete whole sections of a file, given a supporting file system.
Kim Alvefur <zash@zash.se> [Wed, 07 Jun 2023 05:07:03 +0200] rev 13188
util.pposix: Add remove_blocks() for deleting parts of files
Allows implementing e.g. a FIFO
Will probably only work on some Linux file systems like ext4.
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 11:42:41 +0200] rev 13187
util.datamanager: Add way to efficiently remove first items in a list
Copying data without parsing it should be more performant than parsing
it serializing back.
Kim Alvefur <zash@zash.se> [Mon, 10 Jul 2023 17:19:05 +0200] rev 13186
util.datamanager: Fix indexing first item if not at the very start
If the first item does not start at position 0 then the index function
produces a phantom first entry covering position zero until where the
real first item starts. When using the index, this would make it either
appear as the first item was missing or cause an off-by-one issue with
remaining items.
Kim Alvefur <zash@zash.se> [Wed, 12 Jul 2023 10:24:28 +0200] rev 13185
util.datamanager: Reduce log level of left over debug messages to debug (thanks Trung)
These were mostly 'warn' to make them stand out from the debug noise
Kim Alvefur <zash@zash.se> [Mon, 10 Jul 2023 17:52:52 +0200] rev 13184
util.datamanager: Fix missing separator in log line
Kim Alvefur <zash@zash.se> [Mon, 10 Jul 2023 00:34:37 +0200] rev 13183
Merge 0.12->trunk
Kim Alvefur <zash@zash.se> [Sun, 09 Jul 2023 21:18:47 +0200] rev 13182
core.certmanager: Update Mozilla TLS config to version 5.7
Ref https://github.com/mozilla/server-side-tls/issues/285
Kim Alvefur <zash@zash.se> [Sat, 08 Jul 2023 18:23:40 +0200] rev 13181
mod_pubsub: Send correct jid attribute in disco#items
Fixes use in PEP where the JID does not equal the bare domain.
Kim Alvefur <zash@zash.se> [Sun, 02 Jul 2023 14:31:00 +0200] rev 13180
mod_http_file_share: Put 'expires' back, thought it was unused
Removed in 536055476912 because it was not used anywhere else in the
file, but per the documentation it is meant to inform external upload
services of the expiry time of the upload itself.
Kim Alvefur <zash@zash.se> [Fri, 30 Jun 2023 22:01:55 +0200] rev 13179
util.cache: Pass cache itself to eviction callback
Simplifies access to the cache without moving code around a lot given
the currently common pattern of
local some_cache = cache.new(size, function(k,v) end)
Kim Alvefur <zash@zash.se> [Fri, 30 Jun 2023 22:01:49 +0200] rev 13178
util.cache: Keep eviction candidate if callback resized to make room
Previously either the old or the new values would be rejected, even if
the cache was resized to allow more items.
Kim Alvefur <zash@zash.se> [Fri, 30 Jun 2023 18:51:03 +0200] rev 13177
util.serialization: Teach Teal about the new "pretty" preset
Kim Alvefur <zash@zash.se> [Fri, 30 Jun 2023 18:45:18 +0200] rev 13176
util.jsonpointer: Change function prototype to allow anything
But anything that's not a table can't be resolved into, which could
happen in the middle, so eh.
Kim Alvefur <zash@zash.se> [Fri, 30 Jun 2023 15:02:26 +0200] rev 13175
util.jsonpointer: Silence Teal warning
It seems to think 'table' never has array items, but we don't know that.
Matthew Wild <mwild1@gmail.com> [Thu, 29 Jun 2023 15:36:13 +0100] rev 13174
core, plugins: Split prosody:user role into prosody:{guest,registered,member}
This gives us more granular control over different types of user account.
Accounts registered by IBR get assigned prosody:registered by default, while
accounts provisioned by an admin (e.g. via prosodyctl shell) will receive
prosody:member by default.
Matthew Wild <mwild1@gmail.com> [Thu, 29 Jun 2023 15:31:46 +0100] rev 13173
usermanager: Add create_user_with_role() method to atomically set initial role
Kim Alvefur <zash@zash.se> [Wed, 28 Jun 2023 17:17:20 +0200] rev 13172
mod_http_file_share: Set slot token TTL so util.jwt validates expiry
Overrides the util.jwt default of 1h with the intended TTL of 10
minutes. Because util.jwt now has its own expiry checks, so the 'expiry'
field is no longer used and can thus be removed.
Kim Alvefur <zash@zash.se> [Sun, 25 Jun 2023 17:34:13 +0200] rev 13171
prosodyctl: Add experimental way to reload specific modules directly
Mostly thinking out loud about how various actions may use the shell
This enables the following sequence of commands:
prosodyctl install mod_example
prosodyctl reload mod_example
which is simpler than
prosodyctl shell module reload example
Kim Alvefur <zash@zash.se> [Sat, 20 May 2023 20:44:20 +0200] rev 13170
net.server: Handle loading from outside Prosody (e.g. Verse)
server_select only depending on LuaSocket generally makes it more
portable, so fall back to that if util.poll can't be found.
Kim Alvefur <zash@zash.se> [Sun, 18 Jun 2023 16:48:56 +0200] rev 13169
renamening: Fix newly added imports to use the new namespace
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 17:19:40 +0200] rev 13168
util.jsonschema: Remove wrapper function
This was to silence some Teal warning that seems to have gone away.
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 17:17:44 +0200] rev 13167
util.jsonschema: Silence Teal warnings about utf8 library
Teal worries that we redefine the global.
Also that the fallback was missing type information.
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 17:12:54 +0200] rev 13166
util.jsonschema: Silence Teal warnings about counting items in tables
Teal thinks that these are key-value maps which are always of length
zero, but that is not the case.
Kim Alvefur <zash@zash.se> [Wed, 12 Jan 2022 10:23:13 +0100] rev 13165
mod_invites: Refactor argument handling using util.argparse
This makes it so that --admin and --role are no longer mutually
exclusive, they the former is simply treated as another --role.
This was likely a leftover from when only a single role was possible.
It does however become unclear which should be the primary, since the
order is not preserved by argparse.
Bonus: Loading of modules is avoided with only the --help is shown.
Kim Alvefur <zash@zash.se> [Wed, 05 Jan 2022 04:46:27 +0100] rev 13164
util.argparse: Add support for repeatable parameters
These are gathered into arrays
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 13:37:33 +0200] rev 13163
mod_storage_sql: Fix column name in index check for PostgreSQL
Forgot to change the column name in 9a7523ea45cb
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 13:36:42 +0200] rev 13162
mod_storage_sql: Adjust indentation to align with surrounding code
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 00:22:45 +0200] rev 13161
mod_storage_sql: Only remove old index if it exists
Avoids an error if the upgrade is performed twice..
Kim Alvefur <zash@zash.se> [Sat, 17 Jun 2023 00:00:21 +0200] rev 13160
mod_storage_sql: Be more specific when checking for old index in SQLite3
Prevents false positives in the odd case where something other than an
index with this name might exist.
Kim Alvefur <zash@zash.se> [Fri, 16 Jun 2023 23:57:15 +0200] rev 13159
mod_storage_sql: Improve check for old table index on PostgreSQL
The "pg_indexes" view is much simpler to inspect than "pg_class"
Kim Alvefur <zash@zash.se> [Fri, 16 Jun 2023 13:03:34 +0200] rev 13158
mod_storage_sql: Enable UPSERT with PostgreSQL
Tested. Works.
Kim Alvefur <zash@zash.se> [Fri, 16 Jun 2023 13:02:35 +0200] rev 13157
doap: Fix typo in attribute name
Kim Alvefur <zash@zash.se> [Wed, 14 Jun 2023 13:39:39 +0200] rev 13156
util.pposix: Use Lua enum API for resource limit name argument
Because diffstat.
Kim Alvefur <zash@zash.se> [Sun, 11 Jun 2023 20:25:50 +0200] rev 13155
mod_storage_sql: Add some TODO comments for future UPSERT work
Kim Alvefur <zash@zash.se> [Sun, 11 Jun 2023 20:05:32 +0200] rev 13154
mod_storage_sql: Do not keep track of quota when no quota is set
No point in doing this expensive O(n) query if the result is not used
for anything.
Will still cache the total item count if an explicit query for this is
performed, then try to keep it updated with new items added. Will likely
forget eventually tho.
Kim Alvefur <zash@zash.se> [Sun, 11 Jun 2023 17:04:11 +0200] rev 13153
mod_storage_sql: Add setting to tune SQLite3 performance vs safety
Notably the default journal_mode of DELETE is somewhat slow, some users
might want to catch up to the amazing performance of internal storage.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 14:01:56 +0200] rev 13152
mod_storage_sql: Record all SQLite3 compile options for potential use
Knowing what features are available could be useful for future
experiments. For example, with the JSON module or full text search.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 22:20:26 +0200] rev 13151
util.sqlite3: Don't cache prepared statements for one-off queries
The :execute method is mainly used for one-off queries such as creating
tables and indices. There is no need to cache this prepared statement,
as those queries are only done on startup.
Further, prepared statements can't be reused without being reset, so
this was likely broken anyway.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 22:02:15 +0200] rev 13150
util.sqlite3: Deduplicate query methods
There were 3 very similar methods:
- :execute()
- :execute_query()
- :execute_update()
The first one returns the prepared statement and is mainly used
internally in the library for CREATE statements.
The later two only really differ in how the results are returned.
Those two are one main method and one small one that only picks out the
iterator.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 22:00:43 +0200] rev 13149
util.sqlite3: Fix indentation
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 16:39:48 +0200] rev 13148
mod_storage_sql: Compose a keyval+ store out of keyval and map store methods
Removes the need for the shim in storagemanager.
The methods only really access the 'store' property of the first (self)
argument, so this is safe.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 15:44:09 +0200] rev 13147
mod_storage_sql: Add UPSERT support
Currently limited to SQLite3 for lack of testing on other databases.
Adds a migration to replace the non-UNIQUE prosody_index, renaming it
prosody_unique_index since ALTER INDEX does not seem to be portable.
Kim Alvefur <zash@zash.se> [Thu, 08 Jun 2023 09:37:01 +0200] rev 13146
tools: Update imports to use new prosody.* namespace
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 13:06:05 +0200] rev 13145
Merge 0.12->trunk
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 12:18:09 +0200] rev 13144
mod_http: Simplify conversion of Set to Array
Avoids the _items semi-private value, that is used everywhere for some
reason.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 12:33:58 +0200] rev 13143
mod_http: Fix error if 'access_control_allow_origins' is set
Because it changes the type of the 'opt_origins' variable from util.set
to the internal _items table so next time an http app is added an error
"attempt to call a nil value (method 'empty')" is triggered. The value
is not used anywhere else.
Noticed when reviewing uses of the '_items' set property.
Not reported by any users, implying this setting is rarely used.
Kim Alvefur <zash@zash.se> [Sat, 10 Jun 2023 12:14:12 +0200] rev 13142
util.array: Expose new() on module table
For consistency with other utils.
Consistency is good.
Kim Alvefur <zash@zash.se> [Fri, 14 May 2021 05:49:35 +0200] rev 13141
util.datamanager: Halve size of list index
Instead of storing (start, length) tuples, store the offset to the end
of items and derive length using the previous entry.
Kim Alvefur <zash@zash.se> [Wed, 12 May 2021 01:32:03 +0200] rev 13140
mod_storage_internal: Use a binary search for time based ranges
Iterating over an entire archive to find a few items in the far end from
where iteration started is expensive, and probably more expensive with
the lazy-loading of items added in the previous commit.
Since we can now efficiently read items in random order, we can now use
a binary search to find a better starting point for iteration.
Kim Alvefur <zash@zash.se> [Wed, 12 May 2021 01:25:44 +0200] rev 13139
mod_storage_internal: Lazy-load archive items while iterating
Very large list files previously ran into limits of the Lua parser, or
just caused Prosody to freeze while parsing.
Using the new index we can parse individual items one at a time. This
probably won't reduce overall CPU usage, probably the opposite, but it
will reduce the number of items in memory at once and allow collection
of items after we iterated past them.