Skip to content

Commit

Permalink
Sync server_config.thrift from configerator
Browse files Browse the repository at this point in the history
Reviewed By: malanka

Differential Revision: D51659355

fbshipit-source-id: c5f69e64abd27d9f09d209b885ec3b7767b9a44d
  • Loading branch information
Simon Marlow authored and facebook-github-bot committed Dec 4, 2023
1 parent da1a831 commit 7c44d60
Showing 1 changed file with 92 additions and 53 deletions.
145 changes: 92 additions & 53 deletions glean/config/server/server_config.thrift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated SignedSource<<aa0fbfaa0116161c99ebf329c8e8979f>>
// @generated SignedSource<<90ca48e3501aa072dce577a1fe268bc0>>
// DO NOT EDIT THIS FILE MANUALLY!
// This file is a mechanical copy of the version in the configerator repo. To
// modify it, edit the copy in the configerator repo instead and copy it over by
Expand All @@ -19,80 +19,95 @@ typedef i64 Seconds

typedef i64 DBVersion (hs.newtype)

typedef map<string, string> (hs.type = "HashMap") Properties

// A retention policy for local DBs, specifying when DBs get
// automatically deleted. The default is to never delete any DBs.
struct Retention {
1: optional Seconds delete_if_older;
// If set, DBs older than this value will be deleted.
5: optional Seconds delete_incomplete_if_older;
1: optional Seconds delete_if_older;

// If set, incomplete DBs older than this value will be deleted.
2: optional i32 retain_at_least;
5: optional Seconds delete_incomplete_if_older;

// Retain at least this many DBs. Overrides delete_if_older and
// retain_at_most. Note: the value here specifies a number of
// *complete* databases to retain; incomplete or failed databases
// are not subject to this retention.
3: optional i32 retain_at_most;
2: optional i32 retain_at_least;

// If set, and we have more than this many local DBs, the oldest
// will be deleted.
4: optional i32 expire_delay;
3: optional i32 retain_at_most;

// If set, instead of deleting a DB immediately, we keep it in an
// "expiring" state for this many seconds. In this state, the DB
// can still be queried as normal, but it will not be suggested to
// new clients, and it will be removed from the shard map shortly
// before it is actually deleted.
4: optional i32 expire_delay;

// A local DB can be deleted if there is a newer remote DB that is
// at least this old. This is for use in a multi-shard setting
// where we might have old DBs on a server but they won't be
// deleted if the shards holding the newer DBs are on other
// servers; in that case we need some mechanism to eventually
// delete the stale local DB. If not set, we only delete local DBs
// according to delete_if_older and retain_at_most.
6: optional Seconds remote_db_bumps_local_db_after;
// A local DB can be deleted if there is a newer remote DB that is
// at least this old. This is for use in a multi-shard setting
// where we might have old DBs on a server but they won't be
// deleted if the shards holding the newer DBs are on other
// servers; in that case we need some mechanism to eventually
// delete the stale local DB. If not set, we only delete local DBs
// according to delete_if_older and retain_at_most.

// Only retain DBs with the following poperties
7: Properties required_properties = {};
}

struct DatabaseRetentionPolicy {
1: Retention default_retention;
// Retention to use if not overridden by repos
1: Retention default_retention;

// Retention policy to use per repo name
2: map<RepoName, Retention> repos = {};
// Retention policy to use per repo name
}

// If restore is enabled, then repos are restored from backup,
// according to the DatabaseRetentionPolicy for the repo name.
// DatabaseBackupPolicy.location is the location to restore from.
struct DatabaseRestorePolicy {
1: bool enabled = false;

// if enabled is true, this is a blocklist
// if enabled is false, this is an allowlist
2: set<RepoName> override = [];
// if enabled is true, this is a blocklist
// if enabled is false, this is an allowlist
}

struct DatabaseClosePolicy {
// Close any open DBs after this much idle time
1: Seconds close_after = 1800;
// Close any open DBs after this much idle time
}

struct Backup {
1: string location = "manifold:glean_databases/nodes/dev-backup";
// Location to restore from or backup to.
1: string location = "manifold:glean_databases/nodes/dev-backup";

// Delete backups this many seconds after uploading. 0 = never
2: i32 delete_after_seconds = 2592000; // 30 days
// Delete backups this many seconds after uploading. 0 = never
}

struct DatabaseBackupPolicy {
4: set_RepoName_8170 allowed = [];
// What to back up
3: string location = "manifold:glean_databases/nodes/dev-backup";
4: set_RepoName_8170 allowed = [];

// Default location to restore from or backup to, unless
// overridden by an entry in repos below.
3: string location = "manifold:glean_databases/nodes/dev-backup";

5: map<RepoName, Backup> repos = {};
// Backup policy to use per DB name
5: map<RepoName, Backup> repos = {};

// DEPRECATED
1: bool enabled = false;

// DEPRECATED
2: set<RepoName> override = [];
// DEPRECATED
}

// Server will be serving just a subset of the glean dbs specified in the policy
Expand All @@ -107,27 +122,31 @@ struct NoShardsPolicy {}

// Delegate the sharding allocation to ShardManager
struct ShardManagerPolicy {
1: i32 nshards;
// The total number of shards, as specified in the ShardManager spec
2: string service_name;
1: i32 nshards;

// The Shard Manager service name
2: string service_name;
3: string default_domain_id = "default";
}

