Coder Social home page Coder Social logo

snsystems / pstore Goto Github PK

View Code? Open in Web Editor NEW
9.0 7.0 2.0 11.6 MB

A persistent store used with the Program Repository

License: Other

CMake 4.47% C++ 92.50% Python 2.36% Perl 0.04% HTML 0.09% CSS 0.03% JavaScript 0.43% Shell 0.06% LLVM 0.02% C 0.01%
database llvm llvm-prepo program-repository pstore

pstore's Introduction

pstore logo

CI Build/Test Coverity Scan Build Status Quality Gate Status Language grade: C/C++

pstore is a lightweight persistent append-only key/value store intended for use as a back-end for the LLVM Program Repository.

Its design goals are:

  • Performance approaching that of an in-memory hash table
  • Good support for parallel compilations
  • Multiple indices
  • In-process

Table of Contents

Building pstore

Prerequisites

pstore is built and tested on a variety of platforms:

  • Ubuntu Linux 20.04.3 LTS: building with GCC 7.5.0, GCC 10.3.0, Clang 8.0.1, and Clang 12.0.0. We also build with the official GCC 5.5.0 docker image.
  • macOS: building with Xcode 13.2
  • Windows: building with Visual Studio 2019 and 2022

In addition, there’s support for FreeBSD 11, NetBSD 9.1, and Solaris 11.4.

To build it, you’ll also need the following tools:

  • cmake (version 3.4 or later, version 3.8 or later if using Visual Studio)

Optionally:

  • Doxygen for building the documentation
  • GraphViz for graph rendering
  • Node.js for the ElectronJS-based broker dashboard and some system tests.
  • Python 2.7 or later for running the system tests as well as a few utilities
  • Valgrind for extra validation of the executables (enabled by passing the -D PSTORE_VALGRIND=Yes argument when running cmake to generate the build)

Building

pstore may be built either as a standalone collection of libraries, header files, and utilities or as a project within the LLVM framework.

Standalone

The pstore build system uses cmake. If you’re not very familiar with cmake, there’s a small utility (found in utils/make_build.py) which will create an out-of-tree directory in which to build the project and run cmake with the correct arguments for your platform.

python ./utils/make_build.py
cmake ‑‑build build_linux

The build directory will be one of build_linux, build_mac, build_win32, and so on.

Inside LLVM

Make sure that pstore is located within the llvm-project directory tree. For example, to build pstore inside LLVM with Program Repository Support (llvm-project-prepo):

git clone http://github.com/SNSystems/llvm-project-prepo.git
cd llvm
git clone http://github.com/SNSystems/pstore.git
cd -

Build LLVM as normal enabling the pstore subproject in addition to any others. For example:

mkdir build
cd build
cmake -G Ninja \
      -D LLVM_ENABLE_PROJECTS="clang;pstore" \
      -D LLVM_TARGETS_TO_BUILD=X86 \
      -D LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=Off \
      ../llvm
ninja

Getting started

Using the read and write utilities

The pstore-read and pstore-write tools provide a simple way to experiment with the capabilities of the pstore library. Consider the following exchange:

$ echo foo > foo.txt
$ echo bar > bar.txt
$ pstore-write --add-file mykey,foo.txt pstore.db
$ pstore-read pstore.db mykey
foo
$ pstore-write --add-file mykey,bar.txt pstore.db
$ pstore-read pstore.db mykey
bar
$ pstore-read --revision=1 pstore.db mykey
foo
$ pstore-dump --log pstore.db
---

- file : 
      path : pstore.db
      size : 488
  log  : 
      - { number: 2, size: 56, time: 2020-11-19T15:24:04Z }
      - { number: 1, size: 56, time: 2020-11-19T15:23:52Z }
      - { number: 0, size: 0, time: 2020-11-19T15:23:52Z }
...
$

Let’s pick this apart one step at a time…

$ echo foo > foo.txt
$ echo bar > bar.txt

Create two files which contain short text strings that we’ll shortly record in a pstore file:

$ pstore-write --add-file mykey,foo.txt pstore.db

This command creates a new pstore file named pstore.db or appends to that file if it already exists. The choice of file name is arbitrary. The tool creates an entry in one of the pstore indexes with the key “mykey” which has a corresponding value string “foo\n” as read from the foo.txt file we created earlier.

$ pstore-read pstore.db mykey
foo

Next we use the pstore-read utility to search the pstore.db file for key named “mykey” and print its value. Happily it prints “foo\n”: the same string that we passed to pstore-write above.

$ pstore-write --add-file mykey,bar.txt pstore.db

Now we run pstore-write again but this time associating the value “bar” (plus the inevitable newline) with the key “mykey”.

$ pstore-read pstore.db mykey
bar

Running pstore-read a second time prints “bar” showing that the key “mykey” has been updated.

$ pstore-read --revision=1 pstore.db mykey
foo

This command is a little more interesting. Here we’ve retrieved the original value that was linked to “mykey”. Each time that pstore-write stores data in a pstore file, it does so in a self-contained transaction. Each transaction is appended to the file, preserving the previous contents. The first transaction in a pstore file is number 0 (which is always empty). The first time data is added, transaction 1 is created; the second time, we build transaction 2, and so on. Any redundant data stays in the file — and is immutable — until the garbage collector (pstore-vacuumd) runs. This property enables a store to be read without any need for locks.

$ pstore-dump --log pstore.db

