Clearcase UCM Create Feature Stream for Shared Development - clearcase

Background: First of all, I'm in over my head, I have worked with base Clearcase at least 7 years ago but I'm new to UCM. In my new position there doesn't seem to be much/any SCM support (they lost some resources) IT maintains Clearcase but isn't able to provide much support on development process.
Problem: I'm trying to create an environment where 2 or 3 of us can work on a feature that has a separate stream that we can merge into the integration stream when we're ready. (We want to each have our own dev streams so we can checkout/in at will and also not impact other development work that is going into the integration stream)
I tried to "Create Project..." and I was able to create project with it's own integration stream (and when I join the project I am able to create my dev and int views). Let's call the base project A and the project I created A'. I'm able to checkout from A' and deliver to the A'_int stream/view. But when I try and deliver from A'_int (hopefully going to A_int) I get a message "nothing to deliver" (although it does correctly identify my integration view for A).
The version tree looks like this:
main
|
0 -- A_int
|
0
|
...
|
x -- sceaj_A'-- A'_int
| |
0 0
| |
1 --------> 1
In base clearcase the version tree would have looked like:
main
|
0 -- A_int
|
0
|
...
|
x -- A'_int
|
0 -- sceaj_A'
| |
| 0
| |
1 <--- 1
and then I could merge back to A_int.
So, what should I do to get this to work in UCM? Is the problem that I simply can't do this in UCM as a regular user? Is this even the right approach or is there a different "UCM way"?
Update: Here is the actual branch structure.
.
Version 282 is on A_Int, iip_core_1.0.0_tr_Integeration is A'_Int (feature branch), and jr..._iip_core_1.0.0_tr is my dev branch. This structure was created by "Create Project...", but I suspect that isn't what I wanted.

Actually, the first deliver is already delivering to A_Int.
A ClearCase UCM view (as seen here) is created per developer (which I always found an anti-pattern when working on a common feature, because of the all deliver/rebase constant workflow each developer has to do in order to benefit from a colleague's work) in a sub-stream of A_Int.
Once you are delivering (merge from a sub stream to its immediate parent stream by default), you are merging to A_Int)
Note: I prefer creating only one Dev stream, and multiple UCM views (one per developers) on the same stream: no need for deliver/rebase cycles: each developer can detect on checkin the merges to be done if they were working on the same files.
Once the checkings are all done, someone can create a baseline on that Dev (sub-)-stream and deliver that to A_Int.
In your case, it appears the dev branch was done from the same foundation baseline as the feature branch.
It is better to create a baseline on the foundation branch, then use it for creating the dev branch, before delivering from dev to feature, and from feature to Int.
In any case, try in your case to make a baseline on feature, and try to deliver that to see if that works better.
Also see "Difference between branches and streams in ClearCase?".

Related

How to list all parameters in Postgres?

