Commit Graph

148 Commits

Author SHA1 Message Date
Dennis Heimbigner
4636584d5b Revert/Improve nc_create + NC_DISKLESS behavior
re: https://github.com/Unidata/netcdf-c/issues/1154

Inadvertently, the behavior of NC_DISKLESS with nc_create() was
changed in release 4.6.1. Previously, the NC_WRITE flag needed
to be explicitly used with NC_DISKLESS in order to cause the
created file to be persisted to disk.

Additional analyis indicated that the current NC_DISKLESS
implementation was seriously flawed.

This PR attempts to clean up and regularize the situation with
respect to NC_DISKLESS control. One important aspect of diskless
operation is that there are two different notions of write.

1. The file is read-write vs read-only when using the netcdf API.
2. The file is persisted or not to disk at nc_close().

Previously, these two were conflated. The rules now are
as follows.

1. NC_DISKLESS + NC_WRITE means that the file is read/write using the netcdf API
2. NC_DISKLESS + NC_PERSIST means that the file is persisted to a disk file at nc_close.
3. NC_DISKLESS + NC_PERSIST + NC_WRITE means both 1 and 2.

The NC_PERSIST flag is new and takes over the obsolete NC_MPIPOSIX flag.
NC_MPIPOSIX is still defined, but is now an alias for the NC_MPIIO flag.

It is also now the case that for netcdf-4, NC_DISKLESS is independent
of NC_INMEMORY and in fact it is an error to specify both flags
simultaneously.

Finally, the MMAP code was fixed to use NC_PERSIST as well.
Also marked MMAP as deprecated.

Also added a test case to test various combinations of NC_DISKLESS,
NC_PERSIST, and NC_WRITE.

This PR affects a number of files and especially test cases
that used NC_DISKLESS.

Misc. Unrelated fixes
1. fixed some warnings in ncdump/dumplib.c
2018-10-10 13:32:17 -06:00
Wei-keng Liao
0ed70756cc Ignore flags NC_MPIIO and NC_MPIPOSIX. 2018-09-22 20:22:34 -05:00
Wei-keng Liao
28512f77f0 remove unused variables 2018-09-18 01:27:57 -05:00
Wei-keng Liao
83608143ee more checks of NC_ENOTBUILT 2018-09-17 17:18:48 -05:00
Wei-keng Liao
48da78e133 Use PnetCDF instead of parallel-netcdf to avoid confusion with
parallel netcdf4. Also, update PnetCDF web page.
2018-09-17 17:18:48 -05:00
Wei-keng Liao
d24f292077 return NC_ENOTBUILT when CDF5 is not enabled but NC_64BIT_DATA is used 2018-09-17 17:18:48 -05:00
Wei-keng Liao
ec2b3250a3 Use cmode for nc_create() and omode for nc_open() 2018-09-17 17:18:48 -05:00
Wei-keng Liao
2e85316dbb Improve parallel create/open mode logic.
1. When model is detected as NC_FORMATX_NC3 and is called from
   nc_create_par, change the model to NC_FORMATX_PNETCDF.
2. When called from nc_create() or nc_open(), using NC_MPIIO or
   NC_MPIPOSIX is considered invalid.
3. Handle the case when NETCDF4 is not enabled but cmode/omode
   contains NC_NETCDF4.
4. Handle the case when PNETCDF is not enabled but cmode/omode
   contains NC_PNETCDF.
5. Correct comments about PnetCDF only handles CDF-5 files.
6. Add a check for MPI_ERR_NO_SUCH_FILE error class.

Make NC_check_file_type() static, as it is used in dfile.c only.
2018-09-17 17:18:48 -05:00
Dennis Heimbigner
d62a9e623c Fix the NC_INMEMORY code to work in all cases with HDF5 1.10.
re: github issue https://github.com/Unidata/netcdf-c/issues/1111

One of the less common use cases for the in-memory feature is
apparently failing with HDF5-1.10.x.  The fix is complicated and
requires significant changes to libhdf5/nc4memcb.c. The current
setup is detailed in the file docs/inmeminternal.dox.

Additionally, it was discovered that the program
nc_test/tst_inmemory.c, which is invoked by
nc_test/run_inmemory.sh, actually was failing because of the
above problem. But the failure is not detected since the script
does not return non-zero value.

Other Changes:
1. Fix nc_test_tst_inmemory to return errors correctly.
2. Make ncdap_tests/findtestserver.c and dap4_tests/findtestserver4.c
   be generated from ncdap_test/findtestserver.c.in.
3. Make LOG() print output to stderr instead of stdout to
   avoid contaminating e.g. ncdump output.
