diff options
author | Matthew Sackman <matthew@lshift.net> | 2009-08-24 18:06:58 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2009-08-24 18:06:58 +0100 |
commit | 1efae19ce63d2b91d2952ca523a4bd0e19e5d23e (patch) | |
tree | 38f46f02f64ea91ca98a4a09043c53083cc714b8 | |
parent | 0723bbbf63ed850721c24d1c4d77659a464a8633 (diff) | |
parent | 472d2883ea1bef31909f5476d4655e2f23c6df36 (diff) | |
download | rabbitmq-server-1efae19ce63d2b91d2952ca523a4bd0e19e5d23e.tar.gz |
merge in from default
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | calculate-relative | 2 | ||||
-rw-r--r-- | docs/rabbitmq-multi.1.pod | 2 | ||||
-rw-r--r-- | docs/rabbitmq-server.1.pod | 24 | ||||
-rw-r--r-- | docs/rabbitmq.conf.5.pod | 6 | ||||
-rw-r--r-- | docs/rabbitmqctl.1.pod | 103 | ||||
-rw-r--r-- | packaging/generic-unix/Makefile | 4 | ||||
-rw-r--r-- | packaging/windows/Makefile | 4 | ||||
-rw-r--r-- | src/rabbit_mnesia.erl | 42 |
9 files changed, 84 insertions, 105 deletions
@@ -148,7 +148,7 @@ srcdist: distclean rm -rf $(TARGET_SRC_DIR) distclean: clean - make -C $(AMQP_CODEGEN_DIR) distclean + $(MAKE) -C $(AMQP_CODEGEN_DIR) distclean rm -rf dist find . -regex '.*\(~\|#\|\.swp\|\.dump\)' -exec rm {} \; diff --git a/calculate-relative b/calculate-relative index 3c3e2b1f..3af18e8f 100755 --- a/calculate-relative +++ b/calculate-relative @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # relpath.py # R.Barran 30/08/2004 diff --git a/docs/rabbitmq-multi.1.pod b/docs/rabbitmq-multi.1.pod index 23fd96ed..63848756 100644 --- a/docs/rabbitmq-multi.1.pod +++ b/docs/rabbitmq-multi.1.pod @@ -21,7 +21,7 @@ See also rabbitmq-server(1) for configuration information. start_all I<count> start count nodes with unique names, listening on all IP addresses - and on sequential ports starting from 5672. +and on sequential ports starting from 5672. status print the status of all running RabbitMQ nodes diff --git a/docs/rabbitmq-server.1.pod b/docs/rabbitmq-server.1.pod index 99a7cecc..04062b1a 100644 --- a/docs/rabbitmq-server.1.pod +++ b/docs/rabbitmq-server.1.pod @@ -21,34 +21,32 @@ process or use rabbitmqctl(1). =head1 ENVIRONMENT B<RABBITMQ_MNESIA_BASE> - Defaults to /var/lib/rabbitmq/mnesia. Set this to the directory - where Mnesia database files should be placed. + Defaults to /var/lib/rabbitmq/mnesia. Set this to the directory +where Mnesia database files should be placed. B<RABBITMQ_LOG_BASE> Defaults to /var/log/rabbitmq. Log files generated by the server - will be placed in this directory. +will be placed in this directory. B<RABBITMQ_NODENAME> Defaults to rabbit. This can be useful if you want to run more - than one node per machine - B<RABBITMQ_NODENAME> should be unique - per erlang-node-and-machine combination. See clustering on a - single machine guide at - http://www.rabbitmq.com/clustering.html#single-machine for - details. +than one node per machine - B<RABBITMQ_NODENAME> should be unique per +erlang-node-and-machine combination. See clustering on a single +machine guide at +http://www.rabbitmq.com/clustering.html#single-machine for details. B<RABBITMQ_NODE_IP_ADDRESS> Defaults to 0.0.0.0. This can be changed if you only want to bind - to one network interface. +to one network interface. B<RABBITMQ_NODE_PORT> Defaults to 5672. B<RABBITMQ_CLUSTER_CONFIG_FILE> Defaults to /etc/rabbitmq/rabbitmq_cluster.config. If this file is - present it is used by the server to auto-configure a RabbitMQ - cluster. - See the clustering guide at http://www.rabbitmq.com/clustering.html - for details. +present it is used by the server to auto-configure a RabbitMQ cluster. +See the clustering guide at http://www.rabbitmq.com/clustering.html +for details. =head1 OPTIONS diff --git a/docs/rabbitmq.conf.5.pod b/docs/rabbitmq.conf.5.pod index 9b2536c3..4d522163 100644 --- a/docs/rabbitmq.conf.5.pod +++ b/docs/rabbitmq.conf.5.pod @@ -18,12 +18,12 @@ built-in default values. For example, for the B<RABBITMQ_NODENAME> setting, B<RABBITMQ_NODENAME> from the environment is checked first. If it is absent or equal to - the empty string, then +the empty string, then B<NODENAME> from /etc/rabbitmq/rabbitmq.conf is checked. If it is also absent - or set equal to the empty string then the default value from - the startup script is used. +or set equal to the empty string then the default value from the +startup script is used. The variable names in /etc/rabbitmq/rabbitmq.conf are always equal to the environment variable names, with the B<RABBITMQ_> prefix removed: diff --git a/docs/rabbitmqctl.1.pod b/docs/rabbitmqctl.1.pod index 42156896..58fbb100 100644 --- a/docs/rabbitmqctl.1.pod +++ b/docs/rabbitmqctl.1.pod @@ -20,16 +20,16 @@ It performs all actions by connecting to one of the broker's nodes. B<-n> I<node> default node is C<rabbit@server>, where server is the local host. - On a host named C<server.example.com>, the node name of the - RabbitMQ Erlang node will usually be rabbit@server (unless - RABBITMQ_NODENAME has been set to some non-default value at broker - startup time). The output of hostname -s is usually the correct - suffix to use after the "@" sign. See rabbitmq-server(1) for - details of configuring the RabbitMQ broker. +On a host named C<server.example.com>, the node name of the RabbitMQ +Erlang node will usually be rabbit@server (unless RABBITMQ_NODENAME +has been set to some non-default value at broker startup time). The +output of hostname -s is usually the correct suffix to use after the +"@" sign. See rabbitmq-server(1) for details of configuring the +RabbitMQ broker. B<-q> - quiet output mode is selected with the B<-q> flag. Informational - messages are suppressed when quiet mode is in effect. + quiet output mode is selected with the B<-q> flag. Informational +messages are suppressed when quiet mode is in effect. =head1 COMMANDS @@ -40,53 +40,51 @@ stop stop_app stop the RabbitMQ application, leaving the Erlang node running. - This command is typically run prior to performing other management - actions that require the RabbitMQ application to be stopped, - e.g. I<reset>. +This command is typically run prior to performing other management +actions that require the RabbitMQ application to be stopped, +e.g. I<reset>. start_app start the RabbitMQ application. This command is typically run prior to performing other management - actions that require the RabbitMQ application to be stopped, - e.g. I<reset>. +actions that require the RabbitMQ application to be stopped, +e.g. I<reset>. status display various information about the RabbitMQ broker, such as - whether the RabbitMQ application on the current node, its version - number, what nodes are part of the broker, which of these are - running. +whether the RabbitMQ application on the current node, its version +number, what nodes are part of the broker, which of these are running. -force +reset return a RabbitMQ node to its virgin state. Removes the node from any cluster it belongs to, removes all data - from the management database, such as configured users, vhosts and - deletes all persistent messages. +from the management database, such as configured users, vhosts and +deletes all persistent messages. force_reset - the same as I<force> command, but resets the node unconditionally, - regardless of the current management database state and cluster - configuration. + the same as I<reset> command, but resets the node unconditionally, +regardless of the current management database state and cluster +configuration. It should only be used as a last resort if the database or cluster - configuration has been corrupted. +configuration has been corrupted. rotate_logs [suffix] instruct the RabbitMQ node to rotate the log files. The RabbitMQ - broker will attempt to append the current contents of the log file - to the file with the name composed of the original name and the - suffix. It will create a new file if such a file does not already - exist. When no I<suffix> is specified, the empty log file is - simply created at the original location; no rotation takes place. - When an error occurs while appending the contents of the old log - file, the operation behaves in the same way as if no I<suffix> was - specified. +broker will attempt to append the current contents of the log file to +the file with the name composed of the original name and the +suffix. It will create a new file if such a file does not already +exist. When no I<suffix> is specified, the empty log file is simply +created at the original location; no rotation takes place. When an +error occurs while appending the contents of the old log file, the +operation behaves in the same way as if no I<suffix> was specified. This command might be helpful when you are e.g. writing your own - logrotate script and you do not want to restart the RabbitMQ node. +logrotate script and you do not want to restart the RabbitMQ node. cluster I<clusternode> ... instruct the node to become member of a cluster with the specified - nodes determined by I<clusternode> option(s). - See http://www.rabbitmq.com/clustering.html for more information - about clustering. +nodes determined by I<clusternode> option(s). See +http://www.rabbitmq.com/clustering.html for more information about +clustering. =head2 USER MANAGEMENT @@ -110,35 +108,35 @@ add_vhost I<vhostpath> delete_vhost I<vhostpath> delete a virtual host I<vhostpath>. That command deletes also all its exchanges, queues and user - mappings. +mappings. list_vhosts list all virtual hosts. set_permissions [-p I<vhostpath>] I<username> I<regexp> I<regexp> I<regexp> set the permissions for the user named I<username> in the virtual - host I<vhostpath>, granting 'configure', 'write' and 'read' access - to resources with names matching the first, second and third - I<regexp>, respectively. +host I<vhostpath>, granting 'configure', 'write' and 'read' access to +resources with names matching the first, second and third I<regexp>, +respectively. clear_permissions [-p I<vhostpath>] I<username> remove the permissions for the user named I<username> in the - virtual host I<vhostpath>. +virtual host I<vhostpath>. list_permissions [-p I<vhostpath>] list all the users and their permissions in the virtual host - I<vhostpath>. +I<vhostpath>. list_user_permissions I<username> list the permissions of the user named I<username> across all - virtual hosts. +virtual hosts. =head2 SERVER STATUS list_queues [-p I<vhostpath>] [I<queueinfoitem> ...] list queue information by virtual host. If no I<queueinfoitem>s - are specified then then name and number of messages is displayed - for each queue. +are specified then then name and number of messages is displayed for +each queue. =head3 Queue information items @@ -163,8 +161,7 @@ messages_ready number of messages ready to be delivered to clients messages_unacknowledged - number of messages delivered to clients but not yet - acknowledged + number of messages delivered to clients but not yet acknowledged messages_uncommitted number of messages published in as yet uncommitted transactions @@ -174,7 +171,7 @@ messages acks_uncommitted number of acknowledgements received in as yet uncommitted - transactions +transactions consumers number of consumers @@ -184,14 +181,14 @@ transactions memory bytes of memory consumed by the Erlang process for the queue, - including stack, heap and internal structures +including stack, heap and internal structures =back list_exchanges [-p I<vhostpath>] [I<exchangeinfoitem> ...] list exchange information by virtual host. If no - I<exchangeinfoitem>s are specified then name and type is displayed - for each exchange. +I<exchangeinfoitem>s are specified then name and type is displayed for +each exchange. =head3 Exchange information items @@ -216,11 +213,11 @@ arguments list_bindings [-p I<vhostpath>] list bindings by virtual host. Each line contains exchange name, - routing key and queue name (all URL encoded) and arguments. +routing key and queue name (all URL encoded) and arguments. list_connections [I<connectioninfoitem> ...] list connection information. If no I<connectioninfoitem>s are - specified then the user, peer address and peer port are displayed. +specified then the user, peer address and peer port are displayed. =head3 Connection information items @@ -243,7 +240,7 @@ peer_port state connection state (B<pre-init>, B<starting>, B<tuning>, B<opening>, - B<running>, B<closing>, B<closed>) +B<running>, B<closing>, B<closed>) channels number of channels using the connection diff --git a/packaging/generic-unix/Makefile b/packaging/generic-unix/Makefile index b3988696..4eade6c7 100644 --- a/packaging/generic-unix/Makefile +++ b/packaging/generic-unix/Makefile @@ -4,10 +4,10 @@ TARGET_DIR=rabbitmq_server-$(VERSION) TARGET_TARBALL=rabbitmq-server-generic-unix-$(VERSION) dist: - make -C ../.. VERSION=$(VERSION) srcdist + $(MAKE) -C ../.. VERSION=$(VERSION) srcdist tar -zxvf ../../dist/$(SOURCE_DIR).tar.gz - make -C $(SOURCE_DIR) \ + $(MAKE) -C $(SOURCE_DIR) \ TARGET_DIR=`pwd`/$(TARGET_DIR) \ SBIN_DIR=`pwd`/$(TARGET_DIR)/sbin \ MAN_DIR=`pwd`/$(TARGET_DIR)/share/man \ diff --git a/packaging/windows/Makefile b/packaging/windows/Makefile index 28f79319..387becb3 100644 --- a/packaging/windows/Makefile +++ b/packaging/windows/Makefile @@ -4,9 +4,9 @@ TARGET_DIR=rabbitmq_server-$(VERSION) TARGET_ZIP=rabbitmq-server-windows-$(VERSION) dist: - make -C ../.. VERSION=$(VERSION) srcdist + $(MAKE) -C ../.. VERSION=$(VERSION) srcdist tar -zxvf ../../dist/$(SOURCE_DIR).tar.gz - make -C $(SOURCE_DIR) + $(MAKE) -C $(SOURCE_DIR) mkdir $(SOURCE_DIR)/sbin mv $(SOURCE_DIR)/scripts/rabbitmq-server.bat $(SOURCE_DIR)/sbin diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 56d02f33..95549a73 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -152,16 +152,13 @@ table_definitions() -> {local_content, true}]} ]. -replicated_table_definitions() -> - [{Tab, Attrs} || {Tab, Attrs} <- table_definitions(), - not lists:member({local_content, true}, Attrs) - ]. - table_names() -> [Tab || {Tab, _} <- table_definitions()]. replicated_table_names() -> - [Tab || {Tab, _} <- replicated_table_definitions()]. + [Tab || {Tab, Attrs} <- table_definitions(), + not lists:member({local_content, true}, Attrs) + ]. dir() -> mnesia:system_info(directory). @@ -278,7 +275,7 @@ init_db(ClusterNodes) -> IsDiskNode = ClusterNodes == [] orelse lists:member(node(), ClusterNodes), ok = wait_for_replicated_tables(), - ok = create_local_table_copy(schema, false, undefined, disc_copies), + ok = create_local_table_copy(schema, disc_copies), ok = create_local_table_copies(case IsDiskNode of true -> disc; false -> ram @@ -334,30 +331,21 @@ create_tables() -> ok. table_has_copy_type(TabDef, DiscType) -> - case lists:keysearch(DiscType, 1, TabDef) of - false -> false; - {value, {DiscType, List}} -> lists:member(node(), List) - end. - -is_local_content_table(TabDef) -> - case lists:keysearch(local_content, 1, TabDef) of - false -> false; - {value, {local_content, Bool}} -> Bool - end. + lists:member(node(), proplists:get_value(DiscType, TabDef, [])). create_local_table_copies(Type) -> lists:foreach( fun({Tab, TabDef}) -> - HasDiscCopies = table_has_copy_type(TabDef, disc_copies), + HasDiscCopies = table_has_copy_type(TabDef, disc_copies), HasDiscOnlyCopies = table_has_copy_type(TabDef, disc_only_copies), - LocalTab = is_local_content_table(TabDef), + LocalTab = proplists:get_bool(local_content, TabDef), StorageType = if Type =:= disc orelse LocalTab -> if - HasDiscCopies -> disc_copies; + HasDiscCopies -> disc_copies; HasDiscOnlyCopies -> disc_only_copies; - true -> ram_copies + true -> ram_copies end; %% unused code - commented out to keep dialyzer happy %% Type =:= disc_only -> @@ -369,30 +357,26 @@ create_local_table_copies(Type) -> Type =:= ram -> ram_copies end, - ok = create_local_table_copy(Tab, TabDef, LocalTab, StorageType) + ok = create_local_table_copy(Tab, StorageType) end, table_definitions()), ok. -create_local_table_copy(Tab, TabDef, LocalTab, Type) -> +create_local_table_copy(Tab, Type) -> StorageType = mnesia:table_info(Tab, storage_type), {atomic, ok} = if StorageType == unknown -> mnesia:add_table_copy(Tab, node(), Type); - LocalTab andalso StorageType /= Type andalso Tab /= schema -> - mnesia:create_table(Tab, TabDef); StorageType /= Type -> mnesia:change_table_copy_type(Tab, node(), Type); true -> {atomic, ok} end, ok. -wait_for_replicated_tables() -> - wait_for_tables(replicated_table_names()). +wait_for_replicated_tables() -> wait_for_tables(replicated_table_names()). -wait_for_tables() -> - wait_for_tables(table_names()). +wait_for_tables() -> wait_for_tables(table_names()). wait_for_tables(TableNames) -> case check_schema_integrity() of |