The pstore-dump command allows us to inspect the innards of a pstore file. It produces a YAML dump of the requested structures: the transaction log in this case showing a list of all of the transactions in the file (newest first), how much data each of them is carrying, and when that data was committed. There is a small number of other utilities in the tools/ directory which allow various aspects of a pstore file to be explored.

pstore's People

Contributors

carlosalbertoenciso avatar dependabot[bot] avatar flametop avatar maggieyingyi avatar omern1 avatar paulhuggett avatar rgal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ormris fossabot

pstore's Issues

Implement import/export

pstore deliberately doesn‘t make any real attempt to provide a means to move data from one version of its data files to another. In its anticipated use case (the llvm-project-prepo work) this isn’t really needed because the source code can simply be re-compiled when a new version of the tools is released.

However, sometimes there’s a need to move data between versions, to provide longer term backups, or to recover from corruption, when the “just compile” solution isn’t quite good enough. For these situations it would useful to have a means to exporting the contents of the pstore to a structured file (JSON probably) and then rebuild the database contents by importing that JSON into a new file.

Complete the Win32 broker "service"

The pstore broker is intended as a long-lived process which manages the garbage collection process for one or more pstore databases. It is sent a message when a transaction is committed which will cause it to start the GC if it's not already running. It's also the point of contact for a process wanting to understand the GC status (see #14).

On Windows, processes like this are packaged as a "service". We've got a shell which implements some of the basic features that Windows demands of a service, but it doesn't yet have any of the broker functionality. The latter is available as a library so it should simply be a matter of stitching the two things together...

pstore-broker-unit-tests Gc.SpawnOne, SpawnMaxPlus1 fail intermittently on Windows

I've been seeing occasional failures of some of the broker unit tests namely:

  • Gc.SpawnOne
  • Gc.SpawnMaxPlus1

There are other unit tests in this family which follow a very similar pattern and so must also be considered suspicious. These appear to only be a problem on Windows: I've never seen them fail on POSIX platforms.

The output looks something like:

Z:\llvm-project-prepo\build_win32>Z:\llvm-project-prepo\build_win32\tools\pstore\unittests\broker\Debug\pstore-broker-unit-tests.exe
[==========] Running 23 tests from 7 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from BiMap
[ RUN      ] BiMap.Size
[       OK ] BiMap.Size (0 ms)
[ RUN      ] BiMap.SetGet
[       OK ] BiMap.SetGet (0 ms)
[ RUN      ] BiMap.Present
[       OK ] BiMap.Present (0 ms)
[----------] 3 tests from BiMap (20 ms total)

[----------] 3 tests from Command
[ RUN      ] Command.NoCalls
[       OK ] Command.NoCalls (1 ms)
[ RUN      ] Command.Nop
[       OK ] Command.Nop (0 ms)
[ RUN      ] Command.Bad
[       OK ] Command.Bad (0 ms)
[----------] 3 tests from Command (5 ms total)

[----------] 5 tests from Gc
[ RUN      ] Gc.Nothing
[       OK ] Gc.Nothing (1 ms)
[ RUN      ] Gc.SpawnOne
Error:
Z:\llvm-project-prepo\pstore\unittests\broker\test_gc.cpp(150): ERROR: this mock object (used in test Gc.SpawnOne) should be deleted but never is. Its address is @0000007B19D8F6D0.
ERROR: 1 leaked mock object found at program exit.

Extend ptore-dump --tickets to simplify examining an individual repository ticket

At the moment, getting the contents of a ticket involves n steps:

  • hex dump the ticket file
  • extract the ticket uuid from the hex dump
  • run pstore-dump --tickets to get the set of tickets in the pstore
  • search through this output for the correct UUID.

That's all rather tedious. It could be simplified by a couple of changes:

  • implement --all-tickets and --ticket=<> in the same way as we now have for fragments to that it's possible to dump specific tickets
  • allow the user to pass the pass of a ticket file to the --ticket=<> switch. In this case the tool extracts the key from the file and dumps it directly.

Rewrite the dump library to avoid intermediate heap allocations

The YAML output code used by pstore-dump was originally written for another project. That project in general dealt with very small files of the order of a few kilobytes at most. For this reason, the code prioritised the appearance of its output over output performance.

Reusing the code in pstore-dump was expedient: it got the tool up-and-running very quickly.

However, pstore files can hold many megabytes of data meaning that the performance of the tool can be important. Currently, any command that produces a lot of output can take a long time.

For this reason, I proposed that we eliminate the intermediate objects and dump the output directly.

Having std::string as the only interface to the pstore string serializer is inefficient.

pstore provides a std::string serializer which will transfer strings to and from the pstore. However, paying the cost of a malloc to get the string body into memory is wasteful since the pstore provides us with a shared_ptr<> which references the same data. Need to provide an interface which will allow a std::string_view- or LLVM StringRef-type reference to the string body. This should own a reference to the shared_ptr<> returned by the call to getro<>().

examples don't compile inside LLVM

If pstore is built inside LLVM (with exceptions disabled), the example programs fail to build. This is because they include a top-level try{} catch{} for correctness. The examples should be disabled when building inside LLVM.

Index bloat

When a pstore transaction is committed, all of the modified indices are updated. This principally involves flushing the updated branch records to the store. As with traditional B-Tree-style indices, we want our index trees to be wide and shallow to minimize the number of different branches that must be visited during a search. The downside of this is that the records being flushed during commit are rather large.

I did an experiment by instrumenting pstore-write so that it prints the amount of data being written during transaction commt and then adding a large number of files to a database with one transaction for each. Here is a graph of the data that this produced:

image

As you can see, the result is nicely logarithmic (good), but that after the first 5000 or so insertions, each commit requires ~1200 bytes. Not good. We need to find a way of reducing that overhead.

This is worse in the compiler because each compilation is typically updating three indexes (those for compilations, names, and fragments).

rename "record" as "extent"

The record data type does the same job for pstore as a "file extent" does in a file system. Rename to give users a better sense of the data type's purpose.

Debug-line sections must record the header digest as well as the extent

Right now, a debug-line section records the extent of the debug-line section header (in addition to the usual stuff). This is sufficient for the repo2obj tool as well as a linker since they simply need to know where to find the data that is to be stitched onto the start of the debug-line section.

However, an export tool (such as the one found in the nascent “exchange” branch) needs to retrieve the digest of this record so that it can be emitted as part of the debug-line section content. An extent record is not enough for this.

We need to record the digest as well as the extent in the same way that we do for a definition. This contains both the fragment’s digest and extent. The client can then choose the most appropriate access method.

Note that this change will also affect the compiler (it generates this data after all), so there will be a matching issue in that repository.

A system test for the transaction lock

The correct operation of the transaction lock is vital to ensure that processes competing to add data to the store don't end up experiencing data loss or corruption. We need a system test to guarantee that it's working correctly.

Teach the garbage collector about the mcrepo structures

Although a shell implementation of the garbage collector exists (called vacuumd), it doesn't currently know anything about any of the mcrepo structures. These structures are the ones that we really care about!

It needs to enumerate the ticket index gathering the set of directories that may contain live ticket files. Each file needs to opened and the digest within it loaded. The corresponding ticket (including all of the fragments and strings that it references) are then "live" and need to be preserved by the collections process.

(It might be a better design to keep the set of ticket paths in a separate index rather than in the ticket files.)

unknown warning option "-Wno-unused-lambda-capture" on TravisCI

Clang added a warning for cases in which a value is ODR-used and it does not need to appear in the capture list. However, VS2017 doesn't support this behavior and will not compile without an explicit capture. This meant that I ended up disabling the clang warning in commit 129d309 (even though it is strictly correct).

Unfortunately, TravisCI uses a version of clang prior to this warning being added which means that we get a warning about the -Wno-unused-lambda-capture option not being understood.

Need to add code to the cmake file to detect whether this switch is supported rather than just adding it unconditionally.

Add pstore-diff tool

It would be very useful to be able to easily see the delta between two pstore revisions. The tool should to generate a list of all of the keys updated in each of the indices between two specified revisions (i.e. the version visible in revision1 is different from that in revision2). Following the style of pstore-dump, the output should probably use YAML.

Something like:

pstore-diff <filename> [revision1 [revision2]]
  • filename is the path of the pstore file
  • revision1 is a revision number or HEAD. If not specified, defaults to HEAD.
  • revision2 is a revision number of HEAD. If not specified, defaults to revision1-1.
$ pstore-diff clang.db 4 2
---
  indices   : 
      - name    : name
        members : 
            - foo
            - bar
      - name    : fragments
        members : 
            - 123456789abcdef
      - name    : tickets
        members : 
            - fedcba987654321

This shows that two names, one fragment, and one ticket record have been added to the pstore in revisions 3 or 4.

pstore-import: Internal fixup referencing missing section

The pstore-import tool must validate its input so that it doesn’t create bogus input for consumers of the resulting database. At the moment it doesn't verify that fragment sections targeted by internal fixups actually exist.

The following JSON input should be rejected (the fragment does not contain a data section).

{
  "version": 1,
  "id": "23fbd062-c0d9-4830-9cea-2ebb2f8e7d0d",
  "transactions": [
    {
      "names": [
        "x86_64-pc-linux-gnu-repo",
        "f"
      ],
      "fragments": {
        "11111111111111111111111111111111": {
          "text": {
            "data": "McDD",
            "ifixups": [
              {
                "section": "data",
                "type": 1,
                "offset": 0,
                "addend": 0
              }
            ]
          }
        }
      },
      "compilations": {
        "11111111111111111111111111111111": {
          "triple": 0,
          "definitions": [
            {
              "digest": "11111111111111111111111111111111",
              "name": 1,
              "linkage": "external"
            }
          ]
        }
      }
    }
  ]
}

Add disassembly of fragment text sections to pstore-dump

It would be incredibly useful to see a proper disassembly of a fragment's text section when debugging problems with the LLVM repo-object-writer code. When pstore is built inside LLVM there's a disassembler right there already...!

pstore-import into existing database

At the time of writing, rld is missing some important features such as support for static archives and support for external databases. This means that using the standard libraries is awkward and clumsy. It’s necessary to export the library database and import it into the local database so that all of the inputs comes from the same place.

This awkwardness is exacerbated because pstore-import can’t import into an existing database. I didn’t want to implement any extra features in that tool that weren’t genuinely useful and important.

I want to be able to write a makefile such as:

all: a.out

musl-prepo.ph: /musl/lib/musl-prepo.json
	pstore-import clang.db $<
	echo $< > $@

a.out: main.o musl-prepo.ph
	rld -o a.out main.o $(LIBC)

However, right now I have to guarantee that the import will always happen before the compiler runs — even when building in parallel — to avoid the possibility of pstore-import failing because the database exists. This forces use of recursive make, piling more nasties on top of an already warty kludge:

all:
	$(MAKE) clang.db
	$(MAKE) a.out

clang.db: /musl/lib/musl-prepo.json
	-rm -f $@
	pstore-import $@ $<

a.out: main.o
	rld -o $@ $^ $(LIBC)

broker1 test is flaky

Seen failing sporadically on Linux and Windows.

On Linux (https://travis-ci.org/SNSystems/pstore/jobs/650492100):

FAIL: PStore :: broker/broker1.test (19 of 19)
******************** TEST 'PStore :: broker/broker1.test' FAILED ********************
Script:
--
: 'RUN: at line 10';   /usr/bin/python "/home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py" "/home/travis/build/SNSystems/pstore/build/bin" > "/home/travis/build/SNSystems/pstore/build/bin/system_tests/broker/Output/broker1_actual.txt"
: 'RUN: at line 11';   diff "/home/travis/build/SNSystems/pstore/build/bin/system_tests/broker/Output/broker1_actual.txt" "/home/travis/build/SNSystems/pstore/system_tests/broker/broker1_expected.txt"
--
Exit Code: 1
Command Output (stderr):
--
+ : 'RUN: at line 10'
+ /usr/bin/python /home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py /home/travis/build/SNSystems/pstore/build/bin
Running broker: ['/home/travis/build/SNSystems/pstore/build/bin/pstore-brokerd', '--pipe-path', '/tmp/broker1.pipe']
Running poker: ['/home/travis/build/SNSystems/pstore/build/bin/pstore-broker-poker', '--flood', '100', '--kill', '--pipe-path', '/tmp/broker1.pipe']
/home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py: waiting for poker to exit
/home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py: waiting for broker to exit
pstore broker is exiting.
/home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py: done
/home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py: broker timeout
/home/travis/build/SNSystems/pstore/system_tests/broker/broker1.py: broker exception: Command '['/home/travis/build/SNSystems/pstore/build/bin/pstore-brokerd', '--pipe-path', '/tmp/broker1.pipe']' returned non-zero exit status -9
--

On Windows (https://travis-ci.org/SNSystems/pstore/jobs/650492110):

  FAIL: PStore :: broker/broker1.test (19 of 19)
  ******************** TEST 'PStore :: broker/broker1.test' FAILED ********************
  Script:
  --
  : 'RUN: at line 10';   C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/opt/bin/python.exe "C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py" "C:/Users/travis/build/SNSystems/pstore/build/bin/Release" > "C:\Users\travis\build\SNSystems\pstore\build\bin\Release\system_tests\broker\Output/broker1_actual.txt"
  : 'RUN: at line 11';   diff "C:\Users\travis\build\SNSystems\pstore\build\bin\Release\system_tests\broker\Output/broker1_actual.txt" "C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1_expected.txt"
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  $ ":" "RUN: at line 10"
  $ "C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/opt/bin/python.exe" "C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py" "C:/Users/travis/build/SNSystems/pstore/build/bin/Release"
  # redirected output from 'C:\\Users\\travis\\build\\SNSystems\\pstore\\build\\bin\\Release\\system_tests\\broker\\Output/broker1_actual.txt':
  poker exited successfully
  ECHO:0
  ECHO:01
  ECHO:012
  ECHO:0123
  ECHO:01234
  ECHO:012345
  ECHO:0123456
  ECHO:01234567
  ECHO:012345678
  ECHO:0123456789
  ECHO:01234567890
  ECHO:012345678901
  ECHO:0123456789012
  ECHO:01234567890123
  ECHO:012345678901234
  ECHO:0123456789012345
  ECHO:01234567890123456
  ECHO:012345678901234567
  ECHO:0123456789012345678
  ECHO:01234567890123456789
  ECHO:012345678901234567890
  ECHO:0123456789012345678901
  ECHO:01234567890123456789012
  ECHO:012345678901234567890123
  ECHO:0123456789012345678901234
  ECHO:01234567890123456789012345
  ECHO:012345678901234567890123456
  ECHO:0123456789012345678901234567
  ECHO:01234567890123456789012345678
  ECHO:012345678901234567890123456789
  ECHO:0123456789012345678901234567890
  ECHO:01234567890123456789012345678901
  ECHO:012345678901234567890123456789012
  ECHO:0123456789012345678901234567890123
  ECHO:01234567890123456789012345678901234
  ECHO:012345678901234567890123456789012345
  ECHO:0123456789012345678901234567890123456
  ECHO:01234567890123456789012345678901234567
  ECHO:012345678901234567890123
  ...
  note: data was truncated
  
  # command stderr:
  Running broker: ['C:/Users/travis/build/SNSystems/pstore/build/bin/Release\\pstore-brokerd.exe', '--pipe-path', '\\\\.\\pipe\\broker1.pipe']
  
  Running poker: ['C:/Users/travis/build/SNSystems/pstore/build/bin/Release\\pstore-broker-poker.exe', '--flood', '100', '--kill', '--pipe-path', '\\\\.\\pipe\\broker1.pipe']
  
  C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py: waiting for poker to exit
  
  2020-02-14T16:00:34-0000 - main - notice - broker starting
  
  2020-02-14T16:00:34-0000 - main - notice - opening pipe
  
  2020-02-14T16:00:34-0000 - main - notice - starting threads
  
  2020-02-14T16:00:34-0000 - command - info - Waiting for commands
  
  2020-02-14T16:00:34-0000 - gcwatch - info - starting gc process watch thread
  
  2020-02-14T16:00:34-0000 - gcwatch - info - waiting for a GC process to complete
  
  2020-02-14T16:00:34-0000 - http - info - initializing on port: 8080
  
  2020-02-14T16:00:34-0000 - http - info - starting server-loop
  
  2020-02-14T16:00:34-0000 - uptime - info - uptime 1 second tick starting
  
  2020-02-14T16:00:34-0000 - read0 - notice - listening to named pipe "\\.\pipe\broker1.pipe"
  
  2020-02-14T16:00:34-0000 - read1 - notice - listening to named pipe "\\.\pipe\broker1.pipe"
  
  2020-02-14T16:00:34-0000 - main - notice - waiting
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901234
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012345
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901234567
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012345678
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901234567890
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012345678901
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901234567890123
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012345678901234
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901234567890123456
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012345678901234567
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:012345678901234567890123456789
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:0123456789012345678901234567890
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read0 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read1 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - read1 - debug - Pipe was broken
  
  2020-02-14T16:00:34-0000 - command - info - verb:ECHO path:01234567890123456789012345678901...
  
  2020-02-14T16:00:34-0000 - read0 - debug - Queueing command
  
  2020-02-14T16:00:34-0000 - command - info - verb:SUICIDE path:
  
  pstore broker is exiting.
  
  2020-02-14T16:00:34-0000 - command - info - performing shutdown
  
  2020-02-14T16:00:34-0000 - command - info - asking gc process watch thread to exit
  
  2020-02-14T16:00:34-0000 - command - info - push command "_QUIT"
  
  2020-02-14T16:00:34-0000 - command - info - push command "_QUIT"
  
  2020-02-14T16:00:34-0000 - command - info - push command "_CQUIT"
  
  2020-02-14T16:00:34-0000 - command - info - Connecting
  
  2020-02-14T16:00:34-0000 - command - info - Connected
  
  2020-02-14T16:00:34-0000 - command - info - shutdown requests complete
  
  2020-02-14T16:00:34-0000 - command - info - verb:_QUIT path:
  
  2020-02-14T16:00:34-0000 - command - info - waking one reader thread
  
  2020-02-14T16:00:34-0000 - command - info - verb:_QUIT path:
  
  2020-02-14T16:00:34-0000 - command - info - waking one reader thread
  
  2020-02-14T16:00:34-0000 - command - info - verb:_CQUIT path:
  
  2020-02-14T16:00:34-0000 - command - info - Exiting command thread
  
  2020-02-14T16:00:34-0000 - read1 - notice - exiting read loop
  
  2020-02-14T16:00:34-0000 - read0 - notice - exiting read loop
  
  2020-02-14T16:00:34-0000 - gcwatch - info - cleaning up
  
  2020-02-14T16:00:34-0000 - scavenger - info - begin scavenging
  
  2020-02-14T16:00:34-0000 - scavenger - info - scavenger thread exiting
  
  C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py: waiting for broker to exit
  
  2020-02-14T16:00:35-0000 - uptime - info - uptime thread exiting
  
  C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py: done
  
  C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py: broker timeout
  
  C:\Users\travis\build\SNSystems\pstore\system_tests\broker/broker1.py: broker exception: Command '['C:/Users/travis/build/SNSystems/pstore/build/bin/Release\\pstore-brokerd.exe', '--pipe-path', '\\\\.\\pipe\\broker1.pipe']' returned non-zero exit status 1
  
  
CUSTOMBUILD : error : command failed with exit status: 1 [C:\Users\travis\build\SNSystems\pstore\build\pstore-system-tests.vcxproj]
  
  --

Add typed_address<T>

The bug in the llvm-prepo project's repo2obj tool (introduced by commit ad702ea and fixed by 78c5f0b) was allowed to creep-in in part because the pstore library's 'address' type is equivalent to a C void*. It doesn't inherently carry any type information so it's impossible to get any compile-time checking on the correct use of these "pointers".

Introduce a typed_address<> which wraps the raw address type and enables the compiler to prevent invisible misuse.

[CMake] add-dependencies error when enabling pstore_examples

A CMake error is given when enabling pstore_examples.

Command line: utils/make_build.py -DPSTORE_EXAMPLES=On
Error Message:
CMake Error at CMakeLists.txt:367 (add_dependencies):
The dependency target "pstore_examples" of target "pstore_system_tests"
does not exist.

pstore-write creates an empty name index

Try the following simple sequence of commands:

% echo "hello world" > hello.txt
% rm db.db
rm: db.db: No such file or directory
% pstore-write db.db hello.txt
% pstore-index-stats db.db
name,branching-factor,mean-leaf-depth,max-depth,size
name,0,0,0,0
write,0,1,1,1
% 

The output of the pstore-index-stats tool shows that we have a name index which contains no entries. This line should not be present.

Write the "strip" and "merge" tools

The program repository scheme for distribution relies on the presence of two tools: strip and merge. The former makes a copy of a database but with only the index keys and none of the data. The latter takes a stripped database and adds to it any key-value pairs where we do have data.

See the "Early Overview" document for more background on the reasoning behind these tools.

Implement the bss section as a special section

A bss section is currently implemented as a generic section. Typically only the length of the bss section, but no data, is stored in the object file. This task is to implement the bss section as a special section.

broker/httpd test is flaky

I'm seeing intermittent failures of the broker/httpd test on slow machines. Here is the log (original) from a CI Windows-latest/MSVC/Debug build:

2021-01-05T16:54:41.8332470Z   FAIL: pstore :: broker/httpd.test (5 of 22)
2021-01-05T16:54:41.8376768Z   ******************** TEST 'pstore :: broker/httpd.test' FAILED ********************
2021-01-05T16:54:41.8425076Z   Script:
2021-01-05T16:54:41.8508657Z   --
2021-01-05T16:54:41.8514490Z   : 'RUN: at line 8';   C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe "D:\a\pstore\pstore\system_tests\broker/httpd.py" "D:/a/pstore/build/bin/Debug" > "D:\a\pstore\build\bin\Debug\system_tests\broker\Output\httpd.test.tmp"
2021-01-05T16:54:41.8517974Z   --
2021-01-05T16:54:41.8526467Z   Exit Code: 1
2021-01-05T16:54:41.8594588Z   
2021-01-05T16:54:41.8600056Z   Command Output (stdout):
2021-01-05T16:54:41.8622601Z   --
2021-01-05T16:54:41.8665450Z   $ ":" "RUN: at line 8"
2021-01-05T16:54:41.8841020Z   $ "C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe" "D:\a\pstore\pstore\system_tests\broker/httpd.py" "D:/a/pstore/build/bin/Debug"
2021-01-05T16:54:41.8844667Z   # command stderr:
2021-01-05T16:54:41.8848141Z   2021-01-05T16:54:36+0000 - main - notice - broker starting
2021-01-05T16:54:41.8856030Z   
2021-01-05T16:54:41.8857477Z   2021-01-05T16:54:36+0000 - main - notice - opening pipe
2021-01-05T16:54:41.8858179Z   
2021-01-05T16:54:41.8858910Z   2021-01-05T16:54:36+0000 - main - notice - starting threads
2021-01-05T16:54:41.8859553Z   
2021-01-05T16:54:41.8860227Z   2021-01-05T16:54:36+0000 - main - notice - waiting
2021-01-05T16:54:41.8860821Z   
2021-01-05T16:54:41.8861554Z   2021-01-05T16:54:36+0000 - command - info - Waiting for commands
2021-01-05T16:54:41.8862270Z   
2021-01-05T16:54:41.8863108Z   2021-01-05T16:54:36+0000 - gcwatch - info - starting gc process watch thread
2021-01-05T16:54:41.8863804Z   
2021-01-05T16:54:41.8864614Z   2021-01-05T16:54:36+0000 - gcwatch - info - waiting for a GC process to complete
2021-01-05T16:54:41.8865601Z   
2021-01-05T16:54:41.8866360Z   2021-01-05T16:54:36+0000 - http - info - initializing on port: 49875
2021-01-05T16:54:41.8867102Z   
2021-01-05T16:54:41.8867868Z   2021-01-05T16:54:36+0000 - uptime - info - uptime 1 second tick starting
2021-01-05T16:54:41.8868538Z   
2021-01-05T16:54:41.8869418Z   2021-01-05T16:54:36+0000 - read0 - notice - listening to named pipe "\\.\pipe\httpd.py"
2021-01-05T16:54:41.8870140Z   
2021-01-05T16:54:41.8872042Z   2021-01-05T16:54:36+0000 - read1 - notice - listening to named pipe "\\.\pipe\httpd.py"
2021-01-05T16:54:41.8872994Z   
2021-01-05T16:54:41.8874448Z   2021-01-05T16:54:36+0000 - http - error - opening socketAn attempt was made to access a socket in a way forbidden by its access permissions.
2021-01-05T16:54:41.8875485Z   
2021-01-05T16:54:41.8876307Z   2021-01-05T16:54:40+0000 - quit - info - Signal received: shutting down. Signal: SIGBREAK
2021-01-05T16:54:41.8877081Z   
2021-01-05T16:54:41.8877683Z   pstore broker is exiting.
2021-01-05T16:54:41.8878252Z   
2021-01-05T16:54:41.8879219Z   2021-01-05T16:54:40+0000 - quit - info - performing shutdown
2021-01-05T16:54:41.8879922Z   
2021-01-05T16:54:41.8880869Z   2021-01-05T16:54:40+0000 - quit - info - asking gc process watch thread to exit
2021-01-05T16:54:41.8882043Z   
2021-01-05T16:54:41.8882704Z   2021-01-05T16:54:40+0000 - quit - info - push command "_QUIT"
2021-01-05T16:54:41.8883327Z   
2021-01-05T16:54:41.8883973Z   2021-01-05T16:54:40+0000 - gcwatch - info - cleaning up
2021-01-05T16:54:41.8884797Z   
2021-01-05T16:54:41.8885625Z   2021-01-05T16:54:40+0000 - quit - info - push command "_QUIT"
2021-01-05T16:54:41.8886267Z   
2021-01-05T16:54:41.8886986Z   2021-01-05T16:54:40+0000 - quit - info - push command "_CQUIT"
2021-01-05T16:54:41.8887628Z   
2021-01-05T16:54:41.8888314Z   2021-01-05T16:54:40+0000 - scavenger - info - begin scavenging
2021-01-05T16:54:41.8889153Z   
2021-01-05T16:54:41.8889897Z   2021-01-05T16:54:40+0000 - scavenger - info - scavenger thread exiting
2021-01-05T16:54:41.8890614Z   
2021-01-05T16:54:41.8898061Z   2021-01-05T16:54:40+0000 - command - info - verb:_QUIT path:
2021-01-05T16:54:41.8898894Z   
2021-01-05T16:54:41.8899590Z   2021-01-05T16:54:40+0000 - command - info - waking one reader thread
2021-01-05T16:54:41.8900244Z   
2021-01-05T16:54:41.8900941Z   2021-01-05T16:54:40+0000 - quit - info - shutdown requests complete
2021-01-05T16:54:41.8901598Z   
2021-01-05T16:54:41.8902253Z   2021-01-05T16:54:40+0000 - quit - info - quit thread exiting
2021-01-05T16:54:41.8902866Z   
2021-01-05T16:54:41.8903514Z   2021-01-05T16:54:40+0000 - command - info - verb:_QUIT path:
2021-01-05T16:54:41.8904128Z   
2021-01-05T16:54:41.8904790Z   2021-01-05T16:54:40+0000 - read0 - notice - exiting read loop
2021-01-05T16:54:41.8906204Z   
2021-01-05T16:54:41.8907069Z   2021-01-05T16:54:40+0000 - command - info - waking one reader thread
2021-01-05T16:54:41.8909208Z   
2021-01-05T16:54:41.8910861Z   2021-01-05T16:54:40+0000 - read1 - notice - exiting read loop
2021-01-05T16:54:41.8912591Z   
2021-01-05T16:54:41.8913598Z   2021-01-05T16:54:40+0000 - command - info - verb:_CQUIT path:
2021-01-05T16:54:41.8914319Z   
2021-01-05T16:54:41.8915193Z   2021-01-05T16:54:40+0000 - command - info - Exiting command thread
2021-01-05T16:54:41.8916077Z   
2021-01-05T16:54:41.8916800Z   2021-01-05T16:54:41+0000 - uptime - info - uptime thread exiting
2021-01-05T16:54:41.8917463Z   
2021-01-05T16:54:41.8918224Z   2021-01-05T16:54:41+0000 - main - notice - worker threads done: stopping quit thread
2021-01-05T16:54:41.8918927Z   
2021-01-05T16:54:41.8919535Z   2021-01-05T16:54:41+0000 - main - notice - exiting
2021-01-05T16:54:41.8920125Z   
2021-01-05T16:54:41.8920660Z   Using HTTP port 49875
2021-01-05T16:54:41.8921207Z   
2021-01-05T16:54:41.8921986Z   broker args: ['--pipe-path', '\\\\.\\pipe\\httpd.py', '--http-port', '49875']
2021-01-05T16:54:41.8922711Z   
2021-01-05T16:54:41.8923234Z   Broker alive.
2021-01-05T16:54:41.8923988Z   
2021-01-05T16:54:41.8924617Z   Connecting to broker at localhost:49875
2021-01-05T16:54:41.8925231Z   
2021-01-05T16:54:41.8925868Z   Sent SIGTERM. Waiting for broker to exit.
2021-01-05T16:54:41.8926490Z   
2021-01-05T16:54:41.8927125Z   Broker exited. Done.
2021-01-05T16:54:41.8927684Z   
2021-01-05T16:54:41.8928285Z   Traceback (most recent call last):
2021-01-05T16:54:41.8928898Z   
2021-01-05T16:54:41.8929699Z     File "D:\a\pstore\pstore\system_tests\broker/httpd.py", line 193, in <module>
2021-01-05T16:54:41.8930434Z   
2021-01-05T16:54:41.8931219Z       timeout=args.timeout))
2021-01-05T16:54:41.8931754Z   
2021-01-05T16:54:41.8932524Z     File "D:\a\pstore\pstore\system_tests\broker/httpd.py", line 174, in main
2021-01-05T16:54:41.8933192Z   
2021-01-05T16:54:41.8934078Z       reply = http_get(host, port).decode("utf-8")
2021-01-05T16:54:41.8935054Z   
2021-01-05T16:54:41.8935866Z     File "D:\a\pstore\pstore\system_tests\broker/httpd.py", line 154, in http_get
2021-01-05T16:54:41.8937019Z   
2021-01-05T16:54:41.8937797Z       conn.connect()
2021-01-05T16:54:41.8938255Z   
2021-01-05T16:54:41.8939243Z     File "c:\hostedtoolcache\windows\python\3.7.9\x64\lib\http\client.py", line 944, in connect
2021-01-05T16:54:41.8940101Z   
2021-01-05T16:54:41.8940993Z       (self.host,self.port), self.timeout, self.source_address)
2021-01-05T16:54:41.8941814Z   
2021-01-05T16:54:41.8942886Z     File "c:\hostedtoolcache\windows\python\3.7.9\x64\lib\socket.py", line 728, in create_connection
2021-01-05T16:54:41.8943605Z   
2021-01-05T16:54:41.8944219Z       raise err
2021-01-05T16:54:41.8944639Z   
2021-01-05T16:54:41.8945445Z     File "c:\hostedtoolcache\windows\python\3.7.9\x64\lib\socket.py", line 716, in create_connection
2021-01-05T16:54:41.8946185Z   
2021-01-05T16:54:41.8946711Z       sock.connect(sa)
2021-01-05T16:54:41.8947212Z   
2021-01-05T16:54:41.8950554Z   ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
2021-01-05T16:54:41.8952002Z   
2021-01-05T16:54:41.8952454Z   
2021-01-05T16:54:41.8953612Z CUSTOMBUILD : error : command failed with exit status: 1 [D:\a\pstore\build\pstore-system-tests.vcxproj]
2021-01-05T16:54:41.8954721Z   
2021-01-05T16:54:41.8955318Z   --
2021-01-05T16:54:41.8955698Z   

