MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / handle_newsql

Function handle_newsql

tools/cdb2_sqlreplay/cdb2_sqlreplay.cpp:803–822  ·  view source on GitHub ↗

TODO: error messages? */

Source from the content-addressed store, hash-verified

801
802/* TODO: error messages? */
803void handle_newsql(cdb2_hndl_tp *db, cson_value *val) {
804 const char *sql = get_strprop(val, "sql");
805 const char *fingerprint = get_strprop(val, "fingerprint");
806
807 if (sql == nullptr || fingerprint == nullptr)
808 return;
809
810 /* If we already know this fingerprint, ignore it.
811 Checking if SQL matches is useless since diffent sql
812 statements can have identical fingerprints (eg: 'select 1'
813 and 'select 2'. Fingerprints are md5 hashes of the parse
814 tree. We can rely on them being unique for different
815 statement types, unless the user is malicious and extremely
816 clever, in which case we punish them with bad logging.
817 */
818 if (sqltrack.find(fingerprint) != sqltrack.end())
819 return;
820
821 add_fingerprint(std::string(fingerprint), std::string(sql));
822}
823
824
825void handle_txn(cdb2_hndl_tp *db, cson_value *val) {

Callers

nothing calls this directly

Calls 2

get_strpropFunction · 0.85
add_fingerprintFunction · 0.70

Tested by

no test coverage detected