gpt4 book ai didi

hadoop - 垃圾检查点间隔如何在 hadoop 中工作?为什么需要 checkpoint_intereval?

转载 作者:可可西里 更新时间:2023-11-01 15:57:23 26 4
gpt4 key购买 nike

我已经实际尝试过这个来理解这个概念,但我仍然不清楚。

举个例子fs.trash.interval=9 分钟和fs.trash.checkpoint.interval=2分钟

现在我在 10:00 删除了 file1,在 10:03 删除了 file2。它说它被移动到“/user/xxx/.trash/current”并且当前目录在一段时间内消失了,我可以看到检查点文件夹那里看起来像这样“/user/xxx/.trash/(date_somenumber)”。

根据我的理解,file1 应该在 10:09 永久删除,file2 应该在 10:11 永久删除。

如果检查点每 2 分钟发生一次
1 日 10:02
第二场 10:04
三号 10:06
4日10:08
5日10:10
6号10:12
所以 file1 应该在第 5 个 checkpoint_intereval 被删除,file2 在第 6 个间隔被删除。

我的疑问是

1) 当前目录什么时候消失?在 checkpoint_intereval 期间或更早的任何时间?

(对我来说它好像在一分钟内消失了)

2) 对于每个检查点间隔,只有在删除新文件并且是 rest abstract 时才会形成新文件夹?

(所以,这是否意味着每 2 分钟的检查点对我们来说是抽象的,而不是每 2 分钟更改一次目录名称)

3) 我们已经将垃圾间隔设置为 9 分钟(例如),目的是让文件在垃圾桶中保留 9 分钟,所以为什么我们需要 checkpoint_interval 每 2 分钟(例如)检查一次,因为我们知道它会自动获取9 分钟后删除。

(checkpoint 是一个删除文件的过程吗??因为当我们说 checkpoint_intereval=0 时仍然默认它以 trash interval= 9min 作为值并且 checkpoint 每 9 分钟发生一次)

如有不对之处,请指正我的理解,澄清这些疑惑。

最佳答案

/user/username/.Trash/Current/用于保存最近删除的HDFS文件。

/user/username/.Trash/CheckpointTime/ 是在检查点间隔期间创建的,它实际上是重命名的 current 目录。根据 trash.intervalcheckpoint.interval 之间存在的时间差,可以有多个检查点。

fs.trash.interval : Number of minutes after which the checkpoint gets deleted. fs.trash.checkpoint.interval : Number of minutes between trash checkpoints.

1)当前目录在检查点间隔期间使用时间戳重命名为检查点目录,而不是更早的任何时候。

2) 仅当间隔内有任何当前或最近的删除时。

来自 Trash 的片段Hadoop 使用的类:

  private void createCheckpoint(Path trashRoot, Date date) throws IOException {
if (!fs.exists(new Path(trashRoot, CURRENT))) {
return;
}
.....
Path checkpoint = checkpointBase;
Path current = new Path(trashRoot, CURRENT);
......
while (true) {
try {
fs.rename(current, checkpoint, Rename.NONE);
.....
.....

3) 这是检查点进程,每 2 分钟检查一次是否删除。按照配置每 2 分钟,checkpointer 进程会将 current 目录中的文件移动到一个新的 checkpoint 目录,并删除所有早于 fs.trash.interval< 的检查点.

引自官方documentation :

Most recent deleted files are moved to the current trash directory (/user/username/.Trash/Current), and in a configurable interval, HDFS creates checkpoints (under /user/username/.Trash/date) for files in current trash directory and deletes old checkpoints when they are expired.

关于hadoop - 垃圾检查点间隔如何在 hadoop 中工作?为什么需要 checkpoint_intereval?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42323231/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com