Note the line which says:

http - error - opening socketAn attempt was made to access a socket in a way forbidden by its access permissions.

This may originate from the hard-wired ephemeral port number in the httpd.py test which could collide with pre-existing use of that port on the machine.

Missing the section alignment field in the 'pstore-dump --fragments' output.

Each "section" within a fragment contains the following fields: Align, IFixups, XFixups and Data. When we check the fragment using pstore-dump tool, the section align field is missing.

$ pstore-dump --fragments clang.db 

- file      : 
      path : clang.db
      size : 4194304
  fragments : 
      - digest   : be21f32fb7eefb5c5d6fb94c7e481974
        fragment : 
            - type     : ReadOnly
              contents : 
                  data    : !!binary |
                      AAAAAAAA8D8=
                  ifixups : [ ]
                  xfixups : [ ]

Implement the status tool/comms so that the garbage collection process has a UI

The idea is that it should be possible to implement some sort of UI showing the garbage collection status for a pstore file. This should show whether it's running, what it's up to, when the collection process will complete; that sort of thing. Since the purpose of the broker is to manage the garbage-collection processes, it makes sense that this should be the also be the contact-point for other processes to discover what's going on.

To properly implement this there is a fair amount of yak shaving to do.

  1. Define a communication protocol used by the 3 processes (the UI [status], the broker, and the GC).
  2. Implement client & server support between status/broker.
  3. Implement client & server support between broker/GC.

