Ejemplo n.º 1
0
        /// <exception cref="System.IO.IOException"/>
        private static void CreateEmptyInProgressEditLog(MiniDFSCluster cluster, NameNode
                                                         nn, bool writeHeader)
        {
            long     txid           = nn.GetNamesystem().GetEditLog().GetLastWrittenTxId();
            URI      sharedEditsUri = cluster.GetSharedEditsDir(0, 1);
            FilePath sharedEditsDir = new FilePath(sharedEditsUri.GetPath());

            Storage.StorageDirectory storageDir = new Storage.StorageDirectory(sharedEditsDir
                                                                               );
            FilePath inProgressFile = NameNodeAdapter.GetInProgressEditsFile(storageDir, txid
                                                                             + 1);

            NUnit.Framework.Assert.IsTrue("Failed to create in-progress edits file", inProgressFile
                                          .CreateNewFile());
            if (writeHeader)
            {
                DataOutputStream @out = new DataOutputStream(new FileOutputStream(inProgressFile)
                                                             );
                EditLogFileOutputStream.WriteHeader(NameNodeLayoutVersion.CurrentLayoutVersion, @out
                                                    );
                @out.Close();
            }
        }