473,395 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Is Dump Complete?

We have a file that is an extract file that represents data from several
different systems (main frame, etc). This data varies and so from day to day
the file that gets generated has variant size of data. Sometimes is just 5
meg, other times is can be 10 gig. This means that the time it takes for the
file to be completed varies also. In other words it is un-predictable what
the size will be.

Now, the problem is, when the file is complete we need to kick off another
process that parses the file as well as other tasks that are not related but
can not kick off until the file is done being generated.

So, how do we know the file is done being written? The app that generates
the file is a 3rd party and is no-longer supported by the vendor.

I've considered writting code that will attempt to open the file and if the
app still has a lock on it then an exception will get thrown and voila we
know it isn't done yet. That however, is un-acceptable jerry rigging. This
needs to be production worthy code and done properly.

So my question to you guys, in C#, what sort of solution would you provide
the problem of knowing when the file is done?

--
-Brycen
Oct 18 '06 #1
2 1172

"Demetri" <De*****@discussions.microsoft.comwrote in message
news:B9**********************************@microsof t.com...
| We have a file that is an extract file that represents data from several
| different systems (main frame, etc). This data varies and so from day to
day
| the file that gets generated has variant size of data. Sometimes is just 5
| meg, other times is can be 10 gig. This means that the time it takes for
the
| file to be completed varies also. In other words it is un-predictable what
| the size will be.
|
| Now, the problem is, when the file is complete we need to kick off another
| process that parses the file as well as other tasks that are not related
but
| can not kick off until the file is done being generated.
|
| So, how do we know the file is done being written? The app that generates
| the file is a 3rd party and is no-longer supported by the vendor.
|
| I've considered writting code that will attempt to open the file and if
the
| app still has a lock on it then an exception will get thrown and voila we
| know it isn't done yet. That however, is un-acceptable jerry rigging. This
| needs to be production worthy code and done properly.
|

Unfortunately it's the only way to handle this, you try to open the file, if
it fails because of a sharing violation, you wait a couple of seconds and
retry, what makes you think that this isn't production worthy?
To handle this more "nicely", you need two cooparating applications, one
producer and one consumer. The producer uses a semaphore or mutex to signal
the consumer that he's has finished producing the data, the consumer wait's
for the semaphore to be signaled.
The real professional solution is to have both consumer and producer to run
simultaniously, this by using region locks or semaphores to signal data
ready to be consumed.

Willy.

Oct 18 '06 #2
In addition to what Willy said (which is absolutely correct), is the file so
tightly controlled that you can guarantee no 3rd-party will ever access it
besides the programs that are supposed to (e.g., can a user unexpectly open
it up, can it be accessed via some backup program that runs when not
expected, etc.). It's unlikely so a sharing violation can potentially happen
when you're not expecting it. Morevoer, since you can't synchronize access
given that it's created by a 3rd-party vendor (using the methods recommended
by Willy), what other choice do you have but to check for sharing
violations? To do it more efficiently however (rather than explicitly
checking every few seconds), perhaps you can leverage a class like
"FileSystemWatcher" (though I've never had a need to use it myself). Watch
the file in question IOW. If no activity has taken place for a given period
of time then you may be able to assume the file is now free (so try to a
open it exclusively presumably and if it fails because of a sharing
violation then start your wait over again). Food for thought anyway.
Oct 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: georg116 | last post by:
Hi, can someone tell me, if it's possible to "dump" an image object, created like with the snippet below? <?php $im = ImageCreate (50, 100); $background_color = ImageColorAllocate ($im, 255,...
1
by: Bruno BAGUETTE | last post by:
Hello, A friend told me that the views are not in the dump file produced by PostgreSQL 7.1. After looking in the archives, it seems that PostgreSQL 7.1 pg_dumpall had a bug that lost the...
7
by: Cyril VELTER | last post by:
I'm trying to dump a database from a 7.1.3 server to a 7.4.2 one. It doesn't works because of difference in COPY format (unless I use -d which is VERY slow on a 16G database). What are the...
6
by: Soeren Gerlach | last post by:
Hi, some weeks ago I started to develop an application using Postgresql the first time. I'm running 7.4.3 on a Linux box with a plain 2.6.7 kernel, the storage is handled by 5 SATA disks,...
2
by: Oleg | last post by:
Dear All, I have upgraded Postgresql from 7.3 to 7.4. Starting pg brings error: The database is in an older format that cannot be read by version 7.4 of PostgreSQL dpkg-upgrade postgresql...
9
by: Droopy | last post by:
Hi, I am running an application on 74 PC (1 instance on each PC). This morning, 2 applications crashes. There were neither popup windows signaling it nor dump file created. I only find in the...
2
by: Auddog | last post by:
Hello all, I'm fairly new to access database(s), but I work a lot with mysql. I was wondering if there is a script file out there that I can get a hold of that will create a dump file. I need...
6
by: wenmang | last post by:
Here is the code which causes core dump when is built differently, 1 for regular dev built, the other for packaging build. class my_class{ public: my_class(){}; ~my_class(){}; private:...
14
by: Sheldon | last post by:
Hi, I have a python script that uses a C extention. I keep getting a recurring problem that causes a core dump a few lines after the C extention return data back tp python. I tried using pbd and...
4
by: pwpradeep | last post by:
Hello, I have database in Ms Access. I create a tables using wizards. So, now, how can i take a dump of that database. Please, guide me. Thanks in advance.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.