4. Modify the handling of NC_INMEMORY and NC_DISKLESS flags
   to properly handle that NC_DISKLESS => NC_INMEMORY. This
   affects a number of code pieces, especially memio.c.
2018-09-04 11:27:47 -06:00
Wei-keng Liao
0ee68a3263 This commit fixes the logical problem of using the default file formats.
The fix includes the following changes.
1. Checking and using the default file format at file create time is now
   done only when the create mode (argument cmode) does not include any
   format related flags, i.e. NC_64BIT_OFFSET, NC_64BIT_DATA,
   NC_CLASSIC_MODEL, and NC_NETCDF4.
2. Adjustment of cmode based on the default format is now done in
   NC_create() only. The idea is to adjust cmode before entering the
   dispatcher's file create subroutine.
3. Any adjustment of cmode is removed from all I/O dispatchers, i.e.
   NC4_create(), NC3_create(), and NCP_create().
4. Checking for illegal cmode has been done in check_create_mode() called
   in NC_create(). This commit removes the redundant checking from
   NCP_create().
5. Remove PnetCDF tests in nc_test/tst_names.c, so it can focus on testing
   all classic formats and netCDF4 formats.

Two new test programs are added. They can be used to test netCDF with and
without this commit.
1. nc_test/tst_default_format.c
2. nc_test/tst_default_format_pnetcdf.c (use when PnetCDF is enabled).
2018-07-28 11:18:28 -05:00
Ward Fisher
a741bec8d9 Merge branch 'doc-cdf5' of https://github.com/wkliao/netcdf-c into pr-aggregation.wif 2018-07-18 14:08:20 -06:00
Ward Fisher
d6ed28291a
Merge branch 'master' into doc-cdf5 2018-07-17 15:53:56 -06:00
Ward Fisher
b570d10e01
Merge branch 'master' into enable-cdf5 2018-07-17 11:26:02 -06:00
Wei-keng Liao
577fcea506 add missing note about CDF-5 format 2018-07-05 22:54:41 -05:00
Wei-keng Liao
f95d3e3325 replace USE_CDF5 with ENABLE_CDF5 2018-06-29 21:17:07 -05:00
Dennis Heimbigner
40013b72f6 The pr does some cleanup on the internal documentation
in the docs directory.
1. Add a new internal document -- testserver.dox -- to describe
   how to set up and maintain the dap test server.
2. It moves the internal documentation (internal.dox, indexing.dox,
   and testserver.dox) to later in the documentation table of contents.
3. Cleanup the formatting of the internal documents.
4. Cleanup some minor doxygen issues in other files.
2018-06-29 15:06:27 -06:00
Ed Hartnett
29ce3b7d8c
Merge branch 'master' into ejh_udf 2018-06-08 14:49:15 -06:00
Ward Fisher
335f25e947 Corrected a couple of potential memory related issues and an uninitialized variable issue. 2018-06-08 11:38:11 -06:00
Ed Hartnett
7aa073eb5d magic numbers working with user-defined formats 2018-06-07 06:49:16 -06:00
Ed Hartnett
8d08b8c236 more magic numbers 2018-06-06 13:09:16 -06:00
Ed Hartnett
c172acab98 more magic numbers 2018-06-06 12:54:03 -06:00
Ed Hartnett
0dcdf7198f more magic numbers 2018-06-06 12:21:37 -06:00
Ed Hartnett
17da700a5c adding support for magic numbers 2018-06-05 12:22:38 -06:00
Ed Hartnett
2e831e9bbe initialization of user-defined formats 2018-06-02 08:43:34 -06:00
Ed Hartnett
dbacd00c9c fixing windows build problem, plus documentation 2018-05-30 03:29:19 -06:00
Ed Hartnett
aa4032a4f1 merged upstream master 2018-05-30 02:51:32 -06:00
Ed Hartnett
5a0b1cbe98
Merge branch 'master' into ejh_comm_info 2018-05-17 04:24:29 -06:00
Ed Hartnett
ba2c572f63
Merge branch 'master' into ejh_udf 2018-05-16 16:23:27 -06:00
Ed Hartnett
2b44cd3470 don't use MPI_COMM_WORLD as default 2018-05-16 09:36:32 -06:00
Ed Hartnett
350946b1e0 user defined formats only if netcdf-4 is built 2018-05-13 16:03:04 -06:00
Ed Hartnett
a44fda8901 user defined formats 2018-05-13 14:16:07 -06:00
Dennis Heimbigner
3c7ffcc6d1 Fix https://github.com/Unidata/netcdf-c/issues/963
Fix https://github.com/Unidata/netcdf-c/issues/962

