Commit fa59e4c9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5dfff338
...@@ -467,11 +467,18 @@ error _Conn::resync(zodb::Tid at) { ...@@ -467,11 +467,18 @@ error _Conn::resync(zodb::Tid at) {
if (err != nil) if (err != nil)
return E(err); return E(err);
bool retok = false;
defer([&]() {
if (!retok)
; // XXX bring wconn + fileh + mmaps down on errror
});
for (auto fit : wconn._filehtab) { for (auto fit : wconn._filehtab) {
zodb::Oid foid = fit.first; zodb::Oid foid = fit.first;
FileH f = fit.second; FileH f = fit.second;
// XXX if file has no mappings and was not used during whole prev // TODO if file has no mappings and was not used during whole prev
// cycle - forget and stop watching it // cycle - forget and stop watching it
// update f._headfsize and remmap to head/f zero regions that are now covered by head/f // update f._headfsize and remmap to head/f zero regions that are now covered by head/f
...@@ -510,12 +517,13 @@ error _Conn::resync(zodb::Tid at) { ...@@ -510,12 +517,13 @@ error _Conn::resync(zodb::Tid at) {
if (err != nil) if (err != nil)
return E(err); return E(err);
if (ack != "ok") { if (ack != "ok") {
// XXX unregister f from _filehtab // XXX unregister f from _filehtab ?
return E(fmt::errorf("%s", v(ack))); return E(fmt::errorf("%s", v(ack)));
} }
} }
wconn.at = at; wconn.at = at;
retok = true;
return nil; return nil;
} }
...@@ -566,7 +574,7 @@ error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) { ...@@ -566,7 +574,7 @@ error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) {
if (err != nil) if (err != nil)
return E(err); return E(err);
} }
// block is inside file - mmap file data // block is inside file - mmap in file data
else { else {
err = mmap_into_ro(blkmem, 1*f->blksize, fsfile, blk*f->blksize); err = mmap_into_ro(blkmem, 1*f->blksize, fsfile, blk*f->blksize);
if (err != nil) if (err != nil)
...@@ -605,7 +613,7 @@ void _Mapping::unmap() { ...@@ -605,7 +613,7 @@ void _Mapping::unmap() {
error err = mm::unmap(mmap->mem_start, mmap->mem_stop - mmap->mem_start); error err = mm::unmap(mmap->mem_start, mmap->mem_stop - mmap->mem_start);
if (err != nil) if (err != nil)
panic("TODO"); // XXX panic(v(err)); // XXX
mmap->mem_start = NULL; mmap->mem_start = NULL;
mmap->mem_stop = NULL; mmap->mem_stop = NULL;
// XXX clear other fields? // XXX clear other fields?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment