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

Commit253c2aa

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 parentd2a98e4 commit253c2aa

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
}
@@ -1439,6 +1443,7 @@ _fill_knn_data(const DataEntry *entry, List **reloids)
14391443
ptr+=sizeof(double)*data->cols;
14401444
}
14411445
}
1446+
14421447
/* copy targets from DSM storage */
14431448
memcpy(data->targets,ptr,sizeof(double)*entry->rows);
14441449
ptr+=sizeof(double)*entry->rows;
@@ -1461,7 +1466,11 @@ _fill_knn_data(const DataEntry *entry, List **reloids)
14611466
*reloids=lappend_oid(*reloids,ObjectIdGetDatum(*(Oid*)ptr));
14621467
ptr+=sizeof(Oid);
14631468
}
1464-
Assert(ptr- (char*)dsa_get_address(data_dsa,entry->data_dp)==sz);
1469+
1470+
offset=ptr- (char*)dsa_get_address(data_dsa,entry->data_dp);
1471+
if (offset!=sz)
1472+
elog(PANIC,"[AQO] Shared memory ML storage is corrupted.");
1473+
14651474
returndata;
14661475
}
14671476

@@ -1710,9 +1719,10 @@ aqo_data_reset(void)
17101719
}
17111720
aqo_state->data_changed= true;
17121721
LWLockRelease(&aqo_state->data_lock);
1713-
Assert(num_remove==num_entries);
1722+
if (num_remove!=num_entries)
1723+
elog(ERROR,"[AQO] Query ML memory storage is corrupted or parallel access without a lock has detected.");
17141724

1715-
/* TODO: clean disk storage */
1725+
aqo_data_flush();
17161726

17171727
returnnum_remove;
17181728
}
@@ -1844,8 +1854,11 @@ aqo_queries_reset(void)
18441854
elog(ERROR,"[AQO] hash table corrupted");
18451855
num_remove++;
18461856
}
1857+
aqo_state->queries_changed= true;
18471858
LWLockRelease(&aqo_state->queries_lock);
1848-
Assert(num_remove==num_entries-1);
1859+
1860+
if (num_remove!=num_entries-1)
1861+
elog(ERROR,"[AQO] Queries memory storage is corrupted or parallel access without a lock has detected.");
18491862

18501863
aqo_queries_flush();
18511864

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp