[Jlog-devel] [jlog commit] r29 - trunk/perl
svn-commit at lists.omniti.com
svn-commit at lists.omniti.com
Wed Nov 19 22:07:02 EST 2008
Author: george
Date: 2008-11-19 22:07:02 -0500 (Wed, 19 Nov 2008)
New Revision: 29
Modified:
trunk/perl/JLog.xs
Log:
It looks like there's a potential race condition where the metastore can be updated by a writer before
it's underlying storage is created. I don't know why we never ran into this before, but it seems we
should have. We can work around this in the perl api though
Modified: trunk/perl/JLog.xs
===================================================================
--- trunk/perl/JLog.xs 2008-11-18 05:45:32 UTC (rev 28)
+++ trunk/perl/JLog.xs 2008-11-20 03:07:02 UTC (rev 29)
@@ -321,13 +321,13 @@
{
my_obj->error = 0;
cnt = jlog_ctx_read_interval(my_obj->ctx, &my_obj->start, &my_obj->end);
- if(cnt == -1) SYS_CROAK("jlog_ctx_read_interval failed");
- if(cnt == 0) {
+ if(cnt == 0 || (cnt == -1 && jlog_ctx_err(my_obj->ctx) == JLOG_ERR_FILE_OPEN)) {
my_obj->start = epoch;
my_obj->end = epoch;
RETVAL = &PL_sv_undef;
goto end;
}
+ else if(cnt == -1) SYS_CROAK("jlog_ctx_read_interval failed");
}
/* if last is unset, start at the beginning */
if(!memcmp(&my_obj->last, &epoch, sizeof(jlog_id))) {
@@ -350,6 +350,12 @@
}
}
if(jlog_ctx_read_message(my_obj->ctx, &cur, &message) != 0) {
+ if(jlog_ctx_err(my_obj->ctx) == JLOG_ERR_FILE_OPEN) {
+ my_obj->start = epoch;
+ my_obj->end = epoch;
+ RETVAL = &PL_sv_undef;
+ goto end;
+ }
/* read failed; croak, but recover if the read is retried */
my_obj->error = 1;
SYS_CROAK("read failed");
More information about the Jlog-devel
mailing list