MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _UndoLog_Rollback_Add_Schema

Function _UndoLog_Rollback_Add_Schema

src/undo_log/undo_log.c:291–311  ·  view source on GitHub ↗

undo schema addition

Source from the content-addressed store, hash-verified

289
290// undo schema addition
291static void _UndoLog_Rollback_Add_Schema
292(
293 QueryCtx *ctx,
294 int seq_start,
295 int seq_end
296) {
297 for(int i = seq_start; i > seq_end; --i) {
298 Edge e;
299 UndoOp *op = UNDOLOG_GET_ITEM(ctx->undo_log, i);
300 UndoAddSchemaOp schema_op = op->schema_op;
301 int schema_id = schema_op.schema_id;
302 int schema_count = GraphContext_SchemaCount(ctx->gc, schema_op.t);
303 ASSERT(schema_id == schema_count - 1);
304 GraphContext_RemoveSchema(ctx->gc, schema_id, schema_op.t);
305 if(schema_op.t == SCHEMA_NODE) {
306 Graph_RemoveLabel(ctx->gc->g, schema_id);
307 } else {
308 Graph_RemoveRelation(ctx->gc->g, schema_id);
309 }
310 }
311}
312
313// undo attribute addition
314static void _UndoLog_Rollback_Add_Attribute

Callers 1

UndoLog_RollbackFunction · 0.85

Calls 4

GraphContext_SchemaCountFunction · 0.85
Graph_RemoveLabelFunction · 0.85
Graph_RemoveRelationFunction · 0.85

Tested by

no test coverage detected