Skip to content

Commit

Permalink
Revert "Eliminate creation of unnecessary empty files"
Browse files Browse the repository at this point in the history
This reverts commit 997408f58371170c9b5d3b72d05667f540c36380.
While, this was aimed at reducing empty files created by closed stores,
some systems depend on the file being rotated even if a store is closed.

git-svn-id: svn+ssh://tubbs/svnapps/fbomb/branches/scribe-os/fbcode/scribe@28274 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
  • Loading branch information
groys authored and groys committed Jun 7, 2010
1 parent 9c231ed commit 0318e80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 84 deletions.
14 changes: 4 additions & 10 deletions src/store.cpp
Expand Up @@ -779,13 +779,6 @@ bool FileStore::handleMessages(boost::shared_ptr<logentry_vector_t> messages) {
return writeMessages(messages);
}

void FileStore::periodicCheck() {
if (!isOpen()) {
return;
}
FileStoreBase::periodicCheck();
}

// writes messages to either the specified file or the the current writeFile
bool FileStore::writeMessages(boost::shared_ptr<logentry_vector_t> messages,
boost::shared_ptr<FileInterface> file) {
Expand Down Expand Up @@ -1368,13 +1361,14 @@ bool BufferStore::open() {

// try to open the primary store, and set the state accordingly
if (primaryStore->open()) {
// in case there are files left over from a previous instance
changeState(SENDING_BUFFER);

// If we don't need to send buffers, skip to streaming
if (!replayBuffer) {
// We still switch state to SENDING_BUFFER first just to make sure we
// can open the secondary store
changeState(STREAMING);
} else {
// in case there are files left over from a previous instance
changeState(SENDING_BUFFER);
}
} else {
secondaryStore->open();
Expand Down
74 changes: 0 additions & 74 deletions test/tests.php
Expand Up @@ -23,80 +23,6 @@
include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocketPool.php';
// need to get to the gen-php
require_once $GLOBALS['SCRIBE_ROOT'].'/BucketStoreMapping.php';

function reload_test($file) {
static $numTest = 0;
$numTest++;

echo "reload_test($file)\n";
$msg1 = new LogEntry;
$msg1->category = "reload";
$msg1->message = "msg{$numTest}";

$scribe_client = create_scribe_client();
scribe_Log_test(array($msg1), $scribe_client);
sleep(2);

// check
$cmd = "grep -q \"msg{$numTest}\" $file";
system($cmd, $retVal);
echo "$cmd => $retVal\n";

if ($retVal != 0) {
echo "Error: can't find \"msg{$numTest}\" in $file\n";
}
return $retVal == 0;
}

function bucketupdater_test($bid1Path,
$bid2Path,
$bid3Path) {
static $numTest = 0;
$numTest++;

// append /tmp/scribetest_/bucketupdater/ to all the paths
$bid1Path = "/tmp/scribetest_/bucketupdater/$bid1Path";
$bid2Path = "/tmp/scribetest_/bucketupdater/$bid2Path";
$bid3Path = "/tmp/scribetest_/bucketupdater/$bid3Path";

echo "bucketupdater_test($bid1Path, $bid2Path, $bid3Path)\n";
// bucket 1 message
$msg1 = new LogEntry;
$msg1->category = "bucketupdater";
$msg1->message = "0;test #{$numTest}\n";

// bucket 2 message
$msg2 = new LogEntry;
$msg2->category = "bucketupdater";
$msg2->message = "1;test #{$numTest}\n";

$scribe_client = create_scribe_client();
$ret = scribe_Log_test(array($msg1, $msg2), $scribe_client);
echo "scirbe log => $ret\n";
sleep(2);

// check
$cmd = "/bin/grep -q \"0;test #{$numTest}\" $bid1Path";
system($cmd, $retVal);
echo "$cmd => $retVal\n";

if ($retVal != 0) {
echo "Error: can't find \"2;test #{$numTest}\" in $bid1Path\n";
return false;
}

$cmd = "/bin/grep -q \"1;test #{$numTest}\" $bid2Path";
system($cmd, $retVal);
echo "$cmd => $retVal\n";

if ($retVal != 0) {
echo "Error: can't find \"1;test #{$numTest}\" in $bid2Path\n";
}

return $retVal == 0;
}

/**
* testing scribe configuration parameter inheritance.
Expand Down

0 comments on commit 0318e80

Please sign in to comment.