Data Sync
Advanced Customizations
Using ALTER SYSTEM
alter system is an advanced system performance tuning feature for configuring and retrieving system settings for your peer to peer mesh network for information on specific configs supported via alter system reach out to the ditto team member system settings consist of values the ditto library uses to configure specific behaviors, such as timeouts, resource limits, and so on this article provides a high level overview of the alter system ditto query language (dql) statement, as well as instructions on how to use it, once offered, to set, reset, and query peer to peer system settings tasks overview the following table provides an overview of the various tasks you can perform with the alter system statement task query retrieve current system settings for all configurations ( /#retrieving values ) show all retrieve current system settings for a specific configuration ( /#retrieving values ) show change a specific system setting ( /#modifying values ) alter system set reset system settings to default configurations ( /#resetting values to default ) alter system reset retrieving values fetch current setting values for either the entire mesh network or a specific setting to return system wide configurations, use a show all statement dql show all; to return only the value for a specific setting, pass the setting you want to retrieve a value for in a show statement for example dql show replication gc startup delay seconds; executing show and show all to invoke your statement, call the execute api method on the ditto store namespace for example, in swift let result = try await ditto store execute(query "show all") result items\[0] value\["example parameter"] as? int modifying values to modify a system setting, use alter system set similar to postgressql, dql supports both the = and to syntax for setting system configurations regardless of the syntax you use in your alter system set query, the documents ditto returns contain the current value of the setting, identified by the setting name dql alter system set \<setting> = \<value> for example dql alter system set replication gc startup delay seconds = 10; executing set similar to the execution pattern recommended when configuring transports in your app, invoke your statement modifying system configurations immediately after initializing the ditto object (see docid\ dmlp pempfsu1kye4t4de ) ditto stores configuration settings modified by alter system in memory rather than persisting them to disk so, while you can execute your statement to modify a setting at any point during your app’s lifecycle, changing certain settings within your app may not result in immediate effects to invoke the set statement, add a call to the execute api method on the ditto store namespace for example, in swift var result = try await ditto store execute(query "alter system set example parameter = 321") result items\[0] value\["example parameter"] as? int // 321 resetting values to default to return peer to peer system configuration settings to default values, do either of the following to reset all configuration settings for example dql alter system reset all; to reset a specific configuration setting dql alter system reset \<setting> once executed, ditto returns a document containing current values, identified by their setting name troubleshooting ditto throws an error when an alter system query operation fails to execute due to various issues, including syntax mistakes, such as a typo, causing parsing of the dql statement to fail using an unrecognized setting name in the query (often due to a typo) attempting to set a value outside the acceptable bounds for a setting in an alter system set query an internal error occurred while processing the query