Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mupip load on an empty ZWR file reports an incorrect error messages #95

Open
shabiel opened this issue Nov 22, 2017 · 1 comment
Open

Comments

@shabiel
Copy link
Contributor

shabiel commented Nov 22, 2017

Final Release Note

Description

E.g.

OSEHRA ZGO Export: A/R BAD FILE                                                                                                                         
17-OCT-2017 09:11:33 ZWR                                                        
sam@icarus:/var/local/rpms201708$ mupip load \"/home/sam/workspace/repo/FOIA-RPMS/Packages/IHS Accounts Receivable/Globals/90054.8+A-R BAD FILE.zwr\"
OSEHRA ZGO Export: A/R BAD FILE
17-OCT-2017 09:11:33 ZWR
%GTM-E-MAXSTRLEN, Maximum string length exceeded
%GTM-E-LDBINFMT, Unrecognized header for load file

Correct behavior is for it to load 0 records with no error messages.

Draft Release Note

When asked to load an empty file, MUPIP LOAD reports 0 records loaded. Previously, it reported MAXSTRLEN and LDBINFMT errors. (YDB#95)

@shabiel
Copy link
Contributor Author

shabiel commented Nov 22, 2017

Forgot to mention product version: YottaDB r1.10 Linux x86_64.

@ksbhaskar ksbhaskar changed the title mupip load on an empty ZWR file gives you incorrect error messages mupip load on an empty ZWR file reports an incorrect error messages Nov 22, 2017
chathaway-codes pushed a commit that referenced this issue Sep 18, 2018
…ords loaded (instead of MAXSTRLEN/LDBINFMT errors)

The main change is to get_load_format() in sr_unix/mupip_cvtgbl.c. It assumed that in case of
a non-binary format extract file (MU_FMT_GO or MU_FMT_ZWR), there is always a non-empty 3rd line
in the extract file.

Although it is not possible for YottaDB (%GO or MUPIP EXTRACT) to create an empty extract file,
it is possible for the user to delete entries in a ZWR or GO format extract file (which is an
ascii file) effectively creating a file with just the first 2 lines (header).

In that case, MUPIP LOAD currently issue a MAXSTRLEN error (in get_load_format()). This is
get_load_format() assumes that a negative return from go_get() implies a string that is too
long to fit in the passed in buffer. But there are 2 negative return values possible from that
function, FILE_INPUT_GET_LINE2LONG and FILE_INPUT_GET_ERROR. A MAXSTRLEN error in the former case
is correct but not in the latter case which effectively implies an EOF. Therefore this case is
handled separately now by not issuing an error but instead returning as is to the caller function
mupip_cvtgbl(). At this point, we are guaranteed *line3_len is set to 0 indicating there is no
3rd line seen.

In mupip_cvtgbl(), line3_len is examined to see if it is 0 and if so it now knows the extract file
only has 2 lines and so sets "end" to 2 (corresponding to the 2 lines of the extract file header)
before calling go_load() which then knows not to read the extract file any more (i.e. no records to load).

While at this, minor changes were done to go_load() so the last processed record in the
LOADRECCNT message is displayed as 2 (and not 3) in this empty-extract-file case. A value of 3
implies there was 1 non-header line which is not correct for an empty extract file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants