首页 \ 问答 \ Datanode其中一个磁盘卷故障(Datanode one of the disk volume failure)

Datanode其中一个磁盘卷故障(Datanode one of the disk volume failure)

我的hadoop集群datanode中的一个磁盘已变为只读。 我不确定是什么原因引起了这个问题。 从datanode中删除此卷会导致数据丢失吗? 如果我要面对数据丢失,如何处理这个?


One of the disk from my hadoop cluster datanode has become read only. I am not sure what caused this problem. Will removing this volume from the datanode cause data lose ?? How to handle this if i am going to face data lose?


原文:https://stackoverflow.com/questions/36307680
更新时间:2023-10-20 12:10

最满意答案

我发现要做到这一点的最佳方式是:

  • 开始测试
  • 开始交易
  • (可选)使用类似DBUnit的方式加载测试需要的任何DB数据
  • 运行测试
  • 回滚事务

请注意,所有数据库操作都发生在同一个事务中。 由于此事务在测试结束时回滚(即使引发异常),数据库在测试结束时应始终处于与开始时相同的状态。

Spring提供了一些真正有用的类,它们将负责为每个测试启动和回滚事务。 如果您使用的是Spring&JUnit4,并且不介意您的测试类需要扩展Spring类,那么最简单的选择可能是扩展AbstractTransactionalJUnit4SpringContextTests

// Location of the Spring config file(s)
@ContextConfiguration(locations = {"/application-context-test.xml", "classpath*:/application-context-persistence-test.xml"})

// Transaction manager bean name
@TransactionConfiguration(transactionManager = "hsqlTransactionManager", defaultRollback = true)
@Transactional(propagation=Propagation.REQUIRES_NEW)
public class MyTransactionalTests extends AbstractTransactionalJUnit4SpringContextTests {

    @Test
    public void thisWillRunInATransactionThatIsAutomaticallyRolledBack() {}
}

如果您不想扩展Spring类,则可以使用注释来配置测试运行器。 Spring还支持许多其他主要的单元测试框架和旧版本的JUnit。


The best way I've found to do this is:

  • start test
  • start transaction
  • (optional) load any DB data the test requires using something like DBUnit
  • run test
  • rollback transaction

Notice that all DB operations occur within the same transaction. Because this transaction is rolled back at the end of the test (even if an exception is thrown), the database should always be in the same state at the end of the test as it was at the start.

Spring provides some really useful classes that will take care of starting and rolling back the transaction for each test. If you're using Spring & JUnit4 and don't mind that your test classes have to extend a Spring class the easiest option is probably to extend AbstractTransactionalJUnit4SpringContextTests

// Location of the Spring config file(s)
@ContextConfiguration(locations = {"/application-context-test.xml", "classpath*:/application-context-persistence-test.xml"})

// Transaction manager bean name
@TransactionConfiguration(transactionManager = "hsqlTransactionManager", defaultRollback = true)
@Transactional(propagation=Propagation.REQUIRES_NEW)
public class MyTransactionalTests extends AbstractTransactionalJUnit4SpringContextTests {

    @Test
    public void thisWillRunInATransactionThatIsAutomaticallyRolledBack() {}
}

If you don't want to extend a Spring class, you can configure a test-runner instead using annotations. Spring also supports many of the other major unit-testing frameworks and older versions of JUnit.

相关问答

更多
  • pm2 deploy工具提供了命令revert 。 所以,你可以这样做: pm2 deploy ecosystem.json revert 这会将您的应用“回滚”到之前的部署。 您还可以指定上次部署还原的数量。 另请参阅命令[ref]与list , curr或prev结合使用: https://github.com/Unitech/PM2/blob/0.14.7/ADVANCED_README.md#deployment-options The tool pm2 deploy provides the c ...
  • 只需在测试之上添加@Transactional注释: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"testContext.xml"}) @Transactional public class StudentSystemTest { 默认情况下,Spring将会围绕你的测试方法和@Before / @After回调开始一个新的事务,最后回滚。 默认情况下,在上下文中有一些事务管理器就足够了。 来自 ...
  • 我发现要做到这一点的最佳方式是: 开始测试 开始交易 (可选)使用类似DBUnit的方式加载测试需要的任何DB数据 运行测试 回滚事务 请注意,所有数据库操作都发生在同一个事务中。 由于此事务在测试结束时回滚(即使引发异常),数据库在测试结束时应始终处于与开始时相同的状态。 Spring提供了一些真正有用的类,它们将负责为每个测试启动和回滚事务。 如果您使用的是Spring&JUnit4,并且不介意您的测试类需要扩展Spring类,那么最简单的选择可能是扩展AbstractTransactionalJUni ...
  • rake db:rollback STEP=1 是一种方法来执行此操作,如果要回滚的迁移是最后一个应用程序。 您可以替换1,但是您希望返回的许多迁移。 例如: rake db:rollback STEP=5 还会回滚以后发生的所有迁移(4,3,2和1)。 正如意见中所建议的: 为了回滚具体的迁移用途: rake db:migrate:down VERSION=20100905201547 rake db:rollback STEP=1 Is a way to do this, if the migr ...
  • 只需在没有BEGIN..END的情况下从SQL * Plus执行代码; insert into sometable values (1, 1, 'test', 'test', 1, 'a', 1, 1, 1, 'test', 'test', 'test', 'test', 1); select * from sometable where id = 1; ROLLBACK; Just execute your code from SQL*Plus without BEGIN..END; insert ...
  • 最后我得到了答案, 开始了 bin/cake migrations rollback -t 非常感谢SO :) Finally i got the answer, here we go bin/cake migrations rollback -t Thanks Anyways to SO :)
  • 使用“SqlSession”时,MyBatis允许回滚,就是你使用spring依赖注入片,它会在方法完成时自动提交你的事务。 你有几个选择,其中包括 注入依赖项的模拟。 有一些摇摆的图书馆可以帮助解决这个问题。 像Mockito一样, 这是关于Spring Mockito的一个很好的问题 。 这将测试您的Java中的业务逻辑,但不测试您的实际查询。 提交您的查询,并在测试运行后删除您的数据。 这是我们采用的方法,因为它也测试了我们的数据库。 你显然需要一个数据库的测试实例,而有些人却没有。 您可以尝试为在M ...
  • 根据我的理解,您将在测试方法中手动创建一个新的独立Spring上下文,该方法在初始化期间创建表。 由于该上下文使用自己的事务管理器和数据源,因此它不会受到@Rollback注释的影响 - 在整个测试类定义的(隐式)spring上下文的上下文中处理该注释。 另请注意,在某些DB中,您无法回滚CREATE命令(但不确定Derby)。 更新 另一个问题是,当您通过datasource.getConnection()获得连接时,实际上并未使用事务管理器。 从DataSourceTransactionManager文 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)