sql: rename indices_created var to populated.
What changed, and why it matters
This commit is a simple internal code cleanup: a variable named `indices_created` is renamed to `populated` because it will be used more broadly as a 'has this table been initialized' flag. No behavior changes, no security fixes, and no bug fixes are visible in the diff.
No security action needed; treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In plugins/sql.c, the struct table_desc member indices_created is renamed to populated, along with its comment and all references. The logic remains identical: after the first refresh completes, init_indices() is called and the flag is set. The change is purely semantic/refactoring in preparation for future use of the flag beyond index creation.
Changed components
plugins/sql.cInspect captured patch +7 / −5
diff --git a/plugins/sql.c b/plugins/sql.c
index 7712b8be..065f3315 100644
--- a/plugins/sql.c
+++ b/plugins/sql.c
@@ -120,8 +120,8 @@ struct table_desc {
bool is_subobject;
/* Do we use created_index as primary key? Otherwise we create rowid. */
bool has_created_index;
- /* Have we created our sql indexes yet? */
- bool indices_created;
+ /* Have we ever been used? */
+ bool populated;
/* function to refresh it. */
struct command_result *(*refresh)(struct command *cmd,
const struct table_desc *td,
@@ -578,9 +578,11 @@ static struct command_result *one_refresh_done(struct command *cmd,
(u64)refresh_duration.ts.tv_nsec,
td->last_created_index);
- if (!td->indices_created) {
+ if (!td->populated) {
+ /* Now we've done initial population, install indices:
+ * much faster than creating them before! */
init_indices(cmd->plugin, td);
- td->indices_created = 1;
+ td->populated = true;
refresh_duration = timemono_since(td->refresh_start);
plugin_log(cmd->plugin, LOG_DBG,
"Time to refresh + create indices for %s: %"PRIu64".%09"PRIu64" seconds",
@@ -1655,7 +1657,7 @@ static struct table_desc *new_table_desc(const tal_t *ctx,
td->has_created_index = false;
td->needs_refresh = true;
td->refreshing = false;
- td->indices_created = false;
+ td->populated = false;
list_head_init(&td->refresh_waiters);
/* Only top-levels have refresh functions */
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.