0
# Configuration and Options
1
2
Network, database, and transaction-level configuration options for performance tuning, security, and operational behavior. FoundationDB provides extensive configuration capabilities at multiple levels.
3
4
## Capabilities
5
6
### Network Options
7
8
Global configuration options that affect the entire FoundationDB client process.
9
10
```c { .api }
11
/**
12
* Set network option
13
* @param option Network option type
14
* @param value Option value bytes (NULL if no parameter)
15
* @param value_length Length of value in bytes
16
* @return Error code (0 for success)
17
*/
18
fdb_error_t fdb_network_set_option(FDBNetworkOption option, uint8_t const* value, int value_length);
19
20
// Network option types
21
typedef enum {
22
FDB_NET_OPTION_LOCAL_ADDRESS = 10, // Deprecated
23
FDB_NET_OPTION_CLUSTER_FILE = 20, // Deprecated
24
FDB_NET_OPTION_TRACE_ENABLE = 30, // Enable tracing
25
FDB_NET_OPTION_TRACE_ROLL_SIZE = 31, // Trace file size limit
26
FDB_NET_OPTION_TRACE_MAX_LOGS_SIZE = 32, // Total trace size limit
27
FDB_NET_OPTION_TRACE_LOG_GROUP = 33, // Trace log group
28
FDB_NET_OPTION_TRACE_FORMAT = 34, // Trace format (xml/json)
29
FDB_NET_OPTION_TRACE_CLOCK_SOURCE = 35, // Trace clock source
30
FDB_NET_OPTION_TRACE_FILE_IDENTIFIER = 36, // Trace file identifier
31
FDB_NET_OPTION_TRACE_PARTIAL_FILE_SUFFIX = 39, // Partial file suffix
32
FDB_NET_OPTION_KNOB = 40, // Internal knob setting
33
FDB_NET_OPTION_TLS_PLUGIN = 41, // TLS plugin (deprecated)
34
FDB_NET_OPTION_TLS_CERT_BYTES = 42, // TLS certificate bytes
35
FDB_NET_OPTION_TLS_CERT_PATH = 43, // TLS certificate file path
36
FDB_NET_OPTION_TLS_KEY_BYTES = 45, // TLS private key bytes
37
FDB_NET_OPTION_TLS_KEY_PATH = 46, // TLS private key file path
38
FDB_NET_OPTION_TLS_VERIFY_PEERS = 47, // TLS peer verification
39
FDB_NET_OPTION_BUGGIFY_ENABLE = 48, // Enable buggify testing
40
FDB_NET_OPTION_BUGGIFY_DISABLE = 49, // Disable buggify testing
41
FDB_NET_OPTION_BUGGIFY_SECTION_ACTIVATED_PROBABILITY = 50, // Buggify activation probability
42
FDB_NET_OPTION_BUGGIFY_SECTION_FIRED_PROBABILITY = 51, // Buggify firing probability
43
FDB_NET_OPTION_TLS_CA_BYTES = 52, // TLS CA bundle bytes
44
FDB_NET_OPTION_TLS_CA_PATH = 53, // TLS CA bundle file path
45
FDB_NET_OPTION_TLS_PASSWORD = 54 // TLS key password
46
} FDBNetworkOption;
47
```
48
49
```python { .api }
50
class NetworkOptions:
51
def set_trace_enable(self, path: str) -> None:
52
"""
53
Enable trace output to specified directory
54
55
Args:
56
path: Directory path for trace files (or None for current directory)
57
"""
58
59
def set_trace_roll_size(self, size: int) -> None:
60
"""
61
Set maximum size of individual trace files
62
63
Args:
64
size: Maximum file size in bytes (0 for no limit)
65
"""
66
67
def set_trace_max_logs_size(self, size: int) -> None:
68
"""
69
Set maximum total size of all trace files
70
71
Args:
72
size: Maximum total size in bytes (0 for no limit)
73
"""
74
75
def set_trace_log_group(self, group: str) -> None:
76
"""
77
Set LogGroup attribute for trace events
78
79
Args:
80
group: Log group name (default is 'default')
81
"""
82
83
def set_trace_format(self, format: str) -> None:
84
"""
85
Set format for trace files
86
87
Args:
88
format: Either 'xml' (default) or 'json'
89
"""
90
91
def set_tls_cert_path(self, path: str) -> None:
92
"""
93
Set TLS certificate file path
94
95
Args:
96
path: Path to certificate file
97
"""
98
99
def set_tls_cert_bytes(self, cert_data: bytes) -> None:
100
"""
101
Set TLS certificate from bytes
102
103
Args:
104
cert_data: Certificate data bytes
105
"""
106
107
def set_tls_key_path(self, path: str) -> None:
108
"""
109
Set TLS private key file path
110
111
Args:
112
path: Path to private key file
113
"""
114
115
def set_tls_key_bytes(self, key_data: bytes) -> None:
116
"""
117
Set TLS private key from bytes
118
119
Args:
120
key_data: Private key data bytes
121
"""
122
123
def set_tls_ca_path(self, path: str) -> None:
124
"""
125
Set TLS certificate authority bundle file path
126
127
Args:
128
path: Path to CA bundle file
129
"""
130
131
def set_tls_ca_bytes(self, ca_data: bytes) -> None:
132
"""
133
Set TLS certificate authority bundle from bytes
134
135
Args:
136
ca_data: CA bundle data bytes
137
"""
138
139
def set_tls_verify_peers(self, verify_pattern: bytes) -> None:
140
"""
141
Set peer certificate verification criteria
142
143
Args:
144
verify_pattern: Verification pattern bytes
145
"""
146
147
def set_knob(self, knob_setting: str) -> None:
148
"""
149
Set internal tuning or debugging knob
150
151
Args:
152
knob_setting: Knob setting in format "knob_name=knob_value"
153
"""
154
155
# Get network options instance
156
options = fdb.options
157
```
158
159
```java { .api }
160
// Java API
161
public class NetworkOptions {
162
public NetworkOptions setTraceEnable(String outputDirectory):
163
/**
164
* Enable trace output to specified directory
165
* @param outputDirectory Directory for trace files
166
* @return NetworkOptions for chaining
167
*/
168
169
public NetworkOptions setTraceRollSize(long bytes):
170
/**
171
* Set maximum size of individual trace files
172
* @param bytes Maximum file size in bytes
173
* @return NetworkOptions for chaining
174
*/
175
176
public NetworkOptions setTraceMaxLogsSize(long bytes):
177
/**
178
* Set maximum total size of all trace files
179
* @param bytes Maximum total size in bytes
180
* @return NetworkOptions for chaining
181
*/
182
183
public NetworkOptions setTLSCertPath(String path):
184
/**
185
* Set TLS certificate file path
186
* @param path Path to certificate file
187
* @return NetworkOptions for chaining
188
*/
189
190
public NetworkOptions setTLSKeyPath(String path):
191
/**
192
* Set TLS private key file path
193
* @param path Path to private key file
194
* @return NetworkOptions for chaining
195
*/
196
197
public NetworkOptions setTLSCaPath(String path):
198
/**
199
* Set TLS CA bundle file path
200
* @param path Path to CA bundle file
201
* @return NetworkOptions for chaining
202
*/
203
}
204
205
// Access through FDB instance
206
FDB fdb = FDB.selectAPIVersion(630);
207
NetworkOptions networkOptions = fdb.options();
208
```
209
210
```go { .api }
211
// Go API
212
type NetworkOptions struct{}
213
214
func (opt NetworkOptions) SetTraceEnable(outputDir string) error: ...
215
func (opt NetworkOptions) SetTraceRollSize(bytes int) error: ...
216
func (opt NetworkOptions) SetTraceMaxLogsSize(bytes int) error: ...
217
func (opt NetworkOptions) SetTLSCertPath(path string) error: ...
218
func (opt NetworkOptions) SetTLSKeyPath(path string) error: ...
219
func (opt NetworkOptions) SetTLSCaPath(path string) error: ...
220
func (opt NetworkOptions) SetKnob(setting string) error: ...
221
222
// Access network options
223
func Options() NetworkOptions: ...
224
```
225
226
### Database Options
227
228
Configuration options that apply to a specific database connection.
229
230
```c { .api }
231
/**
232
* Set database option
233
* @param d Database handle
234
* @param option Database option type
235
* @param value Option value bytes (NULL if no parameter)
236
* @param value_length Length of value in bytes
237
* @return Error code (0 for success)
238
*/
239
fdb_error_t fdb_database_set_option(FDBDatabase* d, FDBDatabaseOption option,
240
uint8_t const* value, int value_length);
241
242
// Database option types
243
typedef enum {
244
FDB_DB_OPTION_LOCATION_CACHE_SIZE = 10, // Location cache size
245
FDB_DB_OPTION_MAX_WATCHES = 20, // Maximum watches
246
FDB_DB_OPTION_MACHINE_ID = 21, // Machine identifier
247
FDB_DB_OPTION_DATACENTER_ID = 22, // Datacenter identifier
248
FDB_DB_OPTION_SNAPSHOT_RYW_ENABLE = 26, // Enable snapshot read-your-writes
249
FDB_DB_OPTION_SNAPSHOT_RYW_DISABLE = 27, // Disable snapshot read-your-writes
250
FDB_DB_OPTION_TRANSACTION_LOGGING_MAX_FIELD_LENGTH = 405, // Transaction logging field length
251
FDB_DB_OPTION_TRANSACTION_TIMEOUT = 500, // Default transaction timeout
252
FDB_DB_OPTION_TRANSACTION_RETRY_LIMIT = 501, // Default transaction retry limit
253
FDB_DB_OPTION_TRANSACTION_MAX_RETRY_DELAY = 502, // Default max retry delay
254
FDB_DB_OPTION_TRANSACTION_SIZE_LIMIT = 503, // Default transaction size limit
255
FDB_DB_OPTION_TRANSACTION_CAUSAL_READ_RISKY = 504, // Default causal read risky
256
FDB_DB_OPTION_TRANSACTION_INCLUDE_PORT_IN_ADDRESS = 505 // Include port in address
257
} FDBDatabaseOption;
258
```
259
260
```python { .api }
261
class DatabaseOptions:
262
def set_location_cache_size(self, size: int) -> None:
263
"""
264
Set size of location cache
265
266
Args:
267
size: Cache size in entries
268
"""
269
270
def set_max_watches(self, count: int) -> None:
271
"""
272
Set maximum number of watches
273
274
Args:
275
count: Maximum number of outstanding watches
276
"""
277
278
def set_machine_id(self, machine_id: bytes) -> None:
279
"""
280
Set machine identifier for locality
281
282
Args:
283
machine_id: 16-byte machine identifier
284
"""
285
286
def set_datacenter_id(self, datacenter_id: bytes) -> None:
287
"""
288
Set datacenter identifier for locality
289
290
Args:
291
datacenter_id: 16-byte datacenter identifier
292
"""
293
294
def set_transaction_timeout(self, timeout_ms: int) -> None:
295
"""
296
Set default timeout for transactions
297
298
Args:
299
timeout_ms: Timeout in milliseconds
300
"""
301
302
def set_transaction_retry_limit(self, limit: int) -> None:
303
"""
304
Set default retry limit for transactions
305
306
Args:
307
limit: Maximum number of retries
308
"""
309
310
def set_transaction_max_retry_delay(self, delay_ms: int) -> None:
311
"""
312
Set default maximum retry delay
313
314
Args:
315
delay_ms: Maximum delay between retries in milliseconds
316
"""
317
318
# Access through database instance
319
class Database:
320
@property
321
def options(self) -> DatabaseOptions: ...
322
```
323
324
```java { .api }
325
// Java API
326
public class DatabaseOptions {
327
public DatabaseOptions setLocationCacheSize(long size):
328
/**
329
* Set size of location cache
330
* @param size Cache size in entries
331
* @return DatabaseOptions for chaining
332
*/
333
334
public DatabaseOptions setMaxWatches(long count):
335
/**
336
* Set maximum number of watches
337
* @param count Maximum number of outstanding watches
338
* @return DatabaseOptions for chaining
339
*/
340
341
public DatabaseOptions setTransactionTimeout(long timeoutMillis):
342
/**
343
* Set default timeout for transactions
344
* @param timeoutMillis Timeout in milliseconds
345
* @return DatabaseOptions for chaining
346
*/
347
348
public DatabaseOptions setTransactionRetryLimit(long limit):
349
/**
350
* Set default retry limit for transactions
351
* @param limit Maximum number of retries
352
* @return DatabaseOptions for chaining
353
*/
354
}
355
356
// Access through database instance
357
public interface Database {
358
public DatabaseOptions options();
359
}
360
```
361
362
```go { .api }
363
// Go API
364
type DatabaseOptions struct{}
365
366
func (opt DatabaseOptions) SetLocationCacheSize(size int) error: ...
367
func (opt DatabaseOptions) SetMaxWatches(count int) error: ...
368
func (opt DatabaseOptions) SetTransactionTimeout(timeoutMs int) error: ...
369
func (opt DatabaseOptions) SetTransactionRetryLimit(limit int) error: ...
370
371
// Access through database instance
372
type Database interface {
373
Options() DatabaseOptions
374
}
375
```
376
377
### Transaction Options
378
379
Configuration options that control individual transaction behavior.
380
381
```c { .api }
382
/**
383
* Set transaction option
384
* @param tr Transaction handle
385
* @param option Transaction option type
386
* @param value Option value bytes (NULL if no parameter)
387
* @param value_length Length of value in bytes
388
* @return Error code (0 for success)
389
*/
390
fdb_error_t fdb_transaction_set_option(FDBTransaction* tr, FDBTransactionOption option,
391
uint8_t const* value, int value_length);
392
393
// Transaction option types
394
typedef enum {
395
FDB_TR_OPTION_CAUSAL_WRITE_RISKY = 10, // Enable risky causal writes
396
FDB_TR_OPTION_CAUSAL_READ_RISKY = 20, // Enable risky causal reads
397
FDB_TR_OPTION_CAUSAL_READ_DISABLE = 21, // Disable causal reads
398
FDB_TR_OPTION_NEXT_WRITE_NO_WRITE_CONFLICT_RANGE = 30, // Next write no conflict
399
FDB_TR_OPTION_COMMIT_ON_FIRST_PROXY = 40, // Commit on first proxy
400
FDB_TR_OPTION_CHECK_WRITES_ENABLE = 50, // Enable write checking
401
FDB_TR_OPTION_READ_YOUR_WRITES_DISABLE = 51, // Disable read-your-writes
402
FDB_TR_OPTION_READ_AHEAD_DISABLE = 52, // Disable read ahead
403
FDB_TR_OPTION_DURABILITY_DATACENTER = 110, // Datacenter durability
404
FDB_TR_OPTION_DURABILITY_RISKY = 120, // Risky durability
405
FDB_TR_OPTION_DURABILITY_DEV_NULL_DISK = 130, // Dev null durability (testing)
406
FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE = 200, // System immediate priority
407
FDB_TR_OPTION_PRIORITY_BATCH = 201, // Batch priority
408
FDB_TR_OPTION_INITIALIZE_NEW_DATABASE = 300, // Initialize new database
409
FDB_TR_OPTION_ACCESS_SYSTEM_KEYS = 301, // Access system keys
410
FDB_TR_OPTION_READ_SYSTEM_KEYS = 302, // Read system keys
411
FDB_TR_OPTION_RAW_ACCESS = 303, // Raw access mode
412
FDB_TR_OPTION_DEBUG_DUMP = 400, // Debug dump
413
FDB_TR_OPTION_DEBUG_RETRY_LOGGING = 401, // Debug retry logging
414
FDB_TR_OPTION_TRANSACTION_LOGGING_ENABLE = 402, // Enable transaction logging
415
FDB_TR_OPTION_TIMEOUT = 500, // Transaction timeout
416
FDB_TR_OPTION_RETRY_LIMIT = 501, // Retry limit
417
FDB_TR_OPTION_MAX_RETRY_DELAY = 502, // Maximum retry delay
418
FDB_TR_OPTION_SNAPSHOT_RYW_ENABLE = 600, // Enable snapshot read-your-writes
419
FDB_TR_OPTION_SNAPSHOT_RYW_DISABLE = 601, // Disable snapshot read-your-writes
420
FDB_TR_OPTION_LOCK_AWARE = 700, // Lock aware
421
FDB_TR_OPTION_USED_DURING_COMMIT_PROTECTION_DISABLE = 701, // Disable commit protection
422
FDB_TR_OPTION_READ_LOCK_AWARE = 702 // Read lock aware
423
} FDBTransactionOption;
424
```
425
426
```python { .api }
427
class TransactionOptions:
428
def set_read_your_writes_disable(self) -> None:
429
"""Disable read-your-writes for this transaction"""
430
431
def set_read_ahead_disable(self) -> None:
432
"""Disable read ahead optimization"""
433
434
def set_next_write_no_write_conflict_range(self) -> None:
435
"""Next write operation will not add to write conflict range"""
436
437
def set_causal_write_risky(self) -> None:
438
"""Enable risky causal write semantics"""
439
440
def set_causal_read_risky(self) -> None:
441
"""Enable risky causal read semantics"""
442
443
def set_causal_read_disable(self) -> None:
444
"""Disable causal read semantics"""
445
446
def set_timeout(self, timeout_ms: int) -> None:
447
"""
448
Set transaction timeout
449
450
Args:
451
timeout_ms: Timeout in milliseconds
452
"""
453
454
def set_retry_limit(self, limit: int) -> None:
455
"""
456
Set retry limit for this transaction
457
458
Args:
459
limit: Maximum number of retries
460
"""
461
462
def set_max_retry_delay(self, delay_ms: int) -> None:
463
"""
464
Set maximum retry delay
465
466
Args:
467
delay_ms: Maximum delay between retries in milliseconds
468
"""
469
470
def set_priority_system_immediate(self) -> None:
471
"""Set system immediate priority"""
472
473
def set_priority_batch(self) -> None:
474
"""Set batch priority for background operations"""
475
476
def set_access_system_keys(self) -> None:
477
"""Allow access to system keys (requires special permissions)"""
478
479
def set_read_system_keys(self) -> None:
480
"""Allow reading system keys"""
481
482
def set_snapshot_ryw_enable(self) -> None:
483
"""Enable snapshot read-your-writes"""
484
485
def set_snapshot_ryw_disable(self) -> None:
486
"""Disable snapshot read-your-writes"""
487
488
# Access through transaction instance
489
class Transaction:
490
@property
491
def options(self) -> TransactionOptions: ...
492
```
493
494
```java { .api }
495
// Java API
496
public class TransactionOptions {
497
public TransactionOptions setReadYourWritesDisable():
498
/**
499
* Disable read-your-writes for this transaction
500
* @return TransactionOptions for chaining
501
*/
502
503
public TransactionOptions setTimeout(long timeoutMillis):
504
/**
505
* Set transaction timeout
506
* @param timeoutMillis Timeout in milliseconds
507
* @return TransactionOptions for chaining
508
*/
509
510
public TransactionOptions setRetryLimit(long limit):
511
/**
512
* Set retry limit for this transaction
513
* @param limit Maximum number of retries
514
* @return TransactionOptions for chaining
515
*/
516
517
public TransactionOptions setPriorityBatch():
518
/**
519
* Set batch priority for background operations
520
* @return TransactionOptions for chaining
521
*/
522
523
public TransactionOptions setPrioritySystemImmediate():
524
/**
525
* Set system immediate priority
526
* @return TransactionOptions for chaining
527
*/
528
529
public TransactionOptions setAccessSystemKeys():
530
/**
531
* Allow access to system keys
532
* @return TransactionOptions for chaining
533
*/
534
}
535
536
// Access through transaction instance
537
public interface Transaction {
538
public TransactionOptions options();
539
}
540
```
541
542
```go { .api }
543
// Go API
544
type TransactionOptions struct{}
545
546
func (opt TransactionOptions) SetReadYourWritesDisable() error: ...
547
func (opt TransactionOptions) SetTimeout(timeoutMs int) error: ...
548
func (opt TransactionOptions) SetRetryLimit(limit int) error: ...
549
func (opt TransactionOptions) SetPriorityBatch() error: ...
550
func (opt TransactionOptions) SetPrioritySystemImmediate() error: ...
551
func (opt TransactionOptions) SetAccessSystemKeys() error: ...
552
553
// Access through transaction instance
554
type Transaction interface {
555
Options() TransactionOptions
556
}
557
```
558
559
**Usage Examples:**
560
561
**Network Configuration (Python):**
562
```python
563
import fdb
564
565
# Configure before calling api_version
566
fdb.options.set_trace_enable("/tmp/fdb_traces")
567
fdb.options.set_trace_format("json")
568
fdb.options.set_trace_max_logs_size(100 * 1024 * 1024) # 100MB
569
570
# Set TLS configuration
571
fdb.options.set_tls_cert_path("/etc/fdb/cert.pem")
572
fdb.options.set_tls_key_path("/etc/fdb/key.pem")
573
fdb.options.set_tls_ca_path("/etc/fdb/ca.pem")
574
575
# Performance tuning knob
576
fdb.options.set_knob("client_knobs_disable=false")
577
578
fdb.api_version(630)
579
db = fdb.open()
580
```
581
582
**Database Configuration (Java):**
583
```java
584
import com.apple.foundationdb.*;
585
586
FDB fdb = FDB.selectAPIVersion(630);
587
588
try (Database db = fdb.open()) {
589
// Configure database options
590
db.options()
591
.setLocationCacheSize(100000) // Increase location cache
592
.setMaxWatches(10000) // Allow more watches
593
.setTransactionTimeout(30000) // 30 second default timeout
594
.setTransactionRetryLimit(50); // Allow more retries
595
596
// Use database...
597
}
598
```
599
600
**Transaction Configuration (Go):**
601
```go
602
package main
603
604
import (
605
"github.com/apple/foundationdb/bindings/go/src/fdb"
606
)
607
608
func main() {
609
fdb.MustAPIVersion(630)
610
db := fdb.MustOpenDefault()
611
612
// Configure database
613
db.Options().SetTransactionTimeout(60000) // 60 second timeout
614
615
tr, _ := db.CreateTransaction()
616
defer tr.Destroy()
617
618
// Configure this specific transaction
619
tr.Options().SetPriorityBatch() // Background priority
620
tr.Options().SetTimeout(30000) // Override to 30 seconds
621
tr.Options().SetRetryLimit(10) // Limit retries
622
623
// Use transaction...
624
}
625
```
626
627
**TLS Configuration (Python):**
628
```python
629
import fdb
630
631
# Configure TLS before API version
632
fdb.options.set_tls_cert_path("/etc/foundationdb/fdb.pem")
633
fdb.options.set_tls_key_path("/etc/foundationdb/fdb.key")
634
fdb.options.set_tls_ca_path("/etc/foundationdb/ca.pem")
635
636
# Verify peer certificates
637
verify_pattern = b"Check.Valid=1"
638
fdb.options.set_tls_verify_peers(verify_pattern)
639
640
fdb.api_version(630)
641
db = fdb.open()
642
```
643
644
**Performance Tuning (C):**
645
```c
646
#define FDB_API_VERSION 630
647
#include <foundationdb/fdb_c.h>
648
649
int main() {
650
// Enable tracing
651
fdb_network_set_option(FDB_NET_OPTION_TRACE_ENABLE,
652
(uint8_t*)"/tmp/fdb_trace", 14);
653
654
// Set trace file size limit (10MB)
655
int64_t trace_size = 10 * 1024 * 1024;
656
fdb_network_set_option(FDB_NET_OPTION_TRACE_ROLL_SIZE,
657
(uint8_t*)&trace_size, sizeof(trace_size));
658
659
fdb_select_api_version(630);
660
fdb_setup_network();
661
662
// Create database
663
FDBDatabase* db;
664
fdb_create_database(NULL, &db);
665
666
// Set database options
667
int64_t cache_size = 100000;
668
fdb_database_set_option(db, FDB_DB_OPTION_LOCATION_CACHE_SIZE,
669
(uint8_t*)&cache_size, sizeof(cache_size));
670
671
// Create transaction
672
FDBTransaction* tr;
673
fdb_database_create_transaction(db, &tr);
674
675
// Set transaction options
676
int64_t timeout = 30000; // 30 seconds
677
fdb_transaction_set_option(tr, FDB_TR_OPTION_TIMEOUT,
678
(uint8_t*)&timeout, sizeof(timeout));
679
680
fdb_transaction_set_option(tr, FDB_TR_OPTION_PRIORITY_BATCH, NULL, 0);
681
682
// Use transaction...
683
684
fdb_transaction_destroy(tr);
685
fdb_database_destroy(db);
686
fdb_stop_network();
687
688
return 0;
689
}
690
```
691
692
**Advanced Transaction Options (Python):**
693
```python
694
import fdb
695
696
fdb.api_version(630)
697
db = fdb.open()
698
699
def background_batch_job(tr):
700
# Configure for batch processing
701
tr.options.set_priority_batch() # Lower priority
702
tr.options.set_timeout(300000) # 5 minute timeout
703
tr.options.set_retry_limit(100) # More retries
704
tr.options.set_causal_read_disable() # Don't need causal reads
705
706
# Process large amounts of data...
707
for i in range(10000):
708
tr.set(f"batch_item:{i}".encode(), f"data_{i}".encode())
709
710
def system_maintenance(tr):
711
# Configure for system operations
712
tr.options.set_access_system_keys() # Access system keyspace
713
tr.options.set_priority_system_immediate() # Highest priority
714
tr.options.set_timeout(60000) # 1 minute timeout
715
716
# Perform system maintenance...
717
718
# Use with different configurations
719
db.transact(background_batch_job)
720
db.transact(system_maintenance)
721
```