Commit Graph

625 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
Dennis Heimbigner
a5a34f6aba
Merge branch 'master' into nc_mpiio_nc_mpiposix 2018-10-06 13:33:55 -06:00
Wei-keng Liao
82d7ae2a93 revise comments about collective I/O mode 2018-10-02 01:19:44 -05:00
Dennis Heimbigner
8072d1f6bb Modify DAP2 and DAP4 to optionally allow Fillvalue/Variable mismatch
re: issue https://github.com/Unidata/netcdf-c/issues/1151

Modify DAP2 and DAP4 code to handle case when _FillValue type is not
same as the parent variable type.

Specifically:
1. Define a parameter [fillmismatch] to allow this mismatch;
   default is to disallow.
2. If allowed, forcibly change the type of the _FillValue to match
   the parent variable.
3. If allowed Convert the values to match new type
4. Generate a log message
5. if not allowed, then fail

Implementing this required some changes to ncdap_test/dapcvt.c
Also added test cases.

Minor Unrelated Changes:
1. There were a number of warnings about e.g.
   assigning a const char* to a char*. Fix these
2. In nccopy.1, replace .NP with .IP "n"
   (re PR https://github.com/Unidata/netcdf-c/pull/1144)
3. fix minor error in ncdump/ocprint
2018-10-01 15:51:43 -06:00
Wei-keng Liao
0ed70756cc Ignore flags NC_MPIIO and NC_MPIPOSIX. 2018-09-22 20:22:34 -05:00
Wei-keng Liao
01da14da6f if cmode does not contain NC_NETCDF4, then it is for PnetCDF 2018-09-22 18:21:45 -05:00
Wei-keng Liao
bc63c08f41 add a check for MPI_Info_f2c 2018-09-21 17:32:36 -05:00
Wei-keng Liao
740a50d1f2 add more descriptions for parallel APIs 2018-09-20 12:59:19 -05:00
Wei-keng Liao
0853b3c9ee Merge branch 'pnetcdf_driver' of github.com:wkliao/netcdf-c into pnetcdf_driver 2018-09-20 11:50:27 -05:00
Wei-keng Liao
5ed6c239e1 More replacement of "parallel-netcdf" with "PnetCDF". 2018-09-20 11:45:25 -05:00
Ward Fisher
5b5311ef80
Merge branch 'master' into pnetcdf_driver 2018-09-18 12:21:11 -06: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
Wei-keng Liao
a537312895 nc_create_par() and nc_open_par() implies parallel I/O, so
using NC_MPIIO or NC_MPIPOSIX explicitly is not necessary.
These 2 subroutines call NC_create() and NC_open() with argument
useparallel set to 1, which should be used to tell which I/O
driver to use underneath.
2018-09-17 17:18:48 -05:00
Ward Fisher
5259b4b1e8
Merge branch 'master' into ejh_hdf5_sep_next_2 2018-09-17 14:53:55 -06:00
Dennis Heimbigner
108dc0f01d Fix szip filter handling code and correspondingtests
re: https://github.com/Unidata/netcdf-c/issues/972

The current szip plugin code in the HDF5 library has some
unexpected behaviors that require some changes to how
nc_inq_var_szip is implemented and to the corresponding tests:
nc_test4/{test_szip,tst_vars3}.

Specifically, the following can happen:

1. The number of parameters provided by the user will be two,
   but the number of parameters returned by nc_inq_var_filter
   will be four because the HDF5 code (H5Zszip) will add two
   extra parameters for internal use. It turns out that the two
   parameters provided when calling nc_def_var_filter correspond
   to the first two parameters of the four parameters returned
   by nc_inq_var_filter.

2. The nc_inq_var_szip values corresponding to the ones provided
   by the caller may be different than those provided by
   nc_def_var_filter.  The value of the options_mask argument is
   known to add additional flag bits, and the pixels_per_block
   parameter may be modified.
2018-09-15 15:21:51 -06:00
Ed Hartnett
86e002d794 merged master 2018-09-06 14:01:59 -06:00
Ward Fisher
fbe0a18b1c
Merge branch 'master' into ejh_loop_cleanup_2 2018-09-05 11:22:55 -06:00
Ward Fisher
d0bb5ddde8 Merge remote-tracking branch 'origin/inmemory10.dmh' into combined-pr.wif 2018-09-04 13:39:34 -06:00
Ward Fisher
3c3119bed2 Merge remote-tracking branch 'origin/dapcurlopt.dmh' into combined-pr.wif 2018-09-04 12:50:55 -06:00
Ed Hartnett
a23318929f
Merge branch 'master' into ejh_loop_cleanup_2 2018-09-04 12:44:46 -06: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
Dennis Heimbigner
4a1e84b721 Re github issue https://github.com/Unidata/netcdf-c/issues/1131
The identifier typename is apparently a reserved word in C++.
It is used as a fieldname in the ALignment struct in
include/ncoffsets.h.

Change the field name to type_name in ncoffsets.h
and also in libdispatch/doffsets.c, which uses that field.
2018-09-03 13:30:11 -06:00
Ed Hartnett
ad592448df merged master 2018-08-29 06:32:28 -06:00
Ed Hartnett
27281dfe4b
Merge branch 'master' into ejh_loop_cleanup_2 2018-08-28 17:32:40 -06:00
Ward Fisher
5e33522f52
Merge branch 'master' into default_format 2018-08-28 15:02:17 -06:00
Dennis Heimbigner
79e38de840 Add the ability to set some additional curlopt values
Add the ability to set some additional curlopt values via .daprc (aka .dodsrc).
This effects both DAP2 and DAP4 protocols.

Related issues:
[1] re: esupport: KOZ-821332
[2] re: github issue https://github.com/Unidata/netcdf4-python/issues/836
[3] re: github issue https://github.com/Unidata/netcdf-c/issues/1074

1. CURLOPT_BUFFERSIZE: Relevant to [1]. Allow user to set the read/write
buffersizes used by curl.
This is done by adding the following to .daprc (aka .dodsrc):
	HTTP.READ.BUFFERSIZE=n
where n is the buffersize in bytes. There is a built-in (to curl)
limit of 512k for this value.

2. CURLOPT_TCP_KEEPALIVE (and CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL):
Relevant (maybe) to [2] and [3]. Allow the user to turn on KEEPALIVE
This is done by adding the following to .daprc (aka .dodsrc):
	HTTP.KEEPALIVE=on|n/m
If the value is "on", then simply enable default KEEPALIVE. If the value
is n/m, then enable KEEPALIVE and set KEEPIDLE to n and KEEPINTVL to m.
2018-08-26 17:04:46 -06:00
Ed Hartnett
85f3579195 fixed docs 2018-08-24 14:15:59 -06:00
Ed Hartnett
cf890be803 fixed docs 2018-08-24 14:14:15 -06:00
Ward Fisher
373d0365a1
Merge branch 'master' into default_format 2018-08-24 11:27:07 -06:00
Ed Hartnett
62103d761c fixed spaceing in nc.c 2018-08-21 06:53:27 -06:00
Ed Hartnett
c02f976d84 more tests 2018-08-20 17:05:29 -06:00
Ed Hartnett
ab1216da10 fix memory issue 2018-08-14 10:38:28 -06:00
Ed Hartnett
9953e53573 converting NULL checking of put functions 2018-08-14 09:21:45 -06:00
Ed Hartnett
829d9d28ae converting NULL checking of put functions 2018-08-14 09:09:08 -06:00
Ed Hartnett
5f9b7af467 converting NULL checking of put functions 2018-08-14 09:04:16 -06:00
Ed Hartnett
d6c0cbe234 removing unneeded file lookups 2018-08-14 08:56:58 -06:00
Ed Hartnett
5800fdd617 removing unneeded file lookups 2018-08-14 08:49:23 -06:00
Ed Hartnett
24f0c9d74c removing unneeded file lookups 2018-08-14 08:39:17 -06:00
Ed Hartnett
bc3c63bf03 removing unneeded file lookups 2018-08-14 08:32:45 -06:00
Ed Hartnett
1e3fe2b8cc removing unneeded file lookups 2018-08-14 08:29:02 -06:00
Ed Hartnett
d1ed803b31 removing unneeded file lookups 2018-08-14 08:18:05 -06:00
Ed Hartnett
3046dabda0 more NULL parameter changes 2018-08-14 08:06:01 -06:00
Ed Hartnett
baa76219d3 more NULL parameter changes 2018-08-14 08:01:54 -06:00
Ed Hartnett
69b37d994e fixed HDF4 test 2018-08-14 06:44:11 -06:00
Ed Hartnett
acc22e0c54 checking NULLs in function 2018-08-14 06:28:28 -06:00