Bug 44418 - [PATCH] Modified CSV Data Set for independent file reading
Summary: [PATCH] Modified CSV Data Set for independent file reading
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.3.1
Hardware: Other All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-13 14:21 UTC by Frank Schneider
Modified: 2008-05-09 14:53 UTC (History)
0 users



Attachments
Patch with Screenshot (33.54 KB, application/gzip)
2008-02-13 14:23 UTC, Frank Schneider
Details
A testplan for my patch. (1.29 KB, application/x-gzip)
2008-02-17 10:09 UTC, Frank Schneider
Details
Another patch for an independent CSV Data Source (19.02 KB, text/plain)
2008-02-22 08:28 UTC, Tobias Henkel
Details
New patch for CSVDataSet (16.08 KB, patch)
2008-02-23 00:52 UTC, Frank Schneider
Details | Diff
Patch for CSVDataSet for independent file reading with Doku changes (21.13 KB, patch)
2008-02-25 13:45 UTC, Frank Schneider
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Schneider 2008-02-13 14:21:49 UTC
Hello,

this is my first patch for JMeter.
If you have two or more CSV Data Sets in your test plan, which
use the same file you may have a problem (like me). The file is
only opened once (one instance). So every read from a CSV-file 
(regardless of which thread) will cause a jump to the next line.
I wrote a patch so you can choose in the CSV-Data Set whether the file
reading shall be independet (the file will be opened again even it
is already open ) or not (the old behavior). 
A screenshot is also added to the archive.

Please contact me if you have questions or annotations.

Thanks
Comment 1 Frank Schneider 2008-02-13 14:23:17 UTC
Created attachment 21524 [details]
Patch with Screenshot
Comment 2 Frank Schneider 2008-02-17 10:09:34 UTC
Created attachment 21550 [details]
A testplan for my patch.

Here is a testplan for my patch. You need beanshell for this.
Two threads with two CSV Data Sets are reading from the same csv-file.
Without my patch the output (print) is like:
line1
line2

with my patch you can set on both CSV-Data Sets "Independent CSV-Data reading"
to true:
line1
line1

The csv-data is read independently. It doesn't matter if other threads are
reading from the same file.
Comment 3 Sebb 2008-02-20 18:43:09 UTC
Just tried the patch - it does not work reliably.

The FileServer relies on retrieving the FileEntry using just the file name as
key, so if the same name is used more than once, the second entry will overwrite
the first.

It is too restrictive to insist on unique file names.

For independent files, the FileServer could use the CSV Dataset instance (this)
as the key.

There's also a typo in the patch - the new reserveFile parameter should be
boolean, not Boolean.
Comment 4 Tobias Henkel 2008-02-22 08:28:50 UTC
Created attachment 21580 [details]
Another patch for an independent CSV Data Source

I've created a similar patch which makes the CSV Data Source optional
independent.
You can also specify, how many loops throug the file you want to do if recycle
is TRUE.

Greetings
Comment 5 Frank Schneider 2008-02-23 00:52:12 UTC
Created attachment 21583 [details]
New patch for CSVDataSet

Hey,

wow another patch! Thanks Tobias! I' ll test it too.
Here is my new patch. My first patch was stupid. 
Thanks to Sebb for his comments.
I hope you test my new patch and contact me.
Comment 6 Sebb 2008-02-23 06:56:57 UTC
The existing API needs to be retained, in case any 3rd party add-ons have used
it. It's OK to add new methods, or new method signatures, but the old ones must
still work as before.

Also, please ensure that patch files are uploaded as text, and don't contain
unrelated changes.
Comment 7 Frank Schneider 2008-02-25 13:45:46 UTC
Created attachment 21591 [details]
Patch for CSVDataSet for independent file reading with Doku changes

Hey,

here is the full patch with API Doku changes. I hope this is what you wanted.
If I forgot something or you have further questions please contact me.

Best regards
Comment 8 Frank Schneider 2008-03-20 12:12:01 UTC
Hello,

is the patch ok or do I have to change anything? 
Please contact me if I can do something.

Thanks
Comment 9 Sebb 2008-03-30 06:24:48 UTC
See also Bug 42178
Comment 10 Sebb 2008-05-09 14:53:03 UTC
Added options to restrict file sharing to thread group, thread etc

URL: http://svn.apache.org/viewvc?rev=654944&view=rev
Log:
Bug 44418/42178 - CSV Dataset file handling improvements
Comment 11 The ASF infrastructure team 2022-09-24 20:37:41 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2072