1. remove the --disable-diskless option since it is no
   longer needed. Similarly for CMakeLists.txt.
2. Fixed nc4files.c where BAIL and return were mixed
   leading to situation where cleanup code was not
   being invoked. This probably occurs elsewhere,
   but I did not find any specifically.
2018-05-11 15:30:19 -06:00
Dennis Heimbigner
9aa1e9a14e master merge 2018-05-03 21:02:12 -06:00
luz.paz
b4d0fe651a Follow-up trivial typos 2018-04-26 23:04:01 -04:00
Dennis Heimbigner
4739cd3225 Master merge and conflict resolution 2018-04-12 21:51:17 -06:00
Ward Fisher
36c4b7947d Merge branch 'master' into newhash1.dmh 2018-03-20 11:20:14 -06:00
Ward Fisher
0b008fae62 Fencepost for unistd.h 2018-03-12 11:08:50 -06:00
Ward Fisher
66fb19ab36
Merge branch 'master' into big_var_on_32bit 2018-03-05 09:35:23 -07:00
Dennis Heimbigner
ccc70d640b re: esupport MQO-415619
and https://github.com/Unidata/netcdf-c/issues/708

Expand the NC_INMEMORY capabilities to support writing and accessing
the final modified memory.

Three new functions have been added:
nc_open_memio, nc_create_mem, and nc_close_memio.

The following new capabilities were added.
1. nc_open_memio() allows the NC_WRITE mode flag
   so a chunk of memory can be passed in and be modified
2. nc_create_mem() allows the NC_INMEMORY flag to be set
   to cause the created file to be kept in memory.
3. nc_close_mem() allows the final in-memory contents to be
   retrieved at the time the file is closed.
4. A special flag, NC_MEMIO_LOCK, is provided to ensure that
   the provided memory will not be freed or reallocated.

Note the following.
1. If nc_open_memio() is called with NC_WRITE, and NC_MEMIO_LOCK is not set,
   then the netcdf-c library will take control of the incoming memory.
   This means that the original memory block should not be freed
   but the block returned by nc_close_mem() must be freed.
2. If nc_open_memio() is called with NC_WRITE, and NC_MEMIO_LOCK is set,
   then modifications to the original memory may fail if the space available
   is insufficient.

Documentation is provided in the file docs/inmemory.md.
A test case is provided: nc_test/tst_inmemory.c driven by
nc_test/run_inmemory.sh

WARNING: changes were made to the dispatch table for
the close entry. From int (*close)(int) to int (*close)(int,void*).
2018-02-25 21:45:31 -07:00
Dennis Heimbigner
8cb1fc4cfe This is the second step in refactoring the libsrc4 code.
The first was branch newhash0.dmh.

As with newhash0.dmh, these changes should be transparent.
2018-02-24 20:36:24 -07:00
Ward Fisher
f9f27c5ab7
Merge branch 'master' into newhash0.dmh 2018-02-21 14:19:43 -07:00
Dennis Heimbigner
727b613459 This is the initial step in moving to the new higher performance
(I hope) metadata mechanism. This mostly just adds new pieces of
code (e.g. nclistmap) and does some minor fixes.

It should be transparent to everything else.
The next set of changes will be the big step.
2018-02-08 19:53:40 -07:00
Ed Hartnett
2358d4a910 moved HDF4 to its own dispatch layer 2018-02-08 06:20:58 -07:00
Ward Fisher
47f61cf8b8
Merge branch 'master' into big_var_on_32bit 2018-01-31 10:42:05 -07:00
Dennis Heimbigner
99fccab359 1. Keep up to date by merging master
2. Fixed plugin building (nc_test4/hdf5plugins)
   to be done properly by cmake and automake.
4. Duplicated part of the nc_test4 filter test code
   in examples/C

An incomplete and untested set of hooks exist
for OS-X in nc_test4/findplugins.in. They need testing.
2018-01-16 11:00:09 -07:00
Ward Fisher
39ce5e6058
Merge branch 'master' into big_var_on_32bit 2017-12-20 18:11:22 -07:00
Ed Hartnett
ea49cc1d3f merged ejh_notbuilt_errors 2017-12-04 13:23:31 -07:00
Ed Hartnett
1153f0f084 merged in branch ejh_cleanup 2017-12-04 13:20:42 -07:00
Ed Hartnett
4de61e21f2 more docs, more cleaning 2017-12-04 12:21:14 -07:00
Ed Hartnett
857dda487f fixed two doxygen warnings 2017-11-30 08:45:53 -07:00