solidDB Help : solidDB reference : SQL: Statements : REFRESH
  
REFRESH
Note Applies to only solidDB Advanced Replication configurations.
REFRESH publication [parameters] [FULL]
   [
TIMEOUT {DEFAULT | FOREVER | timeout‑ms}]
   [
COMMITBLOCK number‑of‑rows]
   [
OPTIMISTIC | PESSIMISTIC]Usage
Use the REFRESH statement to refresh a replica database from a publication on the master database
The REFRESH statement is a storageless refresh statement. It conserves memory by streaming the associated data. It also saves I/O bandwidth because no messages are written to disk. Each statement blocks until it is successfully executed.
Parameters, clauses, keywords, and variables
TIMEOUT: Defines how long the replica database waits for the reply message. If TIMEOUT is not defined, FOREVER is used.
OPTIMISTIC | PESSIMISTIC: Defines the way the replica table is locked.
OPTIMISTIC (the default value): Specifies that the concurrency control method depends on the table type and the isolation level.
With disk-based tables (D-tables) in OPTIMISTIC mode, the REFRESH always succeeds.
With in-memory tables (M-tables), row-level locking is used.
With D-tables in the PESSIMISTIC mode, if a lock cannot be obtained, the statement fails and returns an error.
PESSIMISTIC: Defines that the table is exclusively locked, regardless of the table type and isolation level chosen, for the time of refresh. If the lock cannot be obtained, the refresh request fails and returns an error.
COMMITBLOCK: Defines the number of rows that are committed in one transaction. The COMMITBLOCK keyword is useful if the reply to the REFRESH request contains REFRESHes of large publications. Defining the commit block size has a positive impact on the performance of the replica database. It is recommended that there are no online users accessing the database when the COMMITBLOCK keyword is being used.
If COMMITBLOCK is not used, the execution of REFRESH is a part of the current transaction.
The effect of REFRESH can be revoked by executing the ROLLBACK statement. To make the effect of REFRESH durable, COMMIT WORK must be executed.
REFRESH can be executed repeatedly, over the rollbacks and commits, and the effects are (in the quiescent state of the database) always the same.
If COMMITBLOCK is used, each transfer part (of the specified size) is committed in the replica database implicitly. The ROLLBACK statement removes the effect of the latest transfer part only. COMMIT WORK commits the last transfer part.
Return values
 
Error code
Description
13133
Not a valid license for this product
25004
Dynamic parameters are not supported
25015
Syntax error: error‑message, line line‑number
25024
Master not defined
25025
Node name not defined
25026
Not a valid master user
25044
SYNC_CONFIG system publication takes only character arguments
25056
Autocommit not allowed
25071
Not registered to publication publication‑name
25072
Already registered to publication publication‑name
13XXX
Table level error
21XXX
Communication error
10006
Concurrency conflict (simultaneous other operation)
13047
No privilege for operation
13056
Insert not allowed for pseudo column
25005
Message message‑name is already active
25018
Illegal message state
In the replica, the message can be executed only using the MESSAGE FORWARD statement if the message is ended and the ending transaction is committed.
25024
Master not defined
This message is produced if double quotation marks, rather than single quotation marks, are used around the connect‑string in a MESSAGE FORWARD statement.
For example, if the master node is given the node name "master" (which is a reserved word and therefore should be delimited by double quotation marks), and if connect string for the is tcp localhost 1315, the following MESSAGE statements shown are correct:
--On the replica
...
--double quotation marks
MESSAGE msg1 BEGIN TO "master";
...
--single quotation marks
MESSAGE msg2 FORWARD TO 'tcp localhost 1315';
The MESSAGE BEGIN statement defines (within the replica server) what the node name of the master is. The MESSAGE FORWARD statement can contain the connect string to the server.
25026
Not a valid master user
25031
Transaction is active, operation failed
25035
Message message‑name is in use.
A user is currently creating or forwarding this message.
25040
User ID user‑id is not found.
While executing a message reply an attempt to map a master user to a local replica id failed.
25041
Subscription to publication publication‑name not found
25048
Publication publication‑name request info not found
25052
Failed to set node name to node‑name.
25054
Table table‑name is not set for synchronization history
25055
Connect information is allowed only when not registered
The connect info in MESSAGE message‑name FORWARD TO connect‑info options is allowed only if the replica has not yet been registered to the master database.
25056
Autocommit not allowed
25057
The replica database is registered to a master database
25060
Column column‑name does not exist on publication publication‑name result set in table table‑name
13XXX
Table level error
13124
User ID num not found
This message is generated, for example, if the user has been dropped.
25056
Autocommit not allowed
Examples
The following example shows a synchronous, messageless refresh:
REFRESH publ_states; PESSIMISTIC; COMMITBLOCK 1000; COMMIT WORK;
Go up to
SQL: Statements