Commit Graph

1368 Commits

Author SHA1 Message Date
Jan Varga
d0a8f8f6a6 Bug 1866217 - Replace uses of Nullable<PersistenceType> type with PersistenceScope; r=dom-storage-reviewers,jari
Nullable<PersistenceType> only allows to specify a concrete persistence type or
all persistence types while PersistenceScope is intended to allow specification
of multiple persistence types as well. Support for that will be added in a
separate patch. This patch is about using the new type especially in directory
locks.

Differential Revision: https://phabricator.services.mozilla.com/D195373
2024-08-14 12:46:14 +00:00
Jan Varga
0d373bc154 Bug 1906041 - Rename Ensure(Persistent|Temporary)OriginIsInitialized to Ensure(Persistent|Temporary)OriginIsInitializedInternal; r=dom-storage-reviewers,jari
One of the goals of the asynchronous temporary storage initialization is to
call Ensure(Persistent|Temporary)OriginIsInitialized only from
Initialize(Persistent|Temporary)OriginOp. Calling from other places including
quota clients will be disallowed by changing the method to a private method.
The private nature of the method should be emphasized by adding the Internal
suffix.

Differential Revision: https://phabricator.services.mozilla.com/D192150
2024-07-16 10:43:40 +00:00
Jan Varga
0de36a844f Bug 1906041 - Simplify signature of QuotaManager::EnsureTemporaryOriginIsInitialized; r=dom-storage-reviewers,jari
EnsureTemporaryOriginIsInitialized currently takes two separate arguments which
can be expressed as just one argument.

Differential Revision: https://phabricator.services.mozilla.com/D192149
2024-07-16 10:43:39 +00:00
Jan Varga
ebd2245035 Bug 1889563 - Bring back debug only slowing down of connection pool threads; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D206589
2024-07-11 06:36:09 +00:00
Jan Varga
c9d406bb7a Bug 1903806 - Clean up directory lock dropping in Maintenance and DatabaseMaintenance; r=dom-storage-reviewers,aiunusov
Maintenance::Abort and DatabaseMaintenance::Abort should not drop any directory
locks. Only Maintenance::Finish and DatabaseMaintenance::RunOnOwningThread are
responsible for cleanup activities like this.
The directory lock for initial collection of databases held by Maintenanace is
normally dropped by BeginDatabaseMaintenance, but if something fails (in any
method), Maintenance::Finish will do the cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D215088
2024-06-28 14:13:45 +00:00
Jan Varga
7850cdbb8f Bug 1903387 - Always check and eventually drop directory lock in Maintenance::Finish; r=dom-storage-reviewers,jstutte
It can happen that DirectoryOpen call in Maintenance::DirectoryLockAcquired
fails or Maintenance::DirectoryWork method fails or
Maintenance::BeginDatabaseMaintenance method fails which results in
Maintenance::Finish being called with not null mDirectoryLock and that
the directory lock hasn't been dropped in Maintenance::BeginDatabaseMaintenance.
Maintenance::Finish should always check and eventually drop the directory lock
instead of relying on Maintenance::BeginDatabaseMaintenance to drop it.
We still want to drop it as soon as possible in
Maintenance::BeginDatabaseMaintenance so other storage operations are not
blocked by the directory lock covering all idb folders for all repositories.

