Fix page was not rewinded before file write

master
Yury Kurlykov 2019-10-31 03:50:50 +10:00
parent a0fb9e6a63
commit 22ab490e3c
1 changed files with 2 additions and 0 deletions

View File

@ -299,6 +299,7 @@ YDB_Error ydb_append_page(YDB_Engine* instance, YDB_TablePage* page) {
YDB_Flags f = ydb_page_flags_get(page); YDB_Flags f = ydb_page_flags_get(page);
YDB_Offset next = 0; YDB_Offset next = 0;
char d[YDB_TABLE_PAGE_SIZE - 11]; // TODO move magic numbers somewhere char d[YDB_TABLE_PAGE_SIZE - 11]; // TODO move magic numbers somewhere
ydb_page_data_seek(page, 0);
if (ydb_page_data_read(page, d, sizeof(d))) { if (ydb_page_data_read(page, d, sizeof(d))) {
return YDB_ERR_UNKNOWN; // FIXME return YDB_ERR_UNKNOWN; // FIXME
} }
@ -338,6 +339,7 @@ YDB_Error ydb_replace_current_page(YDB_Engine *instance, YDB_TablePage *page) {
// Write data // Write data
char page_data[YDB_TABLE_PAGE_SIZE - 11]; // TODO move magic numbers somewhere char page_data[YDB_TABLE_PAGE_SIZE - 11]; // TODO move magic numbers somewhere
ydb_page_data_seek(page, 0);
if (ydb_page_data_read(page, page_data, sizeof(page_data))) { if (ydb_page_data_read(page, page_data, sizeof(page_data))) {
return YDB_ERR_UNKNOWN; // FIXME return YDB_ERR_UNKNOWN; // FIXME
} }