diff --git a/src/rust/data/mariadb_test_case_14.html b/src/rust/data/mariadb_test_case_14.html new file mode 100644 index 00000000..9d130fd5 --- /dev/null +++ b/src/rust/data/mariadb_test_case_14.html @@ -0,0 +1,35 @@ +

gtid_pos_auto_engines

+

This variable is used to enable multiple versions of the mysql.gtid_slave_pos table, one for each transactional storage + engine in use. This can improve replication performance if a server is using multiple different storage engines in + different transactions.

+

The value is a list of engine names, separated by commas (','). Replication + of transactions using these engines will automatically create new versions + of the mysql.gtid_slave_pos table in the same engine and use that for future + transactions (table creation takes place in a background thread). This avoids introducing a cross-engine transaction + to update the GTID position. Only transactional storage engines are supported for + gtid_pos_auto_engines (this currently means InnoDB, TokuDB, or MyRocks).

+

The variable can be changed dynamically, but replica SQL threads should be stopped when changing it, and it will take + effect when the replicas are running again.

+

When setting the variable on the command line or in a configuration file, it is + possible to specify engines that are not enabled in the server. The server will then still start if, for example, + that engine is no longer used. Attempting to set a non-enabled engine dynamically in a running server (with SET + GLOBAL gtid_pos_auto_engines) will still result in an error.

+

Removing a storage engine from the variable will have no effect once the new tables have been created - as long as + these tables are detected, they will be used.

+ diff --git a/src/rust/mariadb.rs b/src/rust/mariadb.rs index 55ae0954..214255f2 100644 --- a/src/rust/mariadb.rs +++ b/src/rust/mariadb.rs @@ -174,7 +174,20 @@ fn process_li(mut entry: KbParsedEntry, li_node: Node) -> KbParsedEntry { entry.dynamic = Some(row_value.to_lowercase() == "yes"); } "data type" | "type" => { - entry.r#type = Some(row_value.to_lowercase().trim().to_string()); + if li_node.find(Name("code")).count() == 1 { + entry.r#type = Some( + li_node + .find(Name("code")) + .next() + .unwrap() + .text() + .to_lowercase() + .trim() + .to_string(), + ); + } else { + entry.r#type = Some(row_value.to_lowercase().trim().to_string()); + } if entry.r#type != Some("".to_string()) { entry.r#type = cleaner::clean_type(entry.r#type.unwrap()); @@ -333,36 +346,6 @@ fn process_li(mut entry: KbParsedEntry, li_node: Node) -> KbParsedEntry { entry.r#type = cleaner::clean_type(row_value.to_lowercase()); } } - /* - - case 'description:': - doc.type = cleaner.cleanType(value.toLowerCase()); - break; - break; - case 'data type:': - /* - * Default method,
  • has a child - * Example:
  • Data Type: numeric
  • - */ - let dataType = valueKey.find('code'); - if (dataType.length > 0) { - doc.type = cleaner.cleanType(dataType.first().text().toLowerCase().trim()); - } else { - /* - * Fallback method,
  • has text - * Example:
  • Data Type: boolean
  • - */ - let dataType = value.replace(/undefined/gi, ''); - dataType = dataType.toLowerCase().trim(); - if (dataType !== '') { - doc.type = cleaner.cleanType(dataType); - } else if (dataType === '') { - console.log('Empty datatype found for : ' + doc.id); - } else { - console.log('No datatype found for : ' + doc.id); - } - } - break; */ _key => { //println!("{} '{}' -> '{}'", li_node.html(), key_name, row_value); //println!("tr: {} -> {}", row_name, row_value); @@ -892,4 +875,28 @@ mod tests { entries ); } + + #[test] + fn test_case_14() { + let entries = extract_mariadb_from_text(QueryResponse { + body: get_test_data("mariadb_test_case_14.html"), + url: "https://example.com", + }); + + assert_eq!( + vec![KbParsedEntry { + has_description: false, + cli: Some("--gtid-pos-auto-engines=value".to_string()), + default: Some("empty".to_string()), + dynamic: Some(true), + id: "gtid_pos_auto_engines".to_string(), + name: Some("gtid_pos_auto_engines".to_string()), + scope: Some(vec!["global".to_string()]), + r#type: Some("string".to_string()), + valid_values: None, + range: None, + },], + entries + ); + } }