Single User Mode¶
When a server is running in “Single User Mode” it means the availability of the Server is limited.
You may enter “Single User Mode” in scenarios where you are performing maintenance operations such as importing VQL or modifying the settings of the Server. In addition, the Server itself may enter Single User Mode to perform actions that cannot be executed concurrently with other actions.
While the Server is running in single user mode, it does not process any request. That is:
- Queries. I.e.
- Data Definition Language statements (DDL). I.e.
ALTER DATA SOURCE,
ALTER VIEW, etc.
- Data Modification Language statements (DML). I.e.
All the requests received while the Server is running in “single user mode” are queued.
If the Server is in single user mode and a user, different from the one who requested the switch, executes a task in the Administration tool, then the Tool will display a “waiting dialog” with the message “Waiting for single user mode to finish”.
After exiting single user mode, the Server executes the queued requests in the order they were received.
There are two types of single user mode:
- Explicit or global single user mode: the user requests the Server to enter this mode. See section Explicit Single User Mode.
- Auto single user mode: the Server automatically enters and exits single user mode. See section Automatic Single User Mode.
Explicit Single User Mode¶
Administrator users may request the Server to switch to “explicit single user mode” to perform configuration changes or import a VQL file. Only administrator users can make the Server switch to single user mode.
The Server switches to explicit single user mode when an administrator performs one of the following actions:
Executes the statement
ENTER SINGLE USER MODE. To exit this mode, execute
EXIT SINGLE USER MODE.
importscript with the option
--singleuser(see more about this script in the section Import Script).
We strongly recommend executing this script with the option
--singleuserto avoid errors due to other clients querying the views that are being modified.
Or, imports a VQL script that contains the statement
ENTER SINGLE USER MODE.
When the administrator requests the Server to switch to single user mode, the Server does the following before fulfilling the request:
- Waits until all the currently running requests finish.
- Queues all the requests received while waiting for the running requests to finish.
- Once all operations finish, switches to single user mode.
When the Server is in “single user mode”, only the administrator who ordered the switch to this mode can execute statements. All operations executed by other clients will be queued until the Server exits this mode.
Only administrator users can make the Server switch to single user mode.
The MBean VDBServerManagementInfo of the JMX interface provides the id
of the connection from which the command
ENTER SINGLE USER MODE was
obtained. See more information about this MBean in the section
Attributes of the VDBServerManagementInfo MBean.
Automatic Single User Mode¶
This section describes how the Server automatically switches to single user mode momentarily to execute certain actions, and exits this mode immediately. It is called “automatic single user mode” as it does so without user request.
The difference between automatic and explicit single user mode is that when switching to automatic single user mode, the Server does not wait for:
- Queries to finish. I.e.
- Data Modification Language operations (DML) to finish. I.e.
However, the Server does wait for Data Definition Language statements
(DDL) to finish. I.e.
ALTER DATA SOURCE,
ALTER VIEW, etc. The reason is to prevent executing
concurrently two operations that modify the Server’s metadata.
A Server switches to automatic single user mode even if the user executing the action is not an administrator nor a local administrator of the database.
Depending on the operation executed, the entire Server may go into single user mode, or just the database where the operation is executed.
Operations that only block the current database:
A user creates/modifies/deletes an element that “belongs” to a database. Those are:
Views: base views, derived views, interface views and materialized tables.
If the materialized view is created with the syntax
CREATE MATERIALIZED TABLE AS SELECT …or
SELECT … INTO …, the database stays in single user mode until the query finishes. If you create the materialized table with the syntax
CREATE MATERIALIZED TABLE … ( <fields> ), the statement finishes instantly.
Read more about materialized views in the section Creating Materialized Tables of the Advanced VQL Guide.
REST Web services, SOAP Web services and widgets
Modify the configuration of a database.
Obtain a list of elements of a certain type. I.e.: execute a
Obtain information about an element. I.e.: execute a
While the Server is processing any of these operations, it queues all the requests sent to this database until the operation finishes. However, the Server will execute normally the requests sent to other databases. In addition, these requests are usually executed instantly.
It is possible that one operation blocks more than one database. The
reason is that the Server blocks the databases of all the elements
involved in the operation. For example, if you create a view in the
database DB1 and this view is a selection of another view in the
database DB2, the
CREATE VIEW statement will block the databases DB1
Operations that block the entire server:
- Creating/modifying/deleting any of the following elements:
- I18n maps
- VCS environments
- Modifying the global VCS settings
- Modifying the global settings of the cache.
When a user has started a transaction, these operations will be queued until the transaction finishes.