Skip to content

Commit 8b771a8

Browse files
committed
DOC: Modifications to documentation following PR 5369 review.
TST: Modifications to unit test following PR 5369 review.
1 parent 9bac34d commit 8b771a8

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

doc/source/io.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,12 +2745,9 @@ Notes & Caveats
27452745
need to serialize these operations in a single thread in a single
27462746
process. You will corrupt your data otherwise. See the issue
27472747
(:`2397`) for more information.
2748-
- If serializing all write operations via a single thread in a single
2749-
process is not an option, another alternative is to use an external
2750-
distributed lock manager to ensure there is only a single writer at a
2751-
time and all readers close the file during writes and re-open it after any
2752-
writes. In this case you should use ``store.flush(fsync=True)`` prior to
2753-
releasing any write locks. See the issue (:`5364`) for more information.
2748+
- If you use locks to manage write access between multiple processes, you
2749+
may want to use :py:func:`~os.fsync` before releasing write locks. For
2750+
convenience you can use ``store.flush(fsync=True)`` to do this for you.
27542751
- ``PyTables`` only supports fixed-width string columns in
27552752
``tables``. The sizes of a string based indexing column
27562753
(e.g. *columns* or *minor_axis*) are determined as the maximum size

pandas/io/pytables.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -530,21 +530,17 @@ def flush(self, fsync=False):
530530
"""
531531
Force all buffered modifications to be written to disk.
532532
533-
By default this method requests PyTables to flush, and PyTables in turn
534-
requests the HDF5 library to flush any changes to the operating system.
535-
There is no guarantee the operating system will actually commit writes
536-
to disk.
537-
538-
To request the operating system to write the file to disk, pass
539-
``fsync=True``. The method will then block until the operating system
540-
reports completion, although be aware there might be other caching
541-
layers (eg disk controllers, disks themselves etc) which further delay
542-
durability.
543-
544533
Parameters
545534
----------
546-
fsync : boolean, invoke fsync for the file handle, default False
535+
fsync : bool (default False)
536+
call ``os.fsync()`` on the file handle to force writing to disk.
547537
538+
Notes
539+
-----
540+
Without ``fsync=True``, flushing may not guarantee that the OS writes
541+
to disk. With fsync, the operation will block until the OS claims the
542+
file has been written; however, other caching layers may still
543+
interfere.
548544
"""
549545
if self._handle is not None:
550546
self._handle.flush()

pandas/io/tests/test_pytables.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,6 @@ def test_flush(self):
465465
with ensure_clean(self.path) as store:
466466
store['a'] = tm.makeTimeSeries()
467467
store.flush()
468-
469-
def test_flush_fsync(self):
470-
471-
with ensure_clean(self.path) as store:
472-
store['a'] = tm.makeTimeSeries()
473468
store.flush(fsync=True)
474469

475470
def test_get(self):

0 commit comments

Comments
 (0)