Skip to content

Commit

Permalink
Use allways Normalized key
Browse files Browse the repository at this point in the history
  • Loading branch information
rickb80 committed Aug 28, 2023
1 parent f4ef6c4 commit ac3e504
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/hashdb/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ zkresult Database::write(const string &_key, const Goldilocks::Element* vkey, co
if(usingAssociativeCache()){
Goldilocks::Element vkeyf[4];
if(vkey == NULL){
string2key(fr, _key, vkeyf);
string2key(fr, key, vkeyf);
}else{
vkeyf[0] = vkey[0];
vkeyf[1] = vkey[1];
Expand Down Expand Up @@ -2039,7 +2039,8 @@ void loadDb2MemCache(const Config &config)
hash = treeMapIterator->second[i];
dbValue.clear();
Goldilocks::Element vhash[4];
if(pHashDB->db.usingAssociativeCache()) string2key(fr, hash, vhash);
string hashNorm = NormalizeToNFormat(hash, 64);
if(pHashDB->db.usingAssociativeCache()) string2key(fr, hashNorm, vhash);
zkresult zkr = pHashDB->db.read(hash, vhash, dbValue, NULL, true);

if (zkr != ZKR_SUCCESS)
Expand Down
2 changes: 1 addition & 1 deletion src/hashdb/database_associative_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool DatabaseMTAssociativeCache::findKey(Goldilocks::Element (&key)[4], vector<G
//
if (attempts<<40 == 0)
{
zklog.info("DatabaseMTAssociativeCache::addKeyValue() name=" + name + " indexesSize=" + to_string(indexesSize) + " cacheSize=" + to_string(cacheSize) + " attempts=" + to_string(attempts) + " hits=" + to_string(hits) + " hit ratio=" + to_string(double(hits) * 100.0 / double(zkmax(attempts, 1))) + "%");
zklog.info("DatabaseMTAssociativeCache::findKey() name=" + name + " indexesSize=" + to_string(indexesSize) + " cacheSize=" + to_string(cacheSize) + " attempts=" + to_string(attempts) + " hits=" + to_string(hits) + " hit ratio=" + to_string(double(hits) * 100.0 / double(zkmax(attempts, 1))) + "%");
}
//
// Find the value
Expand Down
2 changes: 1 addition & 1 deletion src/utils/scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void string2key(Goldilocks &fr, const string& os, Goldilocks::Element (&fea)[4])
Goldilocks::Element fe;
if (os.size() != 64)
{
zklog.error("Database::string2fea() found incorrect DATA column size: " + to_string(os.size()));
zklog.error("Database::string2key() found incorrect DATA column size: " + to_string(os.size()));
exitProcess();
}
int ii=0;
Expand Down

0 comments on commit ac3e504

Please sign in to comment.