Configuring write-behind loader support
You can enable write-behind support with the ObjectGrid descriptor XML file or programmatically with the BackingMap interface.
Use either the ObjectGrid descriptor XML file to enable write-behind support, or programmatically by using the BackingMap interface.
ObjectGrid descriptor XML file
<objectGrid name="library" >
<backingMap name="book" writeBehind="T300;C900" pluginCollectionRef="bookPlugins"/>
write-behind attribute::= <defaults> | <update time> [ ";" <conversion clause> ]| <update key count>
[ ";" <conversion clause> ]| <conversion clause> | <update time> ";" <update key count> [ ";" <conversion clause> ]
If you want the write-behind loader to convert insert and update
operations to an upsert, you can set the configuration option
ConvertToUpsert=<true|false>
on the write-behind attribute
<conversion clause>
. By setting this configuration option to
true
, the operations are converted to an upsert before it is passed to the loader.
Before you set ConvertToUpsert=true
, you should check the specifications of
back-end loader to ensure that upsert operations are supported. The default value is
false
.update time ::= "T" <positive integer>
update key count ::= "C" <positive integer>
defaults ::= "" {table}
conversion clause ::= ConvertToUpsert=<true|false>
- The maximum update time in seconds has elapsed since the last update.
- The number of updated keys in the queue map has reached the update key count.
These parameters are only hints. The real update count and update time will be within close range of the parameters. However, we do not guarantee that the actual update count or update time are the same as defined in the parameters. Also, to prevent all partitions from accessing the database simultaneously, the ObjectGrid randomizes the update starting time. For example, the first update can occur after up to twice as long as the real update time.
In the previous example T300;C900, the loader writes the data to the back-end when 300 seconds have passed since the last update or when 900 keys are pending to be updated. The default update time is 300 seconds and the default update key count is 1000.
Attribute | Time |
---|---|
T100 | The update time is 100 seconds, and the update key count is 1000 (the default value). |
C2000 | The update time is 300 seconds (the default value), and the update key count is 2000. |
T300;C900 | The update time is 300 seconds and the update key count is 900. The loader receives upsert LogElement operations instead of insert and update operations. |
"" | The update time is 300 second (the default value), and the update key count is 1000 (the
default value). Note: If you configure the write-behind loader as an empty string:
writeBehind="" , the write-behind loader is enabled with the default values.
Therefore, do not specify the writeBehind attribute if you do not want write-behind support
enabled. |
Programmatically enabling write-behind support
When you are creating a backing map programmatically for a local, in-memory eXtreme Scale, you can use the following method on the BackingMap interface to enable and disable write-behind support.
public void setWriteBehind(String writeBehindParam);
For more details about how to use the setWriteBehind method, see BackingMap interface.