aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src
AgeCommit message (Collapse)Author
2015-09-10mnesia: Improve index updatesDan Gudmundsson
There is no need to update the index table if a record is updated in non indexed field. This removes one timing glitch where dirty_index_read would return an empty list for records that where updated. There is still an issue with dirty_index_read when updates are made to the index field, it have been reduced but the real table updates are made after the index table references have been added. Originally reported by Nick Marino in erl-questions mailing list, thanks.
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-16Revert "Add number of entries to mnesia copy debug message"Björn-Egil Dahlberg
This reverts commit baad9722c84ecb41d2278ac9912d30e42c3b4409.
2015-06-08Merge branch 'mikpe/mnesia-openlog-emfile'Henrik Nord
* mikpe/mnesia-openlog-emfile: mnesia: don't delete log file on emfile error OTP-12807
2015-05-31mnesia: don't delete log file on emfile errorMikael Pettersson
If the VM runs into the process' file descriptor limit when mnesia tries to open (not create) a disk_log file, the open fails with an emfile error. Mnesia misinterprets this as a corrupt file, deletes it, tries to create a new empty disk_log file, which also fails. The end result is a corrupt database on disk. Check for emfile errors and error out immediately without deleting the file in those cases.
2015-05-06mnesia: dirty error messages did not behave as documentedDan Gudmundsson
The docs express that exit({aborted, Reason}) are called when an error occur.
2015-03-27Merge branch 'dgud/mnesia/try-catch'Dan Gudmundsson
* dgud/mnesia/try-catch: mnesia: Replace catch with try-catch
2015-03-27mnesia: Replace catch with try-catchDan Gudmundsson
Avoids building stacktraces where it is not needed and do not mask errors, i.e. only catch the relevant classes in each try.
2015-03-20Merge branch 'rickard/time_api/OTP-11997'Rickard Green
* rickard/time_api/OTP-11997: (22 commits) Update primary bootstrap inets: Suppress deprecated warning on erlang:now/0 inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules inets: Update comments Suppress deprecated warning on erlang:now/0 Use new time API and be back-compatible in inets Remove unused functions and removed redundant test asn1 test SUITE: Eliminate use of now/0 Disable deprecated warning on erlang:now/0 in diameter_lib Use new time API and be back-compatible in ssh Replace all calls to now/0 in CT with new time API functions test_server: Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API otp_SUITE: Warn for calls to erlang:now/0 Replace usage of erlang:now() with usage of new API Multiple timer wheels Erlang based BIF timer implementation for scalability Implement ethread events with timeout ... Conflicts: bootstrap/bin/start.boot bootstrap/bin/start_clean.boot bootstrap/lib/compiler/ebin/beam_asm.beam bootstrap/lib/compiler/ebin/compile.beam bootstrap/lib/kernel/ebin/auth.beam bootstrap/lib/kernel/ebin/dist_util.beam bootstrap/lib/kernel/ebin/global.beam bootstrap/lib/kernel/ebin/hipe_unified_loader.beam bootstrap/lib/kernel/ebin/inet_db.beam bootstrap/lib/kernel/ebin/inet_dns.beam bootstrap/lib/kernel/ebin/inet_res.beam bootstrap/lib/kernel/ebin/os.beam bootstrap/lib/kernel/ebin/pg2.beam bootstrap/lib/stdlib/ebin/dets.beam bootstrap/lib/stdlib/ebin/dets_utils.beam bootstrap/lib/stdlib/ebin/erl_tar.beam bootstrap/lib/stdlib/ebin/escript.beam bootstrap/lib/stdlib/ebin/file_sorter.beam bootstrap/lib/stdlib/ebin/otp_internal.beam bootstrap/lib/stdlib/ebin/qlc.beam bootstrap/lib/stdlib/ebin/random.beam bootstrap/lib/stdlib/ebin/supervisor.beam bootstrap/lib/stdlib/ebin/timer.beam erts/aclocal.m4 erts/emulator/beam/bif.c erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_db_hash.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_thr_progress.c erts/emulator/beam/utils.c erts/emulator/sys/unix/sys.c erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam erts/preloaded/src/erts_internal.erl lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl lib/diameter/src/base/diameter_lib.erl lib/kernel/src/os.erl lib/ssh/test/ssh_basic_SUITE.erl system/doc/efficiency_guide/advanced.xml
2015-03-20Replace usage of erlang:now() with usage of new APIDan Gudmundsson
2015-03-20Replace usage of erlang:now() with usage of new APIRickard Green
2015-03-11Merge branch 'maint'Dan Gudmundsson
* maint: mnesia: Flush late messages Add Debug info mnesia: better debug info when tests fail mnesia: Ensure tables are loaded before testing them
2015-03-11Merge branch 'dgud/testcasecuddle' into maintDan Gudmundsson
* dgud/testcasecuddle: mnesia: Flush late messages Add Debug info mnesia: better debug info when tests fail mnesia: Ensure tables are loaded before testing them
2015-02-23mnesia: Flush late messagesDan Gudmundsson
2015-02-11Merge branch 'richcarl/dcd-dumps'Zandra Hird
* richcarl/dcd-dumps: Make Mnesia DCD dump behaviour available via API Make Mnesia DCD dump behaviour available via configuration OTP-12481
2015-02-10mnesia: Check nodes after protocol negotiationJean-Sébastien Pédron
During Mnesia startup, after protocol negotiation, the list of connected nodes is written to "recover_nodes". This list is later used to merge the schema. If Mnesia was stopped on a remote node between the protocol negotiation and the moment the list is stored in "recover_nodes", the remote node is still considered running: the value of "recover_nodes" stored during mnesia_down/1 is overwritten. Therefore, this node may be used to acquire a write lock on the schema in order to perform the merge. In this case, the remote node never answers to the lock request and Mnesia hang forever (application:start(mnesia) never returns). To fix the problem, we check the list one last time and remove from it all nodes where Mnesia is stopped. And because there is still a chance for missing mnesia_down event, handle_cast({mnesia_down, ...}, ...) writes to recover_nodes again, in addition to mnesia_down/1.
2014-12-22Make Mnesia DCD dump behaviour available via APIUlf Wiger
If a DCD dump is desired on-demand, use the function mnesia_controller:snapshot_dcd(Tables). Tables must be a list of tables that have a local disc_copy, otherwise an error will be returned. Once the operation actually executes, any table that doesn't have a local disc_copy is ignored. Specifically, the dump_log worker record has been changed to allow an arity-0 fun instead of the default log dump. This fun will be executed as if it were a normal log dump, and must return 'dumped'. This could also be used to e.g. insert a backup operation between log dumps.
2014-12-22Make Mnesia DCD dump behaviour available via configurationUlf Wiger
Setting the new Mnesia parameter 'dump_disc_copies_at_startup' to 'false' will completely disable the DCD dumping while tables are being loaded. If it is set to 'true' (the default), the same test will now be performed as for normal dumps, i.e., using the 'dc_dump_limit' parameter. Previously, the test performed at load time was different from the one used at runtime, and caused a lot of unnecessary dumping which slowed down the startup.
2014-11-12mnesia: Fix match_object bugDan Gudmundsson
match_object returned wrong objects when matching on non key fields and updates in the same transaction had been performed.
2014-09-01Merge branch 'maint-17' into maintMarcus Arendt
Conflicts: OTP_VERSION
2014-08-28Avoid timing issue in schema transaction when node is stoppingDan Gudmundsson
By doing an abort, the create_table can be restarted if a node go down during the transaction. {badarg, [{erlang,link,[undefined],[]}, {mnesia_controller, wait_for_schema_commit_lock,0, [{file,"mnesia_controller.erl"}, {line,303}]}, {mnesia_schema,prepare_commit,3, [{file,"mnesia_schema.erl"}, {line,1838}]}, {mnesia_tm,commit_participant,6, [{file,"mnesia_tm.erl"}, {line,1669}]}]}}},
2014-08-25Fix misspellings of 'another'Tuncer Ayaz
2014-08-21Merge branch 'nox/reedr-logging/OTP-12115' into maintLukas Larsson
* nox/reedr-logging/OTP-12115: Add number of entries to mnesia copy debug message Add thread index to allocator enomem dump slogan Add run queue index to process dump info Add missing error string to syslog logging in epmd Demote rare debug slogan of message discarding to debug build
2014-08-14Add number of entries to mnesia copy debug messageRick Reed
2014-06-16Merge branch 'gorillainduction/improve_mnesia_locker_complexity' into maintHenrik Nord
* gorillainduction/improve_mnesia_locker_complexity: Optimize tid lock table OTP-11981
2014-05-26Optimize tid lock tableTobias Lindahl
By making the ets table mnesia_tid_locks an ordered set instead of a bag, the time for inserting locks for a transaction with large number of locks is reduced significantly.
2014-05-26Merge branch 'dgud/mnesia/timing-issue' into maintDan Gudmundsson
* dgud/mnesia/timing-issue: mnesia: Fix timing issue
2014-05-26Merge branch 'dgud/mnesia/force-load-hangs/OTP-11948' into maintDan Gudmundsson
* dgud/mnesia/force-load-hangs/OTP-11948: mnesia: Handle failed net_loads better
2014-04-24mnesia: Handle failed net_loads betterDan Gudmundsson
In case of a failed net load and no more available copies, remove the table from late_load_queue, otherwise tables can not be forced loaded.
2014-04-11mnesia: Fix timing issueDan Gudmundsson
Be sure to gather release_tid msgs even though we have a mnesia_down in the queue.
2014-03-28mnesia: Dialyzer fixesDan Gudmundsson
2014-03-20Introduce runtime_dependencies in .app filesRickard Green
Most dependencies introduced are exactly the dependencies to other applications found by xref. That is, there might be real dependencies missing. There might also be pure debug dependencies listed that probably should be removed. Each application has to be manually inspected in order to ensure that all real dependencies are listed. All dependencies introduced are to application versions used in OTP 17.0. This since the previously used version scheme wasn't designed for this, and in order to minimize the work of introducing the dependencies.
2014-02-20mnesia: cleanup some dialyzer unmatched return warningsDan Gudmundsson
2014-02-20mnesia: Improve mnesia coredump infoDan Gudmundsson
Add stacktrace of mnesia processes.
2014-02-20mnesia: Add explicit sync_log commandDan Gudmundsson
For performance reasons the file data is not synced to disk in mnesia, data loss can happen between each dump. mnesia:dump_log() can be used explicitly to ensure data is written to disk. But that can take a long time, so mnesia:sync_log() which just sync the log have been added.
2013-12-02Merge branch 'maint'Dan Gudmundsson
2013-11-29mnesia: Fix dirty_update bug when subscriber existsDan Gudmundsson
dirty_update_counter returned the wrong value when a subscriber existed and no events was sent. Thanks Anton Ryabkov.
2013-11-29Merge branch 'maint'Dan Gudmundsson
Conflicts: erts/etc/win32/Install.c
2013-11-28Fix race condition in mnesia_monitorJonas Falkevik
Mnesia_monitor detect mnesia down using a remote process link and net_kernel nodeup to detect that a node are reacable again. If there is a short node communication problem. The node-down and node-up events can happen before the remotely linked process generates an 'EXIT'. When node-down and node-up events are recevied they are stored and later checked if the node came up just before mnesia flagged the node as down.
2013-11-25mnesia: Synchronize lock cleanup after mnesia downDan Gudmundsson
Bad timing could lead to hanging transactions after a mnesia down from a node with sticky locks. Excellent bug report from janchochol Situation: * node A and B have copies of table T * node A ows sticky of table T * node A goes down (e.g. crash) * node B tries to perform transactional operation on table T (e.g. mnesia:select) In this situation there is possibility that first (and maybe other) transaction on node B will hang indefinitely. This is caused by race condition, when transaction process send lock request operation to node A and waits for reply. When node A is down it will never send reply, so process on node B will be stuck forever. Reason is that message sent to mnesia_locker gen_server from mnesia_locker:mnesia_down can be received after mnesia_locker gen_server already replies to transaction processes with {switch, N, Req} and node N is down. Monitoring remote process when sending request to other node should be safe solution.
2013-08-29mnesia: Checkpoint fixDan Gudmundsson
Avoid hanging waiting for other processes on other node to commit.
2013-08-29mnesia: Improve checkpoint activationDan Gudmundsson
Fixed a race where some parts of a transaction could be added to the checkpoint. There are probably more races here but this improves the current testcases.
2013-08-29mnesia: Cleanup and remove obsolete codeDan Gudmundsson
We don't support communicating with such old nodes anyway.
2013-08-16mnesia: fix removal of bup file if not mnesia is startedFredrik Gustafsson
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-06-04mnesia: Fix unsubscribe error handlingDan Gudmundsson
2013-05-17Merge branch 'nm/mnesia_idx_insert_speedup/OTP-11103' into maintFredrik Gustafsson
* nm/mnesia_idx_insert_speedup/OTP-11103: Fix missing case clause for ordered_set tables Optimize index creation for Mnesia set tables
2013-04-24Fix missing case clause for ordered_set tablesNick Marino
The previous commit contained a regression that would trigger a crash when attempting to add an index to an Mnesia table of type ordered_set.
2013-04-12Optimize index creation for Mnesia set tablesNick Marino
ETS bag tables have very poor performance on insertion if you have lots of rows with duplicate keys, since it has to check each existing record and make sure it's not inserting any duplicates. This can lead to some pretty drastic slowdowns when inserting lots of rows into an Mnesia table, IF you're introducing lots of duplicate values into an indexed column. As it turns out, we can fix this by switching to duplicate_bag tables for storing Mnesia indexes on tables of type 'set', and it ultimately makes no functional difference since we will never actually attempt to insert any duplicate records anyway. (We would have to make some bigger changes to make this work for Mnesia bag tables though, so that is left as a possible enhancement for the future.)
2013-04-11mnesia: Fixed bad data in tableDan Gudmundsson
If mnesia:cleartable/1 was called during a table_load an schema event with delete and write of that table is sent, which caused the table to contain the schema record instead of clearing the table.