merkle_sync: add debug logs to _get_level_hashes (SQL error + bitmap result)

This commit is contained in:
Evgeny committed 2026-07-25 17:43:22 +03:00
1 parent 177e9f7d4d
commit de8d40180e
1 file changed
+5 -1
+5 -1
View File
@@ -175,8 +175,10 @@ static int _get_level_hashes(struct merkle_sync* ms, const char* ns,
if (sqlite3_prepare_v2(db,
"SELECT prefix64, hash FROM merkle_tree_hash"
" WHERE namespace=? AND level=? AND prefix64>=? AND prefix64<=?"
" ORDER BY prefix64", -1, &stmt, NULL) != SQLITE_OK || !stmt)
" ORDER BY prefix64", -1, &stmt, NULL) != SQLITE_OK || !stmt) {
DEBUG_ERROR(DEBUG_CATEGORY_DB_SYNC, "%s: _get_level_hashes SQL error ns=%s L%d — %s", MS_ID, ns, level, sqlite3_errmsg(db));
return -1;
}
sqlite3_bind_text(stmt, 1, ns, -1, SQLITE_STATIC);
sqlite3_bind_int(stmt, 2, (int)(level + 1));
sqlite3_bind_int64(stmt, 3, (sqlite3_int64)prefix);
@@ -190,6 +192,8 @@ static int _get_level_hashes(struct merkle_sync* ms, const char* ns,
memcpy(hashes[bucket], h, MT_HASH_SIZE);
}
sqlite3_finalize(stmt);
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: _get_level_hashes ns=%s L%d/P%016llx bitmap=%08x",
MS_ID, ns, level, (unsigned long long)prefix, *bitmap);
return 0;
}