Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd1db7c8

Browse files
danolivoAlena Rybakina
authored and
Alena Rybakina
committed
Add error messages instead of (and in addition to) assertions to handle errors
on production instance in more predictable way.Also, make minor additions in storage reset functions: clean a disk storageafter cleaning the memory storage.
1 parent7fc2db5 commitd1db7c8

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

‎storage.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,11 @@ aqo_stat_reset(void)
391391
elog(ERROR,"[AQO] hash table corrupted");
392392
num_remove++;
393393
}
394+
aqo_state->stat_changed= true;
394395
LWLockRelease(&aqo_state->stat_lock);
395-
Assert(num_remove==num_entries);/* Is it really impossible? */
396+
397+
if (num_remove!=num_entries)
398+
elog(ERROR,"[AQO] Stat memory storage is corrupted or parallel access without a lock was detected.");
396399

397400
aqo_stat_flush();
398401

@@ -1231,9 +1234,10 @@ aqo_qtexts_reset(void)
12311234
}
12321235
aqo_state->qtexts_changed= true;
12331236
LWLockRelease(&aqo_state->qtexts_lock);
1234-
Assert(num_remove==num_entries-1);/* Is it really impossible? */
1237+
if (num_remove!=num_entries-1)
1238+
elog(ERROR,"[AQO] Query texts memory storage is corrupted or parallel access without a lock was detected.");
12351239

1236-
/* TODO: clean disk storage */
1240+
aqo_qtexts_flush();
12371241

12381242
returnnum_remove;
12391243
}
@@ -1441,6 +1445,7 @@ _fill_knn_data(const DataEntry *entry, List **reloids)
14411445
ptr+=sizeof(double)*data->cols;
14421446
}
14431447
}
1448+
14441449
/* copy targets from DSM storage */
14451450
memcpy(data->targets,ptr,sizeof(double)*entry->rows);
14461451
ptr+=sizeof(double)*entry->rows;
@@ -1463,7 +1468,11 @@ _fill_knn_data(const DataEntry *entry, List **reloids)
14631468
*reloids=lappend_oid(*reloids,ObjectIdGetDatum(*(Oid*)ptr));
14641469
ptr+=sizeof(Oid);
14651470
}
1466-
Assert(ptr- (char*)dsa_get_address(data_dsa,entry->data_dp)==sz);
1471+
1472+
offset=ptr- (char*)dsa_get_address(data_dsa,entry->data_dp);
1473+
if (offset!=sz)
1474+
elog(PANIC,"[AQO] Shared memory ML storage is corrupted.");
1475+
14671476
returndata;
14681477
}
14691478

@@ -1712,9 +1721,10 @@ aqo_data_reset(void)
17121721
}
17131722
aqo_state->data_changed= true;
17141723
LWLockRelease(&aqo_state->data_lock);
1715-
Assert(num_remove==num_entries);
1724+
if (num_remove!=num_entries)
1725+
elog(ERROR,"[AQO] Query ML memory storage is corrupted or parallel access without a lock has detected.");
17161726

1717-
/* TODO: clean disk storage */
1727+
aqo_data_flush();
17181728

17191729
returnnum_remove;
17201730
}
@@ -1846,8 +1856,11 @@ aqo_queries_reset(void)
18461856
elog(ERROR,"[AQO] hash table corrupted");
18471857
num_remove++;
18481858
}
1859+
aqo_state->queries_changed= true;
18491860
LWLockRelease(&aqo_state->queries_lock);
1850-
Assert(num_remove==num_entries-1);
1861+
1862+
if (num_remove!=num_entries-1)
1863+
elog(ERROR,"[AQO] Queries memory storage is corrupted or parallel access without a lock has detected.");
18511864

18521865
aqo_queries_flush();
18531866

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp