You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ni...@apache.org on 2007/06/29 19:55:37 UTC
svn commit: r551979 - in /lucene/hadoop/trunk: CHANGES.txt
src/java/org/apache/hadoop/dfs/FSEditLog.java
src/java/org/apache/hadoop/dfs/FSNamesystem.java
Author: nigel
Date: Fri Jun 29 10:55:36 2007
New Revision: 551979
URL: http://svn.apache.org/viewvc?view=rev&rev=551979
Log:
HADOOP-1520. Add appropriate synchronization to FSEditsLog. Contributed by Dhruba
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java
lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=551979&r1=551978&r2=551979
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri Jun 29 10:55:36 2007
@@ -268,6 +268,9 @@
82. HADOOP-1536. Remove file locks from libhdfs tests.
(Dhruba Borthakur via nigel)
+ 83. HADOOP-1520. Add appropriate synchronization to FSEditsLog.
+ (Dhruba Borthakur via nigel)
+
Release 0.13.0 - 2007-06-08
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java?view=diff&rev=551979&r1=551978&r2=551979
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSEditLog.java Fri Jun 29 10:55:36 2007
@@ -88,7 +88,7 @@
return fsimage.getNumStorageDirs();
}
- int getNumEditStreams() {
+ synchronized int getNumEditStreams() {
return editStreams == null ? 0 : editStreams.size();
}
@@ -98,7 +98,7 @@
*
* @throws IOException
*/
- void open() throws IOException {
+ synchronized void open() throws IOException {
int size = getNumStorageDirs();
if (editStreams == null)
editStreams = new ArrayList<EditLogOutputStream>(size);
@@ -115,7 +115,7 @@
}
}
- void createEditLogFile(File name) throws IOException {
+ synchronized void createEditLogFile(File name) throws IOException {
EditLogOutputStream eStream = new EditLogOutputStream(name);
eStream.create();
eStream.flushAndSync();
@@ -125,7 +125,7 @@
/**
* Create edits.new if non existant.
*/
- void createNewIfMissing() throws IOException {
+ synchronized void createNewIfMissing() throws IOException {
for (int idx = 0; idx < getNumStorageDirs(); idx++) {
File newFile = getEditNewFile(idx);
if (!newFile.exists())
@@ -136,7 +136,7 @@
/**
* Shutdown the filestore
*/
- void close() throws IOException {
+ synchronized void close() throws IOException {
if (editStreams == null) {
return;
}
@@ -159,7 +159,7 @@
* remain, then raise an exception that will possibly cause the
* server to exit
*/
- void processIOError(int index) throws IOException {
+ synchronized void processIOError(int index) throws IOException {
if (editStreams == null || editStreams.size() == 1) {
throw new IOException("Checkpoint directories inaccessible.");
}
@@ -557,7 +557,7 @@
/**
* Return the size of the current EditLog
*/
- long getEditLogSize() throws IOException {
+ synchronized long getEditLogSize() throws IOException {
assert(getNumStorageDirs() == editStreams.size());
long size = 0;
for (int idx = 0; idx < getNumStorageDirs(); idx++) {
@@ -572,7 +572,7 @@
/**
* Closes the current edit log and opens edits.new.
*/
- void rollEditLog() throws IOException {
+ synchronized void rollEditLog() throws IOException {
//
// If edits.new already exists, then return error.
//
@@ -601,7 +601,7 @@
* Removes the old edit log and renamed edits.new as edits.
* Reopens the edits file.
*/
- void purgeEditLog() throws IOException {
+ synchronized void purgeEditLog() throws IOException {
//
// If edits.new does not exists, then return error.
//
@@ -636,7 +636,7 @@
/**
* Return the name of the edit file
*/
- File getFsEditName() throws IOException {
+ synchronized File getFsEditName() throws IOException {
return getEditFile(0);
}
}
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?view=diff&rev=551979&r1=551978&r2=551979
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Fri Jun 29 10:55:36 2007
@@ -3352,12 +3352,12 @@
throw new SafeModeException("Checkpoint not created",
safeMode);
}
- LOG.info("Roll Edit Log");
+ LOG.info("Roll Edit Log from " + Server.getRemoteAddress());
getEditLog().rollEditLog();
}
synchronized void rollFSImage() throws IOException {
- LOG.info("Roll FSImage");
+ LOG.info("Roll FSImage from " + Server.getRemoteAddress());
if (isInSafeMode()) {
throw new SafeModeException("Checkpoint not created",
safeMode);