You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by dc...@apache.org on 2011/05/12 17:02:32 UTC
svn commit: r1102334 - in /avro/branches/branch-1.5: ./ CHANGES.txt
lang/c/examples/CMakeLists.txt lang/c/examples/quickstop.c
lang/c/src/datafile.c
Author: dcreager
Date: Thu May 12 15:02:32 2011
New Revision: 1102334
URL: http://svn.apache.org/viewvc?rev=1102334&view=rev
Log:
Merge change 1102332 from trunk into 1.5 branch
Modified:
avro/branches/branch-1.5/ (props changed)
avro/branches/branch-1.5/CHANGES.txt
avro/branches/branch-1.5/lang/c/examples/CMakeLists.txt
avro/branches/branch-1.5/lang/c/examples/quickstop.c
avro/branches/branch-1.5/lang/c/src/datafile.c
Propchange: avro/branches/branch-1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 12 15:02:32 2011
@@ -1 +1 @@
-/avro/trunk:1075938,1075993,1078917,1079055,1079060,1079063,1083246,1085921,1086727,1086730,1086866,1087076,1087129,1087136,1087439-1087440,1087463,1087472,1087792,1089128,1089131,1089550,1094812,1095206-1095208,1095493,1095529,1095548,1095550,1096798,1097916,1097927,1097968,1097974
+/avro/trunk:1075938,1075993,1078917,1079055,1079060,1079063,1083246,1085921,1086727,1086730,1086866,1087076,1087129,1087136,1087439-1087440,1087463,1087472,1087792,1089128,1089131,1089550,1094812,1095206-1095208,1095493,1095529,1095548,1095550,1096798,1097916,1097927,1097968,1097974,1102332
Modified: avro/branches/branch-1.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/CHANGES.txt?rev=1102334&r1=1102333&r2=1102334&view=diff
==============================================================================
--- avro/branches/branch-1.5/CHANGES.txt (original)
+++ avro/branches/branch-1.5/CHANGES.txt Thu May 12 15:02:32 2011
@@ -1,5 +1,15 @@
Avro Change Log
+Avro 1.5.2 (unreleased)
+
+ NEW FEATURES
+
+ IMPROVEMENTS
+
+ BUG FIXES
+
+ AVRO-818. C: Fix data file corruption bug in C library (dcreager)
+
Avro 1.5.1 (3 May 2011)
NEW FEATURES
Modified: avro/branches/branch-1.5/lang/c/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/c/examples/CMakeLists.txt?rev=1102334&r1=1102333&r2=1102334&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/c/examples/CMakeLists.txt (original)
+++ avro/branches/branch-1.5/lang/c/examples/CMakeLists.txt Thu May 12 15:02:32 2011
@@ -20,3 +20,6 @@
add_executable(quickstop quickstop.c)
target_link_libraries(quickstop avro-static)
+add_test(quickstop
+ ${CMAKE_COMMAND} -E chdir ${AvroC_SOURCE_DIR}/examples
+ ${CMAKE_CURRENT_BINARY_DIR}/quickstop)
Modified: avro/branches/branch-1.5/lang/c/examples/quickstop.c
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/c/examples/quickstop.c?rev=1102334&r1=1102333&r2=1102334&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/c/examples/quickstop.c (original)
+++ avro/branches/branch-1.5/lang/c/examples/quickstop.c Thu May 12 15:02:32 2011
@@ -82,7 +82,7 @@ add_person(avro_file_writer_t db, const
avro_datum_decref(phone_datum);
avro_datum_decref(person);
- fprintf(stdout, "Successfully added %s, %s id=%"PRId64"\n", last, first, id);
+ //fprintf(stdout, "Successfully added %s, %s id=%"PRId64"\n", last, first, id);
}
int print_person(avro_file_reader_t db, avro_schema_t reader_schema)
@@ -134,6 +134,7 @@ int main(void)
avro_schema_t projection_schema, first_name_schema, phone_schema;
int64_t i;
const char *dbname = "quickstop.db";
+ char number[15] = {0};
/* Initialize the schema structure from JSON */
init_schema();
@@ -146,13 +147,18 @@ int main(void)
fprintf(stderr, "There was an error creating %s\n", dbname);
exit(EXIT_FAILURE);
}
- /* Add people to the database */
- add_person(db, "Dante", "Hicks", "(555) 123-4567", 32);
- add_person(db, "Randal", "Graves", "(555) 123-5678", 30);
- add_person(db, "Veronica", "Loughran", "(555) 123-0987", 28);
- add_person(db, "Caitlin", "Bree", "(555) 123-2323", 27);
- add_person(db, "Bob", "Silent", "(555) 123-6422", 29);
- add_person(db, "Jay", "???", "(555) 123-9182", 26);
+
+ /* Add lots of people to the database */
+ for (i = 0; i < 1000; i++)
+ {
+ sprintf(number, "(%d)", (int)i);
+ add_person(db, "Dante", "Hicks", number, 32);
+ add_person(db, "Randal", "Graves", "(555) 123-5678", 30);
+ add_person(db, "Veronica", "Loughran", "(555) 123-0987", 28);
+ add_person(db, "Caitlin", "Bree", "(555) 123-2323", 27);
+ add_person(db, "Bob", "Silent", "(555) 123-6422", 29);
+ add_person(db, "Jay", "???", number, 26);
+ }
avro_file_writer_close(db);
fprintf(stdout, "\nNow let's read all the records back out\n");
Modified: avro/branches/branch-1.5/lang/c/src/datafile.c
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/c/src/datafile.c?rev=1102334&r1=1102333&r2=1102334&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/c/src/datafile.c (original)
+++ avro/branches/branch-1.5/lang/c/src/datafile.c Thu May 12 15:02:32 2011
@@ -40,6 +40,7 @@ struct avro_file_writer_t_ {
avro_writer_t writer;
char sync[16];
int block_count;
+ size_t block_size;
avro_writer_t datum_writer;
char datum_buffer[16 * 1024];
};
@@ -315,15 +316,14 @@ static int file_write_block(avro_file_wr
int rval;
if (w->block_count) {
- int64_t blocklen = avro_writer_tell(w->datum_writer);
/* Write the block count */
check_prefix(rval, enc->write_long(w->writer, w->block_count),
"Cannot write file block count: ");
/* Write the block length */
- check_prefix(rval, enc->write_long(w->writer, blocklen),
+ check_prefix(rval, enc->write_long(w->writer, w->block_size),
"Cannot write file block size: ");
/* Write the block */
- check_prefix(rval, avro_write(w->writer, w->datum_buffer, blocklen),
+ check_prefix(rval, avro_write(w->writer, w->datum_buffer, w->block_size),
"Cannot write file block: ");
/* Write the sync marker */
check_prefix(rval, write_sync(w),
@@ -331,6 +331,7 @@ static int file_write_block(avro_file_wr
/* Reset the datum writer */
avro_writer_reset(w->datum_writer);
w->block_count = 0;
+ w->block_size = 0;
}
return 0;
}
@@ -354,6 +355,7 @@ int avro_file_writer_append(avro_file_wr
}
}
w->block_count++;
+ w->block_size = avro_writer_tell(w->datum_writer);
return 0;
}