Exemplo n.º 1
0
 def _verify_wal(self, filetype, filename, path):
     if filetype != "xlog":
         return
     try:
         with open(path, "rb") as fp:
             hdr = wal.read_header(fp.read(wal.WAL_HEADER_LEN))
     except (KeyError, OSError, ValueError) as ex:
         fmt = "WAL file {path!r} verification failed: {ex.__class__.__name__}: {ex}"
         raise HttpResponse(fmt.format(path=path, ex=ex), status=412)
     expected_lsn = wal.lsn_from_name(filename)
     if hdr.lsn != expected_lsn:
         fmt = "Expected LSN {lsn!r} in restored WAL file {path!r}; found {found!r}"
         raise HttpResponse(fmt.format(lsn=expected_lsn, path=path, found=hdr.lsn), status=412)
Exemplo n.º 2
0
 def _verify_wal(self, filetype, filename, path):
     if filetype != "xlog":
         return
     try:
         with open(path, "rb") as fp:
             hdr = wal.read_header(fp.read(wal.WAL_HEADER_LEN))
     except (KeyError, OSError, ValueError) as ex:
         fmt = "WAL file {path!r} verification failed: {ex.__class__.__name__}: {ex}"
         raise HttpResponse(fmt.format(path=path, ex=ex), status=412)
     expected_lsn = wal.lsn_from_name(filename)
     if hdr.lsn != expected_lsn:
         fmt = "Expected LSN {lsn!r} in restored WAL file {path!r}; found {found!r}"
         raise HttpResponse(fmt.format(lsn=expected_lsn,
                                       path=path,
                                       found=hdr.lsn),
                            status=412)
Exemplo n.º 3
0
def test_lsn_from_name():
    assert wal.lsn_from_name("0000002E0000001100000004") == "11/4000000"
    assert wal.lsn_from_name("000000FF0000001100000004") == "11/4000000"
Exemplo n.º 4
0
def test_lsn_from_name():
    assert wal.lsn_from_name("0000002E0000001100000004") == "11/4000000"
    assert wal.lsn_from_name("000000FF0000001100000004") == "11/4000000"