solr delta导入处理程序时间戳不够具体(solr delta import handler timestamp not specific enough)
我是solr的新手,我对delta-imports有一个非常基本的问题。 我的mySQL数据库中有几个新记录。 因此,当我在第二个x开始导入时,我很可能会在开始导入后的同一秒内在数据库中获得一些新记录,但下次当我启动delta-import时,它将检查“ data_mport.properties中的last_index_time“并将导入此第二个x后更改的所有记录。 因此,我将丢失在开始上次导入后在第二个x中更改的所有记录。 如果我是对的,即使可以将时间戳从几秒钟改为例如毫秒,也会出现同样的问题。 时间窗口会更小,丢失的记录量会更小,但问题本身仍然存在。
我没有在教程或其他任何地方找到任何关于此问题的提及。 我是第一个每秒处理几条记录的人,还是我想念别的东西?
提前谢谢了!
I am new to solr and I have a quite basic question about delta-imports. I have several new records by second in my mySQL DB. So when I start an import at second x it is very possible, that I will get some new records in the DB at the very same second after starting the import, but the next time when I start a delta-import it will check the "last_index_time" in dataimport.properties and will import all the records changed after this second x. So I will lose all records which have been changed in second x after starting the last import. And if I am right, it would be same issue even if it is possible to cahange the timestamp from seconds to e.g. milliseconds. The timewindow would be smaller, the amount of lost records would be smaller, but the problem itself would still be there.
I have not found any mention of this issue in the tutorials or anywhere else for that matter. Am I the first one who deals with several records per second, or do i miss something else?
Many thanks in Advance!
原文:https://stackoverflow.com/questions/18570742
最满意答案
更新:OP说他的输入中存在隐藏的问题。 这个答案没有描述如何解决这个问题。 尽管如此,OP已将此答案标记为已被接受。 请参阅Charles Duffy对OP问题的实际解决方案的评论。
警告:我正在逐字地解决你的问题描述中的所有问题,这导致了下面的答案。 如果您提供将通过
$Version
传递的字符串示例,则有助于澄清问题。
据我所知,你正在读取变量中文件的完整路径并
read Version
。 现在如果你说echo $Version
你应该得到/path/to/foo.bar
。我不认为你想要进入文件
/path/to/foo.bar
。 你会收到一个错误:Not a directory
,因为它是一个文件,而不是一个目录。现在,考虑一下
sed -e /\.//g
将对路径名做什么。echo "/path/to/foo.bar" | sed -e '/\.//g' /path/to/foobar
/path/to/foobar
实际存在吗? 不,因为foo.bar
是一个文件。 您将收到错误:No such file or directory
,因为foobar
目录不存在。如果我了解您要执行的操作,则尝试提取包含
$Version
指定的文件的目录。 命令dirname /path/to/foo.bar
将返回/path/to
。 所以你想设置New_version=$( dirname "$Version" )
,此时你应该可以cd $New_version
。PS确保
$Version
正在读取绝对路径名,而不是相对名称,因此它与您运行脚本的位置无关。UPDATE: The OP says that the problem was a hidden character in his input. This answer does not describe how to solve that problem. Nonetheless, the OP has marked this answer as accepted. See the comments of Charles Duffy for the actual solution to the OP's problem.
Caveat: I am taking everything in your problem description literally, which leads to the answer below. If you provide examples of the strings that will be passed through
$Version
it would help clarify the issue.
As I understand it you're reading in the full path of a file in your variable with
read Version
. Now if you sayecho $Version
you should get/path/to/foo.bar
.I don't think you'd want to
cd
into the file/path/to/foo.bar
. You'll get an error:Not a directory
, because it's a file, not a directory.Now, consider what
sed -e /\.//g
will do to the pathname.echo "/path/to/foo.bar" | sed -e '/\.//g' /path/to/foobar
Does
/path/to/foobar
actually exist? No, becausefoo.bar
was a file. You'll get an error:No such file or directory
, because thefoobar
directory does not exist.If I understand what you are trying to do, you are trying to extract the directory that contains the file specified by
$Version
. The commanddirname /path/to/foo.bar
will return/path/to
. So you want to setNew_version=$( dirname "$Version" )
, at which point you should be able tocd $New_version
.P.S. Make sure
$Version
is reading in an absolute path name, not a relative name, so that it's independent of where you run the script from.
相关问答
更多-
使用变量间接引用,所以: pete.mccabe@jackfrog$ p='HOME' pete.mccabe@jackfrog$ echo $p HOME pete.mccabe@jackfrog$ ls ${p} ls: cannot access HOME: No such file or directory pete.mccabe@jackfrog$ ls ${!p} bash libpng-1.2.44-1.el6 python-hwdata ...
-
你需要一些包装ShellExecute函数的东西。 有了Cygwin,这就是cygstart 。 使用PowerShell,这是Start-Process 。 您可以从Bash shell运行PowerShell,但它并不理想: powershell Start-Process Blah.java 这是目前Windows上Ubuntu的功能请求 。 You need something that wraps the ShellExecute function. With Cygwin, this is c ...
-
gnome-terminal使用g_shell_parse_argv自己解析给它的命令,显然不考虑; 成为一个单词分隔符,所以如果一个; 与非空白字符相邻,它被认为是非空白字符的一部分。 如果传递给gnome-terminal的命令中包含shell元字符,则会导致令人惊讶的行为。 我在gnome-terminal进程上使用strace来查看它的作用。 第一个命令 gnome-terminal -e "bash -c 'cd /';$SHELL" 导致gnome-terminal运行以下命令 execve( ...
-
你用bash -c …调用一个全新的shell bash -c …所以你需要传递$1 。 与$sourcePath相同,如果它未导出。 find /EXAMPLEPATH -name pages -type d -execdir bash -c 'cd pages && [ -f "$1" ] && pwd && cp "$2" .' bash "$1" "$sourcePath" \; (在bash -c … bash "$1" "$sourcePath" ,第二个bash为$0 .。) You’re ...
-
更新:OP说他的输入中存在隐藏的问题。 这个答案没有描述如何解决这个问题。 尽管如此,OP已将此答案标记为已被接受。 请参阅Charles Duffy对OP问题的实际解决方案的评论。 警告:我正在逐字地解决你的问题描述中的所有问题,这导致了下面的答案。 如果您提供将通过$Version传递的字符串示例,则有助于澄清问题。 据我所知,你正在读取变量中文件的完整路径并read Version 。 现在如果你说echo $Version你应该得到/path/to/foo.bar 。 我不认为你想要进入文件/pat ...
-
~不会用双引号扩展到您的主目录。 只要删除双引号: backup_source=~/momobobo backup_dest=~/momobobo_backup/ 如果您有需要引用的内容,可以使用~/"momobobo" ~ doesn't expand to your home directory in double quotes. Just remove the double quotes: backup_source=~/momobobo backup_dest=~/momobobo_backup/ ...
-
bash shell脚本仅在没有文件时删除目录(bash shell script to delete directory only if there are no files)[2022-01-21]
你不需要检查; rmdir只会删除空目录。 $ mkdir foo $ touch foo/bar $ rmdir foo rmdir: foo: Directory not empty $ rm foo/bar $ rmdir foo $ ls foo ls: foo: No such file or directory 在更实际的设置中,可以使用带有if语句的rmdir命令询问用户是否要删除所有内容。 if ! rmdir foo 2> /dev/null; then echo "foo co ... -
我修复了一些语法错误。 以下为我工作: a=0 count=0 while read line do count=`expr $count + 1` if [ $count -gt 6 ] then array[$count]=$line fi done < $FILE2 while read line do a=`expr $a + 1` if [ $a -gt 6 ] && [ $a -le 1 ...
-
除非你从不使用它们,否则别忘了pushd和popd 。 我会这样做: PS1='(\w) \$ ' chdir() { local action="$1"; shift case "$action" in # popd needs special care not to pass empty string instead of no args popd) [[ $# -eq 0 ]] && builtin popd || builtin popd "$*" ; ...
-
Bash可变范围泄漏(Bash Variable Scope Leak)[2022-01-11]
有两种不同的现象: 导出变量时, 会将它们复制到子进程的环境中。 未传递未导出的变量。 除非您明确使用export标记它们以进行导出,否则不会导出变量。 export LESS_OPTIONS=-R # export so `less` sees this variable less 不要将此与范围混淆,后者是不同的。 内部函数变量默认具有全局范围 。 您必须使用local关键字来声明局部变量。 否则for i in "$@"循环将修改全局变量$i而不是创建局部变量。 svn() { lo ...