I was wondering if there's a parameter for the currently authenticated psql user?
But then I wonder a more broader question - how can I just see what all the paremeters are?
I might discover some interesting parameters if I could see a whole list of them?
I'm only seeing online how to get the value of one parameter. Not a list...
Alvaro has answered the question how to list your current parameter values.
To get the authenticated user, you can call the SQL function session_user:
SELECT session_user;
The currently effective user can be seen with
SELECT current_user;
In psql, you can see details about your current database session with
\conninfo
Nonsense. Try these two SQL statements:
set foo.bar =42;
and then:
select current_setting('foo.bar');
You’ve just set, and read an entity that the PostgreSQL doc doesn’t seem to name. You might call x.y a “user-defined session parameter”. Where is its value held? Server-side, of course.
I too would like to know how to list the names of all currently defined such entities—system-defined, like TimeZone, and user-defined.
— bryn#yugabyte.com
PostgreSQL does not have such a thing as server-side session variables, so it's not clear what you are asking about.
Some PLs (such as PL/Python, PL/Perl) have session variables (%_SHARED in PL/Perl, GD and SD in PL/Python for example), but they are internal to the PL, not part of the server proper.
psql also has variables, which you can set with \set, and you can get a list with the same command. I suppose that's not what you want though.
Maybe you refer to so-called custom GUC configuration parameters, which are sometimes abused as session variables. You can get a list of those using SHOW ALL or SELECT * FROM pg_catalog.pg_settings.
SHOW ALL below can show all parameters according to the documentation:
SHOW ALL;
This is how SHOW ALL works below:
postgres=# SHOW ALL;
name | setting | description
----------------------------+-------------+------------------------------------------------------------------------------------------
allow_in_place_tablespaces | off | Allows tablespaces directly inside pg_tblspc, for testing.
allow_system_table_mods | off | Allows modifications of the structure of system tables.
application_name | psql | Sets the application name to be reported in statistics and logs.
archive_cleanup_command | | Sets the shell command that will be executed at every restart point.
archive_command | (disabled) | Sets the shell command that will be called to archive a WAL file.
archive_mode | off | Allows archiving of WAL files using archive_command.
archive_timeout | 0 | Forces a switch to the next WAL file if a new file has not been started within N seconds.
array_nulls | on | Enable input of NULL elements in arrays.
authentication_timeout | 1min | Sets the maximum allowed time to complete client authentication.
autovacuum | on | Starts the autovacuum subprocess.
...
And, you can show one specific parameter with SHOW as shown below:
postgres=# SHOW allow_in_place_tablespaces;
allow_in_place_tablespaces
----------------------------
off
(1 row)
But, you cannot show more than one parameters with SHOW as shown below:
postgres=# SHOW allow_in_place_tablespaces, allow_system_table_mods;
ERROR: syntax error at or near ","
LINE 1: show allow_in_place_tablespaces, allow_system_table_mods;
So to show more than one parameters, use SELECT FROM pg_settings below:
postgres=# SELECT name, setting, short_desc FROM pg_settings WHERE name IN ('allow_in_place_tablespaces', 'allow_system_table_mods');
name | setting | short_desc
----------------------------+---------+------------------------------------------------------------
allow_in_place_tablespaces | off | Allows tablespaces directly inside pg_tblspc, for testing.
allow_system_table_mods | off | Allows modifications of the structure of system tables.
(2 rows)
In addition, current_setting() can show one specific parameter as shown below:
postgres=# SELECT current_setting('allow_in_place_tablespaces');
current_setting
-----------------
off
(1 row)
But, you cannot show more than one parameters with current_setting() as shown below:
postgres=# SELECT current_setting('allow_in_place_tablespaces', 'allow_system_table_mods');
ERROR: invalid input syntax for type boolean: "allow_system_table_mods"
LINE 1: ...ECT current_setting('allow_in_place_tablespaces', 'allow_sys...

Designing a caching layer in front of a DB with minimal number of queries

I have multiple jobs that work on some key. The jobs are ran asynchronously and are written to some write-behind cache. Conceptually it looks like this:
+-----+-----------+----------+----------+----------------+
| key | job1 | job2 | job3 | resolution |
+-----+-----------+----------+----------+----------------+
| 123 | job1_res | job2_res | job3_res | resolution_val |
+-----+-----------+----------+----------+----------------+
The key concept is that I don't know in advance how many jobs are running. Instead, when it's time to write the record we add our "resolution" (based on the current job results we've got) and write all values to the DB (MongoDB if that's matter)
I also have a load() function that runs in case of a cache-miss. What it does is to fetch the record from the database, or creating a new (and empty) one if the record wasn't found.
Now, there's a time window where the record isn't in the cache nor in the database. In that time, a "slow worker" might write its result, and unluckily the load() function will create a new record.
When evacuated from the cache, the record will look like this:
+-----+----------+-------------------------------+
| key | job4 | resolution |
+-----+----------+-------------------------------+
| 123 | job4_val | resolution_based_only_on_job4 |
+-----+----------+-------------------------------+
I can think of two ways to control this problem:
Configure the write-behind mechanism so it will wait for all jobs to complete (i.e. give sufficient amount of time)
On write event, first query the DB for the record and merge results.
Problems with current solutions:
Hard to calibrate
Demands an extra query for write operation
What's the most natural solution to my problem?
Do I have to implement solution #2 in order to guarantee a resolution on all job results?
EDIT:
Theoretically speaking, I think that even after implementing solution #2 it doesn't give us the guarantee that the resolution will be based on all job results.
EDIT2:
If the write-behind mechanism guarantees order of operations then solution #2 is ok. This can be achieved by limiting the write-behind to one thread.

Is there a database for reverse lookups, which is having constraints in its documents and not at query time?

I have a problem in one of my projects. I have events that should apply to some users, but not all. The decision if a user is having one of the events applied to him is dynamically integrated into the document.
An example:
--------------------------------------------
| event | constraints |
--------------------------------------------
| kill | age > 67 |
| give_cake | latestGrade == 'A' |
--------------------------------------------
Now if I supply a sample to the database like this one it should return both documents.
{ "age" = 80, "latestGrade": "A" }
For this one it should only match one row:
{ "age" = 80 }
I know that is is rather specific and I know that I could just program this myself by iterating through all the documents and applying the constraints by myself.
I'm looking for a technology that works similar or that can be applied to this kind of problem. If there is no such thing known to you, you could give me an idea of how this can be solved in a way that is better than iterating through all records (maybe compile the constraints in some way?). Also the constraints should be combinable (AND/OR and Parantheses).
Right now we use Redis, Elasticsearch and PostgreSQL in the projects, so maybe there is some funky functionality inside these technologies already that I'm not aware of?

Sonarqube - Very big database

I've found this post about the usual size of a Sonarqube Database:
How big is a sonar database?
In our case, we have 3,584,947 LOC to analyze. If every 1,000 LOC stores 350 Ko of data space it should use about 1.2Gb But we've found that our SonarQube database actually stores more than 20Gb...
The official documentation (https://docs.sonarqube.org/display/SONAR/Requirements) says that for 30 millions LOC with 4 years of history, they use less than 20Gb...
In our General Settings > Database Cleaner we have all default value except for "Delete all analyses after" which is set to 360 instead of 260
What can create so much data in our case?
We use sonarqube 6.7.1 version
EDIT
As #simonbrandhof asked, here are our biggest tables
| Table Name | # Records | Data (KB) |
|`dbo.project_measures` | 12'334'168 | 6'038'384 |
|`dbo.ce_scanner_context`| 116'401 | 12'258'560 |
|`dbo.issues` | 2'175'244 | 2'168'496 |
20Gb of disk sounds way too big for 3.5M lines of code. For comparison the internal PostgreSQL schema at SonarSource is 2.1Gb for 1M lines of code.
I recommend to clean-up db in order to refresh statistics and reclaim dead storage. Command is VACUUM FULL on PostgreSQL. There are probably similar command on other databases. If it's not better then please provide the list of biggest tables.
EDIT
The unexpected size of table ce_scanner_context is due to https://jira.sonarsource.com/browse/SONAR-10658. This bug is going to be fixed in 6.7.4 and 7.2.

Can a value in AWS DynamoDB point to value in different table?

First off, I have very minimal experience with servers and databases (I have only used it once in my entire life and only beginning to learn) and this would not exactly be a "code" question strictly speaking because it is a question concerning a concept regarding DynamoDB.. But here it is because I cannot find answer to it no matter how much I search!
I am trying to make an application where users can see if their friends are "online" or not. There will be a table that keeps track of the users who are online and offline like this:
user_id | online
1 | O
2 | X
3 | O
and when user_id 1 who has friends 2 & 3 "refreshes", 1 would be able to see that 2 is offline and 3 is online. This would normally be done by batch_get in dynamodb, but each item I read would count as one unit, meaning if user1 had 20 friends, one refresh would use up 20 read units. To me, that would cost too much, and I thought that if I made a table for each user that would hold list of their friends that shows whether they are online or not, each refresh would cost only one read unit.
user_id | friends_on_off_line
1 | {2:X, 3:O}
2 | {1:O}
3 | {1:O}
However, the values in the list would have to be a "pointer" to the first table, because I cannot update the value everytime someone goes online or offline (if 1 went offline, I would have to write 1 as offline to both tables, and in second table, write it twice, using 3 write units which would end up costing even more)
So I am trying to make it so that in second table, values would point to the first table that would read whether they are online/offline and return the values as a list using only 1 read unit: like this
user_id | friends_on_off_line
1 | {pointer_to_2.online , pointer_to_3.online}
2 | {pointer_to_1.online}
3 | {pointer_to_1.online}
Is this possible in DynamoDB? If not, which service should I use and how can I make it possible?
Thanks in advance!
I don't think DynamoDB is the right tool for this kind of job.
SQL databases (Mysql/PostgreSQL) both have easy designs - just use joins (pointers).
You can also look at this question regarding this area for MongoDB.
What you should ask yourself is what are the most common questions the database needs to answer and what is the update / read rate. This questions usually navigate you to the right direction when picking up a database.

Resources