mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-19 02:12:28 +00:00
feat: add ingest_rows_rate_limit database option
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
This commit is contained in:
@@ -1507,6 +1507,18 @@ mod tests {
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let sql = "CREATE DATABASE prometheus with ('ingest_rows_rate_limit'='1000');";
|
||||
let result =
|
||||
ParserContext::create_with_dialect(sql, &GreptimeDbDialect {}, ParseOptions::default());
|
||||
let stmts = result.unwrap();
|
||||
match &stmts[0] {
|
||||
Statement::CreateDatabase(c) => {
|
||||
assert_eq!(c.name.to_string(), "prometheus");
|
||||
assert_eq!(c.options.get("ingest_rows_rate_limit").unwrap(), "1000");
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -101,6 +101,9 @@ pub const DDL_WAIT: &str = "wait";
|
||||
|
||||
pub const VALID_DDL_OPTION_KEYS: [&str; 2] = [DDL_TIMEOUT, DDL_WAIT];
|
||||
|
||||
/// The key of ingest rows rate limit option (rows per second, cluster-wide) in database options.
|
||||
pub const INGEST_ROWS_RATE_LIMIT_KEY: &str = "ingest_rows_rate_limit";
|
||||
|
||||
// Valid option keys when creating a db.
|
||||
static VALID_DB_OPT_KEYS: Lazy<HashSet<&str>> = Lazy::new(|| {
|
||||
let mut set = HashSet::new();
|
||||
@@ -120,6 +123,7 @@ static VALID_DB_OPT_KEYS: Lazy<HashSet<&str>> = Lazy::new(|| {
|
||||
set.insert(TWCS_TRIGGER_FILE_NUM);
|
||||
set.insert(TWCS_MAX_OUTPUT_FILE_SIZE);
|
||||
set.insert(SST_FORMAT_KEY);
|
||||
set.insert(INGEST_ROWS_RATE_LIMIT_KEY);
|
||||
set
|
||||
});
|
||||
|
||||
@@ -539,6 +543,8 @@ mod tests {
|
||||
MEMTABLE_BULK_ENCODE_BYTES_THRESHOLD
|
||||
));
|
||||
assert!(validate_database_option(MEMTABLE_BULK_MAX_MERGE_GROUPS));
|
||||
assert!(validate_database_option(INGEST_ROWS_RATE_LIMIT_KEY));
|
||||
assert!(validate_database_option("ingest_rows_rate_limit"));
|
||||
assert!(!validate_database_option("foo"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user