struct ShardManagerMostRecentPolicy {
1: ShardManagerPolicy shard_manager_policy;

// The domain id used to track the most recent db instances
// All other db instances should use the default domain id
2: string most_recent_domain_id;
// The domain id used to track the most recent db instances
// All other db instances should use the default domain id
}

union ShardingPolicy {
1: StaticShardsPolicy static_assignment;
2: NoShardsPolicy no_shards;
3: ShardManagerPolicy shard_manager;

// A sharding policy for a domain-less Shard Manager spec
3: ShardManagerPolicy shard_manager;

// Sharding for all dbs except the most recent instances for each db name
4: ShardManagerMostRecentPolicy shard_manager_most_recent;
// Sharding for all dbs except the most recent instances for each db name
}

// Configeration for Glean Servers
Expand All @@ -136,73 +155,94 @@ struct Config {
2: DatabaseRestorePolicy restore;
3: DatabaseClosePolicy close;
4: DatabaseBackupPolicy backup;
5: optional Seconds janitor_period;

// How often to run the janitor, which initiates backup, restore,
// and deletion operations on databases. If missing, the janitor
// will never run and none of these operations will be performed.
21: Seconds backup_list_sync_period = 300;
5: optional Seconds janitor_period;

// How often to query for backups. Runs in the janitor so a
// timespan less than janitor_period will query for backups every
// janitor run.
6: optional i64 default_max_results;
21: Seconds backup_list_sync_period = 300;

// If the user doesn't suppliy a max_results, then this is what we
// use. Note: setting this makes it impossible to do a query with
// unlimited results (which is arguably a good thing).
18: optional i64 default_max_bytes;
6: optional i64 default_max_results;

// If the user doesn't suppliy a max_bytes, then this is what we
// use. Note: setting this makes it impossible to do a query with
// unlimited bytes (which is arguably a good thing).
20: optional i64 default_max_time_ms;
18: optional i64 default_max_bytes;

// If the user doesn't supply a max_time_ms, then this is what we
// use. Note: setting this makes it impossible to do a query with
// unlimited time (which is arguably a good thing).
7: optional i64 query_alloc_limit;
20: optional i64 default_max_time_ms;

// An allocation limit to protect the server from bugs and runaway
// queries.
8: i32 logging_rate_limit = 50;
7: optional i64 query_alloc_limit;

// Max logs/s per method
9: i32 db_writes_keep = 1200;
8: i32 logging_rate_limit = 50;

// how long to keep to keep write results for (in seconds)
10: i32 db_writes_reap = 300;
9: i32 db_writes_keep = 1200;

// how often to reap writes (in seconds)
11: i32 db_writer_threads = 48;
10: i32 db_writes_reap = 300;

// Number of threads processing write requests from the queue
12: i32 db_write_queue_limit_mb = 10000;
11: i32 db_writer_threads = 48;

// Write queue size limit in MB
12: i32 db_write_queue_limit_mb = 10000;

// whether and how often to save checkpoints for ptail-based writes
13: i32 db_ptail_checkpoint_bytes = 2000000000;
14: bool db_ptail_checkpoint_enabled = true;
// whether and how often to save checkpoints for ptail-based writes
15: i32 db_rocksdb_cache_mb = 8000;

// size of shared rocksdb cache in MB (0 means don't have a shared cache)
16: i32 db_lookup_cache_limit_mb = 1000;
15: i32 db_rocksdb_cache_mb = 8000;

// lookup cache size limit for each database in MB
19: optional DBVersion db_create_version;
16: i32 db_lookup_cache_limit_mb = 1000;

// What binary representation to use for newly created databases
// (nothing means use latest supported).
22: bool disable_predicate_dependency_checks = false;
19: optional DBVersion db_create_version;

// Disable completed dependencies check in stored predicates derivation
// process.
23: bool compact_on_completion = false;
22: bool disable_predicate_dependency_checks = false;

// Should we compact the DB when it is complete, and before it is backed up?
// For production use this should normally be true.
24: bool enable_schema_evolution = true;
23: bool compact_on_completion = false;

// DEPRECATED
25: Seconds min_db_age = 0;
24: bool enable_schema_evolution = true;

// The minimum age (in seconds) of a DB before we consider listing with
// GleanService.listDatabases(). The idea here is that if we wait a
// little while, there's a better chance that the DB will have propagated
// to all the servers.
26: ShardingPolicy sharding = {"no_shards": {}};
25: Seconds min_db_age = 0;

// Out of all available and restorable databases, this server may serve
// only part of them and sharding policy descrbes how the server picks them
27: bool use_schema_id = true;
26: ShardingPolicy sharding = {"no_shards": {}};

// If true, queries will use schema_id instead of schema_version
// to resolve the query. Specifically the server will use the
// first one that exists in the following list:
// * schema_id from the UserQuery request
// * --schema-id flag passed to the server
// * glean.schema_id from the DB
// * the latest all.N in the current schema instance
27: bool use_schema_id = true;

// If true, enable RocksDB's cache_index_and_filter_blocks
28: bool db_rocksdb_cache_index_and_filter_blocks = false;
Expand All @@ -217,8 +257,7 @@ struct Config {
30: bool use_manifold_cli = true;

// The maximum age of the remote db list in seconds, after which the
// server will restart *if Manifold is alive*. If Manifold is believed dead,
// we keep the server alive
// server will restart if the remote db list server is believed alive.
31: Seconds max_remote_db_list_age = 600;
}

Expand Down

0 comments on commit 7c44d60

Please sign in to comment.