1 was easy: use JSON over Unix domain sockets (on platforms that support them) or IP sockets elsewhere. Commit 33ea1de added a straightforward JSON parser.

Add support for VS2019 to make_build.py

I find the make_build.py utility incredibly useful. Frequently switching between operating systems and setups it makes the job of running cmake completely consistent: just cd to the project root and run:

$ ./utils/make_build.py

(The only thing to remember are the backwards slashes on Windows!)

After finally acquiescing to Visual Studio‘s pleading that I install Visual Studio 2019, I found that make_build didn‘t support it.

Race when two processes simultaneously create the same database file

(This issue started life as prepo issue #44.)

If two processes try to simultaneously create the same database file, one will "win" and any data added by the other. For example:

$ rm db.db ; \
  pstore-write --add=a,first db.db & \
  pstore-write --add=b,second db.db && fg

This starts two copies of pstore-write which will both try to write to db.db which does not yet exist. Once this is complete, dump the resulting file:

$ pstore-dump --log db.db 
---
- file : 
      path : ./db.db
      size : 352
  log  : 
      - { number: 1, size: 80, time: 2019-09-09T14:58:23Z }
      - { number: 0, size: 0, time: 2019-09-09T14:58:23Z }
...
$ 

This should contain two transactions, one from each of the pstore-write commands above.

rename "digest_index" as "fragment_index"

This applies to both database::get_digest_index() and pstore::index::digest_index. It maps from digests to fragments; using the value type seems more logical and consistent with pstore::index::ticket_index.

Recover mapped/allocated space on transaction cancel

If a transaction is cancelled then its contents are removed and the store goes back to the state it was in before the transaction was opened. However, any additional storage or memory mappings are not recovered.

Assertion failed in storage.cpp

Synched to commit b946f6f. I’m seeing an assertion fire.

  1. Start the pstore broker dæmon (pstore-brokerd &)

  2. Run a command which stores data with background GC enabled. For example:

    rm ~/db.db; find ~ -type f -exec pstore-write --compact=background ~/db.db {} \;
    

In this situation, I’m seeing an assertion from the pstore-vacuum process:

Assertion failed: (segment.value == nullptr && segment.region == nullptr), function slice_region_into_segments, file …/pstore/lib/core/storage.cpp, line 172.

Assertion failure regression from new LLVM drop

A regression likely introduced by SNSystems/llvm-project-prepo@0c369da.

When building pstore-dump inside LLVM, it will use the latter‘s disassembler library to show the contexts of a fragment’s text section. At some point, LLVM changed to insist that an instance of llvm::mc::RegisterMCTargetOptionsFlags is statically instantiated to register MC-related command line options. Of course, it registers these switches with the LLVM command-line processor which pstore-dump does not use.

Windows error 33 whilst opening a store file

If one process has a store file open with the transaction lock held and another process tries to open that same store file, Windows will produce error 33 (ERROR_LOCK_VIOLATION): “The process cannot access the file because another process has locked a portion of the file.”

To reproduce, run the pstore-lock-test utility in two shells:

  1. In the first shell:

    pstore> build_win32\bin\Debug\pstore-lock-test.exe .\db.db
    start
    pre-lock
    

    Type: a <Return>

    holding-lock
    

    We now have a process holding the transaction lock for the file .\db.db.

  2. In the second shell:

    pstore> build_win32\bin\Debug\pstore-lock-test.exe .\db.db
    start
    Error: Unable to read ".\db.db": The process cannot access the file because another process has locked a portion of the file.
    
    pstore>
    

This error appears to occur because the transaction lock is implemented as a range-lock on a few bytes of the file header. The same file header structure must be read as we go through the steps of opening the file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.