Skip to content

Commit

Permalink
Fixes for recent issues (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
philrz authored Mar 24, 2023
1 parent 0d93c90 commit 08df9d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ of each pool is migrated.
[time travel](https://zed.brimdata.io/docs/commands/zed#15-time-travel)
will not be possible to pre-migration commits.

3. If you have a very large number of pools to migrate, the script may fail
with a `too many open files` error. This can be addressed by increasing the
system's hard limit on the number of file descriptors. Many references are
available that advise how this may be done, such as
[this article](https://docs.oracle.com/cd/E93962_01/bigData.Doc/install_onPrem/src/tins_postinstall_file_descriptors.html).

We expect most users are not yet dependent on the features affected by these
limitations. However, if your environment is severely impacted by these
limitations, come talk to us on the
Expand Down
9 changes: 8 additions & 1 deletion migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ for pool_ksuid in $ksuid_glob; do
pool_order=$(zq -f text "entry.id==ksuid('$pool_ksuid') | head 1 | yield join(entry.layout.keys[0], '.') + ':' + entry.layout.order" $pools_zngs)

# Look for [0-9]*.zng so snap.zng is excluded
branch_count=$(zq -f text 'yield entry.name | sort | uniq | count()' $pool_ksuid/branches/[0-9]*.zng)
branch_count=$(zq -z 'yield entry.name | sort' $pool_ksuid/branches/[0-9]*.zng | zq -f text 'uniq | count()' -)
if [ "$branch_count" != 1 ]; then
echo "warning: found $branch_count branches in '$pool_name' ($pool_ksuid) but only migrating 'main'"
fi
Expand All @@ -78,6 +78,13 @@ for pool_ksuid in $ksuid_glob; do
prior_zng=$(mktemp)
$prior_zed -lake "$src_dir" -use "$pool_name"@main query '*' > "$prior_zng"
zed -lake "$dst_dir" create -q -orderby "$pool_order" "$pool_name"

if ! [ -s "$prior_zng" ]; then
echo "$pool_name is empty: no data to migrate"
rm -f "$prior_zng"
continue
fi

zed -lake "$dst_dir" load -q -use "$pool_name" "$prior_zng"
new_zng=$(mktemp)
zed -lake "$dst_dir" -use "$pool_name" query '*' > "$new_zng"
Expand Down

0 comments on commit 08df9d5

Please sign in to comment.