Differential Revision: https://phabricator.services.mozilla.com/D214388
2024-06-20 23:37:52 +00:00
Jan Varga
381e78c9df Bug 1888878 - Add nsIIndexedDatabaseManager::DoMaintenance; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D206256
2024-06-20 17:27:10 +00:00
Jan Varga
47f5cd1d79 Bug 1888878 - Add QuotaClient::DoMaintenance; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D206223
2024-06-20 07:28:39 +00:00
Jan Varga
530773f7eb Bug 1888878 - Add Maintenance::OnResults; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D206222
2024-06-20 07:28:38 +00:00
Jan Varga
990995f746 Bug 1883045 - Handle IDBTransaction durability hints; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D204868
2024-06-19 13:46:35 +00:00
Jan Varga
d23f2205b4 Bug 1903169 - Drop directory lock only when GetDatabasesOp owns one; r=dom-storage-reviewers,aiunusov
Differential Revision: https://phabricator.services.mozilla.com/D214070
2024-06-18 13:01:45 +00:00
Jan Varga
e87e849e0f Bug 1883353 - Require to always drop directory locks explicitly; r=dom-storage-reviewers,jari
Until now, directory locks were dropped when the last strong reference was
removed or after calling Drop explicitly. The dependency on ref-counting makes
it less obvious when directory locks are dropped for real and it's also
difficult to release them asynchronously eventually. This patch removes the
directory lock unregistration from the destructor, so from now on, directory
locks must be always dropped explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D197294
2024-06-14 07:21:24 +00:00
Jan Varga
5d83d05147 Bug 1892875 - Schedule sending of results after releasing current runnable; r=dom-storage-reviewers,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D212525
2024-06-14 06:51:21 +00:00
Jens Stutte
a81d226888 Bug 1891936 - Have explicit grace timeout settings for the IndexedDB thread pool. r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D209194
2024-06-01 09:05:54 +00:00
Jens Stutte
53e1705e16 Bug 1891664 - Have a grace timeout before shutting down excess idle threads. r=xpcom-reviewers,necko-reviewers,dom-storage-reviewers,nika,janv,jesup#!xpcom-reviewers
Have idleThreadGraceTimeout and idleThreadMaximumTimeout instead of just idleThreadTimeout.
Clarify that idleThreadMaximumTimeout is only affecting allowed idle threads.
Make idle threads end only after at minimum idleThreadGraceTimeout even if they are in excess.
Remove the idleThreadTimeoutRegressive setting.

Introduce a "most recently used" priority for notifying idle threads to
avoid excessive round-robin through all available idle threads.
The management of the linked list has constant time, adding thus only
minimal overhead wrt to the previous wasIdle flags we had.

As a side effect (and coming from the investigations in bug 1891732) to
some extent this can help to improve the "logical thread affinity",
together with trying to keep events dispatched with NS_DISPATCH_AT_END
on the dispatching thread as much as possible, which should help
TaskQueue a lot with affinity.

Differential Revision: https://phabricator.services.mozilla.com/D209884
2024-06-01 09:05:53 +00:00
Jens Stutte
b69b975e29 Bug 1863560 - Relax mClosed check to warning only in Database::RecvBlocked. r=dom-storage-reviewers,aiunusov,janv
Differential Revision: https://phabricator.services.mozilla.com/D211717
2024-05-27 11:52:57 +00:00
Jari Jalkanen
3f212919f2 Bug 1404276 - Support IDB key extraction with autoincremented primary key. r=dom-storage-reviewers,janv
This patch is originally authored by Bevis Tseng.

Differential Revision: https://phabricator.services.mozilla.com/D204361
2024-04-08 15:25:27 +00:00
Jari Jalkanen
bdeadb32ac Bug 1791767 - Use task queues on nsThreadPool for IDB connections. r=dom-storage-reviewers,janv
With this patch, IDB connection pool begins to run transactions and idle maintenance on task queue event targets on top of a thread pool. The underlying thread pool will take over all thread management.

Differential Revision: https://phabricator.services.mozilla.com/D191296
2024-04-03 14:41:53 +00:00
Cristian Tuns
b7957e544a Backed out 2 changesets (bug 1791767) for causing build bustages in ActorsParent.cpp CLOSED TREE
Backed out changeset 01eef2ce9d20 (bug 1791767)
Backed out changeset df9f354630cf (bug 1791767)
2024-04-02 11:42:55 -04:00
Jari Jalkanen
c3512cb860 Bug 1791767 - Use task queues on nsThreadPool for IDB connections. r=dom-storage-reviewers,janv
With this patch, IDB connection pool begins to run transactions and idle maintenance on task queue event targets on top of a thread pool. The underlying thread pool will take over all thread management.

