mirror of https://gitee.com/bigwinds/arangodb
some cleanup
This commit is contained in:
parent
2134b17d13
commit
4d79cfd5cb
|
@ -2591,6 +2591,10 @@ static v8::Handle<v8::Value> JS_ParseAhuacatl (v8::Arguments const& argv) {
|
||||||
/// @{
|
/// @{
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief migrate an "old" collection to a newer version
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
|
static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
|
||||||
v8::HandleScope scope;
|
v8::HandleScope scope;
|
||||||
|
|
||||||
|
@ -2658,7 +2662,6 @@ static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
|
||||||
ostringstream outfile;
|
ostringstream outfile;
|
||||||
outfile << df->_filename << ".new";
|
outfile << df->_filename << ".new";
|
||||||
|
|
||||||
//std::cout << "outfile is " << outfile.str().c_str() << endl;
|
|
||||||
fdout = TRI_CREATE(outfile.str().c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
|
fdout = TRI_CREATE(outfile.str().c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
|
||||||
if (fdout < 0) {
|
if (fdout < 0) {
|
||||||
LOG_ERROR("could not open file '%s' for writing", outfile.str().c_str());
|
LOG_ERROR("could not open file '%s' for writing", outfile.str().c_str());
|
||||||
|
@ -2678,8 +2681,6 @@ static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
|
||||||
// read marker header
|
// read marker header
|
||||||
ssize_t bytesRead = ::read(fd, &marker, sizeof(marker));
|
ssize_t bytesRead = ::read(fd, &marker, sizeof(marker));
|
||||||
|
|
||||||
//std::cout << "we try to read " << sizeof(marker) << " bytes, got " << bytesRead << "\n";
|
|
||||||
|
|
||||||
if (bytesRead == 0) {
|
if (bytesRead == 0) {
|
||||||
// eof
|
// eof
|
||||||
break;
|
break;
|
||||||
|
@ -2705,16 +2706,11 @@ static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::cout << "total marker size is " << marker._size << " bytes, sizeof(marker) is " << sizeof(marker) << "\n";
|
|
||||||
//std::cout << "type " << marker._type << "\n";
|
|
||||||
|
|
||||||
off_t paddedSize = ((marker._size + TRI_DF_BLOCK_ALIGN - 1) / TRI_DF_BLOCK_ALIGN) * TRI_DF_BLOCK_ALIGN;
|
off_t paddedSize = ((marker._size + TRI_DF_BLOCK_ALIGN - 1) / TRI_DF_BLOCK_ALIGN) * TRI_DF_BLOCK_ALIGN;
|
||||||
|
|
||||||
// char payload[marker._size];
|
|
||||||
char payload[paddedSize];
|
char payload[paddedSize];
|
||||||
char* p = (char*) &payload;
|
char* p = (char*) &payload;
|
||||||
|
|
||||||
//std::cout << "marker._size - sizeof(marker) = " << marker._size - sizeof(marker) << " bytes, paddedSize- sizeof(marker) = " << paddedSize - sizeof(marker) << "\n";
|
|
||||||
// copy header
|
// copy header
|
||||||
|
|
||||||
memcpy(&payload, &marker, sizeof(marker));
|
memcpy(&payload, &marker, sizeof(marker));
|
||||||
|
|
Loading…
Reference in New Issue