Differential Revision: https://phabricator.services.mozilla.com/D191296
2024-04-02 12:42:29 +00:00
Jan Varga
a3b830f02b Bug 1888006 - Allow one single factory operation to block multiple factory operations; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D206193
2024-04-01 18:16:51 +00:00
Jan Varga
39166cad12 Bug 1888006 - Allow Maintenance::WaitForCompletion to be called multiple times; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D205829
2024-03-28 05:31:37 +00:00
Jari Jalkanen
9b668cc088 Bug 1878143 - Add durability hint to IDB transaction properties. r=dom-storage-reviewers,webidl,saschanaz,janv,smaug
Differential Revision: https://phabricator.services.mozilla.com/D202732
2024-03-27 17:34:01 +00:00
Jan Varga
d755186948 Bug 934640 - Save current database versions for already touched databases before GetDatabaseOp gets unblocked by an existing factory operation; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190199
2024-03-25 10:54:34 +00:00
Jan Varga
6a00e6f225 Bug 934640 - Implement IDBFactory.databases() to enumerate IndexedDB databases; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190053
2024-03-25 10:54:33 +00:00
Jan Varga
01d34a4d7c Bug 934640 - Add database version to database file managers; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D190052
2024-03-25 10:54:32 +00:00
Jan Varga
628bc93770 Bug 934640 - Add a way to get database file managers by database file path; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D190049
2024-03-25 10:54:31 +00:00
Jan Varga
d5b5c3d711 Bug 934640 - Add support for factory operations which are not tied up with a specific database; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D188979
2024-03-25 10:54:30 +00:00
Jan Varga
98f7fe1faf Bug 934640 - Create a new base for factory operations communicating using PBackgroundIDBFactoryRequest; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D188975
2024-03-25 10:54:30 +00:00
Jan Varga
290c4ef7ac Bug 1799374 - Start using request ids for deciding if an explicitly committed transaction needs to be aborted; r=dom-storage-reviewers,asuth
Explicitly committed transactions are aborted in case of a failed request. This
is achieved by tracking order of requests. The order of requests is currently
tracked by storing request serial numbers. However, request serial numbers are
not always in sync between parent and child, so they are only suitable for
logging purposes. This patch switches from request serial numbers to request
ids which are only generated by the child side and thus always in sync between
parent and child.

Differential Revision: https://phabricator.services.mozilla.com/D204200
2024-03-24 00:52:04 +00:00
Jan Varga
fd37799016 Bug 1799374 - Add support for tracking request ids to cursor continue operation; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D204195
2024-03-23 08:42:40 +00:00
Jan Varga
8047aa1ecd Bug 1799374 - Add support for tracking request ids to cursor opening operation; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D204193
2024-03-23 08:42:40 +00:00
Jan Varga
be2e9f5ac4 Bug 1799374 - Add support for tracking request ids to normal transaction operations; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D204192
2024-03-23 08:42:40 +00:00
Jan Varga
0eaa021e33 Bug 1799374 - Add initial support for tracking request ids; r=dom-storage-reviewers,asuth
This patch adds only new member variables, actual support for sending ids will
be added in individual patches (all ids are set to zero for now). The idea is
to have only one source of truth, so an id used in the parent and child is
always the same.

Differential Revision: https://phabricator.services.mozilla.com/D204025
2024-03-23 08:42:39 +00:00
Jens Stutte
3d898a3c72 Bug 1863129 - Discard pending file deletions on shutdown but block shutdown for running deletions. r=dom-storage-reviewers,janv
In case we did start a DeleteFilesRunnable before shutdown we should ensure it is going to be executed before we leave our QM shutdown barrier, but we can ignore pending but not yet started deletions completely as PBM origins are deleted entirely by other means.

Differential Revision: https://phabricator.services.mozilla.com/D203502
2024-03-18 13:57:53 +00:00
Jari Jalkanen
d80af0af87 Bug 1791767 - Interrupt IDB idle maintenance with atomic flag. r=janv,dom-storage-reviewers,jstutte
Previously, idle maintenance was interrupted whenever a new runnable was
posted to the executing thread. Here we replace this interrupt signal with
an explicit boolean flag in order to support task queue event targets.

Differential Revision: https://phabricator.services.mozilla.com/D165984
2024-03-05 17:44:00 +00:00
Cristian Tuns
7295aff223 Backed out 12 changesets (bug 934640) for causing wpt failures in idb-explicit-commit.any.html CLOSED TREE
Backed out changeset f842e5594224 (bug 934640)
Backed out changeset 3cf1e31d16ba (bug 934640)
Backed out changeset ba85838ef7cd (bug 934640)
Backed out changeset a2769ba4c0ab (bug 934640)
Backed out changeset 3a2af6a310ab (bug 934640)
Backed out changeset 8bbe6f8fb695 (bug 934640)
Backed out changeset 184282e69b59 (bug 934640)
Backed out changeset f3b863806999 (bug 934640)
Backed out changeset ed5bb2e976ef (bug 934640)
Backed out changeset f315683fd3ba (bug 934640)
Backed out changeset 30dbc38c3e9a (bug 934640)
Backed out changeset ef90771d141d (bug 934640)
2024-03-05 13:17:12 -05:00
Jan Varga
402994616e Bug 934640 - Save current database versions for already touched databases before GetDatabaseOp gets unblocked by an existing factory operation; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190199
2024-03-05 13:47:55 +00:00
Jan Varga
8e8e4a1e8d Bug 934640 - Implement IDBFactory.databases() to enumerate IndexedDB databases; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190053
2024-03-05 13:47:54 +00:00
Jan Varga
9c5f94f72c Bug 934640 - Add database version to database file managers; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D190052
2024-03-05 13:47:53 +00:00
Jan Varga
fb4cb9b664 Bug 934640 - Add a way to get database file managers by database file path; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D190049
2024-03-05 13:47:52 +00:00
Jan Varga
5c866369ed Bug 934640 - Add support for factory operations which are not tied up with a specific database; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D188979
2024-03-05 13:47:51 +00:00
Jan Varga
b2c9a27041 Bug 934640 - Create a new base for factory operations communicating using PBackgroundIDBFactoryRequest; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D188975
2024-03-05 13:47:51 +00:00
Norisz Fay
8886f97d29 Backed out changeset 520bd9381f15 (bug 1791767) for causing bustages on ActorsParent.cpp CLOSED TREE 2024-03-05 14:56:43 +02:00
Jari Jalkanen
91a46f13b0 Bug 1791767 - Interrupt IDB idle maintenance with atomic flag. r=janv,dom-storage-reviewers,jstutte
Previously, idle maintenance was interrupted whenever a new runnable was
posted to the executing thread. Here we replace this interrupt signal with
an explicit boolean flag in order to support task queue event targets.

Differential Revision: https://phabricator.services.mozilla.com/D165984
2024-03-05 12:26:48 +00:00
pstanciu
230e61e928 Backed out 12 changesets (bug 934640) for causing xpcshell failures on test_Store.js. CLOSED TREE
Backed out changeset b9130d0d185f (bug 934640)
Backed out changeset f607e117912b (bug 934640)
Backed out changeset 74b616bdd9ca (bug 934640)
Backed out changeset b4ee14550d3c (bug 934640)
Backed out changeset 133d11049a61 (bug 934640)
Backed out changeset 392886344471 (bug 934640)
Backed out changeset 189686b6ccfa (bug 934640)
Backed out changeset 067b6058bf70 (bug 934640)
Backed out changeset 9b5fbc925fe5 (bug 934640)
Backed out changeset 2e53225b5d81 (bug 934640)
Backed out changeset ffdb716cfa3f (bug 934640)
Backed out changeset fb741c8c2cb6 (bug 934640)
2024-03-05 00:13:09 +02:00
Jan Varga
28a0df337d Bug 934640 - Save current database versions for already touched databases before GetDatabaseOp gets unblocked by an existing factory operation; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190199
2024-03-04 17:35:48 +00:00
Jan Varga
40f49ab42c Bug 934640 - Implement IDBFactory.databases() to enumerate IndexedDB databases; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D190053
2024-03-04 17:35:47 +00:00
Jan Varga
f2be125d08 Bug 934640 - Add database version to database file managers; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D190052
2024-03-04 17:35:46 +00:00
Jan Varga
a8ab219e8f Bug 934640 - Add a way to get database file managers by database file path; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D190049
2024-03-04 17:35:45 +00:00